compiler/stage2_l0/src/parser/decl.l0

Module parser.decl

Overview Symbols grouped by source file: compiler/stage2_l0/src/parser/decl.l0

Module: parser.decl

Source: compiler/stage2_l0/src/parser/decl.l0 Language: Dea/L0

Imports / Includes

  • parser.stmt
  • parser.expr
  • parser.shared
  • ast
  • lexer
  • tokens
  • util.diag
  • std.vector
  • std.text

Symbols

Function ps_make_empty_block_stmt

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

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

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 with extern.

Returns: Parsed function declaration, or null on error.

Function ps_parse_extern_func

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

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

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

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

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

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

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

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

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

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

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.