Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
e77243de
Commit
e77243de
authored
Apr 21, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow multiple __future__ imports in separate statements
parent
cde4a371
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
12 deletions
+29
-12
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+29
-12
No files found.
Cython/Compiler/Parsing.py
View file @
e77243de
...
...
@@ -1660,15 +1660,27 @@ def p_simple_statement_list(s, ctx, first_statement = 0):
# Parse a series of simple statements on one line
# separated by semicolons.
stat
=
p_simple_statement
(
s
,
first_statement
=
first_statement
)
if
s
.
sy
==
';'
:
stats
=
[
stat
]
while
s
.
sy
==
';'
:
#print "p_simple_statement_list: maybe more to follow" ###
s
.
next
()
if
s
.
sy
in
(
'NEWLINE'
,
'EOF'
):
break
stats
.
append
(
p_simple_statement
(
s
))
stat
=
Nodes
.
StatListNode
(
stats
[
0
].
pos
,
stats
=
stats
)
pos
=
stat
.
pos
stats
=
[]
if
not
isinstance
(
stat
,
Nodes
.
PassStatNode
):
stats
.
append
(
stat
)
while
s
.
sy
==
';'
:
#print "p_simple_statement_list: maybe more to follow" ###
s
.
next
()
if
s
.
sy
in
(
'NEWLINE'
,
'EOF'
):
break
stat
=
p_simple_statement
(
s
,
first_statement
=
first_statement
)
if
isinstance
(
stat
,
Nodes
.
PassStatNode
):
continue
stats
.
append
(
stat
)
first_statement
=
False
if
not
stats
:
stat
=
Nodes
.
PassStatNode
(
pos
)
elif
len
(
stats
)
==
1
:
stat
=
stats
[
0
]
else
:
stat
=
Nodes
.
StatListNode
(
pos
,
stats
=
stats
)
s
.
expect_newline
(
"Syntax error in simple statement list"
)
return
stat
...
...
@@ -1805,9 +1817,14 @@ def p_statement_list(s, ctx, first_statement = 0):
pos
=
s
.
position
()
stats
=
[]
while
s
.
sy
not
in
(
'DEDENT'
,
'EOF'
):
stats
.
append
(
p_statement
(
s
,
ctx
,
first_statement
=
first_statement
))
first_statement
=
0
if
len
(
stats
)
==
1
:
stat
=
p_statement
(
s
,
ctx
,
first_statement
=
first_statement
)
if
isinstance
(
stat
,
Nodes
.
PassStatNode
):
continue
stats
.
append
(
stat
)
first_statement
=
False
if
not
stats
:
return
Nodes
.
PassStatNode
(
pos
)
elif
len
(
stats
)
==
1
:
return
stats
[
0
]
else
:
return
Nodes
.
StatListNode
(
pos
,
stats
=
stats
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment