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
1bd29b0b
Commit
1bd29b0b
authored
Mar 08, 2019
by
gsamain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cypdef keyword in parsing
parent
6d47061b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+5
-10
No files found.
Cython/Compiler/Parsing.py
View file @
1bd29b0b
...
@@ -2239,7 +2239,7 @@ def p_statement(s, ctx, first_statement = 0):
...
@@ -2239,7 +2239,7 @@ def p_statement(s, ctx, first_statement = 0):
s
.
error
(
'decorator not allowed here'
)
s
.
error
(
'decorator not allowed here'
)
s
.
level
=
ctx
.
level
s
.
level
=
ctx
.
level
decorators
=
p_decorators
(
s
)
decorators
=
p_decorators
(
s
)
if
not
ctx
.
allow_struct_enum_decorator
and
s
.
sy
not
in
(
'def'
,
'cdef'
,
'cpdef'
,
'c
cdef'
,
'c
lass'
):
if
not
ctx
.
allow_struct_enum_decorator
and
s
.
sy
not
in
(
'def'
,
'cdef'
,
'cpdef'
,
'class'
):
if
s
.
sy
==
'IDENT'
and
s
.
systring
==
'async'
:
if
s
.
sy
==
'IDENT'
and
s
.
systring
==
'async'
:
pass
# handled below
pass
# handled below
else
:
else
:
...
@@ -2253,12 +2253,6 @@ def p_statement(s, ctx, first_statement = 0):
...
@@ -2253,12 +2253,6 @@ def p_statement(s, ctx, first_statement = 0):
if
s
.
sy
==
'cdef'
:
if
s
.
sy
==
'cdef'
:
cdef_flag
=
1
cdef_flag
=
1
s
.
next
()
s
.
next
()
elif
s
.
sy
==
'ccdef'
:
cdef_flag
=
1
nogil_flag
=
1
s
.
next
()
if
s
.
systring
not
in
(
"class"
,
"cppclass"
):
s
.
error
(
'ccdef statement only allowed for extension type or cppclass'
)
elif
s
.
sy
==
'cpdef'
:
elif
s
.
sy
==
'cpdef'
:
s
.
level
=
ctx
.
level
s
.
level
=
ctx
.
level
cdef_flag
=
1
cdef_flag
=
1
...
@@ -3086,7 +3080,7 @@ def p_cdef_statement(s, ctx):
...
@@ -3086,7 +3080,7 @@ def p_cdef_statement(s, ctx):
if
ctx
.
overridable
:
if
ctx
.
overridable
:
error
(
pos
,
"Extension types cannot be declared cpdef"
)
error
(
pos
,
"Extension types cannot be declared cpdef"
)
return
p_c_class_definition
(
s
,
pos
,
ctx
)
return
p_c_class_definition
(
s
,
pos
,
ctx
)
elif
s
.
sy
==
'IDENT'
and
s
.
systring
==
'cppclass'
:
elif
s
.
sy
==
'IDENT'
and
s
.
systring
in
(
'cppclass'
,
'cypclass'
)
:
return
p_cpp_class_definition
(
s
,
pos
,
ctx
)
return
p_cpp_class_definition
(
s
,
pos
,
ctx
)
elif
s
.
sy
==
'IDENT'
and
s
.
systring
in
struct_enum_union
:
elif
s
.
sy
==
'IDENT'
and
s
.
systring
in
struct_enum_union
:
if
ctx
.
level
not
in
(
'module'
,
'module_pxd'
):
if
ctx
.
level
not
in
(
'module'
,
'module_pxd'
):
...
@@ -3756,7 +3750,8 @@ def p_template_definition(s):
...
@@ -3756,7 +3750,8 @@ def p_template_definition(s):
return
name
,
required
return
name
,
required
def
p_cpp_class_definition
(
s
,
pos
,
ctx
):
def
p_cpp_class_definition
(
s
,
pos
,
ctx
):
# s.sy == 'cppclass'
# s.sy in ('cppclass', 'cypclass')
cypclass
=
s
.
systring
==
'cypclass'
s
.
next
()
s
.
next
()
module_path
=
[]
module_path
=
[]
class_name
=
p_ident
(
s
)
class_name
=
p_ident
(
s
)
...
@@ -3813,7 +3808,7 @@ def p_cpp_class_definition(s, pos, ctx):
...
@@ -3813,7 +3808,7 @@ def p_cpp_class_definition(s, pos, ctx):
visibility
=
ctx
.
visibility
,
visibility
=
ctx
.
visibility
,
in_pxd
=
ctx
.
level
==
'module_pxd'
,
in_pxd
=
ctx
.
level
==
'module_pxd'
,
attributes
=
attributes
,
attributes
=
attributes
,
templates
=
templates
,
cypclass
=
nogil
)
templates
=
templates
,
cypclass
=
cypclass
)
def
p_cpp_class_attribute
(
s
,
ctx
):
def
p_cpp_class_attribute
(
s
,
ctx
):
decorators
=
None
decorators
=
None
...
...
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