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
5882c337
Commit
5882c337
authored
Feb 06, 2008
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pxd with optional arguments
parent
87c3455c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+11
-3
No files found.
Cython/Compiler/Parsing.py
View file @
5882c337
...
@@ -1325,6 +1325,7 @@ def p_statement(s, level, cdef_flag = 0, visibility = 'private', api = 0):
...
@@ -1325,6 +1325,7 @@ def p_statement(s, level, cdef_flag = 0, visibility = 'private', api = 0):
if
cdef_flag
:
if
cdef_flag
:
if
level
not
in
(
'module'
,
'module_pxd'
,
'function'
,
'c_class'
,
'c_class_pxd'
):
if
level
not
in
(
'module'
,
'module_pxd'
,
'function'
,
'c_class'
,
'c_class_pxd'
):
s
.
error
(
'cdef statement not allowed here'
)
s
.
error
(
'cdef statement not allowed here'
)
s
.
level
=
level
return
p_cdef_statement
(
s
,
level
,
visibility
=
visibility
,
return
p_cdef_statement
(
s
,
level
,
visibility
=
visibility
,
api
=
api
,
overridable
=
overridable
)
api
=
api
,
overridable
=
overridable
)
# elif s.sy == 'cpdef':
# elif s.sy == 'cpdef':
...
@@ -1336,6 +1337,7 @@ def p_statement(s, level, cdef_flag = 0, visibility = 'private', api = 0):
...
@@ -1336,6 +1337,7 @@ def p_statement(s, level, cdef_flag = 0, visibility = 'private', api = 0):
elif
s
.
sy
==
'def'
:
elif
s
.
sy
==
'def'
:
if
level
not
in
(
'module'
,
'class'
,
'c_class'
,
'property'
):
if
level
not
in
(
'module'
,
'class'
,
'c_class'
,
'property'
):
s
.
error
(
'def statement not allowed here'
)
s
.
error
(
'def statement not allowed here'
)
s
.
level
=
level
return
p_def_statement
(
s
)
return
p_def_statement
(
s
)
elif
s
.
sy
==
'class'
:
elif
s
.
sy
==
'class'
:
if
level
<>
'module'
:
if
level
<>
'module'
:
...
@@ -1692,7 +1694,13 @@ def p_c_arg_decl(s, in_pyfunc, cmethod_flag = 0, nonempty = 0, kw_only = 0):
...
@@ -1692,7 +1694,13 @@ def p_c_arg_decl(s, in_pyfunc, cmethod_flag = 0, nonempty = 0, kw_only = 0):
not_none
=
1
not_none
=
1
if
s
.
sy
==
'='
:
if
s
.
sy
==
'='
:
s
.
next
()
s
.
next
()
default
=
p_simple_expr
(
s
)
if
'pxd'
in
s
.
level
:
if
s
.
sy
not
in
[
'*'
,
'?'
]:
error
(
pos
,
"default values cannot be specified in pxd files, use ? or *"
)
default
=
1
s
.
next
()
else
:
default
=
p_simple_expr
(
s
)
return
Nodes
.
CArgDeclNode
(
pos
,
return
Nodes
.
CArgDeclNode
(
pos
,
base_type
=
base_type
,
base_type
=
base_type
,
declarator
=
declarator
,
declarator
=
declarator
,
...
@@ -1710,8 +1718,8 @@ def p_api(s):
...
@@ -1710,8 +1718,8 @@ def p_api(s):
def
p_cdef_statement
(
s
,
level
,
visibility
=
'private'
,
api
=
0
,
def
p_cdef_statement
(
s
,
level
,
visibility
=
'private'
,
api
=
0
,
overridable
=
False
):
overridable
=
False
):
pos
=
s
.
position
()
pos
=
s
.
position
()
#
if overridable and level not in ('c_class', 'c_class_pxd'):
if
overridable
and
level
not
in
(
'c_class'
,
'c_class_pxd'
):
#
error(pos, "Overridable cdef function not allowed here")
error
(
pos
,
"Overridable cdef function not allowed here"
)
visibility
=
p_visibility
(
s
,
visibility
)
visibility
=
p_visibility
(
s
,
visibility
)
api
=
api
or
p_api
(
s
)
api
=
api
or
p_api
(
s
)
if
api
:
if
api
:
...
...
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