From 0866a86b24beaccaf5f711a8aa99d1cbfbf77046 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Tue, 3 Nov 2015 21:31:47 -0800 Subject: string parsing improvements --- src/wasm-s-parser.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index db70a69b7..3a51e7887 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -145,10 +145,17 @@ private: } Element* parseString() { + if (input[0] == '$') input++; // names begin with $, but we don't need that internally + bool quoted = false; + if (input[0] == '"') { + quoted = true; + input++; + } char *start = input; while (input[0] && !isspace(input[0]) && input[0] != ')') input++; char temp = input[0]; input[0] = 0; + if (quoted) input[-1] = 0; auto ret = allocator.alloc()->setString(IString(start, false)); // TODO: reuse the string here, carefully input[0] = temp; return ret; -- cgit v1.2.3