Commit d7ffd39b authored by Stefan Behnel's avatar Stefan Behnel

slightly more telling error message on generic syntax errors

parent 17f53ec1
......@@ -419,7 +419,11 @@ class PyrexScanner(Scanner):
if message:
self.error(message)
else:
self.error("Expected '%s'" % what)
if self.sy == IDENT:
found = self.systring
else:
found = self.sy
self.error("Expected '%s', found '%s'" % (what, found))
def expect_indent(self):
self.expect('INDENT',
......
......@@ -6,5 +6,5 @@ cdef nogil class test: pass
_ERRORS = u"""
2: 5: Expected an identifier, found 'pass'
3: 9: Empty declarator
4:11: Expected ':'
4:11: Expected ':', found 'class'
"""
......@@ -5,5 +5,5 @@ cpdef nogil class test: pass
_ERRORS = u"""
2: 6: cdef blocks cannot be declared cpdef
3: 6: cdef blocks cannot be declared cpdef
3:12: Expected ':'
3:12: Expected ':', found 'class'
"""
......@@ -2,5 +2,5 @@ cdef packed foo:
pass
_ERRORS = u"""
1:12: Expected 'struct'
1:12: Expected 'struct', found 'foo'
"""
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