M Mozhi v3.7.0 code

Error reference › Lexer diagnostics

LEX004

unterminated block comment

error
verifiedverified on v3.7.0 categorylexer terminalstable code

What it means

Block comments nest in Mozhi (`/* /* */ */` is one comment). When the scanner runs out of input while the nesting depth is still positive, the whole remainder of the file is comment — usually a missing `*/` or an accidentally nested opener.

Trigger condition

A `/*` block comment is never closed with `*/` before the end of the input.

Minimal failing example

/* TODO: fix this
fn main() {
  echo("unreachable")
}

Verified fix

/* TODO: fix this */
fn main() {
  echo("reachable")
}

The diagnostic points at the line/column where the comment opened.

What the interpreter prints

error[LEX004]: unterminated block comment
  --> app.mz:1:16
 1 | /* TODO: fix this
   |                 ^
   |
reason: (the exact problem, with positions)
help:   (a suggested fix appears here)
docs:   https://crossberry-in.github.io/mozhi-doc/errors/LEX004
Run mozhi --json run app.mz to get the same information as machine-readable JSON (schema mozhi.diagnostics.v1), or --verbose to also show grouped related diagnostics. See the CLI reference.

Suggested fix

Close the comment with `*/`. Prefer `//` line comments for short notes.

Related syntax

Comments

Related diagnostics

None

Reference links

Limitations

The diagnostic reports the opening position; finding the intended close point is up to you.