Changeset 20 for branches/Void
- Timestamp:
- Jun 25, 2012, 1:24:13 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Void/UCompilator.pas
r19 r20 152 152 var 153 153 RuleProgram, RuleBlock, RuleDeclaration, RuleStatement, RuleConstant, 154 RuleVariable, RuleFunction : TGrammerRule;154 RuleVariable, RuleFunction, RuleConstantBlock: TGrammerRule; 155 155 begin 156 156 Grammer := TGrammer.Create; … … 160 160 Name := 'ConstantDefinition'; 161 161 RuleType := rtSequence; 162 AddTerminal('', ttIdentifier, False, False); 163 AddTerminal('=', ttSymbol, False, False); 164 AddTerminal('', ttNumber, False, False); 162 165 end; 163 166 Rules.Add(RuleConstantDefinition); 167 168 RuleConstantBlock := TGrammerRule.Create; 169 with RuleConstantBlock do begin 170 Name := 'ConstantBlock'; 171 RuleType := rtSequence; 172 AddTerminal(',', ttISymbol, False, False); 173 AddRule(RuleConstantDefinition, False, False); 174 end; 175 Rules.Add(RuleConstantBlock); 164 176 165 177 RuleConstant := TGrammerRule.Create; … … 169 181 AddTerminal('const', ttIdentifier, False, False); 170 182 AddRule(RuleConstantDefinition, False, False); 183 AddRule(RuleConstantBlock, True, True); 171 184 end; 172 185 Rules.Add(RuleConstant); … … 179 192 Rules.Add(RuleFunction); 180 193 194 RuleVariableBlock := TGrammerRule.Create; 195 with RuleVariableBlock do begin 196 Name := 'VariableBlock'; 197 RuleType := rtSequence; 198 AddTerminal(',', ttIdentifier, False, False); 199 AddTerminal('', ttIdentifier, False, False); 200 end; 201 Rules.Add(RuleVariableBlock); 202 181 203 RuleVariable := TGrammerRule.Create; 182 204 with RuleVariable do begin 183 205 Name := 'Variable'; 184 206 RuleType := rtSequence; 207 AddTerminal('var', ttIdentifier, False, False); 208 AddTerminal('', ttIdentifier, False, False); 209 AddRule(RuleVariableBlock, True, True); 185 210 end; 186 211 Rules.Add(RuleVariable);
Note:
See TracChangeset
for help on using the changeset viewer.