Sakura Lang

V0002 unterminated

A string literal, interpolation or block comment reaches the end of the file without being closed.

An error from the lex phase. sakura explain V0002 prints this explanation offline.

A string literal, interpolation or block comment reaches the end of the file without being closed.

Wrong:

let s = "hello

Fixed:

let s = "hello"

Wrong program

compiler/tests/ui/V0002_unterminated_block_comment.sakura, which the compiler's ui suite runs through sakura check:

fn one() -> Int { 1 }
/* this comment never closes

sakura check --json reports this record (pretty-printed; $DIR is the fixture's directory):

{
  "schema_version": "1.0",
  "kind": "diagnostic",
  "id": "d:314d98857730bb67",
  "code": "V0002",
  "severity": "error",
  "phase": "lex",
  "message": "unterminated block comment",
  "snapshot": "sha256:$SNAPSHOT",
  "symbol_id": null,
  "spans": [
    {
      "uri": "file://$DIR/V0002_unterminated_block_comment.sakura",
      "content_hash": "sha256:07a72a6fce2707973062936a0e1963fa5edbb2e766238d9f06335da6403199f7",
      "start_byte": 56,
      "end_byte": 85,
      "role": "primary"
    }
  ],
  "related_ids": [],
  "expected": null,
  "actual": null,
  "obligation": null,
  "counterexample": null,
  "explanation_uri": "sakura://explain/V0002",
  "fixes": []
}

Fixed program

compiler/tests/ui/V0002_unterminated_block_comment.fixed.sakura, which sakura check accepts with no diagnostics:

fn one() -> Int { 1 }

/* this comment is closed */
Edit on GitHub

On this page