summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-07-07 22:26:23 (GMT)
committerGuido van Rossum <guido@python.org>1995-07-07 22:26:23 (GMT)
commita996b910f22c9a249653f6eff72868d37e95f5be (patch)
tree76ffaf98cb8a2c7597ac54d0cf43b216cb39686b /Grammar
parentfec75d66a77e2fd334aaad10b1608a848d2a09cc (diff)
downloadcpython-a996b910f22c9a249653f6eff72868d37e95f5be.zip
cpython-a996b910f22c9a249653f6eff72868d37e95f5be.tar.gz
cpython-a996b910f22c9a249653f6eff72868d37e95f5be.tar.bz2
new grammar for 3rd raise arg and keyword parameters
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar9
1 files changed, 6 insertions, 3 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index 5af4483..f1b5117 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -23,7 +23,7 @@ eval_input: testlist NEWLINE* ENDMARKER
funcdef: 'def' NAME parameters ':' suite
parameters: '(' [varargslist] ')'
-varargslist: (fpdef ['=' test] ',')* '*' NAME | fpdef ['=' test] (',' fpdef ['=' test])* [',']
+varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' '*' '*' NAME] | '*' '*' NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [',']
fpdef: NAME | '(' fplist ')'
fplist: fpdef (',' fpdef)* [',']
@@ -39,7 +39,7 @@ flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt
break_stmt: 'break'
continue_stmt: 'continue'
return_stmt: 'return' [testlist]
-raise_stmt: 'raise' test [',' test]
+raise_stmt: 'raise' test [',' test [',' test]]
import_stmt: 'import' dotted_name (',' dotted_name)* | 'from' dotted_name 'import' ('*' | NAME (',' NAME)*)
dotted_name: NAME ('.' NAME)*
global_stmt: 'global' NAME (',' NAME)*
@@ -73,10 +73,13 @@ term: factor (('*'|'/'|'%') factor)*
factor: ('+'|'-'|'~') factor | atom trailer*
atom: '(' [testlist] ')' | '[' [testlist] ']' | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+
lambdef: 'lambda' [varargslist] ':' test
-trailer: '(' [testlist] ')' | '[' subscript ']' | '.' NAME
+trailer: '(' [arglist] ')' | '[' subscript ']' | '.' NAME
subscript: test | [test] ':' [test]
exprlist: expr (',' expr)* [',']
testlist: test (',' test)* [',']
dictmaker: test ':' test (',' test ':' test)* [',']
classdef: 'class' NAME ['(' testlist ')'] ':' suite
+
+arglist: argument (',' argument)* [',']
+argument: [test '='] test # Really [keyword '='] test