Commit d6e63ab1 authored by Stefan Behnel's avatar Stefan Behnel

fix some error reportings in parser

parent 3173319b
...@@ -1546,7 +1546,7 @@ def p_statement(s, ctx, first_statement = 0): ...@@ -1546,7 +1546,7 @@ def p_statement(s, ctx, first_statement = 0):
return node return node
else: else:
if ctx.api: if ctx.api:
error(s.pos, "'api' not allowed with this statement") s.error("'api' not allowed with this statement")
elif s.sy == 'def': elif s.sy == 'def':
if ctx.level not in ('module', 'class', 'c_class', 'c_class_pxd', 'property'): if ctx.level not in ('module', 'class', 'c_class', 'c_class_pxd', 'property'):
s.error('def statement not allowed here') s.error('def statement not allowed here')
...@@ -1607,7 +1607,7 @@ def p_suite(s, ctx = Ctx(), with_doc = 0, with_pseudo_doc = 0): ...@@ -1607,7 +1607,7 @@ def p_suite(s, ctx = Ctx(), with_doc = 0, with_pseudo_doc = 0):
s.expect_dedent() s.expect_dedent()
else: else:
if ctx.api: if ctx.api:
error(s.pos, "'api' not allowed with this statement") s.error("'api' not allowed with this statement")
if ctx.level in ('module', 'class', 'function', 'other'): if ctx.level in ('module', 'class', 'function', 'other'):
body = p_simple_statement_list(s, ctx) body = p_simple_statement_list(s, ctx)
else: else:
...@@ -2324,7 +2324,7 @@ def p_c_func_or_var_declaration(s, pos, ctx): ...@@ -2324,7 +2324,7 @@ def p_c_func_or_var_declaration(s, pos, ctx):
overridable = ctx.overridable) overridable = ctx.overridable)
else: else:
#if api: #if api:
# error(s.pos, "'api' not allowed with variable declaration") # s.error("'api' not allowed with variable declaration")
declarators = [declarator] declarators = [declarator]
while s.sy == ',': while s.sy == ',':
s.next() s.next()
......
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