Merge fixes, fix constant unicode, string literal indexing.
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 13 Aug 2008 05:55:03 +0000 (22:55 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 13 Aug 2008 05:55:03 +0000 (22:55 -0700)
All test pass but bufaccess, tnumpy, and r_mang1.

Cython/Compiler/ExprNodes.py
Cython/Compiler/Lexicon.py
Cython/Compiler/Main.py
Cython/Compiler/Parsing.py

index 7f9570e4d127242993e4dc18725c3d6a1d09c1c7..555827989ab26de5b5c061faa76fa675a0ce4218 100644 (file)
@@ -759,6 +759,9 @@ class UnicodeNode(PyConstNode):
         # We still need to perform normal coerce_to processing on the
         # result, because we might be coercing to an extension type,
         # in which case a type test node will be needed.
+        
+    def compile_time_value(self, env):
+        return self.value
 
 
 class IdentifierStringNode(ConstNode):
@@ -1370,6 +1373,9 @@ class IndexNode(ExprNode):
         self.is_buffer_access = False
 
         self.base.analyse_types(env)
+        # Handle the case where base is a literal char* (and we expect a string, not an int)
+        if isinstance(self.base, StringNode):
+            self.base = self.base.coerce_to_pyobject(env)
 
         skip_child_analysis = False
         buffer_access = False
index 60c5bd884f85ecb97bbeeaf9b0d54e72908d19b7..0c94dc7d059054c3262b863ed19abfa15533ed50 100644 (file)
@@ -63,7 +63,7 @@ def make_lexicon():
     three_oct = octdigit + octdigit + octdigit
     two_hex = hexdigit + hexdigit
     four_hex = two_hex + two_hex
-    escapeseq = Str("\\") + (two_oct | three_oct | two_hex |
+    escapeseq = Str("\\") + (two_oct | three_oct |
                              Str('u') + four_hex | Str('x') + two_hex |
                              Str('U') + four_hex + four_hex | AnyChar)
     
index 7d68ded109687ef900322b725e7d90840e732e07..2d8c3dd60380d61aad90acf8c7abfe80b8d0fddf 100644 (file)
@@ -632,7 +632,6 @@ def compile_multiple(sources, options):
         if source not in processed:
             # Compiling multiple sources in one context doesn't quite
             # work properly yet.
-            context = Context(options.include_path) # to be removed later
             if not timestamps or context.c_file_out_of_date(source):
                 if verbose:
                     sys.stderr.write("Compiling %s\n" % source)
index 98caa9015940f9dbb83c292f0cb5b36ce7da8318..9c002c5015e997b33eba202982dc35a18bdf05a5 100644 (file)
@@ -603,7 +603,7 @@ def p_string_literal(s):
             else:
                 c = systr[1]
                 if c in "01234567":
-                    chars.append(chr(int(systr[1:])))
+                    chars.append(chr(int(systr[1:], 8)))
                 elif c in "'\"\\":
                     chars.append(c)
                 elif c in "abfnrtv":