Skip to main content

Module lexer

Module lexer 

Source
Expand description

Lexer and token/trivia types for Daml source text. DAML lexer: source text → tokens with spans.

First stage of the real parser pipeline (lexer → layout → parse). Comments (line --, nested block {- -}) and string/char literals are resolved here, so no later stage can ever mistake -- exercise the option for a ledger action.

Structs§

ByteOffset
Parser byte offset into the original UTF-8 source.
ByteSpan
Byte span into the original UTF-8 source.
Identifier
A small, deliberately unchecked domain type for parser identifier-like text.
LexError
A lexical error. The scan must survive these: the caller reports the diagnostic and works with the tokens produced so far.
LexOutput
LexWithTriviaOutput
ModuleName
A small, deliberately unchecked domain type for module-style qualified names (DA.Map, Daml.Foo).
Operator
A small, deliberately unchecked domain type for symbolic operator text.
Pos
1-based source position of a token’s first character.
Token
Trivia

Enums§

LexErrorKind
RenderLosslessError
TokenKind
Token category plus normalized token payload.
TriviaKind
Source text the lexer consumes but the parser never sees.

Functions§

lex
Lex source into tokens and lexical errors only.
lex_with_trivia
Lex source into tokens, trivia, and lexical errors.
render_lossless
Reconstruct the source from token and trivia spans.