summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--CMakeLists.txt38
-rw-r--r--Makefile10
-rw-r--r--README.md14
-rw-r--r--demo/demo.js4
-rw-r--r--demo/index.html2
-rw-r--r--src/emscripten-exported.json6
-rw-r--r--src/prebuilt/wasm-ast-lexer-gen.c (renamed from src/prebuilt/wasm-re2c-lexer.c)979
-rw-r--r--src/prebuilt/wasm-ast-parser-gen.c (renamed from src/prebuilt/wasm-bison-parser.c)749
-rw-r--r--src/prebuilt/wasm-ast-parser-gen.h (renamed from src/prebuilt/wasm-bison-parser.h)46
-rw-r--r--src/sexpr-wasm.c8
-rw-r--r--src/wasm-ast-checker.c10
-rw-r--r--src/wasm-ast-checker.h6
-rw-r--r--src/wasm-ast-lexer.c (renamed from src/wasm-lexer.c)75
-rw-r--r--src/wasm-ast-lexer.h (renamed from src/wasm-lexer.h)35
-rw-r--r--src/wasm-ast-parser-lexer-shared.c (renamed from src/wasm-parser-lexer-shared.c)30
-rw-r--r--src/wasm-ast-parser-lexer-shared.h (renamed from src/wasm-parser-lexer-shared.h)62
-rw-r--r--src/wasm-ast-parser.h (renamed from src/wasm-parser.h)14
-rw-r--r--src/wasm-ast-parser.y (renamed from src/wasm-bison-parser.y)89
-rw-r--r--src/wasm-flex-lexer.l675
-rw-r--r--src/wasm-literal.h2
-rw-r--r--src/wasm.js30
22 files changed, 1110 insertions, 1776 deletions
diff --git a/.travis.yml b/.travis.yml
index 0ec23d3f..2cd3db01 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,7 +3,7 @@ sudo: required
dist: trusty
before_install:
- sudo apt-get update -qq
- - sudo apt-get install -qq flex bison gcc-4.8-multilib g++-4.8-multilib
+ - sudo apt-get install -qq re2c bison gcc-4.8-multilib g++-4.8-multilib
script:
- scripts/download-d8.sh
- scripts/travis-build.sh
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2747513c..06e21de8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,21 +129,21 @@ endif ()
option(RUN_BISON "run bison" ON)
find_package(BISON 3.0)
if (RUN_BISON AND BISON_FOUND)
- set(BISON_PARSER_C ${SEXPR_WASM_BINARY_DIR}/wasm-bison-parser.c)
- BISON_TARGET(WASM_BISON_PARSER
- ${SEXPR_WASM_SOURCE_DIR}/src/wasm-bison-parser.y
- ${BISON_PARSER_C}
- COMPILE_FLAGS --defines=${SEXPR_WASM_BINARY_DIR}/wasm-bison-parser.h
+ set(WASM_AST_PARSER_GEN_C ${SEXPR_WASM_BINARY_DIR}/wasm-ast-parser-gen.c)
+ BISON_TARGET(WASM_AST_PARSER_GEN_C
+ ${SEXPR_WASM_SOURCE_DIR}/src/wasm-ast-parser.y
+ ${WASM_AST_PARSER_GEN_C}
+ COMPILE_FLAGS --defines=${SEXPR_WASM_BINARY_DIR}/wasm-ast-parser-gen.h
)
else ()
- set(BISON_PARSER_C src/prebuilt/wasm-bison-parser.c)
+ set(WASM_AST_PARSER_GEN_C src/prebuilt/wasm-ast-parser-gen.c)
endif ()
if (COMPILER_IS_CLANG OR COMPILER_IS_GNU)
# yyerror passes a non-string-literal to a printf-like function, which is a
# warning.
set_source_files_properties(
- ${BISON_PARSER_C}
+ ${WASM_AST_PARSER_GEN_C}
PROPERTIES
COMPILE_FLAGS -Wno-format-security
)
@@ -154,16 +154,16 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
option(RUN_RE2C "run re2c" ON)
find_package(RE2C 0.13)
if (RUN_RE2C AND RE2C_EXECUTABLE)
- set(WASM_LEXER_C ${SEXPR_WASM_SOURCE_DIR}/src/wasm-lexer.c)
- set(RE2C_LEXER_C ${SEXPR_WASM_BINARY_DIR}/wasm-re2c-lexer.c)
+ set(WASM_AST_LEXER_C ${SEXPR_WASM_SOURCE_DIR}/src/wasm-ast-lexer.c)
+ set(WASM_AST_LEXER_GEN_C ${SEXPR_WASM_BINARY_DIR}/wasm-ast-lexer-gen.c)
RE2C_TARGET(
- NAME RE2C_LEXER_C
- INPUT ${WASM_LEXER_C}
- OUTPUT ${RE2C_LEXER_C}
+ NAME WASM_AST_LEXER_GEN_C
+ INPUT ${WASM_AST_LEXER_C}
+ OUTPUT ${WASM_AST_LEXER_GEN_C}
OPTIONS -bc
)
else ()
- set(RE2C_LEXER_C src/prebuilt/wasm-re2c-lexer.c)
+ set(WASM_AST_LEXER_GEN_C src/prebuilt/wasm-ast-lexer-gen.c)
endif ()
@@ -189,9 +189,9 @@ add_executable(sexpr-wasm
src/wasm-binary-writer-spec.c
src/wasm-literal.c
src/wasm-mark-used-blocks.c
- src/wasm-parser-lexer-shared.c
- ${BISON_PARSER_C}
- ${RE2C_LEXER_C}
+ src/wasm-ast-parser-lexer-shared.c
+ ${WASM_AST_PARSER_GEN_C}
+ ${WASM_AST_LEXER_GEN_C}
)
add_dependencies(everything sexpr-wasm)
target_link_libraries(sexpr-wasm wasm-common)
@@ -279,6 +279,7 @@ if (EMSCRIPTEN)
src/wasm-apply-names.c
src/wasm-ast.c
src/wasm-ast-checker.c
+ src/wasm-ast-parser-lexer-shared.c
src/wasm-ast-writer.c
src/wasm-binary-reader-ast.c
src/wasm-binary-reader.c
@@ -288,9 +289,8 @@ if (EMSCRIPTEN)
src/wasm-generate-names.c
src/wasm-literal.c
src/wasm-mark-used-blocks.c
- src/wasm-parser-lexer-shared.c
- ${BISON_PARSER_C}
- ${RE2C_LEXER_C}
+ ${WASM_AST_PARSER_GEN_C}
+ ${WASM_AST_LEXER_GEN_C}
)
add_dependencies(everything libwasm)
target_link_libraries(libwasm wasm-interp-common wasm-common)
diff --git a/Makefile b/Makefile
index cdc95afe..405070d7 100644
--- a/Makefile
+++ b/Makefile
@@ -135,13 +135,13 @@ clean:
test-everything:
.PHONY: update-bison update-re2c
-update-bison: src/prebuilt/wasm-bison-parser.c
-update-re2c: src/prebuilt/wasm-re2c-lexer.c
+update-bison: src/prebuilt/wasm-ast-parser-gen.c
+update-re2c: src/prebuilt/wasm-ast-lexer-gen.c
-src/prebuilt/wasm-bison-parser.c: src/wasm-bison-parser.y
- bison -o $@ $< --defines=src/prebuilt/wasm-bison-parser.h
+src/prebuilt/wasm-ast-parser-gen.c: src/wasm-ast-parser.y
+ bison -o $@ $< --defines=src/prebuilt/wasm-ast-parser-gen.h
-src/prebuilt/wasm-re2c-lexer.c: src/wasm-lexer.c
+src/prebuilt/wasm-ast-lexer-gen.c: src/wasm-ast-lexer.c
re2c -bc -o $@ $<
# defaults with simple names
diff --git a/README.md b/README.md
index c3c59b8f..b45fc16d 100644
--- a/README.md
+++ b/README.md
@@ -39,7 +39,7 @@ configuration.
- compilers: `gcc`, `clang`, `gcc-i686`, `gcc-fuzz`
- build types: `debug`, `release`
- - configurations: empty, `asan`, `msan`, `lsan`, `no-flex-bison`, `no-tests`
+ - configurations: empty, `asan`, `msan`, `lsan`, `no-re2c-bison`, `no-tests`
They are combined with dashes, for example:
@@ -47,7 +47,7 @@ They are combined with dashes, for example:
$ make clang-debug
$ make gcc-i686-release
$ make clang-debug-lsan
-$ make gcc-debug-no-flex-bison
+$ make gcc-debug-no-re2c-bison
```
You can also run CMake yourself, the normal way:
@@ -59,15 +59,15 @@ $ cmake ..
...
```
-If you make changes to `src/wasm-bison-parser.y`, you'll need to install Bison.
+If you make changes to `src/wasm-ast-parser.y`, you'll need to install Bison.
Before you upload your PR, please run `make update-bison` to update the
prebuilt C sources in `src/prebuilt/`.
-If you make changes to `src/wasm-flex-lexer.l`, you'll need to install Flex.
-Before you upload your PR, please run `make update-flex` to update the prebuilt
-C sources in `src/prebuilt/`.
+If you make changes to `src/wasm-ast-lexer.c`, you'll need to install
+[re2c](http://re2c.org). Before you upload your PR, please run `make
+update-re2c` to update the prebuilt C sources in `src/prebuilt/`.
-CMake will detect if you don't have Flex or Bison installed and use the
+CMake will detect if you don't have re2c or Bison installed and use the
prebuilt source files instead.
## Building d8
diff --git a/demo/demo.js b/demo/demo.js
index 40e937d0..1547133c 100644
--- a/demo/demo.js
+++ b/demo/demo.js
@@ -112,8 +112,8 @@ function compile(text) {
var allocator = wasm.LibcAllocator;
var eh = new wasm.SourceErrorHandler(onError, 80);
var buf = wasm.Buffer.fromString(text);
- var lexer = wasm.Lexer.fromBuffer(allocator, 'test.wast', buf);
- var script = wasm.parse(lexer, eh);
+ var lexer = wasm.AstLexer.fromBuffer(allocator, 'test.wast', buf);
+ var script = wasm.parseAst(lexer, eh);
wasm.checkAst(lexer, script, eh);
var memoryWriter = new wasm.MemoryWriter(allocator);
var jsWriter = new wasm.JSStringWriter();
diff --git a/demo/index.html b/demo/index.html
index d2fa1edf..fecc95b5 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -47,7 +47,7 @@
</div>
</div>
</div>
- <script src="libwasm.js"></script>
+ <script src="libwasm-debug.js"></script>
<script src="demo.js"></script>
</body>
</html>
diff --git a/src/emscripten-exported.json b/src/emscripten-exported.json
index 079cd4c8..2a84cda8 100644
--- a/src/emscripten-exported.json
+++ b/src/emscripten-exported.json
@@ -4,7 +4,7 @@
"_wasm_close_mem_writer",
"_wasm_default_assert_invalid_source_error_callback",
"_wasm_default_source_error_callback",
-"_wasm_destroy_lexer",
+"_wasm_destroy_ast_lexer",
"_wasm_destroy_script",
"_wasm_destroy_stack_allocator",
"_wasm_destroy_output_buffer",
@@ -13,7 +13,7 @@
"_wasm_init_stream",
"_wasm_init_stack_allocator",
"_wasm_mark_used_blocks",
-"_wasm_new_buffer_lexer",
+"_wasm_new_ast_buffer_lexer",
"_wasm_offsetof_allocator_alloc",
"_wasm_offsetof_allocator_destroy",
"_wasm_offsetof_allocator_free",
@@ -49,7 +49,7 @@
"_wasm_offsetof_write_binary_options_write_debug_names",
"_wasm_offsetof_writer_move_data",
"_wasm_offsetof_writer_write_data",
-"_wasm_parse",
+"_wasm_parse_ast",
"_wasm_sizeof_allocator",
"_wasm_sizeof_binary_error_handler",
"_wasm_sizeof_location",
diff --git a/src/prebuilt/wasm-re2c-lexer.c b/src/prebuilt/wasm-ast-lexer-gen.c
index 3519546a..5fdca150 100644
--- a/src/prebuilt/wasm-re2c-lexer.c
+++ b/src/prebuilt/wasm-ast-lexer-gen.c
@@ -1,5 +1,5 @@
-/* Generated by re2c 0.16 on Thu Apr 28 20:35:49 2016 */
-#line 1 "src/wasm-lexer.c"
+/* Generated by re2c 0.16 on Thu Apr 28 21:25:20 2016 */
+#line 1 "src/wasm-ast-lexer.c"
/*
* Copyright 2016 WebAssembly Community Group participants
*
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-#include "wasm-lexer.h"
+#include "wasm-ast-lexer.h"
#include <assert.h>
#include <stdio.h>
@@ -24,12 +24,12 @@
#include "wasm-config.h"
#include "wasm-allocator.h"
-#include "wasm-parser.h"
-#include "wasm-parser-lexer-shared.h"
+#include "wasm-ast-parser.h"
+#include "wasm-ast-parser-lexer-shared.h"
#include "wasm-vector.h"
/* must be included after so some typedefs will be defined */
-#include "wasm-bison-parser.h"
+#include "wasm-ast-parser-gen.h"
#define YYMAXFILL 20
@@ -49,7 +49,7 @@
#define ERROR(...) \
YY_USER_ACTION; \
- wasm_parser_error(loc, lexer, parser, __VA_ARGS__)
+ wasm_ast_parser_error(loc, lexer, parser, __VA_ARGS__)
#define BEGIN(c) \
do { \
@@ -95,8 +95,8 @@
lval->literal.text.length = yyleng
static WasmResult fill(WasmLocation* loc,
- WasmLexer* lexer,
- WasmParser* parser,
+ WasmAstLexer* lexer,
+ WasmAstParser* parser,
size_t need) {
if (lexer->eof)
return WASM_ERROR;
@@ -119,8 +119,8 @@ static WasmResult fill(WasmLocation* loc,
char* new_buffer = wasm_realloc(lexer->allocator, lexer->buffer,
new_buffer_size, WASM_DEFAULT_ALIGN);
if (new_buffer == NULL) {
- wasm_parser_error(loc, lexer, parser,
- "unable to reallocate lexer buffer.");
+ wasm_ast_parser_error(loc, lexer, parser,
+ "unable to reallocate lexer buffer.");
return WASM_ERROR;
}
memmove(new_buffer, lexer->token, lexer->limit - lexer->token);
@@ -168,10 +168,10 @@ static WasmResult fill(WasmLocation* loc,
return WASM_OK;
}
-int wasm_lexer_lex(WASM_PARSER_STYPE* lval,
- WASM_PARSER_LTYPE* loc,
- WasmLexer* lexer,
- WasmParser* parser) {
+int wasm_ast_lexer_lex(WASM_AST_PARSER_STYPE* lval,
+ WASM_AST_PARSER_LTYPE* loc,
+ WasmAstLexer* lexer,
+ WasmAstParser* parser) {
enum {
YYCOND_INIT,
YYCOND_BAD_TEXT,
@@ -183,7 +183,7 @@ int wasm_lexer_lex(WASM_PARSER_STYPE* lval,
for (;;) {
lexer->token = lexer->cursor;
-#line 187 "src/prebuilt/wasm-re2c-lexer.c"
+#line 187 "src/prebuilt/wasm-ast-lexer-gen.c"
{
char yych;
if (cond < 2) {
@@ -222,32 +222,32 @@ YYCOND_BAD_TEXT:
}
}
++lexer->cursor;
-#line 233 "src/wasm-lexer.c"
+#line 233 "src/wasm-ast-lexer.c"
{ ERROR("unexpected EOF"); RETURN(EOF); }
-#line 228 "src/prebuilt/wasm-re2c-lexer.c"
+#line 228 "src/prebuilt/wasm-ast-lexer-gen.c"
yy5:
++lexer->cursor;
yy6:
-#line 234 "src/wasm-lexer.c"
+#line 234 "src/wasm-ast-lexer.c"
{ ERROR("illegal character in string"); continue; }
-#line 234 "src/prebuilt/wasm-re2c-lexer.c"
+#line 234 "src/prebuilt/wasm-ast-lexer-gen.c"
yy7:
++lexer->cursor;
BEGIN(YYCOND_i);
-#line 229 "src/wasm-lexer.c"
+#line 229 "src/wasm-ast-lexer.c"
{ ERROR("newline in string"); NEWLINE; continue; }
-#line 240 "src/prebuilt/wasm-re2c-lexer.c"
+#line 240 "src/prebuilt/wasm-ast-lexer-gen.c"
yy9:
++lexer->cursor;
-#line 228 "src/wasm-lexer.c"
+#line 228 "src/wasm-ast-lexer.c"
{ continue; }
-#line 245 "src/prebuilt/wasm-re2c-lexer.c"
+#line 245 "src/prebuilt/wasm-ast-lexer-gen.c"
yy11:
++lexer->cursor;
BEGIN(YYCOND_i);
-#line 232 "src/wasm-lexer.c"
+#line 232 "src/wasm-ast-lexer.c"
{ TEXT; RETURN(TEXT); }
-#line 251 "src/prebuilt/wasm-re2c-lexer.c"
+#line 251 "src/prebuilt/wasm-ast-lexer-gen.c"
yy13:
yych = *++lexer->cursor;
if (yych <= '@') {
@@ -281,10 +281,10 @@ yy13:
yy14:
++lexer->cursor;
yy15:
-#line 230 "src/wasm-lexer.c"
+#line 230 "src/wasm-ast-lexer.c"
{ ERROR("bad escape \"%.*s\"", (int)yyleng, yytext);
continue; }
-#line 288 "src/prebuilt/wasm-re2c-lexer.c"
+#line 288 "src/prebuilt/wasm-ast-lexer-gen.c"
yy16:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '@') {
@@ -312,20 +312,20 @@ YYCOND_BLOCK_COMMENT:
}
yy19:
++lexer->cursor;
-#line 440 "src/wasm-lexer.c"
+#line 440 "src/wasm-ast-lexer.c"
{ ERROR("unexpected EOF"); RETURN(EOF); }
-#line 318 "src/prebuilt/wasm-re2c-lexer.c"
+#line 318 "src/prebuilt/wasm-ast-lexer-gen.c"
yy21:
++lexer->cursor;
yy22:
-#line 441 "src/wasm-lexer.c"
+#line 441 "src/wasm-ast-lexer.c"
{ continue; }
-#line 324 "src/prebuilt/wasm-re2c-lexer.c"
+#line 324 "src/prebuilt/wasm-ast-lexer-gen.c"
yy23:
++lexer->cursor;
-#line 439 "src/wasm-lexer.c"
+#line 439 "src/wasm-ast-lexer.c"
{ NEWLINE; continue; }
-#line 329 "src/prebuilt/wasm-re2c-lexer.c"
+#line 329 "src/prebuilt/wasm-ast-lexer-gen.c"
yy25:
yych = *++lexer->cursor;
if (yych == ';') goto yy27;
@@ -336,16 +336,16 @@ yy26:
goto yy22;
yy27:
++lexer->cursor;
-#line 435 "src/wasm-lexer.c"
+#line 435 "src/wasm-ast-lexer.c"
{ COMMENT_NESTING++; continue; }
-#line 342 "src/prebuilt/wasm-re2c-lexer.c"
+#line 342 "src/prebuilt/wasm-ast-lexer-gen.c"
yy29:
++lexer->cursor;
-#line 436 "src/wasm-lexer.c"
+#line 436 "src/wasm-ast-lexer.c"
{ if (--COMMENT_NESTING == 0)
BEGIN(YYCOND_INIT);
continue; }
-#line 349 "src/prebuilt/wasm-re2c-lexer.c"
+#line 349 "src/prebuilt/wasm-ast-lexer-gen.c"
/* *********************************** */
YYCOND_LINE_COMMENT:
{
@@ -390,9 +390,9 @@ YYCOND_LINE_COMMENT:
}
goto yy36;
yy33:
-#line 433 "src/wasm-lexer.c"
+#line 433 "src/wasm-ast-lexer.c"
{ continue; }
-#line 396 "src/prebuilt/wasm-re2c-lexer.c"
+#line 396 "src/prebuilt/wasm-ast-lexer-gen.c"
yy34:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -404,9 +404,9 @@ yy34:
yy36:
++lexer->cursor;
BEGIN(YYCOND_i);
-#line 432 "src/wasm-lexer.c"
+#line 432 "src/wasm-ast-lexer.c"
{ NEWLINE; continue; }
-#line 410 "src/prebuilt/wasm-re2c-lexer.c"
+#line 410 "src/prebuilt/wasm-ast-lexer-gen.c"
}
/* *********************************** */
YYCOND_i:
@@ -547,15 +547,15 @@ YYCOND_i:
}
yy40:
++lexer->cursor;
-#line 447 "src/wasm-lexer.c"
+#line 447 "src/wasm-ast-lexer.c"
{ RETURN(EOF); }
-#line 553 "src/prebuilt/wasm-re2c-lexer.c"
+#line 553 "src/prebuilt/wasm-ast-lexer-gen.c"
yy42:
++lexer->cursor;
yy43:
-#line 448 "src/wasm-lexer.c"
+#line 448 "src/wasm-ast-lexer.c"
{ ERROR("unexpected char"); continue; }
-#line 559 "src/prebuilt/wasm-re2c-lexer.c"
+#line 559 "src/prebuilt/wasm-ast-lexer-gen.c"
yy44:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -563,14 +563,14 @@ yy44:
if (yybm[0+yych] & 8) {
goto yy44;
}
-#line 443 "src/wasm-lexer.c"
+#line 443 "src/wasm-ast-lexer.c"
{ continue; }
-#line 569 "src/prebuilt/wasm-re2c-lexer.c"
+#line 569 "src/prebuilt/wasm-ast-lexer-gen.c"
yy47:
++lexer->cursor;
-#line 442 "src/wasm-lexer.c"
+#line 442 "src/wasm-ast-lexer.c"
{ NEWLINE; continue; }
-#line 574 "src/prebuilt/wasm-re2c-lexer.c"
+#line 574 "src/prebuilt/wasm-ast-lexer-gen.c"
yy49:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -580,20 +580,20 @@ yy50:
goto yy49;
}
yy51:
-#line 444 "src/wasm-lexer.c"
+#line 444 "src/wasm-ast-lexer.c"
{ ERROR("unexpected token \"%.*s\"",
(int)yyleng, yytext);
continue; }
-#line 588 "src/prebuilt/wasm-re2c-lexer.c"
+#line 588 "src/prebuilt/wasm-ast-lexer-gen.c"
yy52:
yych = *(lexer->marker = ++lexer->cursor);
if (yych <= 0x1F) goto yy53;
if (yych != 0x7F) goto yy82;
yy53:
BEGIN(YYCOND_BAD_TEXT);
-#line 227 "src/wasm-lexer.c"
+#line 227 "src/wasm-ast-lexer.c"
{ continue; }
-#line 597 "src/prebuilt/wasm-re2c-lexer.c"
+#line 597 "src/prebuilt/wasm-ast-lexer-gen.c"
yy54:
yych = *++lexer->cursor;
if (yych <= ';') {
@@ -633,14 +633,14 @@ yy54:
yy55:
++lexer->cursor;
if ((yych = *lexer->cursor) == ';') goto yy90;
-#line 219 "src/wasm-lexer.c"
+#line 219 "src/wasm-ast-lexer.c"
{ RETURN(LPAR); }
-#line 639 "src/prebuilt/wasm-re2c-lexer.c"
+#line 639 "src/prebuilt/wasm-ast-lexer-gen.c"
yy57:
++lexer->cursor;
-#line 220 "src/wasm-lexer.c"
+#line 220 "src/wasm-ast-lexer.c"
{ RETURN(RPAR); }
-#line 644 "src/prebuilt/wasm-re2c-lexer.c"
+#line 644 "src/prebuilt/wasm-ast-lexer-gen.c"
yy59:
yych = *++lexer->cursor;
if (yych <= 'h') {
@@ -697,9 +697,9 @@ yy60:
}
}
yy61:
-#line 221 "src/wasm-lexer.c"
+#line 221 "src/wasm-ast-lexer.c"
{ LITERAL(INT); RETURN(INT); }
-#line 703 "src/prebuilt/wasm-re2c-lexer.c"
+#line 703 "src/prebuilt/wasm-ast-lexer-gen.c"
yy62:
++lexer->cursor;
if ((lexer->limit - lexer->cursor) < 3) FILL(3);
@@ -868,9 +868,9 @@ yy83:
goto yy53;
yy84:
++lexer->cursor;
-#line 226 "src/wasm-lexer.c"
+#line 226 "src/wasm-ast-lexer.c"
{ TEXT; RETURN(TEXT); }
-#line 874 "src/prebuilt/wasm-re2c-lexer.c"
+#line 874 "src/prebuilt/wasm-ast-lexer-gen.c"
yy86:
++lexer->cursor;
if (lexer->limit <= lexer->cursor) FILL(1);
@@ -933,15 +933,15 @@ yy87:
}
}
yy89:
-#line 429 "src/wasm-lexer.c"
+#line 429 "src/wasm-ast-lexer.c"
{ TEXT; RETURN(VAR); }
-#line 939 "src/prebuilt/wasm-re2c-lexer.c"
+#line 939 "src/prebuilt/wasm-ast-lexer-gen.c"
yy90:
++lexer->cursor;
BEGIN(YYCOND_BLOCK_COMMENT);
-#line 434 "src/wasm-lexer.c"
+#line 434 "src/wasm-ast-lexer.c"
{ COMMENT_NESTING = 1; continue; }
-#line 945 "src/prebuilt/wasm-re2c-lexer.c"
+#line 945 "src/prebuilt/wasm-ast-lexer-gen.c"
yy92:
yych = *++lexer->cursor;
if (yych == 'n') goto yy135;
@@ -990,9 +990,9 @@ yy94:
}
}
yy96:
-#line 222 "src/wasm-lexer.c"
+#line 222 "src/wasm-ast-lexer.c"
{ LITERAL(FLOAT); RETURN(FLOAT); }
-#line 996 "src/prebuilt/wasm-re2c-lexer.c"
+#line 996 "src/prebuilt/wasm-ast-lexer-gen.c"
yy97:
yych = *++lexer->cursor;
if (yych <= ',') {
@@ -1013,9 +1013,9 @@ yy98:
yy99:
++lexer->cursor;
BEGIN(YYCOND_LINE_COMMENT);
-#line 431 "src/wasm-lexer.c"
+#line 431 "src/wasm-ast-lexer.c"
{ continue; }
-#line 1019 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1019 "src/prebuilt/wasm-ast-lexer-gen.c"
yy101:
yych = *++lexer->cursor;
if (yych == 'i') goto yy141;
@@ -1063,9 +1063,9 @@ yy104:
}
}
yy105:
-#line 246 "src/wasm-lexer.c"
+#line 246 "src/wasm-ast-lexer.c"
{ RETURN(BR); }
-#line 1069 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1069 "src/prebuilt/wasm-ast-lexer-gen.c"
yy106:
yych = *++lexer->cursor;
if (yych == 'l') goto yy145;
@@ -1142,9 +1142,9 @@ yy116:
}
}
yy117:
-#line 241 "src/wasm-lexer.c"
+#line 241 "src/wasm-ast-lexer.c"
{ RETURN(IF); }
-#line 1148 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1148 "src/prebuilt/wasm-ast-lexer-gen.c"
yy118:
yych = *++lexer->cursor;
if (yych == 'p') goto yy161;
@@ -1398,9 +1398,9 @@ yy149:
}
}
yy150:
-#line 237 "src/wasm-lexer.c"
+#line 237 "src/wasm-ast-lexer.c"
{ TYPE(F32); RETURN(VALUE_TYPE); }
-#line 1404 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1404 "src/prebuilt/wasm-ast-lexer-gen.c"
yy151:
++lexer->cursor;
if ((yych = *lexer->cursor) <= ':') {
@@ -1435,9 +1435,9 @@ yy151:
}
}
yy152:
-#line 238 "src/wasm-lexer.c"
+#line 238 "src/wasm-ast-lexer.c"
{ TYPE(F64); RETURN(VALUE_TYPE); }
-#line 1441 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1441 "src/prebuilt/wasm-ast-lexer-gen.c"
yy153:
yych = *++lexer->cursor;
if (yych == 'c') goto yy201;
@@ -1484,9 +1484,9 @@ yy156:
}
}
yy157:
-#line 235 "src/wasm-lexer.c"
+#line 235 "src/wasm-ast-lexer.c"
{ TYPE(I32); RETURN(VALUE_TYPE); }
-#line 1490 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1490 "src/prebuilt/wasm-ast-lexer-gen.c"
yy158:
++lexer->cursor;
if ((yych = *lexer->cursor) <= ':') {
@@ -1521,9 +1521,9 @@ yy158:
}
}
yy159:
-#line 236 "src/wasm-lexer.c"
+#line 236 "src/wasm-ast-lexer.c"
{ TYPE(I64); RETURN(VALUE_TYPE); }
-#line 1527 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1527 "src/prebuilt/wasm-ast-lexer-gen.c"
yy160:
yych = *++lexer->cursor;
if (yych == 'e') goto yy207;
@@ -1590,17 +1590,17 @@ yy168:
}
}
yy169:
-#line 225 "src/wasm-lexer.c"
+#line 225 "src/wasm-ast-lexer.c"
{ LITERAL(NAN); RETURN(FLOAT); }
-#line 1596 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1596 "src/prebuilt/wasm-ast-lexer-gen.c"
yy170:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 239 "src/wasm-lexer.c"
+#line 239 "src/wasm-ast-lexer.c"
{ RETURN(NOP); }
-#line 1604 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1604 "src/prebuilt/wasm-ast-lexer-gen.c"
yy172:
yych = *++lexer->cursor;
if (yych == 's') goto yy217;
@@ -1763,25 +1763,25 @@ yy192:
}
}
yy193:
-#line 250 "src/wasm-lexer.c"
+#line 250 "src/wasm-ast-lexer.c"
{ RETURN(CALL); }
-#line 1769 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1769 "src/prebuilt/wasm-ast-lexer-gen.c"
yy194:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 249 "src/wasm-lexer.c"
+#line 249 "src/wasm-ast-lexer.c"
{ RETURN(CASE); }
-#line 1777 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1777 "src/prebuilt/wasm-ast-lexer-gen.c"
yy196:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 244 "src/wasm-lexer.c"
+#line 244 "src/wasm-ast-lexer.c"
{ RETURN(ELSE); }
-#line 1785 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1785 "src/prebuilt/wasm-ast-lexer-gen.c"
yy198:
yych = *++lexer->cursor;
if (yych == 'r') goto yy243;
@@ -1826,9 +1826,9 @@ yy201:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 413 "src/wasm-lexer.c"
+#line 413 "src/wasm-ast-lexer.c"
{ RETURN(FUNC); }
-#line 1832 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1832 "src/prebuilt/wasm-ast-lexer-gen.c"
yy203:
yych = *++lexer->cursor;
if (yych == 'l') goto yy269;
@@ -1901,9 +1901,9 @@ yy212:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 245 "src/wasm-lexer.c"
+#line 245 "src/wasm-ast-lexer.c"
{ RETURN(LOOP); }
-#line 1907 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1907 "src/prebuilt/wasm-ast-lexer-gen.c"
yy214:
yych = *++lexer->cursor;
if (yych == 'r') goto yy306;
@@ -1957,17 +1957,17 @@ yy226:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 243 "src/wasm-lexer.c"
+#line 243 "src/wasm-ast-lexer.c"
{ RETURN(THEN); }
-#line 1963 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1963 "src/prebuilt/wasm-ast-lexer-gen.c"
yy228:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 412 "src/wasm-lexer.c"
+#line 412 "src/wasm-ast-lexer.c"
{ RETURN(TYPE); }
-#line 1971 "src/prebuilt/wasm-re2c-lexer.c"
+#line 1971 "src/prebuilt/wasm-ast-lexer-gen.c"
yy230:
yych = *++lexer->cursor;
if (yych == 'a') goto yy321;
@@ -2013,9 +2013,9 @@ yy232:
}
}
yy234:
-#line 223 "src/wasm-lexer.c"
+#line 223 "src/wasm-ast-lexer.c"
{ LITERAL(HEXFLOAT); RETURN(FLOAT); }
-#line 2019 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2019 "src/prebuilt/wasm-ast-lexer-gen.c"
yy235:
yych = *++lexer->cursor;
if (yych == '=') goto yy322;
@@ -2029,17 +2029,17 @@ yy237:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 240 "src/wasm-lexer.c"
+#line 240 "src/wasm-ast-lexer.c"
{ RETURN(BLOCK); }
-#line 2035 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2035 "src/prebuilt/wasm-ast-lexer-gen.c"
yy239:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 247 "src/wasm-lexer.c"
+#line 247 "src/wasm-ast-lexer.c"
{ RETURN(BR_IF); }
-#line 2043 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2043 "src/prebuilt/wasm-ast-lexer-gen.c"
yy241:
yych = *++lexer->cursor;
if (yych == 'b') goto yy324;
@@ -2383,9 +2383,9 @@ yy304:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 416 "src/wasm-lexer.c"
+#line 416 "src/wasm-ast-lexer.c"
{ RETURN(LOCAL); }
-#line 2389 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2389 "src/prebuilt/wasm-ast-lexer-gen.c"
yy306:
yych = *++lexer->cursor;
if (yych == 'y') goto yy446;
@@ -2407,9 +2407,9 @@ yy310:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 414 "src/wasm-lexer.c"
+#line 414 "src/wasm-ast-lexer.c"
{ RETURN(PARAM); }
-#line 2413 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2413 "src/prebuilt/wasm-ast-lexer-gen.c"
yy312:
yych = *++lexer->cursor;
if (yych == 't') goto yy452;
@@ -2435,17 +2435,17 @@ yy317:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 420 "src/wasm-lexer.c"
+#line 420 "src/wasm-ast-lexer.c"
{ RETURN(START); }
-#line 2441 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2441 "src/prebuilt/wasm-ast-lexer-gen.c"
yy319:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 423 "src/wasm-lexer.c"
+#line 423 "src/wasm-ast-lexer.c"
{ RETURN(TABLE); }
-#line 2449 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2449 "src/prebuilt/wasm-ast-lexer-gen.c"
yy321:
yych = *++lexer->cursor;
if (yych == 'c') goto yy460;
@@ -2474,9 +2474,9 @@ yy326:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 422 "src/wasm-lexer.c"
+#line 422 "src/wasm-ast-lexer.c"
{ RETURN(EXPORT); }
-#line 2480 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2480 "src/prebuilt/wasm-ast-lexer-gen.c"
yy328:
yych = *++lexer->cursor;
if (yych == 's') goto yy468;
@@ -2507,9 +2507,9 @@ yy334:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 371 "src/wasm-lexer.c"
+#line 371 "src/wasm-ast-lexer.c"
{ OPCODE(F32_EQ); RETURN(COMPARE); }
-#line 2513 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2513 "src/prebuilt/wasm-ast-lexer-gen.c"
yy336:
yych = *++lexer->cursor;
if (yych == 'o') goto yy478;
@@ -2519,25 +2519,25 @@ yy337:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 381 "src/wasm-lexer.c"
+#line 381 "src/wasm-ast-lexer.c"
{ OPCODE(F32_GE); RETURN(COMPARE); }
-#line 2525 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2525 "src/prebuilt/wasm-ast-lexer-gen.c"
yy339:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 379 "src/wasm-lexer.c"
+#line 379 "src/wasm-ast-lexer.c"
{ OPCODE(F32_GT); RETURN(COMPARE); }
-#line 2533 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2533 "src/prebuilt/wasm-ast-lexer-gen.c"
yy341:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 377 "src/wasm-lexer.c"
+#line 377 "src/wasm-ast-lexer.c"
{ OPCODE(F32_LE); RETURN(COMPARE); }
-#line 2541 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2541 "src/prebuilt/wasm-ast-lexer-gen.c"
yy343:
yych = *++lexer->cursor;
if (yych == 'a') goto yy479;
@@ -2547,9 +2547,9 @@ yy344:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 375 "src/wasm-lexer.c"
+#line 375 "src/wasm-ast-lexer.c"
{ OPCODE(F32_LT); RETURN(COMPARE); }
-#line 2553 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2553 "src/prebuilt/wasm-ast-lexer-gen.c"
yy346:
yych = *++lexer->cursor;
if (yych == 'x') goto yy480;
@@ -2598,9 +2598,9 @@ yy349:
}
}
yy350:
-#line 373 "src/wasm-lexer.c"
+#line 373 "src/wasm-ast-lexer.c"
{ OPCODE(F32_NE); RETURN(COMPARE); }
-#line 2604 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2604 "src/prebuilt/wasm-ast-lexer-gen.c"
yy351:
yych = *++lexer->cursor;
if (yych == 'i') goto yy489;
@@ -2647,9 +2647,9 @@ yy361:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 372 "src/wasm-lexer.c"
+#line 372 "src/wasm-ast-lexer.c"
{ OPCODE(F64_EQ); RETURN(COMPARE); }
-#line 2653 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2653 "src/prebuilt/wasm-ast-lexer-gen.c"
yy363:
yych = *++lexer->cursor;
if (yych == 'o') goto yy504;
@@ -2659,25 +2659,25 @@ yy364:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 382 "src/wasm-lexer.c"
+#line 382 "src/wasm-ast-lexer.c"
{ OPCODE(F64_GE); RETURN(COMPARE); }
-#line 2665 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2665 "src/prebuilt/wasm-ast-lexer-gen.c"
yy366:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 380 "src/wasm-lexer.c"
+#line 380 "src/wasm-ast-lexer.c"
{ OPCODE(F64_GT); RETURN(COMPARE); }
-#line 2673 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2673 "src/prebuilt/wasm-ast-lexer-gen.c"
yy368:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 378 "src/wasm-lexer.c"
+#line 378 "src/wasm-ast-lexer.c"
{ OPCODE(F64_LE); RETURN(COMPARE); }
-#line 2681 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2681 "src/prebuilt/wasm-ast-lexer-gen.c"
yy370:
yych = *++lexer->cursor;
if (yych == 'a') goto yy505;
@@ -2687,9 +2687,9 @@ yy371:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 376 "src/wasm-lexer.c"
+#line 376 "src/wasm-ast-lexer.c"
{ OPCODE(F64_LT); RETURN(COMPARE); }
-#line 2693 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2693 "src/prebuilt/wasm-ast-lexer-gen.c"
yy373:
yych = *++lexer->cursor;
if (yych == 'x') goto yy506;
@@ -2738,9 +2738,9 @@ yy376:
}
}
yy377:
-#line 374 "src/wasm-lexer.c"
+#line 374 "src/wasm-ast-lexer.c"
{ OPCODE(F64_NE); RETURN(COMPARE); }
-#line 2744 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2744 "src/prebuilt/wasm-ast-lexer-gen.c"
yy378:
yych = *++lexer->cursor;
if (yych == 'o') goto yy515;
@@ -2832,9 +2832,9 @@ yy392:
}
}
yy393:
-#line 351 "src/wasm-lexer.c"
+#line 351 "src/wasm-ast-lexer.c"
{ OPCODE(I32_EQ); RETURN(COMPARE); }
-#line 2838 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2838 "src/prebuilt/wasm-ast-lexer-gen.c"
yy394:
yych = *++lexer->cursor;
if (yych == '_') goto yy536;
@@ -2864,17 +2864,17 @@ yy400:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 353 "src/wasm-lexer.c"
+#line 353 "src/wasm-ast-lexer.c"
{ OPCODE(I32_NE); RETURN(COMPARE); }
-#line 2870 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2870 "src/prebuilt/wasm-ast-lexer-gen.c"
yy402:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 323 "src/wasm-lexer.c"
+#line 323 "src/wasm-ast-lexer.c"
{ OPCODE(I32_OR); RETURN(BINARY); }
-#line 2878 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2878 "src/prebuilt/wasm-ast-lexer-gen.c"
yy404:
yych = *++lexer->cursor;
if (yych == 'p') goto yy543;
@@ -2972,9 +2972,9 @@ yy419:
}
}
yy420:
-#line 352 "src/wasm-lexer.c"
+#line 352 "src/wasm-ast-lexer.c"
{ OPCODE(I64_EQ); RETURN(COMPARE); }
-#line 2978 "src/prebuilt/wasm-re2c-lexer.c"
+#line 2978 "src/prebuilt/wasm-ast-lexer-gen.c"
yy421:
yych = *++lexer->cursor;
if (yych == 't') goto yy569;
@@ -3008,17 +3008,17 @@ yy428:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 354 "src/wasm-lexer.c"
+#line 354 "src/wasm-ast-lexer.c"
{ OPCODE(I64_NE); RETURN(COMPARE); }
-#line 3014 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3014 "src/prebuilt/wasm-ast-lexer-gen.c"
yy430:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 324 "src/wasm-lexer.c"
+#line 324 "src/wasm-ast-lexer.c"
{ OPCODE(I64_OR); RETURN(BINARY); }
-#line 3022 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3022 "src/prebuilt/wasm-ast-lexer-gen.c"
yy432:
yych = *++lexer->cursor;
if (yych == 'p') goto yy577;
@@ -3062,9 +3062,9 @@ yy441:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 421 "src/wasm-lexer.c"
+#line 421 "src/wasm-ast-lexer.c"
{ RETURN(IMPORT); }
-#line 3068 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3068 "src/prebuilt/wasm-ast-lexer-gen.c"
yy443:
yych = *++lexer->cursor;
if (yych == 't') goto yy592;
@@ -3074,9 +3074,9 @@ yy444:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 428 "src/wasm-lexer.c"
+#line 428 "src/wasm-ast-lexer.c"
{ RETURN(INVOKE); }
-#line 3080 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3080 "src/prebuilt/wasm-ast-lexer-gen.c"
yy446:
++lexer->cursor;
if ((yych = *lexer->cursor) <= 'Z') {
@@ -3112,17 +3112,17 @@ yy446:
}
}
yy447:
-#line 418 "src/wasm-lexer.c"
+#line 418 "src/wasm-ast-lexer.c"
{ RETURN(MEMORY); }
-#line 3118 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3118 "src/prebuilt/wasm-ast-lexer-gen.c"
yy448:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 417 "src/wasm-lexer.c"
+#line 417 "src/wasm-ast-lexer.c"
{ RETURN(MODULE); }
-#line 3126 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3126 "src/prebuilt/wasm-ast-lexer-gen.c"
yy450:
yych = *++lexer->cursor;
if (yych <= '@') {
@@ -3144,17 +3144,17 @@ yy452:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 415 "src/wasm-lexer.c"
+#line 415 "src/wasm-ast-lexer.c"
{ RETURN(RESULT); }
-#line 3150 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3150 "src/prebuilt/wasm-ast-lexer-gen.c"
yy454:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 253 "src/wasm-lexer.c"
+#line 253 "src/wasm-ast-lexer.c"
{ RETURN(RETURN); }
-#line 3158 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3158 "src/prebuilt/wasm-ast-lexer-gen.c"
yy456:
yych = *++lexer->cursor;
if (yych == 't') goto yy597;
@@ -3164,9 +3164,9 @@ yy457:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 408 "src/wasm-lexer.c"
+#line 408 "src/wasm-ast-lexer.c"
{ RETURN(SELECT); }
-#line 3170 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3170 "src/prebuilt/wasm-ast-lexer-gen.c"
yy459:
yych = *++lexer->cursor;
if (yych == 'c') goto yy599;
@@ -3212,9 +3212,9 @@ yy461:
}
}
yy463:
-#line 280 "src/wasm-lexer.c"
+#line 280 "src/wasm-ast-lexer.c"
{ TEXT_AT(6); RETURN(ALIGN); }
-#line 3218 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3218 "src/prebuilt/wasm-ast-lexer-gen.c"
yy464:
yych = *++lexer->cursor;
if (yych <= 'q') {
@@ -3242,17 +3242,17 @@ yy468:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 295 "src/wasm-lexer.c"
+#line 295 "src/wasm-ast-lexer.c"
{ OPCODE(F32_ABS); RETURN(UNARY); }
-#line 3248 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3248 "src/prebuilt/wasm-ast-lexer-gen.c"
yy470:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 337 "src/wasm-lexer.c"
+#line 337 "src/wasm-ast-lexer.c"
{ OPCODE(F32_ADD); RETURN(BINARY); }
-#line 3256 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3256 "src/prebuilt/wasm-ast-lexer-gen.c"
yy472:
yych = *++lexer->cursor;
if (yych == 'l') goto yy608;
@@ -3275,9 +3275,9 @@ yy476:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 343 "src/wasm-lexer.c"
+#line 343 "src/wasm-ast-lexer.c"
{ OPCODE(F32_DIV); RETURN(BINARY); }
-#line 3281 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3281 "src/prebuilt/wasm-ast-lexer-gen.c"
yy478:
yych = *++lexer->cursor;
if (yych == 'o') goto yy614;
@@ -3291,25 +3291,25 @@ yy480:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 347 "src/wasm-lexer.c"
+#line 347 "src/wasm-ast-lexer.c"
{ OPCODE(F32_MAX); RETURN(BINARY); }
-#line 3297 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3297 "src/prebuilt/wasm-ast-lexer-gen.c"
yy482:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 345 "src/wasm-lexer.c"
+#line 345 "src/wasm-ast-lexer.c"
{ OPCODE(F32_MIN); RETURN(BINARY); }
-#line 3305 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3305 "src/prebuilt/wasm-ast-lexer-gen.c"
yy484:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 341 "src/wasm-lexer.c"
+#line 341 "src/wasm-ast-lexer.c"
{ OPCODE(F32_MUL); RETURN(BINARY); }
-#line 3313 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3313 "src/prebuilt/wasm-ast-lexer-gen.c"
yy486:
yych = *++lexer->cursor;
if (yych == 'r') goto yy617;
@@ -3319,9 +3319,9 @@ yy487:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 293 "src/wasm-lexer.c"
+#line 293 "src/wasm-ast-lexer.c"
{ OPCODE(F32_NEG); RETURN(UNARY); }
-#line 3325 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3325 "src/prebuilt/wasm-ast-lexer-gen.c"
yy489:
yych = *++lexer->cursor;
if (yych == 'n') goto yy618;
@@ -3339,9 +3339,9 @@ yy492:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 339 "src/wasm-lexer.c"
+#line 339 "src/wasm-ast-lexer.c"
{ OPCODE(F32_SUB); RETURN(BINARY); }
-#line 3345 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3345 "src/prebuilt/wasm-ast-lexer-gen.c"
yy494:
yych = *++lexer->cursor;
if (yych == 'n') goto yy622;
@@ -3351,17 +3351,17 @@ yy495:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 296 "src/wasm-lexer.c"
+#line 296 "src/wasm-ast-lexer.c"
{ OPCODE(F64_ABS); RETURN(UNARY); }
-#line 3357 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3357 "src/prebuilt/wasm-ast-lexer-gen.c"
yy497:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 338 "src/wasm-lexer.c"
+#line 338 "src/wasm-ast-lexer.c"
{ OPCODE(F64_ADD); RETURN(BINARY); }
-#line 3365 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3365 "src/prebuilt/wasm-ast-lexer-gen.c"
yy499:
yych = *++lexer->cursor;
if (yych == 'l') goto yy623;
@@ -3380,9 +3380,9 @@ yy502:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 344 "src/wasm-lexer.c"
+#line 344 "src/wasm-ast-lexer.c"
{ OPCODE(F64_DIV); RETURN(BINARY); }
-#line 3386 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3386 "src/prebuilt/wasm-ast-lexer-gen.c"
yy504:
yych = *++lexer->cursor;
if (yych == 'o') goto yy628;
@@ -3396,25 +3396,25 @@ yy506:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 348 "src/wasm-lexer.c"
+#line 348 "src/wasm-ast-lexer.c"
{ OPCODE(F64_MAX); RETURN(BINARY); }
-#line 3402 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3402 "src/prebuilt/wasm-ast-lexer-gen.c"
yy508:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 346 "src/wasm-lexer.c"
+#line 346 "src/wasm-ast-lexer.c"
{ OPCODE(F64_MIN); RETURN(BINARY); }
-#line 3410 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3410 "src/prebuilt/wasm-ast-lexer-gen.c"
yy510:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 342 "src/wasm-lexer.c"
+#line 342 "src/wasm-ast-lexer.c"
{ OPCODE(F64_MUL); RETURN(BINARY); }
-#line 3418 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3418 "src/prebuilt/wasm-ast-lexer-gen.c"
yy512:
yych = *++lexer->cursor;
if (yych == 'r') goto yy631;
@@ -3424,9 +3424,9 @@ yy513:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 294 "src/wasm-lexer.c"
+#line 294 "src/wasm-ast-lexer.c"
{ OPCODE(F64_NEG); RETURN(UNARY); }
-#line 3430 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3430 "src/prebuilt/wasm-ast-lexer-gen.c"
yy515:
yych = *++lexer->cursor;
if (yych == 'm') goto yy632;
@@ -3448,9 +3448,9 @@ yy519:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 340 "src/wasm-lexer.c"
+#line 340 "src/wasm-ast-lexer.c"
{ OPCODE(F64_SUB); RETURN(BINARY); }
-#line 3454 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3454 "src/prebuilt/wasm-ast-lexer-gen.c"
yy521:
yych = *++lexer->cursor;
if (yych == 'n') goto yy637;
@@ -3468,25 +3468,25 @@ yy524:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 307 "src/wasm-lexer.c"
+#line 307 "src/wasm-ast-lexer.c"
{ OPCODE(I32_ADD); RETURN(BINARY); }
-#line 3474 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3474 "src/prebuilt/wasm-ast-lexer-gen.c"
yy526:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 321 "src/wasm-lexer.c"
+#line 321 "src/wasm-ast-lexer.c"
{ OPCODE(I32_AND); RETURN(BINARY); }
-#line 3482 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3482 "src/prebuilt/wasm-ast-lexer-gen.c"
yy528:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 287 "src/wasm-lexer.c"
+#line 287 "src/wasm-ast-lexer.c"
{ OPCODE(I32_CLZ); RETURN(UNARY); }
-#line 3490 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3490 "src/prebuilt/wasm-ast-lexer-gen.c"
yy530:
yych = *++lexer->cursor;
if (yych == 's') goto yy640;
@@ -3496,9 +3496,9 @@ yy531:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 289 "src/wasm-lexer.c"
+#line 289 "src/wasm-ast-lexer.c"
{ OPCODE(I32_CTZ); RETURN(UNARY); }
-#line 3502 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3502 "src/prebuilt/wasm-ast-lexer-gen.c"
yy533:
yych = *++lexer->cursor;
if (yych == '_') goto yy641;
@@ -3508,9 +3508,9 @@ yy534:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 285 "src/wasm-lexer.c"
+#line 285 "src/wasm-ast-lexer.c"
{ OPCODE(I32_EQZ); RETURN(CONVERT); }
-#line 3514 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3514 "src/prebuilt/wasm-ast-lexer-gen.c"
yy536:
yych = *++lexer->cursor;
if (yych == 's') goto yy642;
@@ -3540,9 +3540,9 @@ yy541:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 311 "src/wasm-lexer.c"
+#line 311 "src/wasm-ast-lexer.c"
{ OPCODE(I32_MUL); RETURN(BINARY); }
-#line 3546 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3546 "src/prebuilt/wasm-ast-lexer-gen.c"
yy543:
yych = *++lexer->cursor;
if (yych == 'c') goto yy660;
@@ -3565,9 +3565,9 @@ yy547:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 327 "src/wasm-lexer.c"
+#line 327 "src/wasm-ast-lexer.c"
{ OPCODE(I32_SHL); RETURN(BINARY); }
-#line 3571 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3571 "src/prebuilt/wasm-ast-lexer-gen.c"
yy549:
yych = *++lexer->cursor;
if (yych == '_') goto yy667;
@@ -3581,9 +3581,9 @@ yy551:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 309 "src/wasm-lexer.c"
+#line 309 "src/wasm-ast-lexer.c"
{ OPCODE(I32_SUB); RETURN(BINARY); }
-#line 3587 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3587 "src/prebuilt/wasm-ast-lexer-gen.c"
yy553:
yych = *++lexer->cursor;
if (yych == 'n') goto yy669;
@@ -3597,33 +3597,33 @@ yy555:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 325 "src/wasm-lexer.c"
+#line 325 "src/wasm-ast-lexer.c"
{ OPCODE(I32_XOR); RETURN(BINARY); }
-#line 3603 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3603 "src/prebuilt/wasm-ast-lexer-gen.c"
yy557:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 308 "src/wasm-lexer.c"
+#line 308 "src/wasm-ast-lexer.c"
{ OPCODE(I64_ADD); RETURN(BINARY); }
-#line 3611 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3611 "src/prebuilt/wasm-ast-lexer-gen.c"
yy559:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 322 "src/wasm-lexer.c"
+#line 322 "src/wasm-ast-lexer.c"
{ OPCODE(I64_AND); RETURN(BINARY); }
-#line 3619 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3619 "src/prebuilt/wasm-ast-lexer-gen.c"
yy561:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 288 "src/wasm-lexer.c"
+#line 288 "src/wasm-ast-lexer.c"
{ OPCODE(I64_CLZ); RETURN(UNARY); }
-#line 3627 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3627 "src/prebuilt/wasm-ast-lexer-gen.c"
yy563:
yych = *++lexer->cursor;
if (yych == 's') goto yy671;
@@ -3633,9 +3633,9 @@ yy564:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 290 "src/wasm-lexer.c"
+#line 290 "src/wasm-ast-lexer.c"
{ OPCODE(I64_CTZ); RETURN(UNARY); }
-#line 3639 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3639 "src/prebuilt/wasm-ast-lexer-gen.c"
yy566:
yych = *++lexer->cursor;
if (yych == '_') goto yy672;
@@ -3645,9 +3645,9 @@ yy567:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 286 "src/wasm-lexer.c"
+#line 286 "src/wasm-ast-lexer.c"
{ OPCODE(I64_EQZ); RETURN(CONVERT); }
-#line 3651 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3651 "src/prebuilt/wasm-ast-lexer-gen.c"
yy569:
yych = *++lexer->cursor;
if (yych == 'e') goto yy673;
@@ -3681,9 +3681,9 @@ yy575:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 312 "src/wasm-lexer.c"
+#line 312 "src/wasm-ast-lexer.c"
{ OPCODE(I64_MUL); RETURN(BINARY); }
-#line 3687 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3687 "src/prebuilt/wasm-ast-lexer-gen.c"
yy577:
yych = *++lexer->cursor;
if (yych == 'c') goto yy692;
@@ -3706,9 +3706,9 @@ yy581:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 328 "src/wasm-lexer.c"
+#line 328 "src/wasm-ast-lexer.c"
{ OPCODE(I64_SHL); RETURN(BINARY); }
-#line 3712 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3712 "src/prebuilt/wasm-ast-lexer-gen.c"
yy583:
yych = *++lexer->cursor;
if (yych == '_') goto yy699;
@@ -3722,9 +3722,9 @@ yy585:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 310 "src/wasm-lexer.c"
+#line 310 "src/wasm-ast-lexer.c"
{ OPCODE(I64_SUB); RETURN(BINARY); }
-#line 3728 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3728 "src/prebuilt/wasm-ast-lexer-gen.c"
yy587:
yych = *++lexer->cursor;
if (yych == 'n') goto yy701;
@@ -3734,17 +3734,17 @@ yy588:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 326 "src/wasm-lexer.c"
+#line 326 "src/wasm-ast-lexer.c"
{ OPCODE(I64_XOR); RETURN(BINARY); }
-#line 3740 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3740 "src/prebuilt/wasm-ast-lexer-gen.c"
yy590:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 242 "src/wasm-lexer.c"
+#line 242 "src/wasm-ast-lexer.c"
{ RETURN(IF); }
-#line 3748 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3748 "src/prebuilt/wasm-ast-lexer-gen.c"
yy592:
yych = *++lexer->cursor;
if (yych == 'y') goto yy702;
@@ -3809,9 +3809,9 @@ yy597:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 419 "src/wasm-lexer.c"
+#line 419 "src/wasm-ast-lexer.c"
{ RETURN(SEGMENT); }
-#line 3815 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3815 "src/prebuilt/wasm-ast-lexer-gen.c"
yy599:
yych = *++lexer->cursor;
if (yych == 'a') goto yy708;
@@ -3837,9 +3837,9 @@ yy604:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 248 "src/wasm-lexer.c"
+#line 248 "src/wasm-ast-lexer.c"
{ RETURN(BR_TABLE); }
-#line 3843 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3843 "src/prebuilt/wasm-ast-lexer-gen.c"
yy606:
yych = *++lexer->cursor;
if (yych == 'o') goto yy713;
@@ -3853,9 +3853,9 @@ yy608:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 299 "src/wasm-lexer.c"
+#line 299 "src/wasm-ast-lexer.c"
{ OPCODE(F32_CEIL); RETURN(UNARY); }
-#line 3859 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3859 "src/prebuilt/wasm-ast-lexer-gen.c"
yy610:
yych = *++lexer->cursor;
if (yych == 't') goto yy715;
@@ -3881,9 +3881,9 @@ yy615:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 258 "src/wasm-lexer.c"
+#line 258 "src/wasm-ast-lexer.c"
{ OPCODE(F32_LOAD); RETURN(LOAD); }
-#line 3887 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3887 "src/prebuilt/wasm-ast-lexer-gen.c"
yy617:
yych = *++lexer->cursor;
if (yych == 'e') goto yy722;
@@ -3897,9 +3897,9 @@ yy619:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 297 "src/wasm-lexer.c"
+#line 297 "src/wasm-ast-lexer.c"
{ OPCODE(F32_SQRT); RETURN(UNARY); }
-#line 3903 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3903 "src/prebuilt/wasm-ast-lexer-gen.c"
yy621:
yych = *++lexer->cursor;
if (yych == 'e') goto yy724;
@@ -3913,9 +3913,9 @@ yy623:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 300 "src/wasm-lexer.c"
+#line 300 "src/wasm-ast-lexer.c"
{ OPCODE(F64_CEIL); RETURN(UNARY); }
-#line 3919 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3919 "src/prebuilt/wasm-ast-lexer-gen.c"
yy625:
yych = *++lexer->cursor;
if (yych == 't') goto yy728;
@@ -3937,9 +3937,9 @@ yy629:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 259 "src/wasm-lexer.c"
+#line 259 "src/wasm-ast-lexer.c"
{ OPCODE(F64_LOAD); RETURN(LOAD); }
-#line 3943 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3943 "src/prebuilt/wasm-ast-lexer-gen.c"
yy631:
yych = *++lexer->cursor;
if (yych == 'e') goto yy734;
@@ -3957,9 +3957,9 @@ yy634:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 298 "src/wasm-lexer.c"
+#line 298 "src/wasm-ast-lexer.c"
{ OPCODE(F64_SQRT); RETURN(UNARY); }
-#line 3963 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3963 "src/prebuilt/wasm-ast-lexer-gen.c"
yy636:
yych = *++lexer->cursor;
if (yych == 'e') goto yy737;
@@ -3990,49 +3990,49 @@ yy642:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 367 "src/wasm-lexer.c"
+#line 367 "src/wasm-ast-lexer.c"
{ OPCODE(I32_GE_S); RETURN(COMPARE); }
-#line 3996 "src/prebuilt/wasm-re2c-lexer.c"
+#line 3996 "src/prebuilt/wasm-ast-lexer-gen.c"
yy644:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 369 "src/wasm-lexer.c"
+#line 369 "src/wasm-ast-lexer.c"
{ OPCODE(I32_GE_U); RETURN(COMPARE); }
-#line 4004 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4004 "src/prebuilt/wasm-ast-lexer-gen.c"
yy646:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 363 "src/wasm-lexer.c"
+#line 363 "src/wasm-ast-lexer.c"
{ OPCODE(I32_GT_S); RETURN(COMPARE); }
-#line 4012 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4012 "src/prebuilt/wasm-ast-lexer-gen.c"
yy648:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 365 "src/wasm-lexer.c"
+#line 365 "src/wasm-ast-lexer.c"
{ OPCODE(I32_GT_U); RETURN(COMPARE); }
-#line 4020 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4020 "src/prebuilt/wasm-ast-lexer-gen.c"
yy650:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 359 "src/wasm-lexer.c"
+#line 359 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LE_S); RETURN(COMPARE); }
-#line 4028 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4028 "src/prebuilt/wasm-ast-lexer-gen.c"
yy652:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 361 "src/wasm-lexer.c"
+#line 361 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LE_U); RETURN(COMPARE); }
-#line 4036 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4036 "src/prebuilt/wasm-ast-lexer-gen.c"
yy654:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '8') {
@@ -4068,25 +4068,25 @@ yy654:
}
}
yy655:
-#line 256 "src/wasm-lexer.c"
+#line 256 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LOAD); RETURN(LOAD); }
-#line 4074 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4074 "src/prebuilt/wasm-ast-lexer-gen.c"
yy656:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 355 "src/wasm-lexer.c"
+#line 355 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LT_S); RETURN(COMPARE); }
-#line 4082 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4082 "src/prebuilt/wasm-ast-lexer-gen.c"
yy658:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 357 "src/wasm-lexer.c"
+#line 357 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LT_U); RETURN(COMPARE); }
-#line 4090 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4090 "src/prebuilt/wasm-ast-lexer-gen.c"
yy660:
yych = *++lexer->cursor;
if (yych == 'n') goto yy752;
@@ -4105,17 +4105,17 @@ yy663:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 333 "src/wasm-lexer.c"
+#line 333 "src/wasm-ast-lexer.c"
{ OPCODE(I32_ROTL); RETURN(BINARY); }
-#line 4111 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4111 "src/prebuilt/wasm-ast-lexer-gen.c"
yy665:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 335 "src/wasm-lexer.c"
+#line 335 "src/wasm-ast-lexer.c"
{ OPCODE(I32_ROTR); RETURN(BINARY); }
-#line 4119 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4119 "src/prebuilt/wasm-ast-lexer-gen.c"
yy667:
yych = *++lexer->cursor;
if (yych == 's') goto yy758;
@@ -4151,49 +4151,49 @@ yy674:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 368 "src/wasm-lexer.c"
+#line 368 "src/wasm-ast-lexer.c"
{ OPCODE(I64_GE_S); RETURN(COMPARE); }
-#line 4157 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4157 "src/prebuilt/wasm-ast-lexer-gen.c"
yy676:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 370 "src/wasm-lexer.c"
+#line 370 "src/wasm-ast-lexer.c"
{ OPCODE(I64_GE_U); RETURN(COMPARE); }
-#line 4165 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4165 "src/prebuilt/wasm-ast-lexer-gen.c"
yy678:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 364 "src/wasm-lexer.c"
+#line 364 "src/wasm-ast-lexer.c"
{ OPCODE(I64_GT_S); RETURN(COMPARE); }
-#line 4173 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4173 "src/prebuilt/wasm-ast-lexer-gen.c"
yy680:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 366 "src/wasm-lexer.c"
+#line 366 "src/wasm-ast-lexer.c"
{ OPCODE(I64_GT_U); RETURN(COMPARE); }
-#line 4181 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4181 "src/prebuilt/wasm-ast-lexer-gen.c"
yy682:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 360 "src/wasm-lexer.c"
+#line 360 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LE_S); RETURN(COMPARE); }
-#line 4189 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4189 "src/prebuilt/wasm-ast-lexer-gen.c"
yy684:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 362 "src/wasm-lexer.c"
+#line 362 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LE_U); RETURN(COMPARE); }
-#line 4197 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4197 "src/prebuilt/wasm-ast-lexer-gen.c"
yy686:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '7') {
@@ -4233,25 +4233,25 @@ yy686:
}
}
yy687:
-#line 257 "src/wasm-lexer.c"
+#line 257 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LOAD); RETURN(LOAD); }
-#line 4239 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4239 "src/prebuilt/wasm-ast-lexer-gen.c"
yy688:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 356 "src/wasm-lexer.c"
+#line 356 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LT_S); RETURN(COMPARE); }
-#line 4247 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4247 "src/prebuilt/wasm-ast-lexer-gen.c"
yy690:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 358 "src/wasm-lexer.c"
+#line 358 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LT_U); RETURN(COMPARE); }
-#line 4255 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4255 "src/prebuilt/wasm-ast-lexer-gen.c"
yy692:
yych = *++lexer->cursor;
if (yych == 'n') goto yy776;
@@ -4270,17 +4270,17 @@ yy695:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 334 "src/wasm-lexer.c"
+#line 334 "src/wasm-ast-lexer.c"
{ OPCODE(I64_ROTL); RETURN(BINARY); }
-#line 4276 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4276 "src/prebuilt/wasm-ast-lexer-gen.c"
yy697:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 336 "src/wasm-lexer.c"
+#line 336 "src/wasm-ast-lexer.c"
{ OPCODE(I64_ROTR); RETURN(BINARY); }
-#line 4284 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4284 "src/prebuilt/wasm-ast-lexer-gen.c"
yy699:
yych = *++lexer->cursor;
if (yych == 's') goto yy782;
@@ -4299,9 +4299,9 @@ yy702:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 224 "src/wasm-lexer.c"
+#line 224 "src/wasm-ast-lexer.c"
{ LITERAL(INFINITY); RETURN(FLOAT); }
-#line 4305 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4305 "src/prebuilt/wasm-ast-lexer-gen.c"
yy704:
yych = *++lexer->cursor;
if (yych == 'i') goto yy789;
@@ -4343,9 +4343,9 @@ yy705:
}
}
yy707:
-#line 279 "src/wasm-lexer.c"
+#line 279 "src/wasm-ast-lexer.c"
{ TEXT_AT(7); RETURN(OFFSET); }
-#line 4349 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4349 "src/prebuilt/wasm-ast-lexer-gen.c"
yy708:
yych = *++lexer->cursor;
if (yych == 'l') goto yy790;
@@ -4379,9 +4379,9 @@ yy715:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 283 "src/wasm-lexer.c"
+#line 283 "src/wasm-ast-lexer.c"
{ TYPE(F32); RETURN(CONST); }
-#line 4385 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4385 "src/prebuilt/wasm-ast-lexer-gen.c"
yy717:
yych = *++lexer->cursor;
if (yych == 'r') goto yy798;
@@ -4399,9 +4399,9 @@ yy720:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 301 "src/wasm-lexer.c"
+#line 301 "src/wasm-ast-lexer.c"
{ OPCODE(F32_FLOOR); RETURN(UNARY); }
-#line 4405 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4405 "src/prebuilt/wasm-ast-lexer-gen.c"
yy722:
yych = *++lexer->cursor;
if (yych == 's') goto yy801;
@@ -4415,25 +4415,25 @@ yy724:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 262 "src/wasm-lexer.c"
+#line 262 "src/wasm-ast-lexer.c"
{ OPCODE(F32_STORE); RETURN(STORE); }
-#line 4421 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4421 "src/prebuilt/wasm-ast-lexer-gen.c"
yy726:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 303 "src/wasm-lexer.c"
+#line 303 "src/wasm-ast-lexer.c"
{ OPCODE(F32_TRUNC); RETURN(UNARY); }
-#line 4429 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4429 "src/prebuilt/wasm-ast-lexer-gen.c"
yy728:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 284 "src/wasm-lexer.c"
+#line 284 "src/wasm-ast-lexer.c"
{ TYPE(F64); RETURN(CONST); }
-#line 4437 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4437 "src/prebuilt/wasm-ast-lexer-gen.c"
yy730:
yych = *++lexer->cursor;
if (yych == 'r') goto yy803;
@@ -4447,9 +4447,9 @@ yy732:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 302 "src/wasm-lexer.c"
+#line 302 "src/wasm-ast-lexer.c"
{ OPCODE(F64_FLOOR); RETURN(UNARY); }
-#line 4453 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4453 "src/prebuilt/wasm-ast-lexer-gen.c"
yy734:
yych = *++lexer->cursor;
if (yych == 's') goto yy805;
@@ -4467,25 +4467,25 @@ yy737:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 263 "src/wasm-lexer.c"
+#line 263 "src/wasm-ast-lexer.c"
{ OPCODE(F64_STORE); RETURN(STORE); }
-#line 4473 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4473 "src/prebuilt/wasm-ast-lexer-gen.c"
yy739:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 304 "src/wasm-lexer.c"
+#line 304 "src/wasm-ast-lexer.c"
{ OPCODE(F64_TRUNC); RETURN(UNARY); }
-#line 4481 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4481 "src/prebuilt/wasm-ast-lexer-gen.c"
yy741:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 254 "src/wasm-lexer.c"
+#line 254 "src/wasm-ast-lexer.c"
{ RETURN(GET_LOCAL); }
-#line 4489 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4489 "src/prebuilt/wasm-ast-lexer-gen.c"
yy743:
yych = *++lexer->cursor;
if (yych == 'r') goto yy808;
@@ -4495,25 +4495,25 @@ yy744:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 281 "src/wasm-lexer.c"
+#line 281 "src/wasm-ast-lexer.c"
{ TYPE(I32); RETURN(CONST); }
-#line 4501 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4501 "src/prebuilt/wasm-ast-lexer-gen.c"
yy746:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 313 "src/wasm-lexer.c"
+#line 313 "src/wasm-ast-lexer.c"
{ OPCODE(I32_DIV_S); RETURN(BINARY); }
-#line 4509 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4509 "src/prebuilt/wasm-ast-lexer-gen.c"
yy748:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 315 "src/wasm-lexer.c"
+#line 315 "src/wasm-ast-lexer.c"
{ OPCODE(I32_DIV_U); RETURN(BINARY); }
-#line 4517 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4517 "src/prebuilt/wasm-ast-lexer-gen.c"
yy750:
yych = *++lexer->cursor;
if (yych == '6') goto yy809;
@@ -4535,33 +4535,33 @@ yy754:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 317 "src/wasm-lexer.c"
+#line 317 "src/wasm-ast-lexer.c"
{ OPCODE(I32_REM_S); RETURN(BINARY); }
-#line 4541 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4541 "src/prebuilt/wasm-ast-lexer-gen.c"
yy756:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 319 "src/wasm-lexer.c"
+#line 319 "src/wasm-ast-lexer.c"
{ OPCODE(I32_REM_U); RETURN(BINARY); }
-#line 4549 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4549 "src/prebuilt/wasm-ast-lexer-gen.c"
yy758:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 329 "src/wasm-lexer.c"
+#line 329 "src/wasm-ast-lexer.c"
{ OPCODE(I32_SHR_S); RETURN(BINARY); }
-#line 4557 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4557 "src/prebuilt/wasm-ast-lexer-gen.c"
yy760:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 331 "src/wasm-lexer.c"
+#line 331 "src/wasm-ast-lexer.c"
{ OPCODE(I32_SHR_U); RETURN(BINARY); }
-#line 4565 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4565 "src/prebuilt/wasm-ast-lexer-gen.c"
yy762:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '8') {
@@ -4597,9 +4597,9 @@ yy762:
}
}
yy763:
-#line 260 "src/wasm-lexer.c"
+#line 260 "src/wasm-ast-lexer.c"
{ OPCODE(I32_STORE); RETURN(STORE); }
-#line 4603 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4603 "src/prebuilt/wasm-ast-lexer-gen.c"
yy764:
yych = *++lexer->cursor;
if (yych == '_') goto yy817;
@@ -4613,25 +4613,25 @@ yy766:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 282 "src/wasm-lexer.c"
+#line 282 "src/wasm-ast-lexer.c"
{ TYPE(I64); RETURN(CONST); }
-#line 4619 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4619 "src/prebuilt/wasm-ast-lexer-gen.c"
yy768:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 314 "src/wasm-lexer.c"
+#line 314 "src/wasm-ast-lexer.c"
{ OPCODE(I64_DIV_S); RETURN(BINARY); }
-#line 4627 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4627 "src/prebuilt/wasm-ast-lexer-gen.c"
yy770:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 316 "src/wasm-lexer.c"
+#line 316 "src/wasm-ast-lexer.c"
{ OPCODE(I64_DIV_U); RETURN(BINARY); }
-#line 4635 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4635 "src/prebuilt/wasm-ast-lexer-gen.c"
yy772:
yych = *++lexer->cursor;
if (yych == 'd') goto yy819;
@@ -4661,33 +4661,33 @@ yy778:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 318 "src/wasm-lexer.c"
+#line 318 "src/wasm-ast-lexer.c"
{ OPCODE(I64_REM_S); RETURN(BINARY); }
-#line 4667 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4667 "src/prebuilt/wasm-ast-lexer-gen.c"
yy780:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 320 "src/wasm-lexer.c"
+#line 320 "src/wasm-ast-lexer.c"
{ OPCODE(I64_REM_U); RETURN(BINARY); }
-#line 4675 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4675 "src/prebuilt/wasm-ast-lexer-gen.c"
yy782:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 330 "src/wasm-lexer.c"
+#line 330 "src/wasm-ast-lexer.c"
{ OPCODE(I64_SHR_S); RETURN(BINARY); }
-#line 4683 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4683 "src/prebuilt/wasm-ast-lexer-gen.c"
yy784:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 332 "src/wasm-lexer.c"
+#line 332 "src/wasm-ast-lexer.c"
{ OPCODE(I64_SHR_U); RETURN(BINARY); }
-#line 4691 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4691 "src/prebuilt/wasm-ast-lexer-gen.c"
yy786:
++lexer->cursor;
if ((yych = *lexer->cursor) <= '7') {
@@ -4727,9 +4727,9 @@ yy786:
}
}
yy787:
-#line 261 "src/wasm-lexer.c"
+#line 261 "src/wasm-ast-lexer.c"
{ OPCODE(I64_STORE); RETURN(STORE); }
-#line 4733 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4733 "src/prebuilt/wasm-ast-lexer-gen.c"
yy788:
yych = *++lexer->cursor;
if (yych == '_') goto yy830;
@@ -4743,9 +4743,9 @@ yy790:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 255 "src/wasm-lexer.c"
+#line 255 "src/wasm-ast-lexer.c"
{ RETURN(SET_LOCAL); }
-#line 4749 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4749 "src/prebuilt/wasm-ast-lexer-gen.c"
yy792:
yych = *++lexer->cursor;
if (yych == 'l') goto yy832;
@@ -4828,9 +4828,9 @@ yy811:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 291 "src/wasm-lexer.c"
+#line 291 "src/wasm-ast-lexer.c"
{ OPCODE(I32_POPCNT); RETURN(UNARY); }
-#line 4834 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4834 "src/prebuilt/wasm-ast-lexer-gen.c"
yy813:
yych = *++lexer->cursor;
if (yych == 'r') goto yy859;
@@ -4844,9 +4844,9 @@ yy815:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 274 "src/wasm-lexer.c"
+#line 274 "src/wasm-ast-lexer.c"
{ OPCODE(I32_STORE8); RETURN(STORE); }
-#line 4850 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4850 "src/prebuilt/wasm-ast-lexer-gen.c"
yy817:
yych = *++lexer->cursor;
if (yych == 's') goto yy862;
@@ -4878,9 +4878,9 @@ yy823:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 292 "src/wasm-lexer.c"
+#line 292 "src/wasm-ast-lexer.c"
{ OPCODE(I64_POPCNT); RETURN(UNARY); }
-#line 4884 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4884 "src/prebuilt/wasm-ast-lexer-gen.c"
yy825:
yych = *++lexer->cursor;
if (yych == 'r') goto yy872;
@@ -4898,9 +4898,9 @@ yy828:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 275 "src/wasm-lexer.c"
+#line 275 "src/wasm-ast-lexer.c"
{ OPCODE(I64_STORE8); RETURN(STORE); }
-#line 4904 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4904 "src/prebuilt/wasm-ast-lexer-gen.c"
yy830:
yych = *++lexer->cursor;
if (yych == 's') goto yy877;
@@ -4927,17 +4927,17 @@ yy835:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 427 "src/wasm-lexer.c"
+#line 427 "src/wasm-ast-lexer.c"
{ RETURN(ASSERT_TRAP); }
-#line 4933 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4933 "src/prebuilt/wasm-ast-lexer-gen.c"
yy837:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 251 "src/wasm-lexer.c"
+#line 251 "src/wasm-ast-lexer.c"
{ RETURN(CALL_IMPORT); }
-#line 4941 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4941 "src/prebuilt/wasm-ast-lexer-gen.c"
yy839:
yych = *++lexer->cursor;
if (yych == 'c') goto yy885;
@@ -4959,9 +4959,9 @@ yy843:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 305 "src/wasm-lexer.c"
+#line 305 "src/wasm-ast-lexer.c"
{ OPCODE(F32_NEAREST); RETURN(UNARY); }
-#line 4965 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4965 "src/prebuilt/wasm-ast-lexer-gen.c"
yy845:
yych = *++lexer->cursor;
if (yych == 'p') goto yy890;
@@ -4979,9 +4979,9 @@ yy848:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 306 "src/wasm-lexer.c"
+#line 306 "src/wasm-ast-lexer.c"
{ OPCODE(F64_NEAREST); RETURN(UNARY); }
-#line 4985 "src/prebuilt/wasm-re2c-lexer.c"
+#line 4985 "src/prebuilt/wasm-ast-lexer-gen.c"
yy850:
yych = *++lexer->cursor;
if (yych == '/') goto yy894;
@@ -4995,9 +4995,9 @@ yy852:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 411 "src/wasm-lexer.c"
+#line 411 "src/wasm-ast-lexer.c"
{ RETURN(GROW_MEMORY); }
-#line 5001 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5001 "src/prebuilt/wasm-ast-lexer-gen.c"
yy854:
yych = *++lexer->cursor;
if (yych == 's') goto yy896;
@@ -5008,17 +5008,17 @@ yy855:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 264 "src/wasm-lexer.c"
+#line 264 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LOAD8_S); RETURN(LOAD); }
-#line 5014 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5014 "src/prebuilt/wasm-ast-lexer-gen.c"
yy857:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 266 "src/wasm-lexer.c"
+#line 266 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LOAD8_U); RETURN(LOAD); }
-#line 5022 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5022 "src/prebuilt/wasm-ast-lexer-gen.c"
yy859:
yych = *++lexer->cursor;
if (yych == 'p') goto yy900;
@@ -5028,9 +5028,9 @@ yy860:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 276 "src/wasm-lexer.c"
+#line 276 "src/wasm-ast-lexer.c"
{ OPCODE(I32_STORE16); RETURN(STORE); }
-#line 5034 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5034 "src/prebuilt/wasm-ast-lexer-gen.c"
yy862:
yych = *++lexer->cursor;
if (yych == '/') goto yy901;
@@ -5063,17 +5063,17 @@ yy868:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 265 "src/wasm-lexer.c"
+#line 265 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LOAD8_S); RETURN(LOAD); }
-#line 5069 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5069 "src/prebuilt/wasm-ast-lexer-gen.c"
yy870:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 267 "src/wasm-lexer.c"
+#line 267 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LOAD8_U); RETURN(LOAD); }
-#line 5077 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5077 "src/prebuilt/wasm-ast-lexer-gen.c"
yy872:
yych = *++lexer->cursor;
if (yych == 'p') goto yy915;
@@ -5083,17 +5083,17 @@ yy873:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 277 "src/wasm-lexer.c"
+#line 277 "src/wasm-ast-lexer.c"
{ OPCODE(I64_STORE16); RETURN(STORE); }
-#line 5089 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5089 "src/prebuilt/wasm-ast-lexer-gen.c"
yy875:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 278 "src/wasm-lexer.c"
+#line 278 "src/wasm-ast-lexer.c"
{ OPCODE(I64_STORE32); RETURN(STORE); }
-#line 5097 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5097 "src/prebuilt/wasm-ast-lexer-gen.c"
yy877:
yych = *++lexer->cursor;
if (yych == '/') goto yy916;
@@ -5107,17 +5107,17 @@ yy879:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 410 "src/wasm-lexer.c"
+#line 410 "src/wasm-ast-lexer.c"
{ RETURN(MEMORY_SIZE); }
-#line 5113 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5113 "src/prebuilt/wasm-ast-lexer-gen.c"
yy881:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 409 "src/wasm-lexer.c"
+#line 409 "src/wasm-ast-lexer.c"
{ RETURN(UNREACHABLE); }
-#line 5121 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5121 "src/prebuilt/wasm-ast-lexer-gen.c"
yy883:
yych = *++lexer->cursor;
if (yych == 'i') goto yy918;
@@ -5140,9 +5140,9 @@ yy887:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 349 "src/wasm-lexer.c"
+#line 349 "src/wasm-ast-lexer.c"
{ OPCODE(F32_COPYSIGN); RETURN(BINARY); }
-#line 5146 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5146 "src/prebuilt/wasm-ast-lexer-gen.c"
yy889:
yych = *++lexer->cursor;
if (yych == '6') goto yy925;
@@ -5161,9 +5161,9 @@ yy892:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 350 "src/wasm-lexer.c"
+#line 350 "src/wasm-ast-lexer.c"
{ OPCODE(F64_COPYSIGN); RETURN(BINARY); }
-#line 5167 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5167 "src/prebuilt/wasm-ast-lexer-gen.c"
yy894:
yych = *++lexer->cursor;
if (yych == 'f') goto yy929;
@@ -5177,17 +5177,17 @@ yy896:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 268 "src/wasm-lexer.c"
+#line 268 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LOAD16_S); RETURN(LOAD); }
-#line 5183 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5183 "src/prebuilt/wasm-ast-lexer-gen.c"
yy898:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 270 "src/wasm-lexer.c"
+#line 270 "src/wasm-ast-lexer.c"
{ OPCODE(I32_LOAD16_U); RETURN(LOAD); }
-#line 5191 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5191 "src/prebuilt/wasm-ast-lexer-gen.c"
yy900:
yych = *++lexer->cursor;
if (yych == 'r') goto yy931;
@@ -5205,9 +5205,9 @@ yy903:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 385 "src/wasm-lexer.c"
+#line 385 "src/wasm-ast-lexer.c"
{ OPCODE(I32_WRAP_I64); RETURN(CONVERT); }
-#line 5211 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5211 "src/prebuilt/wasm-ast-lexer-gen.c"
yy905:
yych = *++lexer->cursor;
if (yych == '/') goto yy934;
@@ -5221,33 +5221,33 @@ yy907:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 269 "src/wasm-lexer.c"
+#line 269 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LOAD16_S); RETURN(LOAD); }
-#line 5227 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5227 "src/prebuilt/wasm-ast-lexer-gen.c"
yy909:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 271 "src/wasm-lexer.c"
+#line 271 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LOAD16_U); RETURN(LOAD); }
-#line 5235 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5235 "src/prebuilt/wasm-ast-lexer-gen.c"
yy911:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 272 "src/wasm-lexer.c"
+#line 272 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LOAD32_S); RETURN(LOAD); }
-#line 5243 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5243 "src/prebuilt/wasm-ast-lexer-gen.c"
yy913:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 273 "src/wasm-lexer.c"
+#line 273 "src/wasm-ast-lexer.c"
{ OPCODE(I64_LOAD32_U); RETURN(LOAD); }
-#line 5251 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5251 "src/prebuilt/wasm-ast-lexer-gen.c"
yy915:
yych = *++lexer->cursor;
if (yych == 'r') goto yy936;
@@ -5299,17 +5299,17 @@ yy919:
}
}
yy920:
-#line 425 "src/wasm-lexer.c"
+#line 425 "src/wasm-ast-lexer.c"
{ RETURN(ASSERT_RETURN); }
-#line 5305 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5305 "src/prebuilt/wasm-ast-lexer-gen.c"
yy921:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 252 "src/wasm-lexer.c"
+#line 252 "src/wasm-ast-lexer.c"
{ RETURN(CALL_INDIRECT); }
-#line 5313 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5313 "src/prebuilt/wasm-ast-lexer-gen.c"
yy923:
yych = *++lexer->cursor;
if (yych == '/') goto yy942;
@@ -5383,9 +5383,9 @@ yy939:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 424 "src/wasm-lexer.c"
+#line 424 "src/wasm-ast-lexer.c"
{ RETURN(ASSERT_INVALID); }
-#line 5389 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5389 "src/prebuilt/wasm-ast-lexer-gen.c"
yy941:
yych = *++lexer->cursor;
if (yych == 'n') goto yy963;
@@ -5403,9 +5403,9 @@ yy944:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 403 "src/wasm-lexer.c"
+#line 403 "src/wasm-ast-lexer.c"
{ OPCODE(F32_DEMOTE_F64); RETURN(CONVERT); }
-#line 5409 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5409 "src/prebuilt/wasm-ast-lexer-gen.c"
yy946:
yych = *++lexer->cursor;
if (yych == 't') goto yy966;
@@ -5507,9 +5507,9 @@ yy969:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 402 "src/wasm-lexer.c"
+#line 402 "src/wasm-ast-lexer.c"
{ OPCODE(F64_PROMOTE_F32); RETURN(CONVERT); }
-#line 5513 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5513 "src/prebuilt/wasm-ast-lexer-gen.c"
yy971:
yych = *++lexer->cursor;
if (yych == '/') goto yy1002;
@@ -5523,33 +5523,33 @@ yy973:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 386 "src/wasm-lexer.c"
+#line 386 "src/wasm-ast-lexer.c"
{ OPCODE(I32_TRUNC_S_F32); RETURN(CONVERT); }
-#line 5529 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5529 "src/prebuilt/wasm-ast-lexer-gen.c"
yy975:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 388 "src/wasm-lexer.c"
+#line 388 "src/wasm-ast-lexer.c"
{ OPCODE(I32_TRUNC_S_F64); RETURN(CONVERT); }
-#line 5537 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5537 "src/prebuilt/wasm-ast-lexer-gen.c"
yy977:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 390 "src/wasm-lexer.c"
+#line 390 "src/wasm-ast-lexer.c"
{ OPCODE(I32_TRUNC_U_F32); RETURN(CONVERT); }
-#line 5545 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5545 "src/prebuilt/wasm-ast-lexer-gen.c"
yy979:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 392 "src/wasm-lexer.c"
+#line 392 "src/wasm-ast-lexer.c"
{ OPCODE(I32_TRUNC_U_F64); RETURN(CONVERT); }
-#line 5553 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5553 "src/prebuilt/wasm-ast-lexer-gen.c"
yy981:
yych = *++lexer->cursor;
if (yych == '2') goto yy1004;
@@ -5567,33 +5567,33 @@ yy984:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 387 "src/wasm-lexer.c"
+#line 387 "src/wasm-ast-lexer.c"
{ OPCODE(I64_TRUNC_S_F32); RETURN(CONVERT); }
-#line 5573 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5573 "src/prebuilt/wasm-ast-lexer-gen.c"
yy986:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 389 "src/wasm-lexer.c"
+#line 389 "src/wasm-ast-lexer.c"
{ OPCODE(I64_TRUNC_S_F64); RETURN(CONVERT); }
-#line 5581 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5581 "src/prebuilt/wasm-ast-lexer-gen.c"
yy988:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 391 "src/wasm-lexer.c"
+#line 391 "src/wasm-ast-lexer.c"
{ OPCODE(I64_TRUNC_U_F32); RETURN(CONVERT); }
-#line 5589 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5589 "src/prebuilt/wasm-ast-lexer-gen.c"
yy990:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 393 "src/wasm-lexer.c"
+#line 393 "src/wasm-ast-lexer.c"
{ OPCODE(I64_TRUNC_U_F64); RETURN(CONVERT); }
-#line 5597 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5597 "src/prebuilt/wasm-ast-lexer-gen.c"
yy992:
yych = *++lexer->cursor;
if (yych == 'n') goto yy1009;
@@ -5647,17 +5647,17 @@ yy1004:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 383 "src/wasm-lexer.c"
+#line 383 "src/wasm-ast-lexer.c"
{ OPCODE(I64_EXTEND_S_I32); RETURN(CONVERT); }
-#line 5653 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5653 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1006:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 384 "src/wasm-lexer.c"
+#line 384 "src/wasm-ast-lexer.c"
{ OPCODE(I64_EXTEND_U_I32); RETURN(CONVERT); }
-#line 5661 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5661 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1008:
yych = *++lexer->cursor;
if (yych == 'f') goto yy1030;
@@ -5667,41 +5667,41 @@ yy1009:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 426 "src/wasm-lexer.c"
+#line 426 "src/wasm-ast-lexer.c"
{ RETURN(ASSERT_RETURN_NAN); }
-#line 5673 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5673 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1011:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 394 "src/wasm-lexer.c"
+#line 394 "src/wasm-ast-lexer.c"
{ OPCODE(F32_CONVERT_S_I32); RETURN(CONVERT); }
-#line 5681 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5681 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1013:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 396 "src/wasm-lexer.c"
+#line 396 "src/wasm-ast-lexer.c"
{ OPCODE(F32_CONVERT_S_I64); RETURN(CONVERT); }
-#line 5689 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5689 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1015:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 398 "src/wasm-lexer.c"
+#line 398 "src/wasm-ast-lexer.c"
{ OPCODE(F32_CONVERT_U_I32); RETURN(CONVERT); }
-#line 5697 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5697 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1017:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 400 "src/wasm-lexer.c"
+#line 400 "src/wasm-ast-lexer.c"
{ OPCODE(F32_CONVERT_U_I64); RETURN(CONVERT); }
-#line 5705 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5705 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1019:
yych = *++lexer->cursor;
if (yych == '3') goto yy1031;
@@ -5711,33 +5711,33 @@ yy1020:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 395 "src/wasm-lexer.c"
+#line 395 "src/wasm-ast-lexer.c"
{ OPCODE(F64_CONVERT_S_I32); RETURN(CONVERT); }
-#line 5717 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5717 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1022:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 397 "src/wasm-lexer.c"
+#line 397 "src/wasm-ast-lexer.c"
{ OPCODE(F64_CONVERT_S_I64); RETURN(CONVERT); }
-#line 5725 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5725 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1024:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 399 "src/wasm-lexer.c"
+#line 399 "src/wasm-ast-lexer.c"
{ OPCODE(F64_CONVERT_U_I32); RETURN(CONVERT); }
-#line 5733 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5733 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1026:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 401 "src/wasm-lexer.c"
+#line 401 "src/wasm-ast-lexer.c"
{ OPCODE(F64_CONVERT_U_I64); RETURN(CONVERT); }
-#line 5741 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5741 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1028:
yych = *++lexer->cursor;
if (yych == '6') goto yy1032;
@@ -5771,45 +5771,45 @@ yy1035:
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 404 "src/wasm-lexer.c"
+#line 404 "src/wasm-ast-lexer.c"
{ OPCODE(F32_REINTERPRET_I32); RETURN(CONVERT); }
-#line 5777 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5777 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1037:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 406 "src/wasm-lexer.c"
+#line 406 "src/wasm-ast-lexer.c"
{ OPCODE(F64_REINTERPRET_I64); RETURN(CONVERT); }
-#line 5785 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5785 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1039:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 405 "src/wasm-lexer.c"
+#line 405 "src/wasm-ast-lexer.c"
{ OPCODE(I32_REINTERPRET_F32); RETURN(CONVERT); }
-#line 5793 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5793 "src/prebuilt/wasm-ast-lexer-gen.c"
yy1041:
++lexer->cursor;
if (yybm[0+(yych = *lexer->cursor)] & 16) {
goto yy49;
}
-#line 407 "src/wasm-lexer.c"
+#line 407 "src/wasm-ast-lexer.c"
{ OPCODE(I64_REINTERPRET_F64); RETURN(CONVERT); }
-#line 5801 "src/prebuilt/wasm-re2c-lexer.c"
+#line 5801 "src/prebuilt/wasm-ast-lexer-gen.c"
}
}
-#line 449 "src/wasm-lexer.c"
+#line 449 "src/wasm-ast-lexer.c"
}
}
-static WasmLexer* wasm_new_lexer(WasmAllocator* allocator,
- WasmLexerSourceType type,
- const char* filename) {
- WasmLexer* lexer =
- wasm_alloc_zero(allocator, sizeof(WasmLexer), WASM_DEFAULT_ALIGN);
+static WasmAstLexer* wasm_new_lexer(WasmAllocator* allocator,
+ WasmAstLexerSourceType type,
+ const char* filename) {
+ WasmAstLexer* lexer =
+ wasm_alloc_zero(allocator, sizeof(WasmAstLexer), WASM_DEFAULT_ALIGN);
lexer->allocator = allocator;
lexer->line = 1;
lexer->filename = filename;
@@ -5817,21 +5817,24 @@ static WasmLexer* wasm_new_lexer(WasmAllocator* allocator,
return lexer;
}
-WasmLexer* wasm_new_file_lexer(WasmAllocator* allocator, const char* filename) {
- WasmLexer* lexer =
+WasmAstLexer* wasm_new_ast_file_lexer(WasmAllocator* allocator,
+ const char* filename) {
+ WasmAstLexer* lexer =
wasm_new_lexer(allocator, WASM_LEXER_SOURCE_TYPE_FILE, filename);
lexer->source.file = fopen(filename, "r");
if (!lexer->source.file) {
- wasm_destroy_lexer(lexer);
+ wasm_destroy_ast_lexer(lexer);
wasm_free(allocator, lexer);
return NULL;
}
return lexer;
}
-WasmLexer* wasm_new_buffer_lexer(WasmAllocator* allocator, const char* filename,
- const void* data, size_t size) {
- WasmLexer* lexer =
+WasmAstLexer* wasm_new_ast_buffer_lexer(WasmAllocator* allocator,
+ const char* filename,
+ const void* data,
+ size_t size) {
+ WasmAstLexer* lexer =
wasm_new_lexer(allocator, WASM_LEXER_SOURCE_TYPE_BUFFER, filename);
lexer->source.buffer.data = data;
lexer->source.buffer.size = size;
@@ -5839,14 +5842,14 @@ WasmLexer* wasm_new_buffer_lexer(WasmAllocator* allocator, const char* filename,
return lexer;
}
-void wasm_destroy_lexer(WasmLexer* lexer) {
+void wasm_destroy_ast_lexer(WasmAstLexer* lexer) {
if (lexer->source.type == WASM_LEXER_SOURCE_TYPE_FILE && lexer->source.file)
fclose(lexer->source.file);
wasm_free(lexer->allocator, lexer->buffer);
wasm_free(lexer->allocator, lexer);
}
-WasmAllocator* wasm_lexer_get_allocator(WasmLexer* lexer) {
+WasmAllocator* wasm_ast_lexer_get_allocator(WasmAstLexer* lexer) {
return lexer->allocator;
}
@@ -5898,7 +5901,7 @@ static WasmResult scan_forward_for_line_offset_in_buffer(
}
static WasmResult scan_forward_for_line_offset_in_file(
- WasmLexer* lexer,
+ WasmAstLexer* lexer,
int line,
size_t line_start_offset,
WasmLineOffsetPosition find_position,
@@ -5946,7 +5949,7 @@ cleanup:
}
static WasmResult scan_forward_for_line_offset(
- WasmLexer* lexer,
+ WasmAstLexer* lexer,
int line,
size_t line_start_offset,
WasmLineOffsetPosition find_position,
@@ -5968,7 +5971,7 @@ static WasmResult scan_forward_for_line_offset(
}
}
-static WasmResult get_line_start_offset(WasmLexer* lexer,
+static WasmResult get_line_start_offset(WasmAstLexer* lexer,
int line,
size_t* out_offset) {
int first_line = 1;
@@ -5991,7 +5994,7 @@ static WasmResult get_line_start_offset(WasmLexer* lexer,
}
}
-static WasmResult get_offsets_from_line(WasmLexer* lexer,
+static WasmResult get_offsets_from_line(WasmAstLexer* lexer,
int line,
size_t* out_line_start,
size_t* out_line_end) {
@@ -6038,12 +6041,12 @@ static void clamp_source_line_offsets_to_location(size_t line_start,
*out_new_line_end = line_end;
}
-WasmResult wasm_lexer_get_source_line(WasmLexer* lexer,
- const WasmLocation* loc,
- size_t line_max_length,
- char* line,
- size_t* out_line_length,
- int* out_column_offset) {
+WasmResult wasm_ast_lexer_get_source_line(WasmAstLexer* lexer,
+ const WasmLocation* loc,
+ size_t line_max_length,
+ char* line,
+ size_t* out_line_length,
+ int* out_column_offset) {
WasmResult result;
size_t line_start; /* inclusive */
size_t line_end; /* exclusive */
diff --git a/src/prebuilt/wasm-bison-parser.c b/src/prebuilt/wasm-ast-parser-gen.c
index eba29f3a..b3d00e71 100644
--- a/src/prebuilt/wasm-bison-parser.c
+++ b/src/prebuilt/wasm-ast-parser-gen.c
@@ -59,18 +59,18 @@
#define YYPULL 1
/* Substitute the type names. */
-#define YYSTYPE WASM_PARSER_STYPE
-#define YYLTYPE WASM_PARSER_LTYPE
+#define YYSTYPE WASM_AST_PARSER_STYPE
+#define YYLTYPE WASM_AST_PARSER_LTYPE
/* Substitute the variable and function names. */
-#define yyparse wasm_parser_parse
-#define yylex wasm_parser_lex
-#define yyerror wasm_parser_error
-#define yydebug wasm_parser_debug
-#define yynerrs wasm_parser_nerrs
+#define yyparse wasm_ast_parser_parse
+#define yylex wasm_ast_parser_lex
+#define yyerror wasm_ast_parser_error
+#define yydebug wasm_ast_parser_debug
+#define yynerrs wasm_ast_parser_nerrs
/* Copy the first part of user declarations. */
-#line 17 "src/wasm-bison-parser.y" /* yacc.c:339 */
+#line 17 "src/wasm-ast-parser.y" /* yacc.c:339 */
#include <assert.h>
#include <stdarg.h>
@@ -78,22 +78,22 @@
#include <stdlib.h>
#include "wasm-allocator.h"
+#include "wasm-ast-parser.h"
+#include "wasm-ast-parser-lexer-shared.h"
#include "wasm-literal.h"
-#include "wasm-parser.h"
-#include "wasm-parser-lexer-shared.h"
#define DUPTEXT(dst, src) \
(dst).start = wasm_strndup(parser->allocator, (src).start, (src).length); \
(dst).length = (src).length
-#define CHECK_ALLOC_(cond) \
- if (!(cond)) { \
- WasmLocation loc; \
- loc.filename = __FILE__; \
- loc.line = __LINE__; \
- loc.first_column = loc.last_column = 0; \
- wasm_parser_error(&loc, lexer, parser, "allocation failed"); \
- YYERROR; \
+#define CHECK_ALLOC_(cond) \
+ if (!(cond)) { \
+ WasmLocation loc; \
+ loc.filename = __FILE__; \
+ loc.line = __LINE__; \
+ loc.first_column = loc.last_column = 0; \
+ wasm_ast_parser_error(&loc, lexer, parser, "allocation failed"); \
+ YYERROR; \
}
#define CHECK_ALLOC(e) CHECK_ALLOC_(WASM_SUCCEEDED(e))
@@ -155,10 +155,10 @@ WasmResult copy_signature_from_func_type(WasmAllocator* allocator,
WasmModule* module,
WasmFuncDeclaration* decl);
-#define wasm_parser_lex wasm_lexer_lex
+#define wasm_ast_parser_lex wasm_ast_lexer_lex
-#line 162 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:339 */
+#line 162 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:339 */
# ifndef YY_NULLPTR
# if defined __cplusplus && 201103L <= __cplusplus
@@ -177,29 +177,29 @@ WasmResult copy_signature_from_func_type(WasmAllocator* allocator,
#endif
/* In a future release of Bison, this section will be replaced
- by #include "wasm-bison-parser.h". */
-#ifndef YY_WASM_PARSER_SRC_PREBUILT_WASM_BISON_PARSER_H_INCLUDED
-# define YY_WASM_PARSER_SRC_PREBUILT_WASM_BISON_PARSER_H_INCLUDED
+ by #include "wasm-ast-parser-gen.h". */
+#ifndef YY_WASM_AST_PARSER_SRC_PREBUILT_WASM_AST_PARSER_GEN_H_INCLUDED
+# define YY_WASM_AST_PARSER_SRC_PREBUILT_WASM_AST_PARSER_GEN_H_INCLUDED
/* Debug traces. */
-#ifndef WASM_PARSER_DEBUG
+#ifndef WASM_AST_PARSER_DEBUG
# if defined YYDEBUG
#if YYDEBUG
-# define WASM_PARSER_DEBUG 1
+# define WASM_AST_PARSER_DEBUG 1
# else
-# define WASM_PARSER_DEBUG 0
+# define WASM_AST_PARSER_DEBUG 0
# endif
# else /* ! defined YYDEBUG */
-# define WASM_PARSER_DEBUG 0
+# define WASM_AST_PARSER_DEBUG 0
# endif /* ! defined YYDEBUG */
-#endif /* ! defined WASM_PARSER_DEBUG */
-#if WASM_PARSER_DEBUG
-extern int wasm_parser_debug;
+#endif /* ! defined WASM_AST_PARSER_DEBUG */
+#if WASM_AST_PARSER_DEBUG
+extern int wasm_ast_parser_debug;
#endif
/* Token type. */
-#ifndef WASM_PARSER_TOKENTYPE
-# define WASM_PARSER_TOKENTYPE
- enum wasm_parser_tokentype
+#ifndef WASM_AST_PARSER_TOKENTYPE
+# define WASM_AST_PARSER_TOKENTYPE
+ enum wasm_ast_parser_tokentype
{
WASM_TOKEN_TYPE_EOF = 0,
WASM_TOKEN_TYPE_LPAR = 258,
@@ -260,35 +260,35 @@ extern int wasm_parser_debug;
#endif
/* Value type. */
-#if ! defined WASM_PARSER_STYPE && ! defined WASM_PARSER_STYPE_IS_DECLARED
-typedef WasmToken WASM_PARSER_STYPE;
-# define WASM_PARSER_STYPE_IS_TRIVIAL 1
-# define WASM_PARSER_STYPE_IS_DECLARED 1
+#if ! defined WASM_AST_PARSER_STYPE && ! defined WASM_AST_PARSER_STYPE_IS_DECLARED
+typedef WasmToken WASM_AST_PARSER_STYPE;
+# define WASM_AST_PARSER_STYPE_IS_TRIVIAL 1
+# define WASM_AST_PARSER_STYPE_IS_DECLARED 1
#endif
/* Location type. */
-#if ! defined WASM_PARSER_LTYPE && ! defined WASM_PARSER_LTYPE_IS_DECLARED
-typedef struct WASM_PARSER_LTYPE WASM_PARSER_LTYPE;
-struct WASM_PARSER_LTYPE
+#if ! defined WASM_AST_PARSER_LTYPE && ! defined WASM_AST_PARSER_LTYPE_IS_DECLARED
+typedef struct WASM_AST_PARSER_LTYPE WASM_AST_PARSER_LTYPE;
+struct WASM_AST_PARSER_LTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
};
-# define WASM_PARSER_LTYPE_IS_DECLARED 1
-# define WASM_PARSER_LTYPE_IS_TRIVIAL 1
+# define WASM_AST_PARSER_LTYPE_IS_DECLARED 1
+# define WASM_AST_PARSER_LTYPE_IS_TRIVIAL 1
#endif
-int wasm_parser_parse (WasmLexer* lexer, WasmParser* parser);
+int wasm_ast_parser_parse (WasmAstLexer* lexer, WasmAstParser* parser);
-#endif /* !YY_WASM_PARSER_SRC_PREBUILT_WASM_BISON_PARSER_H_INCLUDED */
+#endif /* !YY_WASM_AST_PARSER_SRC_PREBUILT_WASM_AST_PARSER_GEN_H_INCLUDED */
/* Copy the second part of user declarations. */
-#line 292 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:358 */
+#line 292 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -469,8 +469,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined WASM_PARSER_LTYPE_IS_TRIVIAL && WASM_PARSER_LTYPE_IS_TRIVIAL \
- && defined WASM_PARSER_STYPE_IS_TRIVIAL && WASM_PARSER_STYPE_IS_TRIVIAL)))
+ || (defined WASM_AST_PARSER_LTYPE_IS_TRIVIAL && WASM_AST_PARSER_LTYPE_IS_TRIVIAL \
+ && defined WASM_AST_PARSER_STYPE_IS_TRIVIAL && WASM_AST_PARSER_STYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -589,7 +589,7 @@ static const yytype_uint8 yytranslate[] =
55, 56
};
-#if WASM_PARSER_DEBUG
+#if WASM_AST_PARSER_DEBUG
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
@@ -600,15 +600,15 @@ static const yytype_uint16 yyrline[] =
419, 426, 431, 437, 445, 454, 467, 473, 480, 487,
494, 500, 504, 508, 515, 516, 519, 523, 529, 530,
535, 542, 548, 556, 562, 568, 578, 581, 645, 651,
- 658, 663, 674, 678, 691, 699, 700, 707, 719, 731,
- 737, 746, 750, 757, 761, 768, 776, 783, 794, 801,
- 807, 810, 819, 828, 836, 844, 852, 860, 868, 878,
- 974, 980, 987, 994, 1002, 1009, 1019, 1020, 1028, 1040,
- 1041, 1044, 1045, 1052, 1061
+ 658, 663, 674, 678, 691, 699, 700, 707, 720, 732,
+ 738, 747, 751, 758, 762, 769, 777, 784, 795, 802,
+ 808, 811, 820, 829, 837, 845, 853, 861, 869, 879,
+ 975, 981, 988, 995, 1003, 1010, 1020, 1021, 1029, 1041,
+ 1042, 1045, 1046, 1053, 1062
};
#endif
-#if WASM_PARSER_DEBUG || YYERROR_VERBOSE || 1
+#if WASM_AST_PARSER_DEBUG || YYERROR_VERBOSE || 1
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
@@ -951,7 +951,7 @@ while (0)
/* Enable debugging if requested. */
-#if WASM_PARSER_DEBUG
+#if WASM_AST_PARSER_DEBUG
# ifndef YYFPRINTF
# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
@@ -970,7 +970,7 @@ do { \
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
-# if defined WASM_PARSER_LTYPE_IS_TRIVIAL && WASM_PARSER_LTYPE_IS_TRIVIAL
+# if defined WASM_AST_PARSER_LTYPE_IS_TRIVIAL && WASM_AST_PARSER_LTYPE_IS_TRIVIAL
/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
@@ -1026,7 +1026,7 @@ do { \
`----------------------------------------*/
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, WasmLexer* lexer, WasmParser* parser)
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, WasmAstLexer* lexer, WasmAstParser* parser)
{
FILE *yyo = yyoutput;
YYUSE (yyo);
@@ -1048,7 +1048,7 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
`--------------------------------*/
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, WasmLexer* lexer, WasmParser* parser)
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, WasmAstLexer* lexer, WasmAstParser* parser)
{
YYFPRINTF (yyoutput, "%s %s (",
yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
@@ -1088,7 +1088,7 @@ do { \
`------------------------------------------------*/
static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, WasmLexer* lexer, WasmParser* parser)
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, WasmAstLexer* lexer, WasmAstParser* parser)
{
unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
@@ -1116,12 +1116,12 @@ do { \
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
-#else /* !WASM_PARSER_DEBUG */
+#else /* !WASM_AST_PARSER_DEBUG */
# define YYDPRINTF(Args)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
-#endif /* !WASM_PARSER_DEBUG */
+#endif /* !WASM_AST_PARSER_DEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
@@ -1368,7 +1368,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
`-----------------------------------------------*/
static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, WasmLexer* lexer, WasmParser* parser)
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, WasmAstLexer* lexer, WasmAstParser* parser)
{
YYUSE (yyvaluep);
YYUSE (yylocationp);
@@ -1382,183 +1382,183 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio
switch (yytype)
{
case 58: /* value_type_list */
-#line 161 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 161 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_type_vector(parser->allocator, &((*yyvaluep).types)); }
-#line 1388 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1388 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 59: /* func_type */
-#line 171 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 171 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_func_signature(parser->allocator, &((*yyvaluep).func_sig)); }
-#line 1394 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1394 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 60: /* literal */
-#line 160 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 160 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).literal).text); }
-#line 1400 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1400 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 61: /* var */
-#line 162 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 162 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_var(parser->allocator, &((*yyvaluep).var)); }
-#line 1406 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1406 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 62: /* var_list */
-#line 163 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 163 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_var_vector_and_elements(parser->allocator, &((*yyvaluep).vars)); }
-#line 1412 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1412 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 63: /* bind_var */
-#line 159 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 159 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).text)); }
-#line 1418 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1418 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 64: /* quoted_text */
-#line 159 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 159 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).text)); }
-#line 1424 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1424 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 65: /* string_contents */
-#line 168 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 168 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_segment(parser->allocator, &((*yyvaluep).segment)); }
-#line 1430 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1430 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 66: /* labeling */
-#line 159 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 159 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_string_slice(parser->allocator, &((*yyvaluep).text)); }
-#line 1436 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1436 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 69: /* expr */
-#line 164 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 164 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_expr_ptr(parser->allocator, &((*yyvaluep).expr)); }
-#line 1442 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1442 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 70: /* expr1 */
-#line 164 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 164 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_expr_ptr(parser->allocator, &((*yyvaluep).expr)); }
-#line 1448 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1448 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 71: /* expr_opt */
-#line 164 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 164 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_expr_ptr(parser->allocator, &((*yyvaluep).expr)); }
-#line 1454 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1454 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 72: /* non_empty_expr_list */
-#line 165 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 165 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_expr_ptr_vector_and_elements(parser->allocator, &((*yyvaluep).exprs)); }
-#line 1460 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1460 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 73: /* expr_list */
-#line 165 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 165 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_expr_ptr_vector_and_elements(parser->allocator, &((*yyvaluep).exprs)); }
-#line 1466 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1466 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 74: /* func_fields */
-#line 166 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 166 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_func_fields(parser->allocator, ((*yyvaluep).func_fields)); }
-#line 1472 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1472 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 76: /* func_info */
-#line 167 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 167 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_func(parser->allocator, ((*yyvaluep).func)); wasm_free(parser->allocator, ((*yyvaluep).func)); }
-#line 1478 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1478 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 77: /* func */
-#line 167 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 167 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_func(parser->allocator, ((*yyvaluep).func)); wasm_free(parser->allocator, ((*yyvaluep).func)); }
-#line 1484 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1484 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 80: /* segment */
-#line 168 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 168 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_segment(parser->allocator, &((*yyvaluep).segment)); }
-#line 1490 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1490 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 81: /* segment_list */
-#line 169 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 169 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_segment_vector_and_elements(parser->allocator, &((*yyvaluep).segments)); }
-#line 1496 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1496 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 84: /* memory */
-#line 170 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 170 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_memory(parser->allocator, &((*yyvaluep).memory)); }
-#line 1502 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1502 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 85: /* type_def */
-#line 172 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 172 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_func_type(parser->allocator, &((*yyvaluep).func_type)); }
-#line 1508 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1508 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 86: /* table */
-#line 163 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 163 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_var_vector_and_elements(parser->allocator, &((*yyvaluep).vars)); }
-#line 1514 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1514 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 87: /* import */
-#line 173 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 173 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_import(parser->allocator, ((*yyvaluep).import)); wasm_free(parser->allocator, ((*yyvaluep).import)); }
-#line 1520 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1520 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 88: /* export */
-#line 174 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 174 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_export(parser->allocator, &((*yyvaluep).export_)); }
-#line 1526 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1526 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 90: /* module_fields */
-#line 175 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 175 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_module(parser->allocator, ((*yyvaluep).module)); wasm_free(parser->allocator, ((*yyvaluep).module)); }
-#line 1532 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1532 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 91: /* module */
-#line 175 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 175 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_module(parser->allocator, ((*yyvaluep).module)); wasm_free(parser->allocator, ((*yyvaluep).module)); }
-#line 1538 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1538 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 92: /* cmd */
-#line 177 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 177 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_command(parser->allocator, ((*yyvaluep).command)); wasm_free(parser->allocator, ((*yyvaluep).command)); }
-#line 1544 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1544 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 93: /* cmd_list */
-#line 178 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 178 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_command_vector_and_elements(parser->allocator, &((*yyvaluep).commands)); }
-#line 1550 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1550 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 96: /* const_list */
-#line 176 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 176 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_const_vector(parser->allocator, &((*yyvaluep).consts)); }
-#line 1556 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1556 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
case 97: /* script */
-#line 179 "src/wasm-bison-parser.y" /* yacc.c:1257 */
+#line 179 "src/wasm-ast-parser.y" /* yacc.c:1257 */
{ wasm_destroy_script(&((*yyvaluep).script)); }
-#line 1562 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1257 */
+#line 1562 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1257 */
break;
@@ -1576,7 +1576,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocatio
`----------*/
int
-yyparse (WasmLexer* lexer, WasmParser* parser)
+yyparse (WasmAstLexer* lexer, WasmAstParser* parser)
{
/* The lookahead symbol. */
int yychar;
@@ -1590,7 +1590,7 @@ YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
/* Location data for the lookahead symbol. */
static YYLTYPE yyloc_default
-# if defined WASM_PARSER_LTYPE_IS_TRIVIAL && WASM_PARSER_LTYPE_IS_TRIVIAL
+# if defined WASM_AST_PARSER_LTYPE_IS_TRIVIAL && WASM_AST_PARSER_LTYPE_IS_TRIVIAL
= { 1, 1, 1, 1 }
# endif
;
@@ -1850,72 +1850,72 @@ yyreduce:
switch (yyn)
{
case 2:
-#line 191 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 191 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.types)); }
-#line 1856 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1856 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 3:
-#line 192 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 192 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.types) = (yyvsp[-1].types);
CHECK_ALLOC(wasm_append_type_value(parser->allocator, &(yyval.types), &(yyvsp[0].type)));
}
-#line 1865 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1865 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 4:
-#line 198 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 198 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.func_sig)); }
-#line 1871 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1871 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 5:
-#line 199 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 199 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_sig).result_type = WASM_TYPE_VOID;
(yyval.func_sig).param_types = (yyvsp[-1].types);
}
-#line 1880 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1880 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 6:
-#line 203 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 203 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_sig).result_type = (yyvsp[-1].type);
(yyval.func_sig).param_types = (yyvsp[-5].types);
}
-#line 1889 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1889 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 7:
-#line 207 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 207 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.func_sig)); (yyval.func_sig).result_type = (yyvsp[-1].type); }
-#line 1895 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1895 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 8:
-#line 214 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 214 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.literal).type = (yyvsp[0].literal).type;
DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text);
CHECK_ALLOC_STR((yyval.literal).text);
}
-#line 1905 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1905 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 9:
-#line 219 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 219 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.literal).type = (yyvsp[0].literal).type;
DUPTEXT((yyval.literal).text, (yyvsp[0].literal).text);
CHECK_ALLOC_STR((yyval.literal).text);
}
-#line 1915 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1915 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 10:
-#line 227 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 227 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.var).loc = (yylsp[0]);
(yyval.var).type = WASM_VAR_TYPE_INDEX;
@@ -1923,48 +1923,48 @@ yyreduce:
if (WASM_FAILED(wasm_parse_int32((yyvsp[0].literal).text.start,
(yyvsp[0].literal).text.start + (yyvsp[0].literal).text.length, &index,
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&(yylsp[0]), lexer, parser, "invalid int " PRIstringslice,
- WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
+ wasm_ast_parser_error(&(yylsp[0]), lexer, parser, "invalid int " PRIstringslice,
+ WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
}
(yyval.var).index = index;
}
-#line 1932 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1932 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 11:
-#line 239 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 239 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.var).loc = (yylsp[0]);
(yyval.var).type = WASM_VAR_TYPE_NAME;
DUPTEXT((yyval.var).name, (yyvsp[0].text));
CHECK_ALLOC_STR((yyval.var).name);
}
-#line 1943 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1943 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 12:
-#line 247 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 247 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.vars)); }
-#line 1949 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1949 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 13:
-#line 248 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 248 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.vars) = (yyvsp[-1].vars);
CHECK_ALLOC(wasm_append_var_value(parser->allocator, &(yyval.vars), &(yyvsp[0].var)));
}
-#line 1958 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1958 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 14:
-#line 254 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 254 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ DUPTEXT((yyval.text), (yyvsp[0].text)); CHECK_ALLOC_STR((yyval.text)); }
-#line 1964 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1964 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 15:
-#line 258 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 258 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
void* data;
size_t size;
@@ -1972,93 +1972,93 @@ yyreduce:
(yyval.text).start = data;
(yyval.text).length = size;
}
-#line 1976 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1976 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 16:
-#line 268 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 268 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
CHECK_ALLOC(dup_string_contents(parser->allocator, &(yyvsp[0].text), &(yyval.segment).data,
&(yyval.segment).size));
}
-#line 1985 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1985 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 17:
-#line 275 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 275 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.text)); }
-#line 1991 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1991 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 18:
-#line 276 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 276 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.text) = (yyvsp[0].text); }
-#line 1997 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 1997 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 19:
-#line 280 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 280 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.u64) = 0; }
-#line 2003 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2003 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 20:
-#line 281 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 281 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
if (WASM_FAILED(wasm_parse_int64((yyvsp[0].text).start, (yyvsp[0].text).start + (yyvsp[0].text).length, &(yyval.u64)))) {
- wasm_parser_error(&(yylsp[0]), lexer, parser,
- "invalid offset \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].text)));
+ wasm_ast_parser_error(&(yylsp[0]), lexer, parser,
+ "invalid offset \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].text)));
}
}
-#line 2015 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2015 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 21:
-#line 290 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 290 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.u32) = USE_NATURAL_ALIGNMENT; }
-#line 2021 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2021 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 22:
-#line 291 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 291 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
if (WASM_FAILED(wasm_parse_int32((yyvsp[0].text).start, (yyvsp[0].text).start + (yyvsp[0].text).length, &(yyval.u32),
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&(yylsp[0]), lexer, parser,
- "invalid alignment \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].text)));
+ wasm_ast_parser_error(&(yylsp[0]), lexer, parser,
+ "invalid alignment \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].text)));
}
}
-#line 2034 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2034 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 23:
-#line 302 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 302 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.expr) = (yyvsp[-1].expr); (yyval.expr)->loc = (yylsp[-2]); }
-#line 2040 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2040 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 24:
-#line 305 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 305 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_empty_expr(parser->allocator, WASM_EXPR_TYPE_NOP);
CHECK_ALLOC_NULL((yyval.expr));
}
-#line 2049 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2049 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 25:
-#line 309 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 309 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = new_block_expr_with_list(parser->allocator, &(yyvsp[-1].text), &(yyvsp[0].exprs));
CHECK_ALLOC_NULL((yyval.expr));
}
-#line 2058 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2058 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 26:
-#line 313 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 313 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_if_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2067,11 +2067,11 @@ yyreduce:
CHECK_ALLOC_NULL(true_block);
(yyval.expr)->if_.true_ = true_block;
}
-#line 2071 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2071 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 27:
-#line 321 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 321 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_if_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2081,11 +2081,11 @@ yyreduce:
CHECK_ALLOC_NULL(true_block);
(yyval.expr)->if_.true_ = true_block;
}
-#line 2085 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2085 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 28:
-#line 330 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 330 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_if_else_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2097,11 +2097,11 @@ yyreduce:
CHECK_ALLOC_NULL(false_block);
(yyval.expr)->if_else.false_ = false_block;
}
-#line 2101 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2101 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 29:
-#line 341 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 341 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_if_else_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2115,22 +2115,22 @@ yyreduce:
CHECK_ALLOC_NULL(false_block);
(yyval.expr)->if_else.false_ = false_block;
}
-#line 2119 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2119 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 30:
-#line 354 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 354 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_br_if_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->br_if.var = (yyvsp[-1].var);
(yyval.expr)->br_if.cond = (yyvsp[0].expr);
}
-#line 2130 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2130 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 31:
-#line 360 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 360 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_br_if_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2138,11 +2138,11 @@ yyreduce:
(yyval.expr)->br_if.expr = (yyvsp[-1].expr);
(yyval.expr)->br_if.cond = (yyvsp[0].expr);
}
-#line 2142 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2142 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 32:
-#line 367 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 367 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_loop_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2150,11 +2150,11 @@ yyreduce:
(yyval.expr)->loop.inner = (yyvsp[-1].text);
(yyval.expr)->loop.exprs = (yyvsp[0].exprs);
}
-#line 2154 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2154 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 33:
-#line 374 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 374 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_loop_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2162,11 +2162,11 @@ yyreduce:
(yyval.expr)->loop.inner = (yyvsp[-1].text);
(yyval.expr)->loop.exprs = (yyvsp[0].exprs);
}
-#line 2166 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2166 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 34:
-#line 381 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 381 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_br_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2175,32 +2175,32 @@ yyreduce:
(yyval.expr)->br.var.index = 0;
(yyval.expr)->br.expr = (yyvsp[0].expr);
}
-#line 2179 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2179 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 35:
-#line 389 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 389 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_br_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->br.var = (yyvsp[-1].var);
(yyval.expr)->br.expr = (yyvsp[0].expr);
}
-#line 2190 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2190 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 36:
-#line 395 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 395 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_return_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->return_.expr = (yyvsp[0].expr);
}
-#line 2200 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2200 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 37:
-#line 400 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 400 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_br_table_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2208,33 +2208,33 @@ yyreduce:
(yyval.expr)->br_table.targets = (yyvsp[-2].vars);
(yyval.expr)->br_table.default_target = (yyvsp[-1].var);
}
-#line 2212 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2212 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 38:
-#line 407 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 407 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_call_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->call.var = (yyvsp[-1].var);
(yyval.expr)->call.args = (yyvsp[0].exprs);
}
-#line 2223 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2223 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 39:
-#line 413 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 413 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_call_import_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->call.var = (yyvsp[-1].var);
(yyval.expr)->call.args = (yyvsp[0].exprs);
}
-#line 2234 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2234 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 40:
-#line 419 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 419 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_call_indirect_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2242,32 +2242,32 @@ yyreduce:
(yyval.expr)->call_indirect.expr = (yyvsp[-1].expr);
(yyval.expr)->call_indirect.args = (yyvsp[0].exprs);
}
-#line 2246 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2246 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 41:
-#line 426 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 426 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_get_local_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->get_local.var = (yyvsp[0].var);
}
-#line 2256 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2256 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 42:
-#line 431 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 431 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_set_local_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->set_local.var = (yyvsp[-1].var);
(yyval.expr)->set_local.expr = (yyvsp[0].expr);
}
-#line 2267 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2267 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 43:
-#line 437 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 437 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_load_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2276,11 +2276,11 @@ yyreduce:
(yyval.expr)->load.align = (yyvsp[-1].u32);
(yyval.expr)->load.addr = (yyvsp[0].expr);
}
-#line 2280 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2280 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 44:
-#line 445 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 445 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_store_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2290,11 +2290,11 @@ yyreduce:
(yyval.expr)->store.addr = (yyvsp[-1].expr);
(yyval.expr)->store.value = (yyvsp[0].expr);
}
-#line 2294 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2294 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 45:
-#line 454 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 454 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_const_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2302,28 +2302,28 @@ yyreduce:
if (WASM_FAILED(parse_const((yyvsp[-1].type), (yyvsp[0].literal).type, (yyvsp[0].literal).text.start,
(yyvsp[0].literal).text.start + (yyvsp[0].literal).text.length,
&(yyval.expr)->const_))) {
- wasm_parser_error(&(yylsp[0]), lexer, parser,
- "invalid literal \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
+ wasm_ast_parser_error(&(yylsp[0]), lexer, parser,
+ "invalid literal \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
}
wasm_free(parser->allocator, (char*)(yyvsp[0].literal).text.start);
}
-#line 2312 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2312 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 46:
-#line 467 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 467 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_unary_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->unary.opcode = (yyvsp[-1].opcode);
(yyval.expr)->unary.expr = (yyvsp[0].expr);
}
-#line 2323 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2323 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 47:
-#line 473 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 473 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_binary_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2331,11 +2331,11 @@ yyreduce:
(yyval.expr)->binary.left = (yyvsp[-1].expr);
(yyval.expr)->binary.right = (yyvsp[0].expr);
}
-#line 2335 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2335 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 48:
-#line 480 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 480 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_select_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2343,11 +2343,11 @@ yyreduce:
(yyval.expr)->select.false_ = (yyvsp[-1].expr);
(yyval.expr)->select.cond = (yyvsp[0].expr);
}
-#line 2347 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2347 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 49:
-#line 487 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 487 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_compare_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
@@ -2355,80 +2355,80 @@ yyreduce:
(yyval.expr)->compare.left = (yyvsp[-1].expr);
(yyval.expr)->compare.right = (yyvsp[0].expr);
}
-#line 2359 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2359 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 50:
-#line 494 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 494 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_convert_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->convert.opcode = (yyvsp[-1].opcode);
(yyval.expr)->convert.expr = (yyvsp[0].expr);
}
-#line 2370 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2370 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 51:
-#line 500 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 500 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_empty_expr(parser->allocator, WASM_EXPR_TYPE_UNREACHABLE);
CHECK_ALLOC_NULL((yyval.expr));
}
-#line 2379 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2379 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 52:
-#line 504 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 504 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_empty_expr(parser->allocator, WASM_EXPR_TYPE_MEMORY_SIZE);
CHECK_ALLOC_NULL((yyval.expr));
}
-#line 2388 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2388 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 53:
-#line 508 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 508 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.expr) = wasm_new_grow_memory_expr(parser->allocator);
CHECK_ALLOC_NULL((yyval.expr));
(yyval.expr)->grow_memory.expr = (yyvsp[0].expr);
}
-#line 2398 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2398 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 54:
-#line 515 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 515 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.expr) = NULL; }
-#line 2404 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2404 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 56:
-#line 519 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 519 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
WASM_ZERO_MEMORY((yyval.exprs));
CHECK_ALLOC(wasm_append_expr_ptr_value(parser->allocator, &(yyval.exprs), &(yyvsp[0].expr)));
}
-#line 2413 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2413 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 57:
-#line 523 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 523 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.exprs) = (yyvsp[-1].exprs);
CHECK_ALLOC(wasm_append_expr_ptr_value(parser->allocator, &(yyval.exprs), &(yyvsp[0].expr)));
}
-#line 2422 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2422 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 58:
-#line 529 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 529 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.exprs)); }
-#line 2428 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2428 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 60:
-#line 535 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 535 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field(parser->allocator);
CHECK_ALLOC_NULL((yyval.func_fields));
@@ -2436,22 +2436,22 @@ yyreduce:
(yyval.func_fields)->exprs = (yyvsp[0].exprs);
(yyval.func_fields)->next = NULL;
}
-#line 2440 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2440 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 61:
-#line 542 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 542 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field(parser->allocator);
(yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_PARAM_TYPES;
(yyval.func_fields)->types = (yyvsp[-2].types);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 2451 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2451 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 62:
-#line 548 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 548 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field(parser->allocator);
(yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_BOUND_PARAM;
@@ -2460,33 +2460,33 @@ yyreduce:
(yyval.func_fields)->bound_type.type = (yyvsp[-2].type);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 2464 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2464 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 63:
-#line 556 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 556 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field(parser->allocator);
(yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_RESULT_TYPE;
(yyval.func_fields)->result_type = (yyvsp[-2].type);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 2475 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2475 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 64:
-#line 562 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 562 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field(parser->allocator);
(yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_LOCAL_TYPES;
(yyval.func_fields)->types = (yyvsp[-2].types);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 2486 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2486 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 65:
-#line 568 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 568 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_fields) = new_func_field(parser->allocator);
(yyval.func_fields)->type = WASM_FUNC_FIELD_TYPE_BOUND_LOCAL;
@@ -2495,17 +2495,17 @@ yyreduce:
(yyval.func_fields)->bound_type.type = (yyvsp[-2].type);
(yyval.func_fields)->next = (yyvsp[0].func_fields);
}
-#line 2499 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2499 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 66:
-#line 578 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 578 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.var) = (yyvsp[-1].var); }
-#line 2505 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2505 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 67:
-#line 581 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 581 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func) = new_func(parser->allocator);
CHECK_ALLOC_NULL((yyval.func));
@@ -2568,22 +2568,22 @@ yyreduce:
field = next;
}
}
-#line 2572 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2572 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 68:
-#line 645 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 645 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func) = (yyvsp[-1].func);
(yyval.func)->loc = (yylsp[-3]);
(yyval.func)->decl.flags |= WASM_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE;
(yyval.func)->decl.type_var = (yyvsp[-2].var);
}
-#line 2583 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2583 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 69:
-#line 651 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 651 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func) = (yyvsp[-1].func);
(yyval.func)->loc = (yylsp[-4]);
@@ -2591,153 +2591,154 @@ yyreduce:
(yyval.func)->decl.type_var = (yyvsp[-2].var);
(yyval.func)->name = (yyvsp[-3].text);
}
-#line 2595 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2595 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 70:
-#line 658 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 658 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func) = (yyvsp[-1].func);
(yyval.func)->loc = (yylsp[-2]);
(yyval.func)->decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_SIGNATURE;
}
-#line 2605 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2605 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 71:
-#line 663 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 663 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func) = (yyvsp[-1].func);
(yyval.func)->loc = (yylsp[-3]);
(yyval.func)->decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_SIGNATURE;
(yyval.func)->name = (yyvsp[-2].text);
}
-#line 2616 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2616 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 72:
-#line 674 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 674 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.var) = (yyvsp[-1].var); }
-#line 2622 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2622 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 73:
-#line 678 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 678 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
if (WASM_FAILED(wasm_parse_int32((yyvsp[0].literal).text.start,
(yyvsp[0].literal).text.start + (yyvsp[0].literal).text.length, &(yyval.u32),
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&(yylsp[0]), lexer, parser,
- "invalid memory segment address \"" PRIstringslice
- "\"",
- WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
+ wasm_ast_parser_error(&(yylsp[0]), lexer, parser,
+ "invalid memory segment address \"" PRIstringslice
+ "\"",
+ WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
}
}
-#line 2637 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2637 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 74:
-#line 691 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 691 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.segment).loc = (yylsp[-3]);
(yyval.segment).data = (yyvsp[-1].segment).data;
(yyval.segment).size = (yyvsp[-1].segment).size;
(yyval.segment).addr = (yyvsp[-2].u32);
}
-#line 2648 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2648 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 75:
-#line 699 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 699 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.segments)); }
-#line 2654 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2654 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 76:
-#line 700 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 700 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.segments) = (yyvsp[-1].segments);
CHECK_ALLOC(wasm_append_segment_value(parser->allocator, &(yyval.segments), &(yyvsp[0].segment)));
}
-#line 2663 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2663 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 77:
-#line 707 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 707 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
if (WASM_FAILED(wasm_parse_int32((yyvsp[0].literal).text.start,
(yyvsp[0].literal).text.start + (yyvsp[0].literal).text.length, &(yyval.u32),
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&(yylsp[0]), lexer, parser,
- "invalid initial memory pages \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
+ wasm_ast_parser_error(&(yylsp[0]), lexer, parser,
+ "invalid initial memory pages \"" PRIstringslice
+ "\"",
+ WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
}
}
-#line 2677 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2678 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 78:
-#line 719 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 720 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
if (WASM_FAILED(wasm_parse_int32((yyvsp[0].literal).text.start,
(yyvsp[0].literal).text.start + (yyvsp[0].literal).text.length, &(yyval.u32),
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&(yylsp[0]), lexer, parser,
- "invalid max memory pages \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
+ wasm_ast_parser_error(&(yylsp[0]), lexer, parser,
+ "invalid max memory pages \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG((yyvsp[0].literal).text));
}
}
-#line 2691 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2692 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 79:
-#line 731 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 732 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.memory).loc = (yylsp[-4]);
(yyval.memory).initial_pages = (yyvsp[-3].u32);
(yyval.memory).max_pages = (yyvsp[-2].u32);
(yyval.memory).segments = (yyvsp[-1].segments);
}
-#line 2702 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2703 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 80:
-#line 737 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 738 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.memory).loc = (yylsp[-3]);
(yyval.memory).initial_pages = (yyvsp[-2].u32);
(yyval.memory).max_pages = (yyval.memory).initial_pages;
(yyval.memory).segments = (yyvsp[-1].segments);
}
-#line 2713 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2714 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 81:
-#line 746 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 747 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
WASM_ZERO_MEMORY((yyval.func_type));
(yyval.func_type).sig = (yyvsp[-2].func_sig);
}
-#line 2722 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2723 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 82:
-#line 750 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 751 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.func_type).name = (yyvsp[-5].text);
(yyval.func_type).sig = (yyvsp[-2].func_sig);
}
-#line 2731 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2732 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 83:
-#line 757 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 758 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.vars) = (yyvsp[-1].vars); }
-#line 2737 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2738 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 84:
-#line 761 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 762 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import(parser->allocator);
(yyval.import)->module_name = (yyvsp[-3].text);
@@ -2745,11 +2746,11 @@ yyreduce:
(yyval.import)->decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE;
(yyval.import)->decl.type_var = (yyvsp[-1].var);
}
-#line 2749 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2750 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 85:
-#line 768 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 769 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import(parser->allocator);
(yyval.import)->name = (yyvsp[-4].text);
@@ -2758,11 +2759,11 @@ yyreduce:
(yyval.import)->decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_FUNC_TYPE;
(yyval.import)->decl.type_var = (yyvsp[-1].var);
}
-#line 2762 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2763 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 86:
-#line 776 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 777 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import(parser->allocator);
(yyval.import)->module_name = (yyvsp[-3].text);
@@ -2770,11 +2771,11 @@ yyreduce:
(yyval.import)->decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_SIGNATURE;
(yyval.import)->decl.sig = (yyvsp[-1].func_sig);
}
-#line 2774 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2775 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 87:
-#line 783 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 784 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.import) = new_import(parser->allocator);
(yyval.import)->name = (yyvsp[-4].text);
@@ -2783,36 +2784,36 @@ yyreduce:
(yyval.import)->decl.flags = WASM_FUNC_DECLARATION_FLAG_HAS_SIGNATURE;
(yyval.import)->decl.sig = (yyvsp[-1].func_sig);
}
-#line 2787 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2788 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 88:
-#line 794 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 795 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.export_).name = (yyvsp[-2].text);
(yyval.export_).var = (yyvsp[-1].var);
}
-#line 2796 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2797 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 89:
-#line 801 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 802 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.export_memory).name = (yyvsp[-2].text);
}
-#line 2804 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2805 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 90:
-#line 807 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 808 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = new_module(parser->allocator);
}
-#line 2812 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2813 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 91:
-#line 810 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 811 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module));
@@ -2822,11 +2823,11 @@ yyreduce:
field->func = *(yyvsp[0].func);
wasm_free(parser->allocator, (yyvsp[0].func));
}
-#line 2826 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2827 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 92:
-#line 819 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 820 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module));
@@ -2836,11 +2837,11 @@ yyreduce:
field->import = *(yyvsp[0].import);
wasm_free(parser->allocator, (yyvsp[0].import));
}
-#line 2840 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2841 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 93:
-#line 828 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 829 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module));
@@ -2849,11 +2850,11 @@ yyreduce:
field->type = WASM_MODULE_FIELD_TYPE_EXPORT;
field->export_ = (yyvsp[0].export_);
}
-#line 2853 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2854 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 94:
-#line 836 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 837 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module));
@@ -2862,11 +2863,11 @@ yyreduce:
field->type = WASM_MODULE_FIELD_TYPE_EXPORT_MEMORY;
field->export_memory = (yyvsp[0].export_memory);
}
-#line 2866 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2867 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 95:
-#line 844 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 845 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module));
@@ -2875,11 +2876,11 @@ yyreduce:
field->type = WASM_MODULE_FIELD_TYPE_TABLE;
field->table = (yyvsp[0].vars);
}
-#line 2879 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2880 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 96:
-#line 852 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 853 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module));
@@ -2888,11 +2889,11 @@ yyreduce:
field->type = WASM_MODULE_FIELD_TYPE_FUNC_TYPE;
field->func_type = (yyvsp[0].func_type);
}
-#line 2892 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2893 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 97:
-#line 860 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 861 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module));
@@ -2901,11 +2902,11 @@ yyreduce:
field->type = WASM_MODULE_FIELD_TYPE_MEMORY;
field->memory = (yyvsp[0].memory);
}
-#line 2905 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2906 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 98:
-#line 868 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 869 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
WasmModuleField* field = wasm_append_module_field(parser->allocator, (yyval.module));
@@ -2914,11 +2915,11 @@ yyreduce:
field->type = WASM_MODULE_FIELD_TYPE_START;
field->start = (yyvsp[0].var);
}
-#line 2918 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 2919 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 99:
-#line 878 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 879 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.module) = (yyvsp[-1].module);
(yyval.module)->loc = (yylsp[-2]);
@@ -3009,22 +3010,22 @@ yyreduce:
&import->decl));
}
}
-#line 3013 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3014 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 100:
-#line 974 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 975 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command(parser->allocator);
(yyval.command)->type = WASM_COMMAND_TYPE_MODULE;
(yyval.command)->module = *(yyvsp[0].module);
wasm_free(parser->allocator, (yyvsp[0].module));
}
-#line 3024 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3025 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 101:
-#line 980 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 981 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command(parser->allocator);
(yyval.command)->type = WASM_COMMAND_TYPE_INVOKE;
@@ -3032,11 +3033,11 @@ yyreduce:
(yyval.command)->invoke.name = (yyvsp[-2].text);
(yyval.command)->invoke.args = (yyvsp[-1].consts);
}
-#line 3036 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3037 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 102:
-#line 987 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 988 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command(parser->allocator);
(yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_INVALID;
@@ -3044,11 +3045,11 @@ yyreduce:
(yyval.command)->assert_invalid.text = (yyvsp[-1].text);
wasm_free(parser->allocator, (yyvsp[-2].module));
}
-#line 3048 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3049 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 103:
-#line 994 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 995 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command(parser->allocator);
(yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_RETURN;
@@ -3057,11 +3058,11 @@ yyreduce:
(yyval.command)->assert_return.invoke.args = (yyvsp[-3].consts);
(yyval.command)->assert_return.expected = (yyvsp[-1].const_);
}
-#line 3061 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3062 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 104:
-#line 1002 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1003 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command(parser->allocator);
(yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_RETURN_NAN;
@@ -3069,11 +3070,11 @@ yyreduce:
(yyval.command)->assert_return_nan.invoke.name = (yyvsp[-3].text);
(yyval.command)->assert_return_nan.invoke.args = (yyvsp[-2].consts);
}
-#line 3073 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3074 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 105:
-#line 1009 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1010 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.command) = new_command(parser->allocator);
(yyval.command)->type = WASM_COMMAND_TYPE_ASSERT_TRAP;
@@ -3082,72 +3083,72 @@ yyreduce:
(yyval.command)->assert_trap.invoke.args = (yyvsp[-3].consts);
(yyval.command)->assert_trap.text = (yyvsp[-1].text);
}
-#line 3086 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3087 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 106:
-#line 1019 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1020 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.commands)); }
-#line 3092 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3093 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 107:
-#line 1020 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1021 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.commands) = (yyvsp[-1].commands);
CHECK_ALLOC(wasm_append_command_value(parser->allocator, &(yyval.commands), (yyvsp[0].command)));
wasm_free(parser->allocator, (yyvsp[0].command));
}
-#line 3102 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3103 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 108:
-#line 1028 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1029 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.const_).loc = (yylsp[-2]);
if (WASM_FAILED(parse_const((yyvsp[-2].type), (yyvsp[-1].literal).type, (yyvsp[-1].literal).text.start,
(yyvsp[-1].literal).text.start + (yyvsp[-1].literal).text.length, &(yyval.const_)))) {
- wasm_parser_error(&(yylsp[-1]), lexer, parser,
- "invalid literal \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG((yyvsp[-1].literal).text));
+ wasm_ast_parser_error(&(yylsp[-1]), lexer, parser,
+ "invalid literal \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG((yyvsp[-1].literal).text));
}
wasm_free(parser->allocator, (char*)(yyvsp[-1].literal).text.start);
}
-#line 3117 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3118 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 109:
-#line 1040 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1041 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ (yyval.const_).type = WASM_TYPE_VOID; }
-#line 3123 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3124 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 111:
-#line 1044 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1045 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{ WASM_ZERO_MEMORY((yyval.consts)); }
-#line 3129 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3130 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 112:
-#line 1045 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1046 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.consts) = (yyvsp[-1].consts);
CHECK_ALLOC(wasm_append_const_value(parser->allocator, &(yyval.consts), &(yyvsp[0].const_)));
}
-#line 3138 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3139 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
case 113:
-#line 1052 "src/wasm-bison-parser.y" /* yacc.c:1646 */
+#line 1053 "src/wasm-ast-parser.y" /* yacc.c:1646 */
{
(yyval.script).commands = (yyvsp[0].commands);
parser->script = (yyval.script);
}
-#line 3147 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3148 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
break;
-#line 3151 "src/prebuilt/wasm-bison-parser.c" /* yacc.c:1646 */
+#line 3152 "src/prebuilt/wasm-ast-parser-gen.c" /* yacc.c:1646 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -3382,7 +3383,7 @@ yyreturn:
#endif
return yyresult;
}
-#line 1064 "src/wasm-bison-parser.y" /* yacc.c:1906 */
+#line 1065 "src/wasm-ast-parser.y" /* yacc.c:1906 */
static WasmResult parse_const(WasmType type,
@@ -3478,16 +3479,16 @@ static WasmResult dup_string_contents(WasmAllocator* allocator,
return WASM_OK;
}
-WasmResult wasm_parse(WasmLexer* lexer,
- struct WasmScript* out_script,
- WasmSourceErrorHandler* error_handler) {
- WasmParser parser;
+WasmResult wasm_parse_ast(WasmAstLexer* lexer,
+ struct WasmScript* out_script,
+ WasmSourceErrorHandler* error_handler) {
+ WasmAstParser parser;
WASM_ZERO_MEMORY(parser);
- WasmAllocator* allocator = wasm_lexer_get_allocator(lexer);
+ WasmAllocator* allocator = wasm_ast_lexer_get_allocator(lexer);
parser.allocator = allocator;
parser.error_handler = error_handler;
out_script->allocator = allocator;
- int result = wasm_parser_parse(lexer, &parser);
+ int result = wasm_ast_parser_parse(lexer, &parser);
out_script->commands = parser.script.commands;
return result == 0 && parser.errors == 0 ? WASM_OK : WASM_ERROR;
}
diff --git a/src/prebuilt/wasm-bison-parser.h b/src/prebuilt/wasm-ast-parser-gen.h
index fdf87abf..6e1d5bbf 100644
--- a/src/prebuilt/wasm-bison-parser.h
+++ b/src/prebuilt/wasm-ast-parser-gen.h
@@ -30,28 +30,28 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
-#ifndef YY_WASM_PARSER_SRC_PREBUILT_WASM_BISON_PARSER_H_INCLUDED
-# define YY_WASM_PARSER_SRC_PREBUILT_WASM_BISON_PARSER_H_INCLUDED
+#ifndef YY_WASM_AST_PARSER_SRC_PREBUILT_WASM_AST_PARSER_GEN_H_INCLUDED
+# define YY_WASM_AST_PARSER_SRC_PREBUILT_WASM_AST_PARSER_GEN_H_INCLUDED
/* Debug traces. */
-#ifndef WASM_PARSER_DEBUG
+#ifndef WASM_AST_PARSER_DEBUG
# if defined YYDEBUG
#if YYDEBUG
-# define WASM_PARSER_DEBUG 1
+# define WASM_AST_PARSER_DEBUG 1
# else
-# define WASM_PARSER_DEBUG 0
+# define WASM_AST_PARSER_DEBUG 0
# endif
# else /* ! defined YYDEBUG */
-# define WASM_PARSER_DEBUG 0
+# define WASM_AST_PARSER_DEBUG 0
# endif /* ! defined YYDEBUG */
-#endif /* ! defined WASM_PARSER_DEBUG */
-#if WASM_PARSER_DEBUG
-extern int wasm_parser_debug;
+#endif /* ! defined WASM_AST_PARSER_DEBUG */
+#if WASM_AST_PARSER_DEBUG
+extern int wasm_ast_parser_debug;
#endif
/* Token type. */
-#ifndef WASM_PARSER_TOKENTYPE
-# define WASM_PARSER_TOKENTYPE
- enum wasm_parser_tokentype
+#ifndef WASM_AST_PARSER_TOKENTYPE
+# define WASM_AST_PARSER_TOKENTYPE
+ enum wasm_ast_parser_tokentype
{
WASM_TOKEN_TYPE_EOF = 0,
WASM_TOKEN_TYPE_LPAR = 258,
@@ -112,28 +112,28 @@ extern int wasm_parser_debug;
#endif
/* Value type. */
-#if ! defined WASM_PARSER_STYPE && ! defined WASM_PARSER_STYPE_IS_DECLARED
-typedef WasmToken WASM_PARSER_STYPE;
-# define WASM_PARSER_STYPE_IS_TRIVIAL 1
-# define WASM_PARSER_STYPE_IS_DECLARED 1
+#if ! defined WASM_AST_PARSER_STYPE && ! defined WASM_AST_PARSER_STYPE_IS_DECLARED
+typedef WasmToken WASM_AST_PARSER_STYPE;
+# define WASM_AST_PARSER_STYPE_IS_TRIVIAL 1
+# define WASM_AST_PARSER_STYPE_IS_DECLARED 1
#endif
/* Location type. */
-#if ! defined WASM_PARSER_LTYPE && ! defined WASM_PARSER_LTYPE_IS_DECLARED
-typedef struct WASM_PARSER_LTYPE WASM_PARSER_LTYPE;
-struct WASM_PARSER_LTYPE
+#if ! defined WASM_AST_PARSER_LTYPE && ! defined WASM_AST_PARSER_LTYPE_IS_DECLARED
+typedef struct WASM_AST_PARSER_LTYPE WASM_AST_PARSER_LTYPE;
+struct WASM_AST_PARSER_LTYPE
{
int first_line;
int first_column;
int last_line;
int last_column;
};
-# define WASM_PARSER_LTYPE_IS_DECLARED 1
-# define WASM_PARSER_LTYPE_IS_TRIVIAL 1
+# define WASM_AST_PARSER_LTYPE_IS_DECLARED 1
+# define WASM_AST_PARSER_LTYPE_IS_TRIVIAL 1
#endif
-int wasm_parser_parse (WasmLexer* lexer, WasmParser* parser);
+int wasm_ast_parser_parse (WasmAstLexer* lexer, WasmAstParser* parser);
-#endif /* !YY_WASM_PARSER_SRC_PREBUILT_WASM_BISON_PARSER_H_INCLUDED */
+#endif /* !YY_WASM_AST_PARSER_SRC_PREBUILT_WASM_AST_PARSER_GEN_H_INCLUDED */
diff --git a/src/sexpr-wasm.c b/src/sexpr-wasm.c
index 2c2622b4..0a12d6e0 100644
--- a/src/sexpr-wasm.c
+++ b/src/sexpr-wasm.c
@@ -23,12 +23,12 @@
#include "wasm-ast.h"
#include "wasm-ast-checker.h"
+#include "wasm-ast-parser.h"
#include "wasm-binary-writer.h"
#include "wasm-binary-writer-spec.h"
#include "wasm-common.h"
#include "wasm-mark-used-blocks.h"
#include "wasm-option-parser.h"
-#include "wasm-parser.h"
#include "wasm-stack-allocator.h"
#include "wasm-stream.h"
#include "wasm-writer.h"
@@ -373,12 +373,12 @@ int main(int argc, char** argv) {
allocator = &stack_allocator.allocator;
}
- WasmLexer* lexer = wasm_new_file_lexer(allocator, s_infile);
+ WasmAstLexer* lexer = wasm_new_ast_file_lexer(allocator, s_infile);
if (!lexer)
WASM_FATAL("unable to read %s\n", s_infile);
WasmScript script;
- WasmResult result = wasm_parse(lexer, &script, &s_error_handler);
+ WasmResult result = wasm_parse_ast(lexer, &script, &s_error_handler);
if (WASM_SUCCEEDED(result)) {
result = wasm_check_ast(lexer, &script, &s_error_handler);
@@ -426,7 +426,7 @@ int main(int argc, char** argv) {
}
}
- wasm_destroy_lexer(lexer);
+ wasm_destroy_ast_lexer(lexer);
if (s_use_libc_allocator)
wasm_destroy_script(&script);
diff --git a/src/wasm-ast-checker.c b/src/wasm-ast-checker.c
index d2c31e99..7f6ac82e 100644
--- a/src/wasm-ast-checker.c
+++ b/src/wasm-ast-checker.c
@@ -22,7 +22,7 @@
#include <stdarg.h>
#include <stdio.h>
-#include "wasm-parser-lexer-shared.h"
+#include "wasm-ast-parser-lexer-shared.h"
static const char* s_type_names[] = {
"void", "i32", "i64", "f32", "f64",
@@ -88,7 +88,7 @@ typedef struct WasmLabelNode {
typedef struct WasmContext {
WasmSourceErrorHandler* error_handler;
- WasmLexer* lexer;
+ WasmAstLexer* lexer;
const WasmModule* last_module;
WasmLabelNode* top_label;
int max_depth;
@@ -102,7 +102,7 @@ static void WASM_PRINTF_FORMAT(3, 4) print_error(WasmContext* ctx,
ctx->result = WASM_ERROR;
va_list args;
va_start(args, fmt);
- wasm_format_error(ctx->error_handler, loc, ctx->lexer, fmt, args);
+ wasm_ast_format_error(ctx->error_handler, loc, ctx->lexer, fmt, args);
va_end(args);
}
@@ -933,7 +933,7 @@ static void check_command(WasmContext* ctx, const WasmCommand* command) {
}
}
-WasmResult wasm_check_ast(WasmLexer* lexer,
+WasmResult wasm_check_ast(WasmAstLexer* lexer,
const struct WasmScript* script,
WasmSourceErrorHandler* error_handler) {
WasmContext ctx;
@@ -948,7 +948,7 @@ WasmResult wasm_check_ast(WasmLexer* lexer,
}
WasmResult wasm_check_assert_invalid(
- WasmLexer* lexer,
+ WasmAstLexer* lexer,
const struct WasmScript* script,
WasmSourceErrorHandler* assert_invalid_error_handler,
WasmSourceErrorHandler* error_handler) {
diff --git a/src/wasm-ast-checker.h b/src/wasm-ast-checker.h
index 034fa238..e88386db 100644
--- a/src/wasm-ast-checker.h
+++ b/src/wasm-ast-checker.h
@@ -17,20 +17,20 @@
#ifndef WASM_AST_CHECKER_H_
#define WASM_AST_CHECKER_H_
+#include "wasm-ast-lexer.h"
#include "wasm-common.h"
-#include "wasm-lexer.h"
struct WasmAllocator;
struct WasmModule;
struct WasmScript;
WASM_EXTERN_C_BEGIN
-WasmResult wasm_check_ast(WasmLexer*,
+WasmResult wasm_check_ast(WasmAstLexer*,
const struct WasmScript*,
WasmSourceErrorHandler*);
WasmResult wasm_check_assert_invalid(
- WasmLexer*,
+ WasmAstLexer*,
const struct WasmScript*,
WasmSourceErrorHandler* assert_invalid_error_handler,
WasmSourceErrorHandler* error_handler);
diff --git a/src/wasm-lexer.c b/src/wasm-ast-lexer.c
index f5d38dc8..3b11a305 100644
--- a/src/wasm-lexer.c
+++ b/src/wasm-ast-lexer.c
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "wasm-lexer.h"
+#include "wasm-ast-lexer.h"
#include <assert.h>
#include <stdio.h>
@@ -22,12 +22,12 @@
#include "wasm-config.h"
#include "wasm-allocator.h"
-#include "wasm-parser.h"
-#include "wasm-parser-lexer-shared.h"
+#include "wasm-ast-parser.h"
+#include "wasm-ast-parser-lexer-shared.h"
#include "wasm-vector.h"
/* must be included after so some typedefs will be defined */
-#include "wasm-bison-parser.h"
+#include "wasm-ast-parser-gen.h"
/*!max:re2c */
@@ -47,7 +47,7 @@
#define ERROR(...) \
YY_USER_ACTION; \
- wasm_parser_error(loc, lexer, parser, __VA_ARGS__)
+ wasm_ast_parser_error(loc, lexer, parser, __VA_ARGS__)
#define BEGIN(c) \
do { \
@@ -93,8 +93,8 @@
lval->literal.text.length = yyleng
static WasmResult fill(WasmLocation* loc,
- WasmLexer* lexer,
- WasmParser* parser,
+ WasmAstLexer* lexer,
+ WasmAstParser* parser,
size_t need) {
if (lexer->eof)
return WASM_ERROR;
@@ -117,8 +117,8 @@ static WasmResult fill(WasmLocation* loc,
char* new_buffer = wasm_realloc(lexer->allocator, lexer->buffer,
new_buffer_size, WASM_DEFAULT_ALIGN);
if (new_buffer == NULL) {
- wasm_parser_error(loc, lexer, parser,
- "unable to reallocate lexer buffer.");
+ wasm_ast_parser_error(loc, lexer, parser,
+ "unable to reallocate lexer buffer.");
return WASM_ERROR;
}
memmove(new_buffer, lexer->token, lexer->limit - lexer->token);
@@ -166,10 +166,10 @@ static WasmResult fill(WasmLocation* loc,
return WASM_OK;
}
-int wasm_lexer_lex(WASM_PARSER_STYPE* lval,
- WASM_PARSER_LTYPE* loc,
- WasmLexer* lexer,
- WasmParser* parser) {
+int wasm_ast_lexer_lex(WASM_AST_PARSER_STYPE* lval,
+ WASM_AST_PARSER_LTYPE* loc,
+ WasmAstLexer* lexer,
+ WasmAstParser* parser) {
enum {
YYCOND_INIT,
YYCOND_BAD_TEXT,
@@ -450,11 +450,11 @@ int wasm_lexer_lex(WASM_PARSER_STYPE* lval,
}
}
-static WasmLexer* wasm_new_lexer(WasmAllocator* allocator,
- WasmLexerSourceType type,
- const char* filename) {
- WasmLexer* lexer =
- wasm_alloc_zero(allocator, sizeof(WasmLexer), WASM_DEFAULT_ALIGN);
+static WasmAstLexer* wasm_new_lexer(WasmAllocator* allocator,
+ WasmAstLexerSourceType type,
+ const char* filename) {
+ WasmAstLexer* lexer =
+ wasm_alloc_zero(allocator, sizeof(WasmAstLexer), WASM_DEFAULT_ALIGN);
lexer->allocator = allocator;
lexer->line = 1;
lexer->filename = filename;
@@ -462,21 +462,24 @@ static WasmLexer* wasm_new_lexer(WasmAllocator* allocator,
return lexer;
}
-WasmLexer* wasm_new_file_lexer(WasmAllocator* allocator, const char* filename) {
- WasmLexer* lexer =
+WasmAstLexer* wasm_new_ast_file_lexer(WasmAllocator* allocator,
+ const char* filename) {
+ WasmAstLexer* lexer =
wasm_new_lexer(allocator, WASM_LEXER_SOURCE_TYPE_FILE, filename);
lexer->source.file = fopen(filename, "r");
if (!lexer->source.file) {
- wasm_destroy_lexer(lexer);
+ wasm_destroy_ast_lexer(lexer);
wasm_free(allocator, lexer);
return NULL;
}
return lexer;
}
-WasmLexer* wasm_new_buffer_lexer(WasmAllocator* allocator, const char* filename,
- const void* data, size_t size) {
- WasmLexer* lexer =
+WasmAstLexer* wasm_new_ast_buffer_lexer(WasmAllocator* allocator,
+ const char* filename,
+ const void* data,
+ size_t size) {
+ WasmAstLexer* lexer =
wasm_new_lexer(allocator, WASM_LEXER_SOURCE_TYPE_BUFFER, filename);
lexer->source.buffer.data = data;
lexer->source.buffer.size = size;
@@ -484,14 +487,14 @@ WasmLexer* wasm_new_buffer_lexer(WasmAllocator* allocator, const char* filename,
return lexer;
}
-void wasm_destroy_lexer(WasmLexer* lexer) {
+void wasm_destroy_ast_lexer(WasmAstLexer* lexer) {
if (lexer->source.type == WASM_LEXER_SOURCE_TYPE_FILE && lexer->source.file)
fclose(lexer->source.file);
wasm_free(lexer->allocator, lexer->buffer);
wasm_free(lexer->allocator, lexer);
}
-WasmAllocator* wasm_lexer_get_allocator(WasmLexer* lexer) {
+WasmAllocator* wasm_ast_lexer_get_allocator(WasmAstLexer* lexer) {
return lexer->allocator;
}
@@ -543,7 +546,7 @@ static WasmResult scan_forward_for_line_offset_in_buffer(
}
static WasmResult scan_forward_for_line_offset_in_file(
- WasmLexer* lexer,
+ WasmAstLexer* lexer,
int line,
size_t line_start_offset,
WasmLineOffsetPosition find_position,
@@ -591,7 +594,7 @@ cleanup:
}
static WasmResult scan_forward_for_line_offset(
- WasmLexer* lexer,
+ WasmAstLexer* lexer,
int line,
size_t line_start_offset,
WasmLineOffsetPosition find_position,
@@ -613,7 +616,7 @@ static WasmResult scan_forward_for_line_offset(
}
}
-static WasmResult get_line_start_offset(WasmLexer* lexer,
+static WasmResult get_line_start_offset(WasmAstLexer* lexer,
int line,
size_t* out_offset) {
int first_line = 1;
@@ -636,7 +639,7 @@ static WasmResult get_line_start_offset(WasmLexer* lexer,
}
}
-static WasmResult get_offsets_from_line(WasmLexer* lexer,
+static WasmResult get_offsets_from_line(WasmAstLexer* lexer,
int line,
size_t* out_line_start,
size_t* out_line_end) {
@@ -683,12 +686,12 @@ static void clamp_source_line_offsets_to_location(size_t line_start,
*out_new_line_end = line_end;
}
-WasmResult wasm_lexer_get_source_line(WasmLexer* lexer,
- const WasmLocation* loc,
- size_t line_max_length,
- char* line,
- size_t* out_line_length,
- int* out_column_offset) {
+WasmResult wasm_ast_lexer_get_source_line(WasmAstLexer* lexer,
+ const WasmLocation* loc,
+ size_t line_max_length,
+ char* line,
+ size_t* out_line_length,
+ int* out_column_offset) {
WasmResult result;
size_t line_start; /* inclusive */
size_t line_end; /* exclusive */
diff --git a/src/wasm-lexer.h b/src/wasm-ast-lexer.h
index f469a6fd..3fe05107 100644
--- a/src/wasm-lexer.h
+++ b/src/wasm-ast-lexer.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef WASM_LEXER_H_
-#define WASM_LEXER_H_
+#ifndef WASM_AST_LEXER_H_
+#define WASM_AST_LEXER_H_
#include <stddef.h>
#include <stdio.h>
@@ -25,13 +25,13 @@
struct WasmAllocator;
-typedef enum WasmLexerSourceType {
+typedef enum WasmAstLexerSourceType {
WASM_LEXER_SOURCE_TYPE_FILE,
WASM_LEXER_SOURCE_TYPE_BUFFER,
-} WasmLexerSourceType;
+} WasmAstLexerSourceType;
-typedef struct WasmLexerSource {
- WasmLexerSourceType type;
+typedef struct WasmAstLexerSource {
+ WasmAstLexerSourceType type;
union {
FILE* file;
struct {
@@ -40,11 +40,11 @@ typedef struct WasmLexerSource {
size_t read_offset;
} buffer;
};
-} WasmLexerSource;
+} WasmAstLexerSource;
-typedef struct WasmLexer {
+typedef struct WasmAstLexer {
struct WasmAllocator* allocator;
- WasmLexerSource source;
+ WasmAstLexerSource source;
const char* filename;
int line;
int comment_nesting;
@@ -59,16 +59,17 @@ typedef struct WasmLexer {
char* token;
char* cursor;
char* limit;
-} WasmLexer;
+} WasmAstLexer;
WASM_EXTERN_C_BEGIN
-WasmLexer* wasm_new_file_lexer(struct WasmAllocator*, const char* filename);
-WasmLexer* wasm_new_buffer_lexer(struct WasmAllocator*,
- const char* filename,
- const void* data,
- size_t size);
-void wasm_destroy_lexer(WasmLexer*);
+WasmAstLexer* wasm_new_ast_file_lexer(struct WasmAllocator*,
+ const char* filename);
+WasmAstLexer* wasm_new_ast_buffer_lexer(struct WasmAllocator*,
+ const char* filename,
+ const void* data,
+ size_t size);
+void wasm_destroy_ast_lexer(WasmAstLexer*);
WASM_EXTERN_C_END
-#endif /* WASM_LEXER_H_ */
+#endif /* WASM_AST_LEXER_H_ */
diff --git a/src/wasm-parser-lexer-shared.c b/src/wasm-ast-parser-lexer-shared.c
index 9e62aa7a..9c380282 100644
--- a/src/wasm-parser-lexer-shared.c
+++ b/src/wasm-ast-parser-lexer-shared.c
@@ -14,29 +14,29 @@
* limitations under the License.
*/
-#include "wasm-parser-lexer-shared.h"
+#include "wasm-ast-parser-lexer-shared.h"
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-void wasm_parser_error(WasmLocation* loc,
- WasmLexer* lexer,
- WasmParser* parser,
- const char* format,
- ...) {
+void wasm_ast_parser_error(WasmLocation* loc,
+ WasmAstLexer* lexer,
+ WasmAstParser* parser,
+ const char* format,
+ ...) {
parser->errors++;
va_list args;
va_start(args, format);
- wasm_format_error(parser->error_handler, loc, lexer, format, args);
+ wasm_ast_format_error(parser->error_handler, loc, lexer, format, args);
va_end(args);
}
-void wasm_format_error(WasmSourceErrorHandler* error_handler,
- const struct WasmLocation* loc,
- WasmLexer* lexer,
- const char* format,
- va_list args) {
+void wasm_ast_format_error(WasmSourceErrorHandler* error_handler,
+ const struct WasmLocation* loc,
+ WasmAstLexer* lexer,
+ const char* format,
+ va_list args) {
va_list args_copy;
va_copy(args_copy, args);
char fixed_buf[WASM_DEFAULT_SNPRINTF_ALLOCA_BUFSIZE];
@@ -53,9 +53,9 @@ void wasm_format_error(WasmSourceErrorHandler* error_handler,
size_t source_line_max_length = error_handler->source_line_max_length;
if (loc) {
source_line = alloca(source_line_max_length + 1);
- WasmResult result = wasm_lexer_get_source_line(
- lexer, loc, source_line_max_length, source_line,
- &source_line_length, &source_line_column_offset);
+ WasmResult result = wasm_ast_lexer_get_source_line(
+ lexer, loc, source_line_max_length, source_line, &source_line_length,
+ &source_line_column_offset);
if (WASM_FAILED(result)) {
/* if this fails, it means that we've probably screwed up the lexer. blow
* up. */
diff --git a/src/wasm-parser-lexer-shared.h b/src/wasm-ast-parser-lexer-shared.h
index 25178409..9b891e26 100644
--- a/src/wasm-parser-lexer-shared.h
+++ b/src/wasm-ast-parser-lexer-shared.h
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-#ifndef WASM_PARSER_LEXER_SHARED_H_
-#define WASM_PARSER_LEXER_SHARED_H_
+#ifndef WASM_AST_PARSER_LEXER_SHARED_H_
+#define WASM_AST_PARSER_LEXER_SHARED_H_
#include <stdarg.h>
#include "wasm-ast.h"
+#include "wasm-ast-lexer.h"
#include "wasm-common.h"
-#include "wasm-lexer.h"
-#define WASM_PARSER_STYPE WasmToken
-#define WASM_PARSER_LTYPE WasmLocation
-#define YYSTYPE WASM_PARSER_STYPE
-#define YYLTYPE WASM_PARSER_LTYPE
+#define WASM_AST_PARSER_STYPE WasmToken
+#define WASM_AST_PARSER_LTYPE WasmLocation
+#define YYSTYPE WASM_AST_PARSER_STYPE
+#define YYLTYPE WASM_AST_PARSER_LTYPE
#define WASM_INVALID_LINE_OFFSET ((size_t)~0)
@@ -67,35 +67,35 @@ typedef union WasmToken {
WasmScript script;
} WasmToken;
-typedef struct WasmParser {
+typedef struct WasmAstParser {
struct WasmAllocator* allocator;
WasmScript script;
WasmSourceErrorHandler* error_handler;
int errors;
-} WasmParser;
+} WasmAstParser;
WASM_EXTERN_C_BEGIN
-struct WasmAllocator* wasm_lexer_get_allocator(WasmLexer* lexer);
-int wasm_lexer_lex(union WasmToken*,
- struct WasmLocation*,
- WasmLexer*,
- struct WasmParser*);
-WasmResult wasm_lexer_get_source_line(WasmLexer*,
- const struct WasmLocation*,
- size_t line_max_length,
- char* line,
- size_t* out_line_length,
- int* out_column_offset);
-void WASM_PRINTF_FORMAT(4, 5) wasm_parser_error(struct WasmLocation*,
- WasmLexer*,
- struct WasmParser*,
- const char*,
- ...);
-void wasm_format_error(WasmSourceErrorHandler*,
- const struct WasmLocation*,
- WasmLexer*,
- const char* format,
- va_list);
+struct WasmAllocator* wasm_ast_lexer_get_allocator(WasmAstLexer* lexer);
+int wasm_ast_lexer_lex(union WasmToken*,
+ struct WasmLocation*,
+ WasmAstLexer*,
+ struct WasmAstParser*);
+WasmResult wasm_ast_lexer_get_source_line(WasmAstLexer*,
+ const struct WasmLocation*,
+ size_t line_max_length,
+ char* line,
+ size_t* out_line_length,
+ int* out_column_offset);
+void WASM_PRINTF_FORMAT(4, 5) wasm_ast_parser_error(struct WasmLocation*,
+ WasmAstLexer*,
+ struct WasmAstParser*,
+ const char*,
+ ...);
+void wasm_ast_format_error(WasmSourceErrorHandler*,
+ const struct WasmLocation*,
+ WasmAstLexer*,
+ const char* format,
+ va_list);
WASM_EXTERN_C_END
-#endif /* WASM_PARSER_LEXER_SHARED_H_ */
+#endif /* WASM_AST_PARSER_LEXER_SHARED_H_ */
diff --git a/src/wasm-parser.h b/src/wasm-ast-parser.h
index c1c570e5..8a9b0860 100644
--- a/src/wasm-parser.h
+++ b/src/wasm-ast-parser.h
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-#ifndef WASM_PARSER_H_
-#define WASM_PARSER_H_
+#ifndef WASM_AST_PARSER_H_
+#define WASM_AST_PARSER_H_
+#include "wasm-ast-lexer.h"
#include "wasm-common.h"
-#include "wasm-lexer.h"
struct WasmScript;
WASM_EXTERN_C_BEGIN
-WasmResult wasm_parse(WasmLexer* lexer,
- struct WasmScript* out_script,
- WasmSourceErrorHandler*);
+WasmResult wasm_parse_ast(WasmAstLexer* lexer,
+ struct WasmScript* out_script,
+ WasmSourceErrorHandler*);
WASM_EXTERN_C_END
-#endif /* WASM_PARSER_H_ */
+#endif /* WASM_AST_PARSER_H_ */
diff --git a/src/wasm-bison-parser.y b/src/wasm-ast-parser.y
index b453c620..d27d0e1e 100644
--- a/src/wasm-bison-parser.y
+++ b/src/wasm-ast-parser.y
@@ -21,22 +21,22 @@
#include <stdlib.h>
#include "wasm-allocator.h"
+#include "wasm-ast-parser.h"
+#include "wasm-ast-parser-lexer-shared.h"
#include "wasm-literal.h"
-#include "wasm-parser.h"
-#include "wasm-parser-lexer-shared.h"
#define DUPTEXT(dst, src) \
(dst).start = wasm_strndup(parser->allocator, (src).start, (src).length); \
(dst).length = (src).length
-#define CHECK_ALLOC_(cond) \
- if (!(cond)) { \
- WasmLocation loc; \
- loc.filename = __FILE__; \
- loc.line = __LINE__; \
- loc.first_column = loc.last_column = 0; \
- wasm_parser_error(&loc, lexer, parser, "allocation failed"); \
- YYERROR; \
+#define CHECK_ALLOC_(cond) \
+ if (!(cond)) { \
+ WasmLocation loc; \
+ loc.filename = __FILE__; \
+ loc.line = __LINE__; \
+ loc.first_column = loc.last_column = 0; \
+ wasm_ast_parser_error(&loc, lexer, parser, "allocation failed"); \
+ YYERROR; \
}
#define CHECK_ALLOC(e) CHECK_ALLOC_(WASM_SUCCEEDED(e))
@@ -98,17 +98,17 @@ WasmResult copy_signature_from_func_type(WasmAllocator* allocator,
WasmModule* module,
WasmFuncDeclaration* decl);
-#define wasm_parser_lex wasm_lexer_lex
+#define wasm_ast_parser_lex wasm_ast_lexer_lex
%}
-%define api.prefix {wasm_parser_}
+%define api.prefix {wasm_ast_parser_}
%define api.pure true
%define api.value.type {WasmToken}
%define api.token.prefix {WASM_TOKEN_TYPE_}
%define parse.error verbose
-%lex-param {WasmLexer* lexer} {WasmParser* parser}
-%parse-param {WasmLexer* lexer} {WasmParser* parser}
+%lex-param {WasmAstLexer* lexer} {WasmAstParser* parser}
+%parse-param {WasmAstLexer* lexer} {WasmAstParser* parser}
%locations
%token LPAR "("
@@ -231,8 +231,8 @@ var :
if (WASM_FAILED(wasm_parse_int32($1.text.start,
$1.text.start + $1.text.length, &index,
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&@1, lexer, parser, "invalid int " PRIstringslice,
- WASM_PRINTF_STRING_SLICE_ARG($1.text));
+ wasm_ast_parser_error(&@1, lexer, parser, "invalid int " PRIstringslice,
+ WASM_PRINTF_STRING_SLICE_ARG($1.text));
}
$$.index = index;
}
@@ -280,9 +280,9 @@ offset :
/* empty */ { $$ = 0; }
| OFFSET {
if (WASM_FAILED(wasm_parse_int64($1.start, $1.start + $1.length, &$$))) {
- wasm_parser_error(&@1, lexer, parser,
- "invalid offset \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG($1));
+ wasm_ast_parser_error(&@1, lexer, parser,
+ "invalid offset \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG($1));
}
}
;
@@ -291,9 +291,9 @@ align :
| ALIGN {
if (WASM_FAILED(wasm_parse_int32($1.start, $1.start + $1.length, &$$,
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&@1, lexer, parser,
- "invalid alignment \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG($1));
+ wasm_ast_parser_error(&@1, lexer, parser,
+ "invalid alignment \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG($1));
}
}
;
@@ -458,9 +458,9 @@ expr1 :
if (WASM_FAILED(parse_const($1, $2.type, $2.text.start,
$2.text.start + $2.text.length,
&$$->const_))) {
- wasm_parser_error(&@2, lexer, parser,
- "invalid literal \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG($2.text));
+ wasm_ast_parser_error(&@2, lexer, parser,
+ "invalid literal \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG($2.text));
}
wasm_free(parser->allocator, (char*)$2.text.start);
}
@@ -679,10 +679,10 @@ segment_address :
if (WASM_FAILED(wasm_parse_int32($1.text.start,
$1.text.start + $1.text.length, &$$,
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&@1, lexer, parser,
- "invalid memory segment address \"" PRIstringslice
- "\"",
- WASM_PRINTF_STRING_SLICE_ARG($1.text));
+ wasm_ast_parser_error(&@1, lexer, parser,
+ "invalid memory segment address \"" PRIstringslice
+ "\"",
+ WASM_PRINTF_STRING_SLICE_ARG($1.text));
}
}
;
@@ -708,9 +708,10 @@ initial_pages :
if (WASM_FAILED(wasm_parse_int32($1.text.start,
$1.text.start + $1.text.length, &$$,
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&@1, lexer, parser,
- "invalid initial memory pages \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG($1.text));
+ wasm_ast_parser_error(&@1, lexer, parser,
+ "invalid initial memory pages \"" PRIstringslice
+ "\"",
+ WASM_PRINTF_STRING_SLICE_ARG($1.text));
}
}
;
@@ -720,9 +721,9 @@ max_pages :
if (WASM_FAILED(wasm_parse_int32($1.text.start,
$1.text.start + $1.text.length, &$$,
WASM_PARSE_UNSIGNED_ONLY))) {
- wasm_parser_error(&@1, lexer, parser,
- "invalid max memory pages \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG($1.text));
+ wasm_ast_parser_error(&@1, lexer, parser,
+ "invalid max memory pages \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG($1.text));
}
}
;
@@ -1029,9 +1030,9 @@ const :
$$.loc = @2;
if (WASM_FAILED(parse_const($2, $3.type, $3.text.start,
$3.text.start + $3.text.length, &$$))) {
- wasm_parser_error(&@3, lexer, parser,
- "invalid literal \"" PRIstringslice "\"",
- WASM_PRINTF_STRING_SLICE_ARG($3.text));
+ wasm_ast_parser_error(&@3, lexer, parser,
+ "invalid literal \"" PRIstringslice "\"",
+ WASM_PRINTF_STRING_SLICE_ARG($3.text));
}
wasm_free(parser->allocator, (char*)$3.text.start);
}
@@ -1156,16 +1157,16 @@ static WasmResult dup_string_contents(WasmAllocator* allocator,
return WASM_OK;
}
-WasmResult wasm_parse(WasmLexer* lexer,
- struct WasmScript* out_script,
- WasmSourceErrorHandler* error_handler) {
- WasmParser parser;
+WasmResult wasm_parse_ast(WasmAstLexer* lexer,
+ struct WasmScript* out_script,
+ WasmSourceErrorHandler* error_handler) {
+ WasmAstParser parser;
WASM_ZERO_MEMORY(parser);
- WasmAllocator* allocator = wasm_lexer_get_allocator(lexer);
+ WasmAllocator* allocator = wasm_ast_lexer_get_allocator(lexer);
parser.allocator = allocator;
parser.error_handler = error_handler;
out_script->allocator = allocator;
- int result = wasm_parser_parse(lexer, &parser);
+ int result = wasm_ast_parser_parse(lexer, &parser);
out_script->commands = parser.script.commands;
return result == 0 && parser.errors == 0 ? WASM_OK : WASM_ERROR;
}
diff --git a/src/wasm-flex-lexer.l b/src/wasm-flex-lexer.l
deleted file mode 100644
index 4d911545..00000000
--- a/src/wasm-flex-lexer.l
+++ /dev/null
@@ -1,675 +0,0 @@
-/*
- * Copyright 2016 WebAssembly Community Group participants
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-%top {
-#include <stdint.h>
-}
-
-%{
-#include <assert.h>
-
-#include "wasm-config.h"
-
-#include "wasm-allocator.h"
-#include "wasm-parser.h"
-#include "wasm-parser-lexer-shared.h"
-#include "wasm-vector.h"
-
-/* must be included after so some typedefs will be defined */
-#include "wasm-bison-parser.h"
-
-#if !HAVE_UNISTD_H
-#define YY_NO_UNISTD_H
-#if COMPILER_IS_MSVC
-/* unistd.h replacement for Windows */
-#include <stdlib.h>
-#include <io.h>
-#define isatty _isatty
-#define fileno _fileno
-#else
-#error "no unistd.h, but not Windows!"
-#endif /* COMPILER_IS_MSVC */
-#endif /* !HAVE_UNISTD_H */
-
-#define WASM_INITIAL_LINE_OFFSETS 10000
-
-typedef size_t WasmLineOffset;
-WASM_DEFINE_VECTOR(line_offset, WasmLineOffset);
-
-typedef enum WasmLexerType {
- WASM_LEXER_TYPE_FILE,
- WASM_LEXER_TYPE_BUFFER,
-} WasmLexerType;
-
-typedef struct WasmLexerExtra {
- WasmAllocator* allocator;
- WasmLexerType type;
- union {
- FILE* file;
- struct {
- const void* data;
- size_t size;
- size_t read_offset;
- } buffer;
- };
- const char* filename;
- size_t offset;
- WasmLineOffsetVector line_offsets;
- int column;
- int comment_nesting;
-} WasmLexerExtra;
-
-static void read_input(WasmLexer, char* buffer, size_t* result,
- size_t max_size);
-
-#define YY_DECL \
- int wasm_lexer_lex(WASM_PARSER_STYPE* yylval_param, \
- WASM_PARSER_LTYPE* yylloc_param, yyscan_t yyscanner, \
- WasmParser* parser)
-
-#undef YY_INPUT
-#define YY_INPUT(buf, result, max_size) \
- do { \
- size_t my_result = 0; \
- read_input(yyscanner, buf, &my_result, max_size); \
- result = my_result; \
- } while (0)
-
-#define COMMENT_NESTING (yyextra->comment_nesting)
-#define RESET_COLUMN \
- do { \
- yyextra->column = 1; \
- *wasm_append_line_offset(yyextra->allocator, &yyextra->line_offsets) = \
- yyextra->offset; \
- } while (0)
-
-#define YY_USER_ACTION \
- { \
- yylloc->filename = yyextra->filename; \
- yylloc->line = yylineno; \
- yylloc->first_column = yyextra->column; \
- yyextra->column += yyleng; \
- yylloc->last_column = yyextra->column; \
- yyextra->offset += yyleng; \
- }
-
-#define TEXT \
- yylval->text.start = yytext; \
- yylval->text.length = yyleng
-
-#define TEXT_AT(offset) \
- yylval->text.start = yytext + offset; \
- yylval->text.length = yyleng - offset
-
-#define TYPE(type_) yylval->type = WASM_TYPE_##type_
-
-#define OPCODE(name) yylval->opcode = WASM_OPCODE_##name
-
-#define LITERAL(type_) \
- yylval->literal.type = WASM_LITERAL_TYPE_##type_; \
- yylval->literal.text.start = yytext; \
- yylval->literal.text.length = yyleng
-
-#define TOK(name) WASM_TOKEN_TYPE_##name
-
-%}
-
-%option prefix="wasm_lexer_"
-%option bison-bridge
-%option bison-locations
-%option yylineno
-%option reentrant
-%option noyyalloc
-%option noyyrealloc
-%option noyyfree
-%option extra-type="WasmLexerExtra*"
-
-%x LINE_COMMENT
-%x BLOCK_COMMENT
-%x BAD_TEXT
-
-SPACE [ \t]
-DIGIT [0-9]
-DIGITS [0-9]+
-HEXDIGIT [0-9a-fA-F]
-LETTER [a-zA-Z]
-SYMBOL [+\-*/\\\^~=<>!?@#$%&|:`.]
-TICK `
-ESCAPE [nt\\'"]
-CHARACTER [^"\\\x00-\x1f\x7f]|\\{ESCAPE}|\\{HEXDIGIT}{HEXDIGIT}
-SIGN [+-]?
-NUM {SIGN}{DIGIT}+
-HEXNUM {SIGN}"0x"{HEXDIGIT}+
-INT {NUM}|{HEXNUM}
-FLOAT0 {NUM}\.{DIGIT}*
-FLOAT1 {NUM}(\.{DIGIT}*)?[eE]{NUM}
-HEXFLOAT {SIGN}"0x"{HEXDIGIT}+\.?{HEXDIGIT}*p{SIGN}{DIGIT}+
-INFINITY {SIGN}"infinity"
-NAN {SIGN}"nan"|{SIGN}"nan:0x"{HEXDIGIT}+
-FLOAT {FLOAT0}|{FLOAT1}
-TEXT \"{CHARACTER}*\"
-ATOM ({LETTER}|{DIGIT}|_|{TICK}|{SYMBOL})+
-NAME \${ATOM}
-
-%%
-
-"(" { return TOK(LPAR); }
-")" { return TOK(RPAR); }
-{INT} { LITERAL(INT); return TOK(INT); }
-{FLOAT} { LITERAL(FLOAT); return TOK(FLOAT); }
-{HEXFLOAT} { LITERAL(HEXFLOAT); return TOK(FLOAT); }
-{INFINITY} { LITERAL(INFINITY); return TOK(FLOAT); }
-{NAN} { LITERAL(NAN); return TOK(FLOAT); }
-{TEXT} { TEXT; return TOK(TEXT); }
-\" { BEGIN(BAD_TEXT); }
-<BAD_TEXT>{CHARACTER} {}
-<BAD_TEXT>\n { BEGIN(INITIAL);
- RESET_COLUMN;
- wasm_parser_error(yylloc, yyscanner, parser,
- "newline in string"); }
-<BAD_TEXT><<EOF>> { wasm_parser_error(yylloc, yyscanner, parser,
- "unexpected EOF");
- return TOK(EOF); }
-<BAD_TEXT>\\. { wasm_parser_error(yylloc, yyscanner, parser,
- "bad escape \"%.*s\"", yyleng,
- yytext); }
-<BAD_TEXT>\" { BEGIN(INITIAL); TEXT; return TOK(TEXT); }
-<BAD_TEXT>[^\\] { wasm_parser_error(yylloc, yyscanner, parser,
- "illegal character in string"); }
-"i32" { TYPE(I32); return TOK(VALUE_TYPE); }
-"i64" { TYPE(I64); return TOK(VALUE_TYPE); }
-"f32" { TYPE(F32); return TOK(VALUE_TYPE); }
-"f64" { TYPE(F64); return TOK(VALUE_TYPE); }
-"nop" { return TOK(NOP); }
-"block" { return TOK(BLOCK); }
-"if" { return TOK(IF); }
-"if_else" { return TOK(IF); /* TODO(binji): remove */ }
-"then" { return TOK(THEN); }
-"else" { return TOK(ELSE); }
-"loop" { return TOK(LOOP); }
-"br" { return TOK(BR); }
-"br_if" { return TOK(BR_IF); }
-"br_table" { return TOK(BR_TABLE); }
-"case" { return TOK(CASE); }
-"call" { return TOK(CALL); }
-"call_import" { return TOK(CALL_IMPORT); }
-"call_indirect" { return TOK(CALL_INDIRECT); }
-"return" { return TOK(RETURN); }
-"get_local" { return TOK(GET_LOCAL); }
-"set_local" { return TOK(SET_LOCAL); }
-"i32.load" { OPCODE(I32_LOAD); return TOK(LOAD); }
-"i64.load" { OPCODE(I64_LOAD); return TOK(LOAD); }
-"f32.load" { OPCODE(F32_LOAD); return TOK(LOAD); }
-"f64.load" { OPCODE(F64_LOAD); return TOK(LOAD); }
-"i32.store" { OPCODE(I32_STORE); return TOK(STORE); }
-"i64.store" { OPCODE(I64_STORE); return TOK(STORE); }
-"f32.store" { OPCODE(F32_STORE); return TOK(STORE); }
-"f64.store" { OPCODE(F64_STORE); return TOK(STORE); }
-"i32.load8_s" { OPCODE(I32_LOAD8_S); return TOK(LOAD); }
-"i64.load8_s" { OPCODE(I64_LOAD8_S); return TOK(LOAD); }
-"i32.load8_u" { OPCODE(I32_LOAD8_U); return TOK(LOAD); }
-"i64.load8_u" { OPCODE(I64_LOAD8_U); return TOK(LOAD); }
-"i32.load16_s" { OPCODE(I32_LOAD16_S); return TOK(LOAD); }
-"i64.load16_s" { OPCODE(I64_LOAD16_S); return TOK(LOAD); }
-"i32.load16_u" { OPCODE(I32_LOAD16_U); return TOK(LOAD); }
-"i64.load16_u" { OPCODE(I64_LOAD16_U); return TOK(LOAD); }
-"i64.load32_s" { OPCODE(I64_LOAD32_S); return TOK(LOAD); }
-"i64.load32_u" { OPCODE(I64_LOAD32_U); return TOK(LOAD); }
-"i32.store8" { OPCODE(I32_STORE8); return TOK(STORE); }
-"i64.store8" { OPCODE(I64_STORE8); return TOK(STORE); }
-"i32.store16" { OPCODE(I32_STORE16); return TOK(STORE); }
-"i64.store16" { OPCODE(I64_STORE16); return TOK(STORE); }
-"i64.store32" { OPCODE(I64_STORE32); return TOK(STORE); }
-"offset="{DIGITS} { TEXT_AT(7); return TOK(OFFSET); }
-"align="{DIGITS} { TEXT_AT(6); return TOK(ALIGN); }
-"i32.const" { TYPE(I32); return TOK(CONST); }
-"i64.const" { TYPE(I64); return TOK(CONST); }
-"f32.const" { TYPE(F32); return TOK(CONST); }
-"f64.const" { TYPE(F64); return TOK(CONST); }
-"i32.eqz" { OPCODE(I32_EQZ); return TOK(CONVERT); }
-"i64.eqz" { OPCODE(I64_EQZ); return TOK(CONVERT); }
-"i32.clz" { OPCODE(I32_CLZ); return TOK(UNARY); }
-"i64.clz" { OPCODE(I64_CLZ); return TOK(UNARY); }
-"i32.ctz" { OPCODE(I32_CTZ); return TOK(UNARY); }
-"i64.ctz" { OPCODE(I64_CTZ); return TOK(UNARY); }
-"i32.popcnt" { OPCODE(I32_POPCNT); return TOK(UNARY); }
-"i64.popcnt" { OPCODE(I64_POPCNT); return TOK(UNARY); }
-"f32.neg" { OPCODE(F32_NEG); return TOK(UNARY); }
-"f64.neg" { OPCODE(F64_NEG); return TOK(UNARY); }
-"f32.abs" { OPCODE(F32_ABS); return TOK(UNARY); }
-"f64.abs" { OPCODE(F64_ABS); return TOK(UNARY); }
-"f32.sqrt" { OPCODE(F32_SQRT); return TOK(UNARY); }
-"f64.sqrt" { OPCODE(F64_SQRT); return TOK(UNARY); }
-"f32.ceil" { OPCODE(F32_CEIL); return TOK(UNARY); }
-"f64.ceil" { OPCODE(F64_CEIL); return TOK(UNARY); }
-"f32.floor" { OPCODE(F32_FLOOR); return TOK(UNARY); }
-"f64.floor" { OPCODE(F64_FLOOR); return TOK(UNARY); }
-"f32.trunc" { OPCODE(F32_TRUNC); return TOK(UNARY); }
-"f64.trunc" { OPCODE(F64_TRUNC); return TOK(UNARY); }
-"f32.nearest" { OPCODE(F32_NEAREST); return TOK(UNARY); }
-"f64.nearest" { OPCODE(F64_NEAREST); return TOK(UNARY); }
-"i32.add" { OPCODE(I32_ADD); return TOK(BINARY); }
-"i64.add" { OPCODE(I64_ADD); return TOK(BINARY); }
-"i32.sub" { OPCODE(I32_SUB); return TOK(BINARY); }
-"i64.sub" { OPCODE(I64_SUB); return TOK(BINARY); }
-"i32.mul" { OPCODE(I32_MUL); return TOK(BINARY); }
-"i64.mul" { OPCODE(I64_MUL); return TOK(BINARY); }
-"i32.div_s" { OPCODE(I32_DIV_S); return TOK(BINARY); }
-"i64.div_s" { OPCODE(I64_DIV_S); return TOK(BINARY); }
-"i32.div_u" { OPCODE(I32_DIV_U); return TOK(BINARY); }
-"i64.div_u" { OPCODE(I64_DIV_U); return TOK(BINARY); }
-"i32.rem_s" { OPCODE(I32_REM_S); return TOK(BINARY); }
-"i64.rem_s" { OPCODE(I64_REM_S); return TOK(BINARY); }
-"i32.rem_u" { OPCODE(I32_REM_U); return TOK(BINARY); }
-"i64.rem_u" { OPCODE(I64_REM_U); return TOK(BINARY); }
-"i32.and" { OPCODE(I32_AND); return TOK(BINARY); }
-"i64.and" { OPCODE(I64_AND); return TOK(BINARY); }
-"i32.or" { OPCODE(I32_OR); return TOK(BINARY); }
-"i64.or" { OPCODE(I64_OR); return TOK(BINARY); }
-"i32.xor" { OPCODE(I32_XOR); return TOK(BINARY); }
-"i64.xor" { OPCODE(I64_XOR); return TOK(BINARY); }
-"i32.shl" { OPCODE(I32_SHL); return TOK(BINARY); }
-"i64.shl" { OPCODE(I64_SHL); return TOK(BINARY); }
-"i32.shr_s" { OPCODE(I32_SHR_S); return TOK(BINARY); }
-"i64.shr_s" { OPCODE(I64_SHR_S); return TOK(BINARY); }
-"i32.shr_u" { OPCODE(I32_SHR_U); return TOK(BINARY); }
-"i64.shr_u" { OPCODE(I64_SHR_U); return TOK(BINARY); }
-"i32.rotl" { OPCODE(I32_ROTL); return TOK(BINARY); }
-"i64.rotl" { OPCODE(I64_ROTL); return TOK(BINARY); }
-"i32.rotr" { OPCODE(I32_ROTR); return TOK(BINARY); }
-"i64.rotr" { OPCODE(I64_ROTR); return TOK(BINARY); }
-"f32.add" { OPCODE(F32_ADD); return TOK(BINARY); }
-"f64.add" { OPCODE(F64_ADD); return TOK(BINARY); }
-"f32.sub" { OPCODE(F32_SUB); return TOK(BINARY); }
-"f64.sub" { OPCODE(F64_SUB); return TOK(BINARY); }
-"f32.mul" { OPCODE(F32_MUL); return TOK(BINARY); }
-"f64.mul" { OPCODE(F64_MUL); return TOK(BINARY); }
-"f32.div" { OPCODE(F32_DIV); return TOK(BINARY); }
-"f64.div" { OPCODE(F64_DIV); return TOK(BINARY); }
-"f32.min" { OPCODE(F32_MIN); return TOK(BINARY); }
-"f64.min" { OPCODE(F64_MIN); return TOK(BINARY); }
-"f32.max" { OPCODE(F32_MAX); return TOK(BINARY); }
-"f64.max" { OPCODE(F64_MAX); return TOK(BINARY); }
-"f32.copysign" { OPCODE(F32_COPYSIGN); return TOK(BINARY); }
-"f64.copysign" { OPCODE(F64_COPYSIGN); return TOK(BINARY); }
-"i32.eq" { OPCODE(I32_EQ); return TOK(COMPARE); }
-"i64.eq" { OPCODE(I64_EQ); return TOK(COMPARE); }
-"i32.ne" { OPCODE(I32_NE); return TOK(COMPARE); }
-"i64.ne" { OPCODE(I64_NE); return TOK(COMPARE); }
-"i32.lt_s" { OPCODE(I32_LT_S); return TOK(COMPARE); }
-"i64.lt_s" { OPCODE(I64_LT_S); return TOK(COMPARE); }
-"i32.lt_u" { OPCODE(I32_LT_U); return TOK(COMPARE); }
-"i64.lt_u" { OPCODE(I64_LT_U); return TOK(COMPARE); }
-"i32.le_s" { OPCODE(I32_LE_S); return TOK(COMPARE); }
-"i64.le_s" { OPCODE(I64_LE_S); return TOK(COMPARE); }
-"i32.le_u" { OPCODE(I32_LE_U); return TOK(COMPARE); }
-"i64.le_u" { OPCODE(I64_LE_U); return TOK(COMPARE); }
-"i32.gt_s" { OPCODE(I32_GT_S); return TOK(COMPARE); }
-"i64.gt_s" { OPCODE(I64_GT_S); return TOK(COMPARE); }
-"i32.gt_u" { OPCODE(I32_GT_U); return TOK(COMPARE); }
-"i64.gt_u" { OPCODE(I64_GT_U); return TOK(COMPARE); }
-"i32.ge_s" { OPCODE(I32_GE_S); return TOK(COMPARE); }
-"i64.ge_s" { OPCODE(I64_GE_S); return TOK(COMPARE); }
-"i32.ge_u" { OPCODE(I32_GE_U); return TOK(COMPARE); }
-"i64.ge_u" { OPCODE(I64_GE_U); return TOK(COMPARE); }
-"f32.eq" { OPCODE(F32_EQ); return TOK(COMPARE); }
-"f64.eq" { OPCODE(F64_EQ); return TOK(COMPARE); }
-"f32.ne" { OPCODE(F32_NE); return TOK(COMPARE); }
-"f64.ne" { OPCODE(F64_NE); return TOK(COMPARE); }
-"f32.lt" { OPCODE(F32_LT); return TOK(COMPARE); }
-"f64.lt" { OPCODE(F64_LT); return TOK(COMPARE); }
-"f32.le" { OPCODE(F32_LE); return TOK(COMPARE); }
-"f64.le" { OPCODE(F64_LE); return TOK(COMPARE); }
-"f32.gt" { OPCODE(F32_GT); return TOK(COMPARE); }
-"f64.gt" { OPCODE(F64_GT); return TOK(COMPARE); }
-"f32.ge" { OPCODE(F32_GE); return TOK(COMPARE); }
-"f64.ge" { OPCODE(F64_GE); return TOK(COMPARE); }
-"i64.extend_s/i32" { OPCODE(I64_EXTEND_S_I32); return TOK(CONVERT); }
-"i64.extend_u/i32" { OPCODE(I64_EXTEND_U_I32); return TOK(CONVERT); }
-"i32.wrap/i64" { OPCODE(I32_WRAP_I64); return TOK(CONVERT); }
-"i32.trunc_s/f32" { OPCODE(I32_TRUNC_S_F32); return TOK(CONVERT); }
-"i64.trunc_s/f32" { OPCODE(I64_TRUNC_S_F32); return TOK(CONVERT); }
-"i32.trunc_s/f64" { OPCODE(I32_TRUNC_S_F64); return TOK(CONVERT); }
-"i64.trunc_s/f64" { OPCODE(I64_TRUNC_S_F64); return TOK(CONVERT); }
-"i32.trunc_u/f32" { OPCODE(I32_TRUNC_U_F32); return TOK(CONVERT); }
-"i64.trunc_u/f32" { OPCODE(I64_TRUNC_U_F32); return TOK(CONVERT); }
-"i32.trunc_u/f64" { OPCODE(I32_TRUNC_U_F64); return TOK(CONVERT); }
-"i64.trunc_u/f64" { OPCODE(I64_TRUNC_U_F64); return TOK(CONVERT); }
-"f32.convert_s/i32" { OPCODE(F32_CONVERT_S_I32); return TOK(CONVERT); }
-"f64.convert_s/i32" { OPCODE(F64_CONVERT_S_I32); return TOK(CONVERT); }
-"f32.convert_s/i64" { OPCODE(F32_CONVERT_S_I64); return TOK(CONVERT); }
-"f64.convert_s/i64" { OPCODE(F64_CONVERT_S_I64); return TOK(CONVERT); }
-"f32.convert_u/i32" { OPCODE(F32_CONVERT_U_I32); return TOK(CONVERT); }
-"f64.convert_u/i32" { OPCODE(F64_CONVERT_U_I32); return TOK(CONVERT); }
-"f32.convert_u/i64" { OPCODE(F32_CONVERT_U_I64); return TOK(CONVERT); }
-"f64.convert_u/i64" { OPCODE(F64_CONVERT_U_I64); return TOK(CONVERT); }
-"f64.promote/f32" { OPCODE(F64_PROMOTE_F32); return TOK(CONVERT); }
-"f32.demote/f64" { OPCODE(F32_DEMOTE_F64); return TOK(CONVERT); }
-"f32.reinterpret/i32" { OPCODE(F32_REINTERPRET_I32); return TOK(CONVERT); }
-"i32.reinterpret/f32" { OPCODE(I32_REINTERPRET_F32); return TOK(CONVERT); }
-"f64.reinterpret/i64" { OPCODE(F64_REINTERPRET_I64); return TOK(CONVERT); }
-"i64.reinterpret/f64" { OPCODE(I64_REINTERPRET_F64); return TOK(CONVERT); }
-"select" { return TOK(SELECT); }
-"unreachable" { return TOK(UNREACHABLE); }
-"memory_size" { return TOK(MEMORY_SIZE); }
-"grow_memory" { return TOK(GROW_MEMORY); }
-"type" { return TOK(TYPE); }
-"func" { return TOK(FUNC); }
-"param" { return TOK(PARAM); }
-"result" { return TOK(RESULT); }
-"local" { return TOK(LOCAL); }
-"module" { return TOK(MODULE); }
-"memory" { return TOK(MEMORY); }
-"segment" { return TOK(SEGMENT); }
-"start" { return TOK(START); }
-"import" { return TOK(IMPORT); }
-"export" { return TOK(EXPORT); }
-"table" { return TOK(TABLE); }
-"assert_invalid" { return TOK(ASSERT_INVALID); }
-"assert_return" { return TOK(ASSERT_RETURN); }
-"assert_return_nan" { return TOK(ASSERT_RETURN_NAN); }
-"assert_trap" { return TOK(ASSERT_TRAP); }
-"invoke" { return TOK(INVOKE); }
-{NAME} { TEXT; return TOK(VAR); }
-
-";;" { BEGIN(LINE_COMMENT); }
-<LINE_COMMENT>\n { RESET_COLUMN; BEGIN(INITIAL); }
-<LINE_COMMENT><<EOF>> { return TOK(EOF); }
-<LINE_COMMENT>.
-"(;" { BEGIN(BLOCK_COMMENT); COMMENT_NESTING = 1; }
-<BLOCK_COMMENT>"(;" { COMMENT_NESTING++; }
-<BLOCK_COMMENT>";)" { if (--COMMENT_NESTING == 0) BEGIN(INITIAL); }
-<BLOCK_COMMENT>\n { RESET_COLUMN; }
-<BLOCK_COMMENT><<EOF>> { wasm_parser_error(yylloc, yyscanner, parser,
- "unexpected EOF");
- return TOK(EOF); }
-<BLOCK_COMMENT>.
-\n { RESET_COLUMN; }
-[ \t\r]+
-<<EOF>> { return TOK(EOF); }
-{ATOM} { wasm_parser_error(yylloc, yyscanner, parser,
- "unexpected token \"%.*s\"", yyleng,
- yytext); }
-. { wasm_parser_error(yylloc, yyscanner, parser,
- "unexpected char"); }
-
-%%
-
-int wasm_lexer_wrap(yyscan_t yyscanner) {
- return 1;
-}
-
-static WasmAllocator* s_lexer_allocator;
-
-static WasmLexer wasm_new_lexer(WasmAllocator* allocator,
- WasmLexerType type,
- const char* filename) {
- WasmLexerExtra* extra =
- wasm_alloc_zero(allocator, sizeof(WasmLexerExtra), WASM_DEFAULT_ALIGN);
- if (!extra)
- return NULL;
- extra->allocator = allocator;
- extra->column = 1;
- extra->filename = filename;
- extra->type = type;
-
- if (WASM_FAILED(wasm_reserve_line_offsets(allocator, &extra->line_offsets,
- WASM_INITIAL_LINE_OFFSETS))) {
- wasm_free(allocator, extra);
- return NULL;
- }
-
- /* Skip the zeroeth line, and make the first line offset 0 */
- assert(extra->line_offsets.capacity >= 2);
- *wasm_append_line_offset(allocator, &extra->line_offsets) = 0;
- *wasm_append_line_offset(allocator, &extra->line_offsets) = 0;
-
- /* when the lexer is created in yylex_init, it uses wasm_lexer_alloc before
- extra has been set, so we have to use a static variable here. */
- s_lexer_allocator = allocator;
- yyscan_t lexer;
- yylex_init(&lexer);
- yyset_extra(extra, lexer);
- s_lexer_allocator = NULL;
- return lexer;
-}
-
-WasmLexer wasm_new_file_lexer(WasmAllocator* allocator, const char* filename) {
- WasmLexer lexer = wasm_new_lexer(allocator, WASM_LEXER_TYPE_FILE, filename);
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- extra->file = fopen(filename, "r");
- if (!extra->file) {
- wasm_destroy_lexer(lexer);
- wasm_free(allocator, extra);
- return NULL;
- }
- yyset_in(extra->file, lexer);
- return lexer;
-}
-
-WasmLexer wasm_new_buffer_lexer(WasmAllocator* allocator, const char* filename,
- const void* data, size_t size) {
- WasmLexer lexer = wasm_new_lexer(allocator, WASM_LEXER_TYPE_BUFFER, filename);
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- extra->buffer.data = data;
- extra->buffer.size = size;
- extra->buffer.read_offset = 0;
- return lexer;
-}
-
-static void read_input(WasmLexer lexer, char* buffer, size_t* result,
- size_t max_size) {
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- if (extra->type == WASM_LEXER_TYPE_FILE) {
- *result = fread(buffer, 1, max_size, extra->file);
- } else {
- assert(extra->type == WASM_LEXER_TYPE_BUFFER);
- size_t read_size = max_size;
- size_t offset = extra->buffer.read_offset;
- size_t bytes_left = extra->buffer.size - offset;
- if (read_size > bytes_left)
- read_size = bytes_left;
- memcpy(buffer, (char*)extra->buffer.data + offset, read_size);
- extra->buffer.read_offset += read_size;
- *result = read_size;
- }
-}
-
-void wasm_destroy_lexer(WasmLexer lexer) {
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- if (extra->type == WASM_LEXER_TYPE_FILE && extra->file)
- fclose(extra->file);
- wasm_destroy_line_offset_vector(extra->allocator, &extra->line_offsets);
- wasm_lexer_lex_destroy((yyscan_t)lexer);
- wasm_free(extra->allocator, extra);
-}
-
-void* wasm_lexer_alloc(size_t bytes, WasmLexer lexer) {
- WasmAllocator* allocator =
- lexer ? (wasm_lexer_get_extra(lexer))->allocator : s_lexer_allocator;
- return wasm_alloc(allocator, bytes, WASM_DEFAULT_ALIGN);
-}
-
-void* wasm_lexer_realloc(void* ptr, size_t bytes, WasmLexer lexer) {
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- return wasm_realloc(extra->allocator, ptr, bytes, WASM_DEFAULT_ALIGN);
-}
-
-void wasm_lexer_free(void* ptr, WasmLexer lexer) {
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- wasm_free(extra->allocator, ptr);
-}
-
-WasmAllocator* wasm_lexer_get_allocator(WasmLexer lexer) {
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- return extra->allocator;
-}
-
-static size_t lexer_get_offset_from_line(WasmLexer lexer, int line) {
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- if (line < 0 || (size_t)line >= extra->line_offsets.size)
- return WASM_INVALID_LINE_OFFSET;
-
- return extra->line_offsets.data[line];
-}
-
-static WasmResult lexer_get_offsets_from_line(WasmLexer lexer,
- int line,
- size_t* out_line_start,
- size_t* out_line_end) {
- size_t line_start = lexer_get_offset_from_line(lexer, line);
- size_t line_end = lexer_get_offset_from_line(lexer, line + 1);
- if (line_end == WASM_INVALID_LINE_OFFSET) {
- /* we haven't gotten to the next line yet. scan ahead to find it. */
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- if (extra->type == WASM_LEXER_TYPE_BUFFER) {
- const char* buffer_start = extra->buffer.data;
- const char* buffer_line_start = buffer_start + line_start;
- const char* buffer_end = buffer_start + extra->buffer.size;
-
- const char* newline =
- memchr(buffer_line_start, '\n', buffer_end - buffer_line_start);
- line_end = (newline ? newline : buffer_end) - buffer_start;
- } else {
- assert(extra->type == WASM_LEXER_TYPE_FILE);
- FILE* lexer_file = extra->file;
- long old_offset = ftell(lexer_file);
- if (old_offset == -1)
- return WASM_ERROR;
-
- /* we haven't gotten to the next line yet. read the file to find it. */
- size_t offset = line_start;
- line_end = offset;
- if (fseek(lexer_file, offset, SEEK_SET) == -1)
- return WASM_ERROR;
-
- char buffer[256];
- while (1) {
- size_t bytes_read = fread(buffer, 1, sizeof(buffer), lexer_file);
- if (bytes_read == 0)
- break;
-
- char* newline = memchr(buffer, '\n', bytes_read);
- if (newline) {
- line_end += (newline - buffer);
- break;
- } else {
- line_end += bytes_read;
- }
- }
- if (fseek(lexer_file, old_offset, SEEK_SET) == -1)
- return WASM_ERROR;
- }
- } else {
- /* don't include the newline */
- line_end--;
- }
-
- *out_line_start = line_start;
- *out_line_end = line_end;
- return WASM_OK;
-}
-
-static void clamp_source_line_offsets_to_location(size_t line_start,
- size_t line_end,
- int first_column,
- int last_column,
- size_t max_line_length,
- size_t* out_new_line_start,
- size_t* out_new_line_end) {
- size_t line_length = line_end - line_start;
- if (line_length > max_line_length) {
- size_t column_range = last_column - first_column;
- size_t center_on;
- if (column_range > max_line_length) {
- /* the column range doesn't fit, just center on first_column */
- center_on = first_column - 1;
- } else {
- /* the entire range fits, display it all in the center */
- center_on = (first_column + last_column) / 2 - 1;
- }
- if (center_on > max_line_length / 2)
- line_start += center_on - max_line_length / 2;
- if (line_start > line_end - max_line_length)
- line_start = line_end - max_line_length;
- line_end = line_start + max_line_length;
- }
-
- *out_new_line_start = line_start;
- *out_new_line_end = line_end;
-}
-
-WasmResult wasm_lexer_get_source_line(WasmLexer lexer,
- const WasmLocation* loc,
- size_t line_max_length,
- char* line,
- size_t* out_line_length,
- int* out_column_offset) {
- WasmResult result;
- size_t line_start;
- size_t line_end;
- result =
- lexer_get_offsets_from_line(lexer, loc->line, &line_start, &line_end);
- if (WASM_FAILED(result))
- return result;
-
- size_t new_line_start;
- size_t new_line_end;
- clamp_source_line_offsets_to_location(
- line_start, line_end, loc->first_column, loc->last_column,
- line_max_length, &new_line_start, &new_line_end);
- WasmBool has_start_ellipsis = line_start != new_line_start;
- WasmBool has_end_ellipsis = line_end != new_line_end;
-
- char* write_start = line;
- size_t line_length = new_line_end - new_line_start;
- size_t read_start = new_line_start;
- size_t read_length = line_length;
- if (has_start_ellipsis) {
- memcpy(line, "...", 3);
- read_start += 3;
- write_start += 3;
- read_length -= 3;
- }
- if (has_end_ellipsis) {
- memcpy(line + line_length - 3, "...", 3);
- read_length -= 3;
- }
-
- WasmLexerExtra* extra = wasm_lexer_get_extra(lexer);
- if (extra->type == WASM_LEXER_TYPE_BUFFER) {
- char* buffer_read_start = (char*)extra->buffer.data + read_start;
- memcpy(write_start, buffer_read_start, read_length);
- } else {
- assert(extra->type == WASM_LEXER_TYPE_FILE);
- FILE* lexer_file = extra->file;
- long old_offset = ftell(lexer_file);
- if (old_offset == -1)
- return WASM_ERROR;
- if (fseek(lexer_file, read_start, SEEK_SET) == -1)
- return WASM_ERROR;
- if (fread(write_start, 1, read_length, lexer_file) < read_length)
- return WASM_ERROR;
- if (fseek(lexer_file, old_offset, SEEK_SET) == -1)
- return WASM_ERROR;
- }
-
- line[line_length] = '\0';
-
- *out_line_length = line_length;
- *out_column_offset = new_line_start - line_start;
- return WASM_OK;
-}
diff --git a/src/wasm-literal.h b/src/wasm-literal.h
index 7196e641..07e70a78 100644
--- a/src/wasm-literal.h
+++ b/src/wasm-literal.h
@@ -23,7 +23,7 @@
/* These functions all return WASM_OK on success and WASM_ERROR on failure.
*
- * NOTE: the functions are written for use with the flex lexer, assuming that
+ * NOTE: the functions are written for use with the re2c lexer, assuming that
* the literal has already matched the regular expressions defined there. As a
* result, the only validation that is done is for overflow, not for otherwise
* bogus input. */
diff --git a/src/wasm.js b/src/wasm.js
index 5a2b4a08..6761d0f5 100644
--- a/src/wasm.js
+++ b/src/wasm.js
@@ -227,24 +227,24 @@ var JSStringWriter = function() {
JSStringWriter.prototype = Object.create(JSWriter.prototype);
-// Lexer ///////////////////////////////////////////////////////////////////////
-var Lexer = function() {
- throw "Lexer must be created with $fromBuffer";
+// AstLexer ///////////////////////////////////////////////////////////////////////
+var AstLexer = function() {
+ throw "AstLexer must be created with $fromBuffer";
};
-Lexer.prototype = Object.create(Object.prototype);
-Lexer.fromBuffer = function(allocator, filename, buffer) {
+AstLexer.prototype = Object.create(Object.prototype);
+AstLexer.fromBuffer = function(allocator, filename, buffer) {
var $filename = allocateString(filename);
- var addr = Module._wasm_new_buffer_lexer(allocator.$addr, $filename,
- buffer.$addr, buffer.$size);
+ var addr = Module._wasm_new_ast_buffer_lexer(allocator.$addr, $filename,
+ buffer.$addr, buffer.$size);
if (addr == 0)
- throw "Lexer.fromBuffer failed";
- var this_ = Object.create(Lexer.prototype);
+ throw "AstLexer.fromBuffer failed";
+ var this_ = Object.create(AstLexer.prototype);
this_.$addr = addr;
this_.$filename = $filename;
return this_;
};
-Lexer.prototype.$destroy = function() {
- Module._wasm_destroy_lexer(this.$addr);
+AstLexer.prototype.$destroy = function() {
+ Module._wasm_destroy_ast_lexer(this.$addr);
freeString(this.$filename);
};
@@ -469,10 +469,10 @@ Writer.prototype.$moveData = function(dstOffset, srcOffset, size, userData) {
// Free functions //////////////////////////////////////////////////////////////
-var parse = function(lexer, errorHandler) {
+var parseAst = function(lexer, errorHandler) {
var script = new Script();
var result =
- Module._wasm_parse(lexer.$addr, script.$addr, errorHandler.$addr);
+ Module._wasm_parse_ast(lexer.$addr, script.$addr, errorHandler.$addr);
if (result != OK)
throw "parse failed";
return script;
@@ -507,10 +507,10 @@ wasm = {
ERROR: ERROR,
Allocator: Allocator,
+ AstLexer: AstLexer,
Buffer: Buffer,
JSStringWriter: JSStringWriter,
JSWriter: JSWriter,
- Lexer: Lexer,
LibcAllocator: LibcAllocator,
Location: Location,
MemoryWriter: MemoryWriter,
@@ -524,7 +524,7 @@ wasm = {
checkAst: checkAst,
markUsedBlocks: markUsedBlocks,
- parse: parse,
+ parseAst: parseAst,
writeBinaryScript: writeBinaryScript,
};