Skip to content

[test] Add string escape cases - #2352

Merged
rossberg merged 2 commits into
WebAssembly:mainfrom
WasmEdge:test-escape-underscore
Nov 26, 2026
Merged

rossberg merged 2 commits into
WebAssembly:mainfrom
WasmEdge:test-escape-underscore

Conversation

@ibmibmibm

Copy link
Copy Markdown
Contributor

Adds the first tests for the \r and \' escapes, and for _ in \u{...}. Each name is invoked by another spelling, so the decoded value is checked. A leading, trailing or double _ is an illegal escape.

wast2json 1.0.42 rejects the valid \u{1_F600}, so it can no longer convert names.wast.

No test uses the \r and \' string escapes. Export a function under
each name and invoke it by an independent spelling of the same name.
The hex digits of a \u{...} escape follow the hexnum rule, so one
underscore between two digits is valid. Export a name with \u{1_F600}
and invoke it by its UTF-8 bytes. A leading, trailing, or double
underscore is an illegal escape.
@ibmibmibm
ibmibmibm marked this pull request as ready for review November 25, 2026 23:25
ibmibmibm added a commit to WasmEdge/wabt that referenced this pull request Nov 26, 2026
The text format defines the digits of a `\u{...}` escape as a hexnum,
which lets a single `_` separate two hex digits, for example
`\u{1_F600}`. WebAssembly/spec#2352 adds this case to names.wast, and
wabt rejects it with `bad escape "\u{1"`. The lexer and the string
decoder now accept it. A leading, trailing or double `_` is still a bad
escape.
@rossberg
rossberg merged commit 2199515 into WebAssembly:main Nov 26, 2026
2 checks passed
ibmibmibm added a commit to WasmEdge/wabt that referenced this pull request Nov 26, 2026
The text format defines the digits of a `\u{...}` escape as a hexnum,
which lets a single `_` separate two hex digits, for example
`\u{1_F600}`. WebAssembly/spec#2352 adds this case to names.wast, and
wabt rejects it with `bad escape "\u{1"`. The lexer and the string
decoder now accept it. A leading, trailing or double `_` is still a bad
escape.
@ibmibmibm
ibmibmibm deleted the test-escape-underscore branch November 26, 2026 11:18
ibmibmibm added a commit to WasmEdge/wabt that referenced this pull request Nov 26, 2026
The text format defines the digits of a `\u{...}` escape as a hexnum,
which lets a single `_` separate two hex digits, for example
`\u{1_F600}`. WebAssembly/spec#2352 adds this case to names.wast, and
wabt rejects it with `bad escape "\u{1"`. The lexer and the string
decoder now accept it. A leading, trailing or double `_` is still a bad
escape.
ibmibmibm added a commit to WasmEdge/wabt that referenced this pull request Nov 27, 2026
The text format defines the digits of a `\u{...}` escape as a hexnum,
which lets a single `_` separate two hex digits, for example
`\u{1_F600}`. WebAssembly/spec#2352 adds this case to names.wast, and
wabt rejects it with `bad escape "\u{1"`. The lexer and the string
decoder now accept it. A leading, trailing or double `_` is still a bad
escape.
ibmibmibm added a commit to WasmEdge/wabt that referenced this pull request Nov 27, 2026
The text format defines the digits of a `\u{...}` escape as a hexnum,
which lets a single `_` separate two hex digits, for example
`\u{1_F600}`. WebAssembly/spec#2352 adds this case to names.wast, and
wabt rejects it with `bad escape "\u{1"`. The lexer and the string
decoder now accept it. A leading, trailing or double `_` is still a bad
escape.
ibmibmibm added a commit to WasmEdge/wabt that referenced this pull request Nov 27, 2026
The text format defines the digits of a `\u{...}` escape as a hexnum,
which lets a single `_` separate two hex digits, for example
`\u{1_F600}`. WebAssembly/spec#2352 adds this case to names.wast, and
wabt rejects it with `bad escape "\u{1"`. The lexer and the string
decoder now accept it. A leading, trailing or double `_` is still a bad
escape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants