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§

Identifier
A small domain type for 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 domain type for module-style qualified names (DA.Map, Daml.Foo).
Operator
A small domain type for symbolic operator text.
Pos
1-based source position of a token’s first character.
Token
Trivia

Enums§

LexErrorKind
RenderLosslessError
TokenKind
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.