Skip to content

Commit 62c7a02

Browse files
committed
Corrected grammar
1 parent 82bfb73 commit 62c7a02

3 files changed

Lines changed: 21 additions & 21 deletions

File tree

dice_notation/parser/DiceNotationListener.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
# This class defines a complete listener for a parse tree produced by DiceNotationParser.
55
class DiceNotationListener(ParseTreeListener):
66

7-
# Enter a parse tree produced by DiceNotationParser#startRule.
8-
def enterStartRule(self, ctx):
7+
# Enter a parse tree produced by DiceNotationParser#notation.
8+
def enterNotation(self, ctx):
99
pass
1010

11-
# Exit a parse tree produced by DiceNotationParser#startRule.
12-
def exitStartRule(self, ctx):
11+
# Exit a parse tree produced by DiceNotationParser#notation.
12+
def exitNotation(self, ctx):
1313
pass
1414

1515

dice_notation/parser/DiceNotationParser.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ class DiceNotationParser ( Parser ):
4848
symbolicNames = [ u"<INVALID>", u"DSEPARATOR", u"DIGIT", u"ADDOPERATOR",
4949
u"MULTOPERATOR", u"LPAREN", u"RPAREN", u"WS" ]
5050

51-
RULE_startRule = 0
51+
RULE_notation = 0
5252
RULE_addOp = 1
5353
RULE_multOp = 2
5454
RULE_operand = 3
5555
RULE_dice = 4
5656
RULE_number = 5
5757

58-
ruleNames = [ u"startRule", u"addOp", u"multOp", u"operand", u"dice",
58+
ruleNames = [ u"notation", u"addOp", u"multOp", u"operand", u"dice",
5959
u"number" ]
6060

6161
EOF = Token.EOF
@@ -76,10 +76,10 @@ def __init__(self, input, output=sys.stdout):
7676

7777

7878

79-
class StartRuleContext(ParserRuleContext):
79+
class NotationContext(ParserRuleContext):
8080

8181
def __init__(self, parser, parent=None, invokingState=-1):
82-
super(DiceNotationParser.StartRuleContext, self).__init__(parent, invokingState)
82+
super(DiceNotationParser.NotationContext, self).__init__(parent, invokingState)
8383
self.parser = parser
8484

8585
def dice(self):
@@ -95,23 +95,23 @@ def addOp(self):
9595

9696

9797
def getRuleIndex(self):
98-
return DiceNotationParser.RULE_startRule
98+
return DiceNotationParser.RULE_notation
9999

100100
def enterRule(self, listener):
101-
if hasattr(listener, "enterStartRule"):
102-
listener.enterStartRule(self)
101+
if hasattr(listener, "enterNotation"):
102+
listener.enterNotation(self)
103103

104104
def exitRule(self, listener):
105-
if hasattr(listener, "exitStartRule"):
106-
listener.exitStartRule(self)
105+
if hasattr(listener, "exitNotation"):
106+
listener.exitNotation(self)
107107

108108

109109

110110

111-
def startRule(self):
111+
def notation(self):
112112

113-
localctx = DiceNotationParser.StartRuleContext(self, self._ctx, self.state)
114-
self.enterRule(localctx, 0, self.RULE_startRule)
113+
localctx = DiceNotationParser.NotationContext(self, self._ctx, self.state)
114+
self.enterRule(localctx, 0, self.RULE_notation)
115115
try:
116116
self.state = 15
117117
self._errHandler.sync(self)
@@ -287,8 +287,8 @@ def number(self):
287287
def LPAREN(self):
288288
return self.getToken(DiceNotationParser.LPAREN, 0)
289289

290-
def startRule(self):
291-
return self.getTypedRuleContext(DiceNotationParser.StartRuleContext,0)
290+
def notation(self):
291+
return self.getTypedRuleContext(DiceNotationParser.NotationContext,0)
292292

293293

294294
def RPAREN(self):
@@ -333,7 +333,7 @@ def operand(self):
333333
self.state = 35
334334
self.match(DiceNotationParser.LPAREN)
335335
self.state = 36
336-
self.startRule()
336+
self.notation()
337337
self.state = 37
338338
self.match(DiceNotationParser.RPAREN)
339339
pass

grammar/DiceNotation.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ options { tokenVocab=DiceNotationLexer; }
2727
* Rules.
2828
*/
2929

30-
startRule
30+
notation
3131
:
3232
dice
3333
| number
@@ -48,7 +48,7 @@ operand
4848
:
4949
dice
5050
| number
51-
| LPAREN startRule RPAREN
51+
| LPAREN notation RPAREN
5252
;
5353

5454
dice

0 commit comments

Comments
 (0)