summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2022-10-12 16:19:58 -0500
committerGitHub <noreply@github.com>2022-10-12 21:19:58 +0000
commit5449744d79ec996c7334681ac1b85e5461194dc8 (patch)
treed1823bda7990365a8e9ea037f9474444cbe92aea /scripts
parent27e654a775d3767c3dcedaf583d97c4c8b84d60c (diff)
downloadbinaryen-5449744d79ec996c7334681ac1b85e5461194dc8.tar.gz
binaryen-5449744d79ec996c7334681ac1b85e5461194dc8.tar.bz2
binaryen-5449744d79ec996c7334681ac1b85e5461194dc8.zip
[Parser][NFC] Pass instruction locations to `makeXXX` functions (#5133)
The `makeXXX` functions that are responsible for individual instructions will generally need the locations of those functions to emit useful errors. However, since the instruction names are parsed before the `makeXXX` functions are called, the functions have no good way of getting the location of the beginning of the instruction. Fix this by explicitly passing them the location of the beginning of the instruction.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen-s-parser.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py
index 35c0bdae3..4a701680d 100755
--- a/scripts/gen-s-parser.py
+++ b/scripts/gen-s-parser.py
@@ -720,8 +720,8 @@ def instruction_parser(new_parser=False):
def print_leaf(expr, inst):
if new_parser:
- expr = expr.replace("()", "(ctx)")
- expr = expr.replace("(s", "(ctx")
+ expr = expr.replace("()", "(ctx, pos)")
+ expr = expr.replace("(s", "(ctx, pos")
printer.print_line("if (op == \"{inst}\"sv) {{".format(inst=inst))
with printer.indent():
printer.print_line("auto ret = {expr};".format(expr=expr))