decl.l0
Module: parser.decl
Source: compiler/stage2_l0/src/parser/decl.l0 Language: Dea/L0
Imports / Includes
parser.stmtparser.exprparser.sharedastlexertokensutil.diagstd.vectorstd.text
Symbols
- ps_make_empty_block_stmt
- ps_finish_function
- ps_parse_function
- ps_parse_extern_func
- ps_parse_struct
- ps_parse_enum
- ps_parse_type_alias
- ps_parse_top_level_let
- ps_parse_top_level_decl
- ps_parse_module
- impl_parse_module_tokens
- ps_lex_error_result
- ps_tokens_result
- impl_parse_module_source
Function ps_make_empty_block_stmt
1
func ps_make_empty_block_stmt(self: ParserState*, span: Span) -> StmtId
Create an empty block statement node in the statement arena.
Parameters:
self: Parser state providing the statement arena.span: Source span for the synthetic block.
Returns: Statement id for the created block.
Function ps_finish_function
1
func ps_finish_function(self: ParserState*, start: Span, name_tok: Token, params: VectorBase*, is_extern: bool, ret_type: TypeRef*) -> FuncDecl*?
Finish parsing a function declaration after its signature.
Parameters:
self: Parser state to advance.start: Starting span for the declaration.name_tok: Function name token.params: Parsed parameter vector.is_extern: Whether this is an extern declaration.ret_type: Parsed return type.
Returns: Completed function declaration, or null on error.
Function ps_parse_function
1
func ps_parse_function(self: ParserState*, is_extern: bool) -> FuncDecl*?
Parse a function declaration.
Parameters:
self: Parser state to advance.is_extern: Whether the declaration started withextern.
Returns: Parsed function declaration, or null on error.
Function ps_parse_extern_func
1
func ps_parse_extern_func(self: ParserState*) -> FuncDecl*?
Parse an extern function declaration.
Parameters:
self: Parser state to advance.
Returns: Parsed extern function declaration, or null on error.
Function ps_parse_struct
1
func ps_parse_struct(self: ParserState*) -> StructDecl*?
Parse a struct declaration.
Parameters:
self: Parser state to advance.
Returns: Parsed struct declaration, or null on error.
Function ps_parse_enum
1
func ps_parse_enum(self: ParserState*) -> EnumDecl*?
Parse an enum declaration.
Parameters:
self: Parser state to advance.
Returns: Parsed enum declaration, or null on error.
Function ps_parse_type_alias
1
func ps_parse_type_alias(self: ParserState*) -> TypeAliasDecl*?
Parse a type-alias declaration.
Parameters:
self: Parser state to advance.
Returns: Parsed type-alias declaration, or null on error.
Function ps_parse_top_level_let
1
func ps_parse_top_level_let(self: ParserState*) -> LetDecl*?
Parse a top-level let declaration.
Parameters:
self: Parser state to advance.
Returns: Parsed top-level let, or null on error.
Function ps_parse_top_level_decl
1
func ps_parse_top_level_decl(self: ParserState*) -> TopLevelDecl*?
Parse one top-level declaration.
Parameters:
self: Parser state to advance.
Returns: Parsed top-level declaration, or null on error.
Function ps_parse_module
1
func ps_parse_module(self: ParserState*) -> Module*?
Parse a module declaration and its contents.
Parameters:
self: Parser state to advance.
Returns: Parsed module, or null on error.
Function impl_parse_module_tokens
1
func impl_parse_module_tokens(tokens: TokenVector, filename: string) -> ImplParseResult*
Parse a module from a token stream and keep the internal arenas.
Parameters:
tokens: Token stream to parse.filename: Source filename used in diagnostics.
Returns: Internal parse result.
Function ps_lex_error_result
1
func ps_lex_error_result(ls: LexerState*, filename: string) -> ImplParseResult*
Build a parser result from lexer diagnostics when tokenization fails.
Parameters:
ls: Lexer state holding diagnostics.filename: Source filename used for fallback diagnostics.
Returns: Internal parse result containing copied lexer diagnostics.
Function ps_tokens_result
1
func ps_tokens_result(ls: LexerState*, toks: TokenVector, filename: string) -> ImplParseResult*
Parse tokenized source and clean up lexer/token resources.
Parameters:
ls: Lexer state to free after parsing.toks: Token stream to parse and then free.filename: Source filename used in diagnostics.
Returns: Internal parse result.
Function impl_parse_module_source
1
func impl_parse_module_source(source: string, filename: string) -> ImplParseResult*
Lex and parse a module from source text, preserving internal arenas.
Parameters:
source: Source text to parse.filename: Source filename used in diagnostics.
Returns: Internal parse result.