Zen-C
Loading...
Searching...
No Matches
ParserContext Struct Reference

Global compilation state and symbol table. More...

#include <parser.h>

Collaboration diagram for ParserContext:

Data Fields

Scopecurrent_scope
 Current lexical scope for variable lookup.
 
FuncSigfunc_registry
 Registry of declared function signatures.
 
LambdaRefglobal_lambdas
 List of all lambdas generated during parsing.
 
int lambda_counter
 Counter for generating unique lambda IDs.
 
char * known_generics [MAX_KNOWN_GENERICS]
 Stack of currently active generic type parameters.
 
int known_generics_count
 Count of active generic parameters.
 
GenericTemplatetemplates
 Struct generic templates.
 
GenericFuncTemplatefunc_templates
 Function generic templates.
 
GenericImplTemplateimpl_templates
 Implementation block templates.
 
Instantiationinstantiations
 Cache of instantiated generic types.
 
ASTNodeinstantiated_structs
 List of AST nodes for instantiated structs.
 
ASTNodeinstantiated_funcs
 List of AST nodes for instantiated functions.
 
StructRefparsed_structs_list
 List of all parsed struct nodes.
 
StructRefparsed_enums_list
 List of all parsed enum nodes.
 
StructRefparsed_funcs_list
 List of all parsed function nodes.
 
StructRefparsed_impls_list
 List of all parsed impl blocks.
 
StructRefparsed_globals_list
 List of all parsed global variables.
 
StructDefstruct_defs
 Registry of struct definitions (map name -> node).
 
EnumVariantRegenum_variants
 Registry of enum variants for global lookup.
 
ImplRegregistered_impls
 Cache of type/trait implementations.
 
SliceTypeused_slices
 Cache of generated slice types.
 
TupleTypeused_tuples
 Cache of generated tuple types.
 
TypeAliastype_aliases
 Defined type aliases.
 
Modulemodules
 List of registered modules.
 
SelectiveImportselective_imports
 Symbols imported via import { ... }.
 
char * current_module_prefix
 Prefix for current module (namespacing).
 
ImportedFileimported_files
 List of files already included/imported.
 
ImportedPluginimported_plugins
 List of active plugins.
 
char * current_impl_struct
 Name of struct currently being implemented (in impl block).
 
ASTNodecurrent_impl_methods
 Head of method list for current impl block.
 
DeprecatedFuncdeprecated_funcs
 Registry of deprecated functions.
 
int is_fault_tolerant
 1 if parser should recover from errors (LSP mode).
 
void * error_callback_data
 User data for error callback.
 
void(* on_error )(void *data, Token t, const char *msg)
 Callback for reporting errors.
 
ZenSymbolall_symbols
 comprehensive list of all symbols seen.
 
int has_external_includes
 Set when #include <...> is used.
 
char ** extern_symbols
 Explicitly declared extern symbols.
 
int extern_symbol_count
 Count of external symbols.
 
FILE * hoist_out
 File stream for hoisting code (e.g. from plugins).
 
int skip_preamble
 If 1, codegen won't emit standard preamble (includes etc).
 
int is_repl
 1 if running in REPL mode.
 
int has_async
 1 if async/await features are used in the program.
 
int in_defer_block
 1 if currently parsing inside a defer block.
 
struct TypeUsagepending_type_validations
 List of types to validate after parsing.
 
int is_speculative
 Flag to suppress side effects during speculative parsing.
 
int silent_warnings
 Suppress warnings (e.g., during codegen interpolation).
 

Detailed Description

Global compilation state and symbol table.

ParserContext maintains the state of the compiler during parsing and analysis. It holds symbol tables, type definitions, function registries, and configuration.

Field Documentation

◆ all_symbols

ZenSymbol* ParserContext::all_symbols

comprehensive list of all symbols seen.

◆ current_impl_methods

ASTNode* ParserContext::current_impl_methods

Head of method list for current impl block.

◆ current_impl_struct

char* ParserContext::current_impl_struct

Name of struct currently being implemented (in impl block).

◆ current_module_prefix

char* ParserContext::current_module_prefix

Prefix for current module (namespacing).

◆ current_scope

Scope* ParserContext::current_scope

Current lexical scope for variable lookup.

◆ deprecated_funcs

