fix error reporting position for illegal string escapes
authorStefan Behnel <scoder@users.berlios.de>
Sat, 15 Jan 2011 17:34:51 +0000 (18:34 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 15 Jan 2011 17:34:51 +0000 (18:34 +0100)
Cython/Compiler/Parsing.py
tests/errors/invalid_uescape0.pyx
tests/errors/invalid_uescape2.pyx

index 1b39d7cbe2c491233de9ce4b99192f94dec6bc5f..7f59c2562ee8d233339c304b4160f0093e0debbf 100644 (file)
@@ -785,18 +785,17 @@ def p_string_literal(s, kind_override=None):
                     if len(systr) == 4:
                         chars.append_charval( int(systr[2:], 16) )
                     else:
-                        s.error("Invalid hex escape '%s'" % systr, pos=s.position())
+                        s.error("Invalid hex escape '%s'" % systr)
                 elif c in u'Uu':
                     if kind in ('u', ''):
                         if len(systr) in (6,10):
                             chrval = int(systr[2:], 16)
                             if chrval > 1114111: # sys.maxunicode:
-                                s.error("Invalid unicode escape '%s'" % systr,
-                                        pos = pos)
+                                s.error("Invalid unicode escape '%s'" % systr)
                         else:
-                            s.error("Invalid unicode escape '%s'" % systr, pos=s.position())
+                            s.error("Invalid unicode escape '%s'" % systr)
                     else:
-                        # unicode escapes in plain byte strings are not unescaped
+                        # unicode escapes in byte strings are not unescaped
                         chrval = None
                     chars.append_uescape(chrval, systr)
                 else:
index 1aa52350521afb8398d011b635a5826341c6624a..93d87ae016d56f76e8002a2aefbc277bfafc85b4 100644 (file)
@@ -2,5 +2,5 @@
 u'\u'
 
 _ERRORS = '''
-2:1: Invalid unicode escape '\u'
+2:2: Invalid unicode escape '\u'
 '''
index e91561f4d4459fe8dc8f067bba381c3a6b221701..e98e0ce9b825e7865ea2e58d2cf1a120d5e848a8 100644 (file)
@@ -2,5 +2,5 @@
 u'\u12'
 
 _ERRORS = '''
-2:1: Invalid unicode escape '\u'
+2:2: Invalid unicode escape '\u'
 '''