39#ifndef EXTENSION_REGISTRY_H
40#define EXTENSION_REGISTRY_H
51struct GrammarModification;
177 const char **
requires;
DisambiguationStrategy
How an extension prefers to resolve ambiguities introduced by its grammar modifications.
@ DISAMBIG_ORACLE
Delegate to a runtime oracle callback.
@ DISAMBIG_FORK_RESOLVE
Fork the parse and resolve after lookahead.
@ DISAMBIG_CONTEXT
Use grammar context to disambiguate.
@ DISAMBIG_PRIORITY
Resolve by numeric priority (higher wins)
@ DISAMBIG_NONE
No disambiguation; conflicts are errors.
ExecutionPolicy
Controls how an extension's modifications are applied relative to other extensions.
@ EXEC_PARALLEL
Apply concurrently where safe.
@ EXEC_SEQUENTIAL
Apply modifications one at a time.
@ EXEC_LAZY
Defer application until first use.
@ EXEC_PIPELINE
Apply as a pipeline stage.
void extension_order_destroy(ExtensionOrder *order)
Free an ExtensionOrder and all owned strings.
int(* OracleCallback)(const OracleContext *ctx)
Oracle callback type.
void extension_registry_foreach(const ExtensionRegistry *reg, ExtensionVisitorFn visitor, void *user_data)
Iterate over all registered extensions.
bool extension_registry_register(ExtensionRegistry *reg, const GrammarExtensionMetadata *metadata)
Register an extension with its metadata.
bool extension_registry_check_dependencies(ExtensionRegistry *reg, char **error_out)
Validate all dependency and conflict declarations.
bool extension_registry_unregister(ExtensionRegistry *reg, const char *name)
Unregister an extension by name.
uint32_t extension_registry_count(const ExtensionRegistry *reg)
Return the number of registered extensions.
void extension_registry_destroy(ExtensionRegistry *reg)
Destroy the registry and free all owned memory.
ExtensionRegistry * extension_registry_create(void)
Create an empty extension registry.
bool extension_registry_get_order(ExtensionRegistry *reg, ExtensionOrder *order_out, char **error_out)
Produce a topological ordering of all registered extensions.
const GrammarExtensionMetadata * extension_registry_find(ExtensionRegistry *reg, const char *name)
Look up an extension by name.
bool(* ExtensionVisitorFn)(const GrammarExtensionMetadata *meta, void *user_data)
Visitor callback for extension iteration.
struct ExtensionRegistry ExtensionRegistry
Opaque extension registry handle.
Result of dependency resolution: a sorted array of extension names in load order (dependencies before...
uint32_t count
Number of entries.
char ** names
malloc'd array of strdup'd names
Context passed to an oracle callback when the system needs a disambiguation decision.
void * user_data
Extension's user_data pointer.
const char * conflict_description
Human-readable conflict info.
const char ** candidate_labels
Labels for each candidate.
const char * extension_name
Extension requesting resolution.
int candidate_count
Number of candidate resolutions.