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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
72fc9e34
Commit
72fc9e34
authored
Nov 24, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support parentheses around import-from names
parent
e021a252
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
0 deletions
+17
-0
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+17
-0
No files found.
Cython/Compiler/Parsing.py
View file @
72fc9e34
...
...
@@ -42,6 +42,10 @@ class Ctx(object):
d
.
update
(
kwds
)
return
ctx
def
eat_newlines
(
s
):
while
s
.
sy
==
'NEWLINE'
:
s
.
next
()
def
p_ident
(
s
,
message
=
"Expected an identifier"
):
if
s
.
sy
==
'IDENT'
:
name
=
s
.
systring
...
...
@@ -1022,14 +1026,27 @@ def p_from_import_statement(s, first_statement = 0):
else
:
s
.
error
(
"Expected 'import' or 'cimport'"
)
is_cimport
=
kind
==
'cimport'
is_parenthesized
=
False
if
s
.
sy
==
'*'
:
imported_names
=
[(
s
.
position
(),
"*"
,
None
,
None
)]
s
.
next
()
else
:
if
s
.
sy
==
'('
:
is_parenthesized
=
True
s
.
next
()
eat_newlines
(
s
)
imported_names
=
[
p_imported_name
(
s
,
is_cimport
)]
if
is_parenthesized
:
eat_newlines
(
s
)
while
s
.
sy
==
','
:
s
.
next
()
if
is_parenthesized
:
eat_newlines
(
s
)
imported_names
.
append
(
p_imported_name
(
s
,
is_cimport
))
if
is_parenthesized
:
eat_newlines
(
s
)
if
is_parenthesized
:
s
.
expect
(
')'
)
dotted_name
=
EncodedString
(
dotted_name
)
if
dotted_name
==
'__future__'
:
if
not
first_statement
:
...
...
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