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
Kirill Smelkov
cython
Commits
0a9cecf7
Commit
0a9cecf7
authored
Nov 23, 2014
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clean up some whitespace in parser code
parent
0a375513
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+12
-9
No files found.
Cython/Compiler/Parsing.py
View file @
0a9cecf7
...
...
@@ -1097,6 +1097,7 @@ def p_genexp(s, expr):
expr_terminators
=
cython
.
declare
(
set
,
set
([
')'
,
']'
,
'}'
,
':'
,
'='
,
'NEWLINE'
]))
#-------------------------------------------------------
#
# Statements
...
...
@@ -1110,12 +1111,14 @@ def p_global_statement(s):
names
=
p_ident_list
(
s
)
return
Nodes
.
GlobalNode
(
pos
,
names
=
names
)
def
p_nonlocal_statement
(
s
):
pos
=
s
.
position
()
s
.
next
()
names
=
p_ident_list
(
s
)
return
Nodes
.
NonlocalNode
(
pos
,
names
=
names
)
def
p_expression_or_assignment
(
s
):
expr_list
=
[
p_testlist_star_expr
(
s
)]
if
s
.
sy
==
'='
and
expr_list
[
0
].
is_starred
:
...
...
@@ -1140,7 +1143,7 @@ def p_expression_or_assignment(s):
lhs
.
pos
,
base
=
lhs
.
base
,
index
=
make_slice_node
(
lhs
.
pos
,
lhs
.
start
,
lhs
.
stop
))
elif
not
isinstance
(
lhs
,
(
ExprNodes
.
AttributeNode
,
ExprNodes
.
IndexNode
,
ExprNodes
.
NameNode
)
):
elif
not
isinstance
(
lhs
,
(
ExprNodes
.
AttributeNode
,
ExprNodes
.
IndexNode
,
ExprNodes
.
NameNode
)):
error
(
lhs
.
pos
,
"Illegal operand for inplace operation."
)
operator
=
s
.
sy
[:
-
1
]
s
.
next
()
...
...
@@ -1148,17 +1151,16 @@ def p_expression_or_assignment(s):
rhs
=
p_yield_expression
(
s
)
else
:
rhs
=
p_testlist
(
s
)
return
Nodes
.
InPlaceAssignmentNode
(
lhs
.
pos
,
operator
=
operator
,
lhs
=
lhs
,
rhs
=
rhs
)
return
Nodes
.
InPlaceAssignmentNode
(
lhs
.
pos
,
operator
=
operator
,
lhs
=
lhs
,
rhs
=
rhs
)
expr
=
expr_list
[
0
]
return
Nodes
.
ExprStatNode
(
expr
.
pos
,
expr
=
expr
)
rhs
=
expr_list
[
-
1
]
if
len
(
expr_list
)
==
2
:
return
Nodes
.
SingleAssignmentNode
(
rhs
.
pos
,
lhs
=
expr_list
[
0
],
rhs
=
rhs
)
return
Nodes
.
SingleAssignmentNode
(
rhs
.
pos
,
lhs
=
expr_list
[
0
],
rhs
=
rhs
)
else
:
return
Nodes
.
CascadedAssignmentNode
(
rhs
.
pos
,
lhs_list
=
expr_list
[:
-
1
],
rhs
=
rhs
)
return
Nodes
.
CascadedAssignmentNode
(
rhs
.
pos
,
lhs_list
=
expr_list
[:
-
1
],
rhs
=
rhs
)
def
p_print_statement
(
s
):
# s.sy == 'print'
...
...
@@ -1182,10 +1184,11 @@ def p_print_statement(s):
ends_with_comma
=
1
break
args
.
append
(
p_test
(
s
))
arg_tuple
=
ExprNodes
.
TupleNode
(
pos
,
args
=
args
)
arg_tuple
=
ExprNodes
.
TupleNode
(
pos
,
args
=
args
)
return
Nodes
.
PrintStatNode
(
pos
,
arg_tuple
=
arg_tuple
,
stream
=
stream
,
append_newline
=
not
ends_with_comma
)
arg_tuple
=
arg_tuple
,
stream
=
stream
,
append_newline
=
not
ends_with_comma
)
def
p_exec_statement
(
s
):
# s.sy == 'exec'
...
...
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