|
Lime Parser Generator 0.1.0
Runtime-extensible LALR(1) parser with SIMD tokenization and LLVM JIT
|
Manage parse sessions pinned to a snapshot. More...
Functions | |
| ParseContext * | parse_begin (ParserSnapshot *snap) |
| Begin a parse session pinned to a snapshot. | |
| void | parse_end (ParseContext *ctx) |
| End the parse session. | |
| ParserSnapshot * | parse_get_snapshot (ParseContext *ctx) |
| Return the snapshot pinned by this context. | |
| int | parse_token (ParseContext *ctx, int token_code, void *token_value, int location) |
| Feed a token to the parser. | |
Manage parse sessions pinned to a snapshot.
| ParseContext * parse_begin | ( | ParserSnapshot * | snap | ) |
#include <include/parser.h>
Begin a parse session pinned to a snapshot.
Acquires a reference to snap.
| snap | Snapshot to pin. |
| void parse_end | ( | ParseContext * | ctx | ) |
#include <include/parser.h>
End the parse session.
Releases the snapshot reference and frees all internal state.
| ctx | Parse context to end. Passing NULL is safe. |
| ParserSnapshot * parse_get_snapshot | ( | ParseContext * | ctx | ) |
#include <include/parser.h>
Return the snapshot pinned by this context.
| ctx | Active parse context. |
| int parse_token | ( | ParseContext * | ctx, |
| int | token_code, | ||
| void * | token_value, | ||
| int | location | ||
| ) |
#include <include/parser.h>
Feed a token to the parser.
| ctx | Active parse context. |
| token_code | Token code (0 for end-of-input). |
| token_value | Semantic value associated with the token (may be NULL). |
| location | Byte offset of the token in the original source, or LIME_LOC_UNKNOWN if the grammar does not declare locations or the caller does not track positions. Currently stored but not yet propagated into reduce actions (that plumbing lands with the push-parser full implementation); callers should pass real locations anyway so they are ready for it. |
| 0 | Success. |
| non-zero | Parse error. |