Skip to content

L001 -- Lexer Error

The source text could not be tokenized, so parsing never starts. The message names the exact problem.

Examples

Unterminated string literal:

fn main() {
  let s = "abc;
}
error[L001]: 2:11: unterminated string literal

Unterminated char literal, or an escape that is not valid in a char:

fn main() {
  let c = '\u{1F600}';
}
error[L001]: 2:11: invalid escape in char literal
error[L001]: 2:21: unterminated char literal

\u{...} is a string-only escape, so the char form reports an invalid escape and then an unterminated literal. Write the codepoint as a string instead.

Fix

  • Close every " and '.
  • A char literal holds exactly one Unicode scalar value.
  • Valid escapes: \n, \t, \\, \" in both strings and chars; \u{...} in strings only.

Notes

  • One bad token can produce more than one L001 line; fix the first one and recompile.
  • L001 suppresses every later stage, so type errors below it are not shown yet.