66 uint32_t first_line, first_column, last_line, last_column;
78typedef int (*
GLRDisambiguateFn)(uint32_t rule1_index, uint32_t rule2_index,
void *user_data);
171void gss_node_release(
GSSNode *node);
bool glr_parser_accepted(const GLRParser *parser, uint16_t accept_action)
Check if the parse completed successfully.
int lime_parse_glr_feed(struct ParseContext *ctx, uint16_t token)
Feed one token into the GLR engine.
void lime_parse_glr_end(struct ParseContext *ctx)
Tear down GLR-mode state on the ParseContext.
bool lime_parse_glr_accepted(struct ParseContext *ctx)
Check whether the GLR parse accepted the input.
int lime_parse_glr(struct ParseContext *ctx, GLRDisambiguateFn disambig, void *user_data)
Enter GLR mode for an existing ParseContext.
uint32_t glr_parser_head_count(const GLRParser *parser)
Return the number of active parse heads.
void glr_parser_destroy(GLRParser *parser)
Destroy a GLR parser and free all resources.
int(* GLRDisambiguateFn)(uint32_t rule1_index, uint32_t rule2_index, void *user_data)
User-provided disambiguation callback.
int glr_parser_feed(GLRParser *parser, const ParserSnapshot *snap, uint16_t token)
Feed a token to the GLR parser.
uint32_t lime_parse_glr_head_count(struct ParseContext *ctx)
Number of active parse heads.
void glr_parser_set_disambiguate(GLRParser *parser, GLRDisambiguateFn fn, void *user_data)
Set the disambiguation callback.
GLRParser * glr_parser_create(uint32_t initial_state, size_t arena_size)
Create a GLR parser.
GLR parser context, wrapping an underlying LALR(1) parser.
bool has_ambiguity
True if unresolved ambiguity detected.
void * disambiguate_data
User data for callback.
LimeArena * arena
Arena for GSSNode allocation.
uint32_t total_merges
Statistics: total merges.
uint32_t nheads
Number of active heads.
uint32_t max_heads
Capacity of active_heads.
GSSNode ** active_heads
Array of active stack top nodes.
GLRDisambiguateFn disambiguate
User disambiguation callback.
uint32_t total_forks
Statistics: total forks.
Graph-Structured Stack (GSS) node for GLR parsing.
uint32_t npred
Number of predecessors.
uint32_t refcount
Reference count.
struct GSSNode ** predecessors
Array of predecessor nodes.
uint32_t state
Parser state number.
uint32_t pred_capacity
Allocated predecessor slots.
union GSSNode::@0 value
Semantic value (one of int / pointer / double, by convention).
Arena allocator for AST nodes.