Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ac4a88

Browse files
committed
Change treatment of multiple NEWLINES
1 parent a608109 commit 7ac4a88

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Grammar/Grammar

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Grammar for Python, version 5
22

33
# Changes compared to version 4:
4+
# Blank lines and lines only containing a comment are now eaten
5+
# by the lexer, so the NEWLINE* things in suite are gone
6+
# (but the 2nd NEWLINE terminating single_input stays!)
47
# Semicolons can separate small statements
58
# 'continue' statement
69
# Dictionary constructors: {key:value, key:value, ...}
@@ -59,7 +62,7 @@ while_stmt: 'while' test ':' suite ['else' ':' suite]
5962
for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite]
6063
try_stmt: 'try' ':' suite (except_clause ':' suite)* ['finally' ':' suite]
6164
except_clause: 'except' [test [',' test]]
62-
suite: simple_stmt | NEWLINE INDENT NEWLINE* (stmt NEWLINE*)+ DEDENT
65+
suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT
6366

6467
test: and_test ('or' and_test)*
6568
and_test: not_test ('and' not_test)*

0 commit comments

Comments
 (0)