summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-05 15:01:58 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-05 15:01:58 -0800
commit18ed75e5a7da5dfd14e5a2c8d3fee5b9eaf7f284 (patch)
treecab3dd64a85185f1ad2eca9f2d26501e15e6095d /src
parenta3f479d3694ddfcbf7fe35658dff435fce0ae59b (diff)
downloadbinaryen-18ed75e5a7da5dfd14e5a2c8d3fee5b9eaf7f284.tar.gz
binaryen-18ed75e5a7da5dfd14e5a2c8d3fee5b9eaf7f284.tar.bz2
binaryen-18ed75e5a7da5dfd14e5a2c8d3fee5b9eaf7f284.zip
handle ;; comments on top scope
Diffstat (limited to 'src')
-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;