tripon[github]

diagnostic codes / Parser

E0102 missing-token

A required token was missing.

E0102missing-tokenexpected the token named in the message
severityerror
bandParser
in the v0 bootstrapreserved — not emitted yet
explainralt explain E0102

The frozen table reserves a distinct code for a missing token, separate from a token that is present and wrong. The bootstrap currently reports both as E0101 and puts the expected token in the message text, so the information is there even though the second code is not.

Not emitted by the v0 bootstrap

Not emitted by the v0 bootstrap. Every parse error today, including a missing `;`, carries E0101; the message still names the token that was expected.

What it looks like

e0102.tp
use tier core;

fn main() -> i32 {
    let x = 1
    return 0;
}
ralt check e0102.tp
e0102.tp:5:5: error: expected ';' to end the statement, got 'return'
  [E0101 unexpected-token] see spec/grammar.ebnf for what is legal here

What to do

  • Add the token named in the message.
  • A `let` statement always ends in `;`, including when it is the last statement before `}`.
  • An `if` or `while` body is a block and takes no `;` after the closing brace.

Why the code exists

The split matters to a tool, not a person: a missing token is usually a one-character insertion at the reported span, while a wrong token may need a rewrite. Keeping the codes separate lets a fixer choose the cheaper edit without reading English.

What ralt explain says

ralt explain E0102
E0102
severity: error
name: missing-token
hint: expected the token named in the message

Related