Ignore:
Timestamp:
Nov 29, 2017, 2:03:17 PM (7 years ago)
Author:
chronos
Message:
  • Added: New rule item type "Terminal range" to hold interval of characters.
  • Fixed: Removel of selected items in a list was not working correctly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/generator/URules.pas

    r120 r122  
    1414  TRuleItems = class;
    1515
    16   TRuleItemType = (ritTerminal, ritNonTerminal, ritSubItems);
     16  TRuleItemType = (ritTerminal, ritNonTerminal, ritSubItems, ritTerminalRange);
    1717
    1818  { TRuleItem }
     
    2929    RuleItemType: TRuleItemType;
    3030    Terminal: string;
     31    TerminalFrom: string;
     32    TerminalTo: string;
    3133    NonTerminalName: string;
    3234    NonTerminal: TRule;
     
    342344      SubItems.SaveToXmlNode(SubItemsNode);
    343345    end;
     346    ritTerminalRange: begin
     347      WriteString(Node, 'TerminalFrom', TerminalFrom);
     348      WriteString(Node, 'TerminalTo', TerminalTo);
     349    end;
    344350  end;
    345351end;
     
    351357    ritNonTerminal: Result := NonTerminal.Name;
    352358    ritSubItems: Result := '(' + SubItems.GetString + ')';
     359    ritTerminalRange: Result := '(' + TerminalFrom + ' .. ' + TerminalTo + ')';
    353360  end;
    354361  if Optional then Result := '+' + Result;
     
    381388    ritNonTerminal: Result := Length(NonTerminal.Name);
    382389    ritSubItems: Result := SubItems.GetCharLength;
     390    ritTerminalRange: Result := Max(Length(TerminalFrom), Length(TerminalTo))
    383391  end;
    384392end;
     
    405413      if Assigned(SubItemsNode) then SubItems.LoadFromXmlNode(SubItemsNode);
    406414    end;
     415    ritTerminalRange: begin
     416      TerminalFrom := ReadString(Node, 'TerminalFrom', '');
     417      TerminalTo := ReadString(Node, 'TerminalTo', '');
     418    end;
    407419  end;
    408420end;
Note: See TracChangeset for help on using the changeset viewer.