Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Quoted identifiers and invalid lexing #25

@alexcrichton

Description

@alexcrichton

In #23 a test was added along the lines of:

(assert_malformed (module quote "(func $\"a\tb\")") "empty identifier")

This is asserting that a string-based identifier with invalid characters in the string is invalid, but I'm opening this issue to clarify the error emitted here. In the prototype implementation in wasm-tools of #23 the error looks like:

invalid character in string '\t'
                 --> <anon>:1:10
                  |
                1 | (func $"a    b")
                  |          ^

Specifically I'm curious about the lexical format here. Despite both implementations returning an error there's been bits about subtle differences between lexers in the past so I want to smooth this out ideally. I was under the impression that the token was going to be $"a\tb" (with the \t expanded) so during the lexing phase after seeing the $ the adjacent " means "activate the string parser". In doing so an error is generated. It looks like the spec interpreter ignores the string error and assumes the token ends just before the string, but in wasm-tools I was thinking of reporting the string parsing error.

Is there a specific behavior desired here? Is there a downside to reporting the string-parse-error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions