Commit bf4a8f0c authored by Igor Dejanovic's avatar Igor Dejanovic

Changing EOF rule name in PEG grammars

parent cf7876a8
...@@ -89,7 +89,7 @@ class SemRule(PEGSemanticAction): ...@@ -89,7 +89,7 @@ class SemRule(PEGSemanticAction):
if not hasattr(parser, "peg_rules"): if not hasattr(parser, "peg_rules"):
parser.peg_rules = {} # Used for linking phase parser.peg_rules = {} # Used for linking phase
parser.peg_rules["EndOfFile"] = EndOfFile() parser.peg_rules["EOF"] = EndOfFile()
# Keep a map of parser rules for cross reference # Keep a map of parser rules for cross reference
# resolving. # resolving.
......
...@@ -27,7 +27,7 @@ calc_grammar = """ ...@@ -27,7 +27,7 @@ calc_grammar = """
(number / "(" expression ")"); (number / "(" expression ")");
term <- factor (( "*" / "/") factor)*; term <- factor (( "*" / "/") factor)*;
expression <- term (("+" / "-") term)*; expression <- term (("+" / "-") term)*;
calc <- expression+ EndOfFile; calc <- expression+ EOF;
""" """
# Rules are mapped to semantic actions # Rules are mapped to semantic actions
......
...@@ -26,7 +26,7 @@ from arpeggio.peg import ParserPEG ...@@ -26,7 +26,7 @@ from arpeggio.peg import ParserPEG
# Grammar rules # Grammar rules
robot_grammar = ''' robot_grammar = '''
program <- 'begin' (command)* 'end' EndOfFile; program <- 'begin' (command)* 'end' EOF;
command <- UP/DOWN/LEFT/RIGHT; command <- UP/DOWN/LEFT/RIGHT;
UP <- 'up'; UP <- 'up';
DOWN <- 'down'; DOWN <- 'down';
......
...@@ -17,7 +17,7 @@ grammar = ''' ...@@ -17,7 +17,7 @@ grammar = '''
(number / "(" expression ")"); (number / "(" expression ")");
term <- factor (( "*" / "/") factor)*; term <- factor (( "*" / "/") factor)*;
expression <- term (("+" / "-") term)*; expression <- term (("+" / "-") term)*;
calc <- expression+ EndOfFile; calc <- expression+ EOF;
''' '''
class TestPEGParser(TestCase): class TestPEGParser(TestCase):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment