Ignore:
Timestamp:
Aug 9, 2017, 8:47:42 AM (7 years ago)
Author:
chronos
Message:
  • Added: Icons for various actions.
  • Added: Show rule items in rules list.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generator/URules.pas

    r111 r112  
    2929  end;
    3030
     31  TRuleType = (rtAnd, rtOr);
     32
    3133  { TRuleItems }
    3234
     
    3537    procedure LoadFromXmlNode(Node: TDOMNode);
    3638    procedure SaveToXmlNode(Node: TDOMNode);
    37   end;
    38 
    39   TRuleType = (rtAnd, rtOr);
     39    function GetBNF(RuleType: TRuleType): string;
     40  end;
    4041
    4142  { TRule }
     
    190191end;
    191192
     193function TRuleItems.GetBNF(RuleType: TRuleType): string;
     194var
     195  Item: TRuleItem;
     196begin
     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;
     205end;
     206
    192207procedure TRuleItems.LoadFromXmlNode(Node: TDOMNode);
    193208var
     
    221236
    222237function 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;
     238begin
     239  Result := Name + ' ::= ' + Items.GetBNF(RuleType);
    234240end;
    235241
Note: See TracChangeset for help on using the changeset viewer.