Skip to content

Fix string continuations and emitted integer suffixes - #31

Closed
faysou wants to merge 2 commits into
aacebo:masterfrom
faysou:fix-literal-spelling
Closed

faysou wants to merge 2 commits into
aacebo:masterfrom
faysou:fix-literal-spelling

Conversation

@faysou

@faysou faysou commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

String, byte-string, and C-string literals accept escaped newlines and skip the following indentation. Suffixed integer constructors emit their suffix, so Lit::u64_suffixed(7) renders as 7u64.

The token literal tests pass.

Related to #25.

A backslash at the end of a line inside a string, which Rust uses to
continue the string on the next line, was a lex error, so the lexer
failed on source such as:

    log!("The handler was called, \
          which is expected");

The string escape scanner now accepts `\` followed by a newline (or
`\r\n`) and skips the whitespace that follows, and the decoded value
leaves both out, for string, byte string, and C string literals.
`Lit::u64_suffixed(7)` and the other `*_suffixed` constructors recorded
the suffix but wrote the literal's text without it, and a literal emits
its text, so `Lit::u64_suffixed(7)` emitted `7`. The constructors now
write the suffix into the text, as `proc_macro2::Literal::u64_suffixed`
does.
@faysou
faysou force-pushed the fix-literal-spelling branch from b8bb3e1 to 8349ab2 Compare November 21, 2026 07:04
@faysou faysou closed this Nov 21, 2026
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.

1 participant