Commit 205ea59d authored by Robert Bradshaw's avatar Robert Bradshaw

Merge fixes, fix constant unicode, string literal indexing.

All test pass but bufaccess, tnumpy, and r_mang1.
parent 82acc1f8
...@@ -759,6 +759,9 @@ class UnicodeNode(PyConstNode): ...@@ -759,6 +759,9 @@ class UnicodeNode(PyConstNode):
# We still need to perform normal coerce_to processing on the # We still need to perform normal coerce_to processing on the
# result, because we might be coercing to an extension type, # result, because we might be coercing to an extension type,
# in which case a type test node will be needed. # in which case a type test node will be needed.
def compile_time_value(self, env):
return self.value
class IdentifierStringNode(ConstNode): class IdentifierStringNode(ConstNode):
...@@ -1370,6 +1373,9 @@ class IndexNode(ExprNode): ...@@ -1370,6 +1373,9 @@ class IndexNode(ExprNode):
self.is_buffer_access = False self.is_buffer_access = False
self.base.analyse_types(env) 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 skip_child_analysis = False
buffer_access = False buffer_access = False
......
...@@ -63,7 +63,7 @@ def make_lexicon(): ...@@ -63,7 +63,7 @@ def make_lexicon():
three_oct = octdigit + octdigit + octdigit three_oct = octdigit + octdigit + octdigit
two_hex = hexdigit + hexdigit two_hex = hexdigit + hexdigit
four_hex = two_hex + two_hex 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 | Str('x') + two_hex |
Str('U') + four_hex + four_hex | AnyChar) Str('U') + four_hex + four_hex | AnyChar)
......
...@@ -632,7 +632,6 @@ def compile_multiple(sources, options): ...@@ -632,7 +632,6 @@ def compile_multiple(sources, options):
if source not in processed: if source not in processed:
# Compiling multiple sources in one context doesn't quite # Compiling multiple sources in one context doesn't quite
# work properly yet. # work properly yet.
context = Context(options.include_path) # to be removed later
if not timestamps or context.c_file_out_of_date(source): if not timestamps or context.c_file_out_of_date(source):
if verbose: if verbose:
sys.stderr.write("Compiling %s\n" % source) sys.stderr.write("Compiling %s\n" % source)
......
...@@ -603,7 +603,7 @@ def p_string_literal(s): ...@@ -603,7 +603,7 @@ def p_string_literal(s):
else: else:
c = systr[1] c = systr[1]
if c in "01234567": if c in "01234567":
chars.append(chr(int(systr[1:]))) chars.append(chr(int(systr[1:], 8)))
elif c in "'\"\\": elif c in "'\"\\":
chars.append(c) chars.append(c)
elif c in "abfnrtv": elif c in "abfnrtv":
......
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