DeprecatedFunc* ParserContext::deprecated_funcs

Registry of deprecated functions.

◆ enum_variants

EnumVariantReg* ParserContext::enum_variants

Registry of enum variants for global lookup.

◆ error_callback_data

void* ParserContext::error_callback_data

User data for error callback.

◆ extern_symbol_count

int ParserContext::extern_symbol_count

Count of external symbols.

◆ extern_symbols

char** ParserContext::extern_symbols

Explicitly declared extern symbols.

◆ func_registry

FuncSig* ParserContext::func_registry

Registry of declared function signatures.

◆ func_templates

GenericFuncTemplate* ParserContext::func_templates

Function generic templates.

◆ global_lambdas

LambdaRef* ParserContext::global_lambdas

List of all lambdas generated during parsing.

◆ has_async

int ParserContext::has_async

1 if async/await features are used in the program.

◆ has_external_includes

int ParserContext::has_external_includes

Set when #include <...> is used.

◆ hoist_out

FILE* ParserContext::hoist_out

File stream for hoisting code (e.g. from plugins).

◆ impl_templates

GenericImplTemplate* ParserContext::impl_templates

Implementation block templates.

◆ imported_files

ImportedFile* ParserContext::imported_files

List of files already included/imported.

◆ imported_plugins

ImportedPlugin* ParserContext::imported_plugins

List of active plugins.

◆ in_defer_block

int ParserContext::in_defer_block

1 if currently parsing inside a defer block.

◆ instantiated_funcs

ASTNode* ParserContext::instantiated_funcs

List of AST nodes for instantiated functions.

◆ instantiated_structs

ASTNode* ParserContext::instantiated_structs

List of AST nodes for instantiated structs.

◆ instantiations

Instantiation* ParserContext::instantiations

Cache of instantiated generic types.

◆ is_fault_tolerant

int ParserContext::is_fault_tolerant

1 if parser should recover from errors (LSP mode).

◆ is_repl

int ParserContext::is_repl

1 if running in REPL mode.

◆ is_speculative

int ParserContext::is_speculative

Flag to suppress side effects during speculative parsing.

◆ known_generics

char* ParserContext::known_generics[MAX_KNOWN_GENERICS]

Stack of currently active generic type parameters.

◆ known_generics_count

int ParserContext::known_generics_count

Count of active generic parameters.

◆ lambda_counter

int ParserContext::lambda_counter

Counter for generating unique lambda IDs.

◆ modules

Module* ParserContext::modules

List of registered modules.

◆ on_error

void(* ParserContext::on_error) (void *data, Token t, const char *msg)

Callback for reporting errors.

◆ parsed_enums_list

StructRef* ParserContext::parsed_enums_list

List of all parsed enum nodes.

◆ parsed_funcs_list

StructRef* ParserContext::parsed_funcs_list

List of all parsed function nodes.

◆ parsed_globals_list

StructRef* ParserContext::parsed_globals_list

List of all parsed global variables.

◆ parsed_impls_list

StructRef* ParserContext::parsed_impls_list

List of all parsed impl blocks.

◆ parsed_structs_list

StructRef* ParserContext::parsed_structs_list

List of all parsed struct nodes.

◆ pending_type_validations

struct TypeUsage* ParserContext::pending_type_validations

List of types to validate after parsing.

◆ registered_impls

ImplReg* ParserContext::registered_impls

Cache of type/trait implementations.

◆ selective_imports

SelectiveImport* ParserContext::selective_imports

Symbols imported via import { ... }.

◆ silent_warnings

int ParserContext::silent_warnings

Suppress warnings (e.g., during codegen interpolation).

◆ skip_preamble

int ParserContext::skip_preamble

If 1, codegen won't emit standard preamble (includes etc).

◆ struct_defs

StructDef* ParserContext::struct_defs

Registry of struct definitions (map name -> node).

◆ templates

GenericTemplate* ParserContext::templates

Struct generic templates.

◆ type_aliases

TypeAlias* ParserContext::type_aliases

Defined type aliases.

◆ used_slices

SliceType* ParserContext::used_slices

Cache of generated slice types.

◆ used_tuples

TupleType* ParserContext::used_tuples

Cache of generated tuple types.


The documentation for this struct was generated from the following file: