[Python-checkins] python/dist/src/Grammar Grammar,1.53,1.54

pje@users.sourceforge.net pje at users.sourceforge.net
Tue Aug 2 02:47:14 CEST 2005


Update of /cvsroot/python/python/dist/src/Grammar
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12011/Grammar

Modified Files:
	Grammar 
Log Message:
PEP 342 implementation.  Per Guido's comments, the generator throw() 
method still needs to support string exceptions, and allow None for the
third argument.  Documentation updates are needed, too.


Index: Grammar
===================================================================
RCS file: /cvsroot/python/python/dist/src/Grammar/Grammar,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- Grammar	5 Mar 2005 06:47:56 -0000	1.53
+++ Grammar	2 Aug 2005 00:46:38 -0000	1.54
@@ -39,7 +39,7 @@
 stmt: simple_stmt | compound_stmt
 simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
 small_stmt: expr_stmt | print_stmt  | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt | assert_stmt
-expr_stmt: testlist (augassign testlist | ('=' testlist)*)
+expr_stmt: testlist (augassign (yield_expr|testlist) | ('=' (yield_expr|testlist))*)
 augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' | '<<=' | '>>=' | '**=' | '//='
 # For normal assignments, additional restrictions enforced by the interpreter
 print_stmt: 'print' ( [ test (',' test)* [','] ] | '>>' test [ (',' test)+ [','] ] )
@@ -49,7 +49,7 @@
 break_stmt: 'break'
 continue_stmt: 'continue'
 return_stmt: 'return' [testlist]
-yield_stmt: 'yield' testlist
+yield_stmt: yield_expr
 raise_stmt: 'raise' [test [',' test [',' test]]]
 import_stmt: import_name | import_from
 import_name: 'import' dotted_as_names
@@ -86,7 +86,7 @@
 term: factor (('*'|'/'|'%'|'//') factor)*
 factor: ('+'|'-'|'~') factor | power
 power: atom trailer* ['**' factor]
-atom: '(' [testlist_gexp] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+
+atom: '(' [yield_expr|testlist_gexp] ')' | '[' [listmaker] ']' | '{' [dictmaker] '}' | '`' testlist1 '`' | NAME | NUMBER | STRING+
 listmaker: test ( list_for | (',' test)* [','] )
 testlist_gexp: test ( gen_for | (',' test)* [','] )
 lambdef: 'lambda' [varargslist] ':' test
@@ -116,3 +116,6 @@
 
 # not used in grammar, but may appear in "node" passed from Parser to Compiler
 encoding_decl: NAME
+
+yield_expr: 'yield' [testlist]
+



More information about the Python-checkins mailing list