Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Provisional API: This reference documents current compiler behavior. Compatibility is not yet promised.

src/grammar.x

The source forms that lowering recognizes.

Functions

FunctionSummary
catch_handleReturns the error handler the parser introduced for the catch arms of the parsed try node, or NULL for a try without catches.
retain_catch_handleRestores the binder’s handler after a caught template rebuild.
source_any_lambdaReturns a pattern for either lambda form, with or without captures.
source_block_contentBuilds block content with its complete source-ordered statements.
source_call_contentReturns bare call content with the supplied callee and argument patterns.
source_cast_contentBuilds cast content with its children unchanged.
source_commas_contentBuilds comma sequence content from its ordered rows.
source_composite_contentBuilds braced initializer content from its ordered comma rows.
source_conditional_statementReturns the canonical pattern for conditional statements.
source_content_patternReturns a source form’s content pattern without its typed shell.
source_declarator_rowReturns a pattern for a declarator row, with or without its initializer.
source_expressionReturns the source expression beneath casts and parentheses with its type.
source_generic_contentBuilds generic selection content with its declaration and ordered rows.
source_identifier_contentBuilds identifier content with its bound child records.
source_literal_contentBuilds literal content with its typed child records.
source_operator_contentBuilds operator content with its token and source-ordered operands.
source_operator_expressionBuilds a typed operator expression from its content children.
source_postfix_contentBuilds postfix update content with its token and operand.
source_postfix_expressionBuilds a typed postfix update expression from its content children.
source_return_contentBuilds return content with all bound and normalized fields.
source_return_typeReturns a return node’s target type, or NULL for another form.
source_slice_contentBuilds slice content while retaining omitted bounds.
source_string_contentBuilds string content from its ordered text, expression, and cache rows.
source_va_arg_contentBuilds va-arg content with its declaration and operand.

Functions

catch_handle

meta List catch_handle(List node)

Returns the error handler the parser introduced for the catch arms of the parsed try node, or NULL for a try without catches. The arms read their captures through it, and no source form writes it.

Source: src/grammar.x:217

retain_catch_handle

meta List retain_catch_handle(List rebuilt, List handle)

Restores the binder’s handler after a caught template rebuild. The source form has no hole for this derived identity.

Source: src/grammar.x:224

source_any_lambda

meta List source_any_lambda(void)

Returns a pattern for either lambda form, with or without captures.

Source: src/grammar.x:89

source_block_content

meta List source_block_content(List fields)

Builds block content with its complete source-ordered statements.

Source: src/grammar.x:185

source_call_content

meta List source_call_content( Macro call, List callee, List arguments)

Returns bare call content with the supplied callee and argument patterns.

Source: src/grammar.x:173

source_cast_content

meta List source_cast_content(List parts)

Builds cast content with its children unchanged. The first child is a declaration or a semantic type at different stages.

Source: src/grammar.x:131

source_commas_content

meta List source_commas_content(List rows)

Builds comma sequence content from its ordered rows.

Source: src/grammar.x:138

source_composite_content

meta List source_composite_content(List rows)

Builds braced initializer content from its ordered comma rows.

Source: src/grammar.x:143

source_conditional_statement

meta List source_conditional_statement(void)

Returns the canonical pattern for conditional statements. With is normally parsed away; foreach and finally remain accepted canonical compatibility heads.

Source: src/grammar.x:82

source_content_pattern

meta List source_content_pattern(Macro shape, List names)

Returns a source form’s content pattern without its typed shell. Bare-content dispatch arms retain the fixed head the match emitter labels. Inside a shell, write %(expr ? ${$shape(...)}) instead.

Source: src/grammar.x:168

source_declarator_row

meta List source_declarator_row(List fields)

Returns a pattern for a declarator row, with or without its initializer.

Source: src/grammar.x:197

source_expression

meta Var source_expression(Var value)

Returns the source expression beneath casts and parentheses with its type.

Source: src/grammar.x:202

source_generic_content

meta List source_generic_content(List parts)

Builds generic selection content with its declaration and ordered rows.

Source: src/grammar.x:134

source_identifier_content

meta List source_identifier_content(List fields)

Builds identifier content with its bound child records.

Source: src/grammar.x:189

source_literal_content

meta List source_literal_content(List fields)

Builds literal content with its typed child records.

Source: src/grammar.x:193

source_operator_content

meta List source_operator_content(List parts)

Builds operator content with its token and source-ordered operands. Constructed nonstandard operators retain the same form.

Source: src/grammar.x:152

source_operator_expression

meta List source_operator_expression(List type, List parts)

Builds a typed operator expression from its content children.

Source: src/grammar.x:155

source_postfix_content

meta List source_postfix_content(List parts)

Builds postfix update content with its token and operand.

Source: src/grammar.x:159

source_postfix_expression

meta List source_postfix_expression(List type, List parts)

Builds a typed postfix update expression from its content children.

Source: src/grammar.x:162

source_return_content

meta List source_return_content(List fields)

Builds return content with all bound and normalized fields.

Source: src/grammar.x:181

source_return_type

meta List source_return_type(List node)

Returns a return node’s target type, or NULL for another form. The binder supplies the type; the source form does not write it.

Source: src/grammar.x:74

source_slice_content

meta List source_slice_content(List parts)

Builds slice content while retaining omitted bounds.

Source: src/grammar.x:141

source_string_content

meta List source_string_content(List rows)

Builds string content from its ordered text, expression, and cache rows. The parser and resolver share this shape.

Source: src/grammar.x:148

source_va_arg_content

meta List source_va_arg_content(List parts)

Builds va-arg content with its declaration and operand.

Source: src/grammar.x:136

Design notes

Each macro’s body is the source form a lowering receives, so a lowering recognizes its input with case on the macro instead of spelling the parsed node. The accessors read the parts of a parsed node that no source form writes, such as a handler the parser introduced.