Changeset 112 for branches/generator/URules.pas
- Timestamp:
- Aug 9, 2017, 8:47:42 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/generator/URules.pas
r111 r112 29 29 end; 30 30 31 TRuleType = (rtAnd, rtOr); 32 31 33 { TRuleItems } 32 34 … … 35 37 procedure LoadFromXmlNode(Node: TDOMNode); 36 38 procedure SaveToXmlNode(Node: TDOMNode); 37 end; 38 39 TRuleType = (rtAnd, rtOr); 39 function GetBNF(RuleType: TRuleType): string; 40 end; 40 41 41 42 { TRule } … … 190 191 end; 191 192 193 function TRuleItems.GetBNF(RuleType: TRuleType): string; 194 var 195 Item: TRuleItem; 196 begin 197 Result := ''; 198 for Item in Self do begin 199 if Item <> First then begin 200 if RuleType = rtAnd then Result := Result + ' ' 201 else if RuleType = rtOr then Result := Result + ' | '; 202 end; 203 Result := Result + Item.GetBNF; 204 end; 205 end; 206 192 207 procedure TRuleItems.LoadFromXmlNode(Node: TDOMNode); 193 208 var … … 221 236 222 237 function TRule.GetBNF: string; 223 var 224 Item: TRuleItem; 225 begin 226 Result := Name + ' ::= '; 227 for Item in Items do begin 228 if Item <> Items.First then begin 229 if RuleType = rtAnd then Result := Result + ' ' 230 else if RuleType = rtOr then Result := Result + ' | '; 231 end; 232 Result := Result + Item.GetBNF; 233 end; 238 begin 239 Result := Name + ' ::= ' + Items.GetBNF(RuleType); 234 240 end; 235 241
Note:
See TracChangeset
for help on using the changeset viewer.