cdef p_c_modifiers(PyrexScanner s)
cdef p_binding(PyrexScanner s, ctx)
cdef p_c_func_or_var_declaration(PyrexScanner s, pos, ctx)
-cdef p_ctypedef_statement(PyrexScanner s, ctx)
+cdef p_ctypedef_statement(PyrexScanner s, pos, ctx)
cdef p_decorators(PyrexScanner s)
cdef p_def_statement(PyrexScanner s, list decorators = *)
cpdef p_varargslist(PyrexScanner s, terminator=*, bint annotated = *)
_LOG.debug('p_statement(s=<s sy:%s systring:%s>)'
% (s.sy, s.systring))
decorators = None
- if s.sy == 'ctypedef':
- if ctx.level not in ('module', 'module_pxd'):
- s.error("ctypedef statement not allowed here")
- #if ctx.c_binding.api:
- # error(s.position(), "'api' not allowed with 'ctypedef'")
- return p_ctypedef_statement(s, ctx)
- elif s.sy == 'DEF':
+ pos = s.position()
+ if s.sy == 'DEF':
return p_DEF_statement(s)
elif s.sy == 'IF':
return p_IF_statement(s, ctx)
elif s.sy == 'pass' and ctx.c_source.cdef:
# empty cdef block
return p_pass_statement(s, with_newline = 1)
+ sy = s.sy
ctx = p_binding(s, ctx)
+ if sy == 'ctypedef':
+ if ctx.level not in ('module', 'module_pxd'):
+ s.error("ctypedef statement not allowed here")
+ return p_ctypedef_statement(s, pos, ctx)
if ctx.c_source.cdef:
if ctx.level not in ('module', 'module_pxd', 'function', 'c_class', 'c_class_pxd'):
s.error('cdef statement not allowed here')
in_pxd = ctx.level == 'module_pxd')
return result
-def p_ctypedef_statement(s, ctx):
- # s.sy == 'ctypedef'
+def p_ctypedef_statement(s, pos, ctx):
_LOG.debug('p_ctypedef_statement(s=<s sy:%s systring:%s>)'
% (s.sy, s.systring))
- pos = s.position()
- ctx = p_binding(s, ctx)
if s.sy == 'class':
return p_c_class_definition(s, pos, ctx)
elif s.sy == 'IDENT' and s.systring in ('packed', 'struct', 'union', 'enum'):