Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.
src/literals/literals.x
X2c literal parsing.
Functions
| Function | Summary |
|---|---|
Compiler.literal_cell | Conses the element expression head onto the cells tail, or appends the List a (splice EXPR) head holds, and folds the cell into the literal cache when both parts are constant. |
Compiler.parse_array_literal | Parses a quoted Array literal into a typed, source-ordered (array ...) node and consumes its closing ]. |
Compiler.parse_atomic_literal | Parses the current atomic token into a typed expression and advances once. |
Compiler.parse_catch_pattern_literal | Parses a filtered-catch %() payload into a typed List pattern. |
Compiler.parse_list_literal | Parses a List literal beginning at ( or %( and returns its typed expression after consuming ). |
Compiler.parse_macro_pattern_arguments | Parses a macro pattern’s parenthesized arguments and returns the static pattern of each: a binder or wildcard, a nested macro pattern, or a %(...) List pattern. |
Compiler.parse_map_entries | Parses comma-separated Map entries up to but not including }. |
Compiler.parse_map_entry | Parses one Map entry without consuming its following comma or }. |
Compiler.parse_map_literal | Parses a quoted Map literal into a typed, source-ordered (map ...) node and consumes its closing }. |
Compiler.parse_raise_literal | Parses the %() payload following raise into a (raise CODE (args ...)) node and consumes its closing ). |
Compiler.parse_string_literal | Parses a percent String literal and returns its typed expression after the closing quote. |
Compiler.parse_symbol_set_literal | Parses a %<<...>> literal into an immutable ordered SymbolSet. |
Compiler.symbol_set_expression | Builds a typed SymbolSet expression from source-ordered Symbol values. |
Compiler.try_parse_macro_pattern_insertion | Parses a pattern’s ${$NAME(...)}, where NAME is a macro, into its derived pattern, or returns NULL without consuming tokens. |
Compiler.typed_match_pattern | Applies each typed capture’s predicate to every unquoted occurrence. |
Compiler
Compiler.literal_cell
List Compiler.literal_cell(Compiler c, List head, List tail)
Conses the element expression head onto the cells tail, or appends
the List a (splice EXPR) head holds, and folds the cell into the
literal cache when both parts are constant.
Source: src/literals/quotation.x:256
Compiler.parse_array_literal
List Compiler.parse_array_literal(Compiler c)
Parses a quoted Array literal into a typed, source-ordered (array ...)
node and consumes its closing ].
Source: src/literals/collections.x:121
Compiler.parse_atomic_literal
List Compiler.parse_atomic_literal(Compiler c)
Parses the current atomic token into a typed expression and advances once. Pattern and macro-hole state control binder validation and quoting, while shallow parsing permits provisional numeric types.
Source: src/literals/atoms.x:34
Compiler.parse_catch_pattern_literal
List Compiler.parse_catch_pattern_literal(Compiler c)
Parses a filtered-catch %() payload into a typed List pattern.
The call consumes the closing ). A code Symbol, binder, or pattern
may be followed by * patterns or (key pattern) pairs; pattern and
runtime-literal state is restored on every exit.
Source: src/literals/payloads.x:98
Compiler.parse_list_literal
List Compiler.parse_list_literal(Compiler c)
Parses a List literal beginning at ( or %( and returns its typed
expression after consuming ). Pattern parsing sets and restores
match_is; runtime_literals disables stable-cell caching.
Source: src/literals/quotation.x:35
Compiler.parse_macro_pattern_arguments
List Compiler.parse_macro_pattern_arguments(Compiler c)
Parses a macro pattern’s parenthesized arguments and returns the static
pattern of each: a binder or wildcard, a nested macro pattern, or a
%(...) List pattern.
Source: src/literals/quotation.x:146
Compiler.parse_map_entries
List Compiler.parse_map_entries(Compiler c)
Parses comma-separated Map entries up to but not including }.
Entry-position macro sequences are flattened in source order.
Source: src/literals/collections.x:206
Compiler.parse_map_entry
List Compiler.parse_map_entry(Compiler c)
Parses one Map entry without consuming its following comma or }.
A bare identifier key is an Atom; any other key is an expression.
A direct row returns a resolved (map-entry KEY VALUE) node; an
entry-position macro may return (seq ...) for its caller to splice.
Source: src/literals/collections.x:221
Compiler.parse_map_literal
List Compiler.parse_map_literal(Compiler c)
Parses a quoted Map literal into a typed, source-ordered (map ...) node
and consumes its closing }.
Source: src/literals/collections.x:155
Compiler.parse_raise_literal
List Compiler.parse_raise_literal(Compiler c)
Parses the %() payload following raise into a (raise CODE (args ...))
node and consumes its closing ). The code is a bare Symbol or a
$name reference, detail keys are bare Symbols, each keyed detail has
one value, and payload literals bypass the compiler cache.
Source: src/literals/payloads.x:32
Compiler.parse_string_literal
List Compiler.parse_string_literal(Compiler c)
Parses a percent String literal and returns its typed expression after
the closing quote. Static segments enter the compiler cache unless
runtime_literals is set; interpolated segments remain source ordered.
Source: src/literals/strings.x:18
Compiler.parse_symbol_set_literal
List Compiler.parse_symbol_set_literal(Compiler c)
Parses a %<<...>> literal into an immutable ordered SymbolSet.
Entries must be literal compact Symbols; source order defines dense
indexes and an equal encoded Symbol reports a duplicate diagnostic.
Source: src/literals/collections.x:30
Compiler.symbol_set_expression
List Compiler.symbol_set_expression(Compiler c, List values, int &duplicate)
Builds a typed SymbolSet expression from source-ordered Symbol values.
Stores the first duplicate index, or -1, through duplicate; a duplicate
returns NULL.
Source: src/literals/collections.x:72
Compiler.try_parse_macro_pattern_insertion
List Compiler.try_parse_macro_pattern_insertion(Compiler c, int content)
Parses a pattern’s ${$NAME(...)}, where NAME is a macro, into its
derived pattern, or returns NULL without consuming tokens. content
selects the bare content, for the content position of an
(expr TYPE ...) shell.
Source: src/literals/quotation.x:184
Compiler.typed_match_pattern
List Compiler.typed_match_pattern(Compiler c, List pattern, List types)
Applies each typed capture’s predicate to every unquoted occurrence.
Source: src/literals/quotation.x:336
Design notes
Each literal parses to a typed expression. A List cell or String
segment with no dynamic reference enters the compiler cache and is built
once; runtime_literals builds every one at run time instead. Lambda
literals parse in lambdas.x.