summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThomas Lively <tlively@google.com>2023-12-20 14:17:35 -0800
committerGitHub <noreply@github.com>2023-12-20 14:17:35 -0800
commitfb7d00b336c8d682cbaaf02c96dab64b39d941ba (patch)
tree8b01240df861436fd0b74d2175155fa334f724bc /scripts
parent2b81d39e133ff443c09837c7b0bf77e661d15345 (diff)
downloadbinaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.tar.gz
binaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.tar.bz2
binaryen-fb7d00b336c8d682cbaaf02c96dab64b39d941ba.zip
Drop support for non-standard quoted function names (#6188)
We previously supported a non-standard `(func "name" ...` syntax for declaring functions exported with the quoted name. Since that is not part of the standard text format, drop support for it, replacing it with the standard `(func $name (export "name") ...` syntax instead. Also replace our other usage of the quoted form in our text output, which was where we quoted names containing characters that are not allowed to appear in standard names. To handle that case, adjust our output from `"$name"` to `$"name"`, which is the standards-track way of supporting such names. Also fix how we detect non-standard name characters to match the spec. Update the lit test output generation script to account for these changes, including by making the `$` prefix on names mandatory. This causes the script to stop interpreting declarative element segments with the `(elem declare ...` syntax as being named "declare", so prevent our generated output from regressing by counting "declare" as a name in the script.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/update_lit_checks.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/update_lit_checks.py b/scripts/update_lit_checks.py
index ef1dc6aae..79af92ab9 100755
--- a/scripts/update_lit_checks.py
+++ b/scripts/update_lit_checks.py
@@ -39,7 +39,11 @@ MODULE_RE = re.compile(r'^\(module.*$', re.MULTILINE)
ALL_ITEMS = '|'.join(['type', 'import', 'global', 'memory', 'data', 'table',
'elem', 'tag', 'export', 'start', 'func'])
-ITEM_NAME = r'\$?[^\s()]*|"[^\s()]*"'
+
+# Regular names as well as the "declare" in (elem declare ... to get declarative
+# segments included in the output.
+ITEM_NAME = r'\$[^\s()]*|"[^\s()]*"|declare'
+
# FIXME: This does not handle nested string contents. For example,
# (data (i32.const 10) "hello(")
# will look unterminated, due to the '(' inside the string. As a result, the
@@ -152,9 +156,9 @@ def parse_output_fuzz_exec(text):
for line in text.split('\n'):
func = FUZZ_EXEC_FUNC.match(line)
if func:
- # Add quotes around the name because that is how it will be parsed
+ # Add a '$' prefix to the name because that is how it will be parsed
# in the input.
- name = f'"{func.group("name")}"'
+ name = '$' + func.group("name")
items.append((('func', name), [line]))
elif line.startswith('[host limit'):
# Skip mentions of host limits that we hit. This can happen even