summaryrefslogtreecommitdiff
path: root/src/wasm-s-parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm-s-parser.h')
-rw-r--r--src/wasm-s-parser.h9
1 files changed, 8 insertions, 1 deletions
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;