Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
Loading...
Searching...
No Matches
Active Parser Management

Select and query the active parser plugin. More...

Functions

LimePluginHandle parser_manager_get_active (const ParserManager *mgr)
 Get the handle of the currently active plugin.
 
ParserSnapshotparser_manager_get_snapshot (ParserManager *mgr)
 Get the current active snapshot.
 
ParserManagerStatus parser_manager_set_active (ParserManager *mgr, LimePluginHandle handle, const char *grammar_file)
 Set the active parser plugin.
 
ParserManagerStatus parser_manager_set_snapshot (ParserManager *mgr, ParserSnapshot *snap)
 Provide or replace the active snapshot directly.
 

Detailed Description

Select and query the active parser plugin.

Function Documentation

◆ parser_manager_get_active()

LimePluginHandle parser_manager_get_active ( const ParserManager mgr)

#include <include/parser_manager.h>

Get the handle of the currently active plugin.

Parameters
mgrThe parser manager.
Returns
Handle of the active plugin, or LIME_PLUGIN_HANDLE_INVALID if no plugin is active.

◆ parser_manager_get_snapshot()

ParserSnapshot * parser_manager_get_snapshot ( ParserManager mgr)

#include <include/parser_manager.h>

Get the current active snapshot.

Returns a snapshot with an additional reference – the caller must call lemon_snapshot_release() when done.

Parameters
mgrThe parser manager.
Returns
Active snapshot, or NULL if no active snapshot is available.
Thread Safety:
Multiple threads can call this concurrently.

◆ parser_manager_set_active()

ParserManagerStatus parser_manager_set_active ( ParserManager mgr,
LimePluginHandle  handle,
const char *  grammar_file 
)

#include <include/parser_manager.h>

Set the active parser plugin.

The active plugin is the one whose snapshot is returned by parser_manager_get_snapshot(). Only one plugin can be active at a time.

Parameters
mgrThe parser manager.
handleHandle of the plugin to activate.
grammar_fileIf non-NULL, the manager calls create_snapshot() immediately. If NULL, a snapshot must have been previously set via parser_manager_set_snapshot().
Returns
PM_OK on success, or an error code.
See also
parser_manager_get_active()
parser_manager_hot_swap()

◆ parser_manager_set_snapshot()

ParserManagerStatus parser_manager_set_snapshot ( ParserManager mgr,
ParserSnapshot snap 
)

#include <include/parser_manager.h>

Provide or replace the active snapshot directly.

The manager acquires a reference to snap. The previous active snapshot (if any) is released.

This is useful for loading pre-built or deserialized snapshots without going through create_snapshot().

Parameters
mgrThe parser manager.
snapSnapshot to set as active.
Returns
PM_OK on success, or an error code.