Documentation
¶
Overview ¶
Package token defines the lexical tokens of the Runefile language and the source-position types that every token and AST node carries. Precise positions are the foundation of Principle II ("errors are a feature"): every diagnostic renders file:line:col with a caret-underlined span.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind int
Kind enumerates the lexical token kinds produced by the lexer.
const ( ILLEGAL Kind = iota // an unrecognized rune (carries a diagnostic) EOF // end of input // Layout (significant indentation). NEWLINE // end of a logical line INDENT // start of a more-indented block (a task body) DEDENT // end of an indented block COMMENT // # ... (declaration context only; bodies are raw text) IDENT // a name: letter { letter | digit | _ | - } STRING // a string literal; Lit holds the decoded value // Keywords. SET IMPORT MOD IF ELSE // Punctuation & operators. ASSIGN // := COLON // : COLONCOLON // :: (namespace separator) COMMA // , AT // @ (body: suppress echo) DASH // - (body: continue on error) PLUS // + (concat / variadic-plus) STAR // * (variadic-star) SLASH // / (path join) AMPAMP // && PIPEPIPE // || EQ // == NEQ // != MATCH // =~ EQUALS // = (param default, cache(inputs=...)) LPAREN // ( RPAREN // ) LBRACK // [ RBRACK // ] LBRACE // { RBRACE // } QUESTION // ? (import? optional-import marker) BODYTEXT // raw text of a task body line (may contain {{ ... }}) )
type Position ¶
type Position struct {
Offset int // 0-based byte offset into the file
Line int // 1-based line number
Col int // 1-based column number (bytes)
}
Position is a location in a source file: a 0-based byte offset plus a 1-based line and column (column counted in bytes from the start of the line).
type Span ¶
Span is a half-open range [Start, End) within a single file. It is attached to every AST node and every Diagnostic.
Click to show internal directories.
Click to hide internal directories.