parser.l0
Module: parser
Source: compiler/stage2_l0/src/parser.l0 Language: Dea/L0
Imports / Includes
parser.declutil.diagparser.sharedasttokenslexer
Symbols
- parse_result_free
- parse_has_errors
- parse_diag_count
- parse_diag_get
- impl_result_to_public
- parse_module_tokens
- parse_module_tokens_owned
- parse_lex_error_result
- parse_module_source
- ParseResult
Function parse_result_free
1
func parse_result_free(self: ParseResult*)
Free a public parse result and all owned AST arenas.
Parameters:
self: Parse result to free.
Function parse_has_errors
1
func parse_has_errors(self: ParseResult*) -> bool
Report whether parsing produced any errors.
Parameters:
self: Parse result to inspect.
Returns: true if the parse diagnostics contain an error.
Function parse_diag_count
1
func parse_diag_count(self: ParseResult*) -> int
Return the number of diagnostics produced during parsing.
Parameters:
self: Parse result to inspect.
Returns: Total diagnostic count.
Function parse_diag_get
1
func parse_diag_get(self: ParseResult*, index: int) -> Diagnostic*
Return a parse diagnostic by index.
Parameters:
self: Parse result to inspect.index: Zero-based diagnostic index.
Returns: Diagnostic at index.
Function impl_result_to_public
1
func impl_result_to_public(self: ImplParseResult*) -> ParseResult*
Convert the internal parser result to the public parse-result type.
Parameters:
self: Internal parse result to consume.
Returns: Public parse result owning the same AST arenas and diagnostics.
Function parse_module_tokens
1
func parse_module_tokens(tokens: TokenVector, filename: string) -> ParseResult*
Parse a module from an existing token stream.
Parameters:
tokens: Token stream to parse.filename: Source filename used in diagnostics.
Returns: Parse result for the module.
Function parse_module_tokens_owned
1
func parse_module_tokens_owned(tokens: TokenVector, filename: string) -> ParseResult*
Parse a module from an existing token stream and free the token buffer.
Parameters:
tokens: Token stream to parse.filename: Source filename used in diagnostics.
Returns: Parse result for the module.
Function parse_lex_error_result
1
func parse_lex_error_result(ls: LexerState*, filename: string) -> ParseResult*
Convert lexer diagnostics into a public parse result and free the lexer state.
Parameters:
ls: Lexer state holding diagnostics.filename: Source filename used in diagnostics.
Returns: Parse result containing the copied lexer diagnostics.
Function parse_module_source
1
func parse_module_source(source: string, filename: string) -> ParseResult*
Lex and parse a module from source text.
Parameters:
source: Source text to parse.filename: Source filename used in diagnostics.
Returns: Parse result for the module.
Struct ParseResult
Represents the ParseResult structure.
ParseResult Field root_module
1
root_module: Module*?
ParseResult Field expr_arena
1
expr_arena: ExprArena*
ParseResult Field stmt_arena
1
stmt_arena: StmtArena*
ParseResult Field pattern_arena
1
pattern_arena: PatternArena*
ParseResult Field diags
1
diags: DiagCollector*