All files

src/compiler/types.panack

Green: covered; red: known zero; amber: unavailable. Blank lines are outside the executable-start-line denominator.

    1 // Source positions use Unicode code-point offsets and one-based line/column values.
    2 // Shared token and diagnostic records preserve those coordinates across passes.
    3 
    4 pub record SourcePos {
    5   file: Str,
    6   offset: Nat,
    7   line: Nat,
    8   column: Nat
    9 }
   10 
   11 // Half-open Unicode code-point range in one original source file.
   12 pub record SourceSpan {
   13   start: SourcePos,
   14   end: SourcePos
   15 }
   16 
   17 pub enum TokenKind {
   18   Identifier,
   19   Number,
   20   DecimalNumber,
   21   StringLiteral,
   22   Punctuation
   23 }
   24 
   25 pub record Token {
   26   kind: TokenKind,
   27   text: Str,
   28   start: Nat,
   29   end: Nat,
   30   position: SourcePos,
   31   end_line: Nat,
   32   end_column: Nat
   33 }
   34 
   35 pub record Diagnostic {
   36   message: Str,
   37   position: SourcePos
   38 }
   39 
   40 pub pure diagnostic_text(diagnostic: Diagnostic): Str {
   41   position: SourcePos = diagnostic.position
   42 
   43   if position.file.len() > 0 {
   44     file: Str = position.file
   45     line: Nat = position.line
   46     column: Nat = position.column
   47     message: Str = diagnostic.message
   48     "${file}:${line}:${column}: ${message}"
   49   } else {
   50     diagnostic.message
   51   }
   52 }
   53 

Functions

[
  {
    "id": "declaration/5",
    "name": "diagnostic_text",
    "line": 40,
    "state": "covered",
    "entries": "267"
  }
]

Source branch outcomes

[
  {
    "id": "declaration/5/tail/decision/true",
    "outcome": "true",
    "line": 43,
    "state": "covered",
    "hits": "32"
  },
  {
    "id": "declaration/5/tail/decision/false",
    "outcome": "false",
    "line": 43,
    "state": "covered",
    "hits": "235"
  }
]

Reviewed declaration exclusions

[
  {
    "id": "declaration/0",
    "reason": "record-declaration",
    "line": 4
  },
  {
    "id": "declaration/1",
    "reason": "record-declaration",
    "line": 12
  },
  {
    "id": "declaration/2",
    "reason": "enum-declaration",
    "line": 17
  },
  {
    "id": "declaration/3",
    "reason": "record-declaration",
    "line": 25
  },
  {
    "id": "declaration/4",
    "reason": "record-declaration",
    "line": 35
  }
]