Commit 9db14a42 authored by gsamain's avatar gsamain

cypdef keyword in parsing

parent ccdee500
......@@ -2239,7 +2239,7 @@ def p_statement(s, ctx, first_statement = 0):
s.error('decorator not allowed here')
s.level = ctx.level
decorators = p_decorators(s)
if not ctx.allow_struct_enum_decorator and s.sy not in ('def', 'cdef', 'cpdef', 'ccdef', 'class'):
if not ctx.allow_struct_enum_decorator and s.sy not in ('def', 'cdef', 'cpdef', 'class'):
if s.sy == 'IDENT' and s.systring == 'async':
pass # handled below
else:
......@@ -2253,12 +2253,6 @@ def p_statement(s, ctx, first_statement = 0):
if s.sy == 'cdef':
cdef_flag = 1
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':
s.level = ctx.level
cdef_flag = 1
......@@ -3086,7 +3080,7 @@ def p_cdef_statement(s, ctx):
if ctx.overridable:
error(pos, "Extension types cannot be declared cpdef")
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)
elif s.sy == 'IDENT' and s.systring in struct_enum_union:
if ctx.level not in ('module', 'module_pxd'):
......@@ -3756,7 +3750,8 @@ def p_template_definition(s):
return name, required
def p_cpp_class_definition(s, pos, ctx):
# s.sy == 'cppclass'
# s.sy in ('cppclass', 'cypclass')
cypclass = s.systring == 'cypclass'
s.next()
module_path = []
class_name = p_ident(s)
......@@ -3813,7 +3808,7 @@ def p_cpp_class_definition(s, pos, ctx):
visibility = ctx.visibility,
in_pxd = ctx.level == 'module_pxd',
attributes = attributes,
templates = templates, cypclass=nogil)
templates = templates, cypclass=cypclass)
def p_cpp_class_attribute(s, ctx):
decorators = None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment