Skip to main content

Crate harn_lexer

Crate harn_lexer 

Source

Structs§

FixEdit
A machine-applicable text replacement for autofixing diagnostics.
Lexer
Character-by-character scanner producing tokens.
Span
Source location for error reporting.
Token
A token with its kind and source location.

Enums§

LexerError
Lexer errors.
StringSegment
A segment of an interpolated string.
TokenKind
Token kinds produced by the lexer.

Constants§

KEYWORDS
Canonical list of Harn language keywords. Single source of truth; the lexer’s identifier-to-keyword match must stay in sync (enforced by test_keywords_const_covers_lexer). External tooling should consume this rather than duplicate it.

Functions§

escape_string_literal
Escape value so it round-trips as the body of a double-quoted Harn string literal: the lexer’s escape set (\n, \r, \t, \0, \\, \") plus \$ before { so a value containing ${…} renders as text instead of becoming live interpolation when the generated source is compiled. This is the single source of truth for code generators — the CLI’s harn try scaffolding and the VM’s composition/crystallize codegen had each grown a private copy that forgot ${, letting a value like ${host_call(...)} execute.