diff options
Diffstat (limited to 'Grammar')
-rw-r--r-- | Grammar/Grammar | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar index 57a39de..872ec81 100644 --- a/Grammar/Grammar +++ b/Grammar/Grammar @@ -74,7 +74,8 @@ arith_expr: term (('+'|'-') term)* term: factor (('*'|'/'|'%') factor)* factor: ('+'|'-'|'~') factor | power power: atom trailer* ('**' factor)* -atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+ +atom: '(' [testlist] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+ +listmaker: test ( list_iter | (',' test)* [','] ) lambdef: 'lambda' [varargslist] ':' test trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME subscriptlist: subscript (',' subscript)* [','] @@ -88,3 +89,7 @@ classdef: 'class' NAME ['(' testlist ')'] ':' suite arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] | '**' test) argument: [test '='] test # Really [keyword '='] test + +list_iter: list_for | list_if +list_for: 'for' exprlist 'in' testlist [list_iter] +list_if: 'if' test [list_iter] |