X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/dfa45cec9e4991823b06fa655e3e444391fadb65..95e77cb5590a1499d3aa4cf7fe60481347191c35:/src/blib2to3/Grammar.txt diff --git a/src/blib2to3/Grammar.txt b/src/blib2to3/Grammar.txt index de9a6a2..cf4799f 100644 --- a/src/blib2to3/Grammar.txt +++ b/src/blib2to3/Grammar.txt @@ -168,8 +168,8 @@ subscript: test [':=' test] | [test] ':' [test] [sliceop] sliceop: ':' [test] exprlist: (expr|star_expr) (',' (expr|star_expr))* [','] testlist: test (',' test)* [','] -dictsetmaker: ( ((test ':' test | '**' expr) - (comp_for | (',' (test ':' test | '**' expr))* [','])) | +dictsetmaker: ( ((test ':' asexpr_test | '**' expr) + (comp_for | (',' (test ':' asexpr_test | '**' expr))* [','])) | ((test [':=' test] | star_expr) (comp_for | (',' (test [':=' test] | star_expr))* [','])) ) @@ -187,7 +187,7 @@ arglist: argument (',' argument)* [','] argument: ( test [comp_for] | test ':=' test | test 'as' test | - test '=' test | + test '=' asexpr_test | '**' test | '*' test ) @@ -238,10 +238,14 @@ yield_arg: 'from' test | testlist_star_expr # to reformat them. match_stmt: "match" subject_expr ':' NEWLINE INDENT case_block+ DEDENT -subject_expr: namedexpr_test (',' namedexpr_test)* [','] + +# This is more permissive than the actual version. For example it +# accepts `match *something:`, even though single-item starred expressions +# are forbidden. +subject_expr: (namedexpr_test|star_expr) (',' (namedexpr_test|star_expr))* [','] # cases case_block: "case" patterns [guard] ':' suite guard: 'if' namedexpr_test -patterns: pattern ['as' pattern] -pattern: (expr|star_expr) (',' (expr|star_expr))* [','] +patterns: pattern (',' pattern)* [','] +pattern: (expr|star_expr) ['as' expr]