summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2024-04-29 10:24:24 -0700
committerGitHub <noreply@github.com>2024-04-29 10:24:24 -0700
commite257ceccbddcfedf08d50f388d82d0cc637c64ac (patch)
tree8dc146d85d4cc3fcc518c75e5db99d85e9369941 /src
parenta7c434bdc98025f182cadac74e6a2a3cd0359f60 (diff)
downloadbinaryen-e257ceccbddcfedf08d50f388d82d0cc637c64ac.tar.gz
binaryen-e257ceccbddcfedf08d50f388d82d0cc637c64ac.tar.bz2
binaryen-e257ceccbddcfedf08d50f388d82d0cc637c64ac.zip
Use the new wat parser in the C API (#6555)
Diffstat (limited to 'src')
-rw-r--r--src/binaryen-c.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/binaryen-c.cpp b/src/binaryen-c.cpp
index 93e3f609b..f27f6e2c8 100644
--- a/src/binaryen-c.cpp
+++ b/src/binaryen-c.cpp
@@ -23,6 +23,7 @@
#include "binaryen-c.h"
#include "cfg/Relooper.h"
#include "ir/utils.h"
+#include "parser/wat-parser.h"
#include "pass.h"
#include "shell-interface.h"
#include "support/colors.h"
@@ -5578,13 +5579,9 @@ void BinaryenModuleSetFeatures(BinaryenModuleRef module,
BinaryenModuleRef BinaryenModuleParse(const char* text) {
auto* wasm = new Module;
- try {
- SExpressionParser parser(text);
- Element& root = *parser.root;
- SExpressionWasmBuilder builder(*wasm, *root[0], IRProfile::Normal);
- } catch (ParseException& p) {
- p.dump(std::cerr);
- Fatal() << "error in parsing wasm text";
+ auto parsed = WATParser::parseModule(*wasm, text);
+ if (auto* err = parsed.getErr()) {
+ Fatal() << err->msg << "\n";
}
return wasm;
}