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
84384af4
Commit
84384af4
authored
May 20, 2009
by
DaniloFreitas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
namespace allowed (cdef extern from "foo.h" namespace something:)
parent
bb50c3e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
12 deletions
+21
-12
Cython/Compiler/Parsing.py
Cython/Compiler/Parsing.py
+21
-12
No files found.
Cython/Compiler/Parsing.py
View file @
84384af4
...
@@ -2121,13 +2121,17 @@ def p_cdef_extern_block(s, pos, ctx):
...
@@ -2121,13 +2121,17 @@ def p_cdef_extern_block(s, pos, ctx):
s
.
next
()
s
.
next
()
else
:
else
:
_
,
include_file
=
p_string_literal
(
s
)
_
,
include_file
=
p_string_literal
(
s
)
if
s
.
systring
==
"namespace"
:
s
.
next
()
namespace
=
p_ident
(
s
)
ctx
=
ctx
(
cdef_flag
=
1
,
visibility
=
'extern'
)
ctx
=
ctx
(
cdef_flag
=
1
,
visibility
=
'extern'
)
if
p_nogil
(
s
):
if
p_nogil
(
s
):
ctx
.
nogil
=
1
ctx
.
nogil
=
1
body
=
p_suite
(
s
,
ctx
)
body
=
p_suite
(
s
,
ctx
)
return
Nodes
.
CDefExternNode
(
pos
,
return
Nodes
.
CDefExternNode
(
pos
,
include_file
=
include_file
,
include_file
=
include_file
,
body
=
body
)
body
=
body
,
namespace
=
namespace
)
def
p_c_enum_definition
(
s
,
pos
,
ctx
):
def
p_c_enum_definition
(
s
,
pos
,
ctx
):
# s.sy == ident 'enum'
# s.sy == ident 'enum'
...
@@ -2562,15 +2566,22 @@ def p_cpp_class_definition(s, pos, ctx):
...
@@ -2562,15 +2566,22 @@ def p_cpp_class_definition(s, pos, ctx):
if s.sy == '[':
if s.sy == '[':
error(s.position(), "
Name
options
not
allowed
for
C
++
class
")
error(s.position(), "
Name
options
not
allowed
for
C
++
class
")
if s.sy == ':':
if s.sy == ':':
if ctx.level == 'module_pxd':
attributes = None
body_level = 'cpp_class_pxd'
s.next()
else:
s.expect('NEWLINE')
body_level = 'cpp_class'
s.expect_indent()
doc, body = p_suite(s, Ctx(level = body_level), with_doc = 1)
attributes = []
body_ctx = Ctx()
while s.sy != 'DEDENT':
if s.sy != 'pass':
attributes.append(
p_c_func_or_var_declaration(s, s.position(), body_ctx))
else:
s.next()
s.expect_newline("
Expected
a
newline
")
s.expect_dedent()
else:
else:
s.expect_newline("
Syntax
error
in
C
++
class
definition
")
s.expect_newline("
Syntax
error
in
C
++
class
definition
")
doc = None
body = None
return Nodes.CppClassNode(pos,
return Nodes.CppClassNode(pos,
name = class_name,
name = class_name,
namespace = None,
namespace = None,
...
@@ -2578,10 +2589,8 @@ def p_cpp_class_definition(s, pos, ctx):
...
@@ -2578,10 +2589,8 @@ def p_cpp_class_definition(s, pos, ctx):
base_classes = base_classes,
base_classes = base_classes,
visibility = ctx.visibility,
visibility = ctx.visibility,
in_pxd = ctx.level == 'module_pxd',
in_pxd = ctx.level == 'module_pxd',
attributes = None,
attributes = None)
doc = doc,
body = body)
def p_cpp_class(s):
def p_cpp_class(s):
pass
pass
...
...
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