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