diagnostic codes / Lexer
E0001 unterminated-string
A string was opened and never closed.
| severity | error |
|---|---|
| band | Lexer |
| in the v0 bootstrap | emitted |
| explain | ralt explain E0001 |
The lexer starts a string at the first double quote and looks for the matching quote on the same line. A newline before it is not allowed to continue the string; it ends the token with an error. Everything after the unclosed quote is still lexed, which is why one missing `"` usually arrives with one or two follow-on errors.
What it looks like
use tier core; fn main() -> i32 { print_str("oops); return 0; }
ralt check e0001.tp e0001.tp:4:15: error: unterminated string [E0001 unterminated-string] string must close with a double quote on the same line e0001.tp:5:5: error: expected ')' to close the call, got 'return' [E0101 unexpected-token] see spec/grammar.ebnf for what is legal here e0001.tp:5:5: error: expected ';' to end the statement, got 'return' [E0101 unexpected-token] see spec/grammar.ebnf for what is legal here
The two E0101 lines are cascade: the parser never saw a `)` or a `;`, because the string swallowed them. Fix the first error and the rest usually vanish. Do not chase the last line first.
What to do
- Close the string with `"` on the same line.
- Multi-line text is a sequence of strings, not one literal: there is no triple-quoted form and no automatic continuation.
- If the quote is meant to be literal, escape it as `\"`.
Why the code exists
A string that silently continues across lines makes every subsequent line's column numbers a lie, and column numbers are the contract this compiler gives an agent. Refusing early keeps spans exact.
What ralt explain says
ralt explain E0001 E0001 severity: error name: unterminated-string hint: string must close with a double quote on the same line
Related
- Literals and names /docs/reference/literals