From 18ed75e5a7da5dfd14e5a2c8d3fee5b9eaf7f284 Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 5 Nov 2015 15:01:58 -0800 Subject: handle ;; comments on top scope --- src/wasm-s-parser.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/wasm-s-parser.h b/src/wasm-s-parser.h index 854982e62..1e934a96f 100644 --- a/src/wasm-s-parser.h +++ b/src/wasm-s-parser.h @@ -112,7 +112,10 @@ class SExpressionParser { public: // Assumes control of and modifies the input. SExpressionParser(char* input) : beginning(input), input(input) { - root = parseInnerList(); + root = nullptr; + while (!root) { // keep parsing until we pass an initial comment + root = parseInnerList(); + } } Element* root; @@ -123,6 +126,10 @@ private: if (input[0] == ';') { // comment input++; + if (input[0] == ';') { + while (input[0] != '\n') input++; + return nullptr; + } input = strstr(input, ";)"); assert(input); return nullptr; -- cgit v1.2.3