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
Boxiang Sun
cython
Commits
85bb6796
Commit
85bb6796
authored
Oct 04, 2013
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More complete array type parsing.
Also fixed passing templates through complex types.
parent
9b24fd97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+13
-13
No files found.
Cython/Compiler/Parsing.py
View file @
85bb6796
...
@@ -2009,7 +2009,7 @@ def p_c_base_type(s, self_flag = 0, nonempty = 0, templates = None):
...
@@ -2009,7 +2009,7 @@ def p_c_base_type(s, self_flag = 0, nonempty = 0, templates = None):
# If self_flag is true, this is the base type for the
# If self_flag is true, this is the base type for the
# self argument of a C method of an extension type.
# self argument of a C method of an extension type.
if
s
.
sy
==
'('
:
if
s
.
sy
==
'('
:
return
p_c_complex_base_type
(
s
)
return
p_c_complex_base_type
(
s
,
templates
=
templates
)
else
:
else
:
return
p_c_simple_base_type
(
s
,
self_flag
,
nonempty
=
nonempty
,
templates
=
templates
)
return
p_c_simple_base_type
(
s
,
self_flag
,
nonempty
=
nonempty
,
templates
=
templates
)
...
@@ -2024,20 +2024,21 @@ def p_calling_convention(s):
...
@@ -2024,20 +2024,21 @@ def p_calling_convention(s):
calling_convention_words
=
cython
.
declare
(
calling_convention_words
=
cython
.
declare
(
set
,
set
([
"__stdcall"
,
"__cdecl"
,
"__fastcall"
]))
set
,
set
([
"__stdcall"
,
"__cdecl"
,
"__fastcall"
]))
def
p_c_complex_base_type
(
s
):
def
p_c_complex_base_type
(
s
,
templates
=
None
):
# s.sy == '('
# s.sy == '('
pos
=
s
.
position
()
pos
=
s
.
position
()
s
.
next
()
s
.
next
()
base_type
=
p_c_base_type
(
s
)
base_type
=
p_c_base_type
(
s
,
templates
=
templates
)
declarator
=
p_c_declarator
(
s
,
empty
=
1
)
declarator
=
p_c_declarator
(
s
,
empty
=
1
)
s
.
expect
(
')'
)
s
.
expect
(
')'
)
complex_typ
e
=
Nodes
.
CComplexBaseTypeNode
(
pos
,
type_nod
e
=
Nodes
.
CComplexBaseTypeNode
(
pos
,
base_type
=
base_type
,
declarator
=
declarator
)
base_type
=
base_type
,
declarator
=
declarator
)
while
s
.
sy
==
'['
:
if
s
.
sy
==
'['
:
declarator
=
p_c_declarator
(
s
,
empty
=
1
)
if
is_memoryviewslice_access
(
s
):
complex_type
=
Nodes
.
CComplexBaseTypeNode
(
pos
,
type_node
=
p_memoryviewslice_access
(
s
,
type_node
)
base_type
=
complex_type
,
declarator
=
declarator
)
else
:
return
complex_type
type_node
=
p_buffer_or_template
(
s
,
type_node
,
templates
)
return
type_node
def
p_c_simple_base_type
(
s
,
self_flag
,
nonempty
,
templates
=
None
):
def
p_c_simple_base_type
(
s
,
self_flag
,
nonempty
,
templates
=
None
):
...
@@ -2110,10 +2111,6 @@ def p_c_simple_base_type(s, self_flag, nonempty, templates = None):
...
@@ -2110,10 +2111,6 @@ def p_c_simple_base_type(s, self_flag, nonempty, templates = None):
type_node
=
p_memoryviewslice_access
(
s
,
type_node
)
type_node
=
p_memoryviewslice_access
(
s
,
type_node
)
else
:
else
:
type_node
=
p_buffer_or_template
(
s
,
type_node
,
templates
)
type_node
=
p_buffer_or_template
(
s
,
type_node
,
templates
)
while
s
.
sy
==
'['
:
declarator
=
p_c_declarator
(
s
,
empty
=
1
)
type_node
=
Nodes
.
CComplexBaseTypeNode
(
pos
,
base_type
=
type_node
,
declarator
=
declarator
)
if
s
.
sy
==
'.'
:
if
s
.
sy
==
'.'
:
s
.
next
()
s
.
next
()
...
@@ -2132,6 +2129,9 @@ def p_buffer_or_template(s, base_type_node, templates):
...
@@ -2132,6 +2129,9 @@ def p_buffer_or_template(s, base_type_node, templates):
p_positional_and_keyword_args
(
s
,
(
']'
,),
templates
)
p_positional_and_keyword_args
(
s
,
(
']'
,),
templates
)
)
)
s
.
expect
(
']'
)
s
.
expect
(
']'
)
if
s
.
sy
==
'['
:
base_type_node
=
p_buffer_or_template
(
s
,
base_type_node
,
templates
)
keyword_dict
=
ExprNodes
.
DictNode
(
pos
,
keyword_dict
=
ExprNodes
.
DictNode
(
pos
,
key_value_pairs
=
[
key_value_pairs
=
[
...
...
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