summaryrefslogtreecommitdiff
path: root/src/wast-parser-lexer-shared.cc
diff options
context:
space:
mode:
authorBen Smith <binjimin@gmail.com>2017-06-07 12:45:08 -0700
committerGitHub <noreply@github.com>2017-06-07 12:45:08 -0700
commitd999df990e41634e45c199ca1e391b06f4734ebe (patch)
tree99335c60f7262b94e76204f35748ced7b62f5b85 /src/wast-parser-lexer-shared.cc
parent044a198e827521f54b5260486ad3c89350b79450 (diff)
downloadwabt-d999df990e41634e45c199ca1e391b06f4734ebe.tar.gz
wabt-d999df990e41634e45c199ca1e391b06f4734ebe.tar.bz2
wabt-d999df990e41634e45c199ca1e391b06f4734ebe.zip
Update testsuite; various lexing/parsing fixes (#482)
* Update testsuite; various lexing/parsing fixes Lexer changes: * Switch re2c parser to UTF-8 parser. This can almost be done "for free" with a flag, but required a bit of work to allow us to catch malformed UTF-8 as well. * Change the re2c fill value to 0xff, since it's never a valid UTF-8 byte. * Allow for more reserved tokens (basically any ascii aside from parentheses, double-quote, and semi-colon) * Remove "infinity" from lexer, only "inf" is allowed now. * Change definition of EOF token, it was implemented incorrectly. The correct way to handle it is to only return it from FILL when there is no more data to fill. * \r is a valid escape. Parser changes: * Changes to match the spec parser: - block signatures use (result <type>) syntax - func/global/table/memory can have multiple inline exports - inline imports are handled in func definition instead of import definition - allow for inline modules (i.e. no "(module ...)" s-expr required) * Remove FuncField. This was previously used for parsing params/results/locals, but it's less code to just parse right-recursive (i.e. backward) and insert everything at the front. This requires reversing the indexes in the BindingHash too. * Remove the nasty macros `APPEND_FIELD_TO_LIST`, `APPEND_ITEM_TO_VECTOR`, `APPEND_INLINE_EXPORT`, and `CHECK_IMPORT_ORDERING`. This behavior is all handled by `append_module_fields` now. * All inline imports/exports are handled by returning additional ModuleFields in a list. This removes the need for `OptionalExport`, `ExportedFunc`, `ExportedGlobal`, `ExportedTable`, and `ExportedMemory`. * Use "_opt" suffix instead of "non_empty_" prefix, e.g.: - text_list => text_list_opt, non_empty_text_list => text_list * The locations changed for some symbols, typically the use the name following the LPAR now, e.g. (import ^^^^^^ * Add PPA for re2c 0.16 * add -y to skip confirmation on travis
Diffstat (limited to 'src/wast-parser-lexer-shared.cc')
-rw-r--r--src/wast-parser-lexer-shared.cc34
1 files changed, 6 insertions, 28 deletions
diff --git a/src/wast-parser-lexer-shared.cc b/src/wast-parser-lexer-shared.cc
index fe785fe8..34bf7ebe 100644
--- a/src/wast-parser-lexer-shared.cc
+++ b/src/wast-parser-lexer-shared.cc
@@ -77,34 +77,12 @@ void destroy_text_list(TextList* text_list) {
}
}
-FuncField::FuncField()
- : type(FuncFieldType::Exprs), first_expr(nullptr), next(nullptr) {}
-
-FuncField::~FuncField() {
- switch (type) {
- case FuncFieldType::Exprs:
- destroy_expr_list(first_expr);
- break;
-
- case FuncFieldType::ParamTypes:
- case FuncFieldType::LocalTypes:
- case FuncFieldType::ResultTypes:
- delete types;
- break;
-
- case FuncFieldType::BoundParam:
- case FuncFieldType::BoundLocal:
- destroy_string_slice(&bound_type.name);
- break;
- }
-}
-
-void destroy_func_fields(FuncField* func_field) {
- /* destroy the entire linked-list */
- while (func_field) {
- FuncField* next_func_field = func_field->next;
- delete func_field;
- func_field = next_func_field;
+void destroy_module_field_list(ModuleFieldList* fields) {
+ ModuleField* field = fields->first;
+ while (field) {
+ ModuleField* next = field->next;
+ delete field;
+ field = next;
}
}