Refinement of EBNF extensions

This commit is contained in:
David Beazley
2020-03-07 06:28:19 -06:00
parent a2cdf52d0f
commit 39ffd0361a
4 changed files with 92 additions and 39 deletions

View File

@@ -56,11 +56,11 @@ class CalcParser(Parser):
@_('ID "(" [ arglist ] ")"')
def statement(self, p):
return (p.ID, p[2])
return (p.ID, p.arglist)
@_('expr { COMMA expr }')
def arglist(self, p):
return [p.expr, *[e.expr for e in p[1]]]
return [p.expr0, *p.expr1]
@_('expr')
def statement(self, p):