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):
# 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
......
......@@ -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)
......
......@@ -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)
......
......@@ -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":
......
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