From c5ab566cc3343d3b9e07eab4855b0dbfb2c81afe Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 26 Oct 2016 10:11:27 -0700 Subject: Binary 0xd changes (#803) * Renumber opcodes for 0xd * Unified type encoding * Add reserved flags fields to host instructions and call_indirect * Rename flags->reserved * Fix line numbers in wast parser Also don't throw if the memory is defined in the same Element as the export of memory (the validity is checked later anyway). * Skip spec binary.wast The spec testsuite is still on 0xc, so 0xd doesn't match. In order to update to 0xd we need to implement some additional functionality for the import test, namely (register) --- src/wasm/wasm-s-parser.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/wasm/wasm-s-parser.cpp') diff --git a/src/wasm/wasm-s-parser.cpp b/src/wasm/wasm-s-parser.cpp index cbcdd5d3a..5898cc252 100644 --- a/src/wasm/wasm-s-parser.cpp +++ b/src/wasm/wasm-s-parser.cpp @@ -94,7 +94,7 @@ void Element::dump() { SExpressionParser::SExpressionParser(char* input) : input(input) { root = nullptr; - line = 0; + line = 1; lineStart = input; while (!root) { // keep parsing until we pass an initial comment root = parse(); @@ -138,7 +138,7 @@ void SExpressionParser::skipWhitespace() { if (input[0] == ';' && input[1] == ';') { while (input[0] && input[0] != '\n') input++; line++; - lineStart = input; + lineStart = ++input; } else if (input[0] == '(' && input[1] == ';') { // Skip nested block comments. input += 2; @@ -1438,7 +1438,6 @@ void SExpressionWasmBuilder::parseExport(Element& s) { if (inner[0]->str() == FUNC) { ex->kind = ExternalKind::Function; } else if (inner[0]->str() == MEMORY) { - if (!wasm.memory.exists) throw ParseException("memory exported but no memory"); ex->kind = ExternalKind::Memory; } else if (inner[0]->str() == TABLE) { ex->kind = ExternalKind::Table; -- cgit v1.2.3