Generated parsers no longer export a parser constructor function. They now export an opaque Language object which can be set on Documents directly. This way, the logic for constructing parsers lives entirely in the runtime. The Languages are just structs which have no load-time dependency on the runtime
30 lines
644 B
C
30 lines
644 B
C
#ifndef RUNTIME_PARSER_H_
|
|
#define RUNTIME_PARSER_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "runtime/stack.h"
|
|
|
|
typedef struct {
|
|
TSLexer lexer;
|
|
TSStack stack;
|
|
int debug;
|
|
TSTree *lookahead;
|
|
TSTree *next_lookahead;
|
|
const TSLanguage *language;
|
|
} TSParser;
|
|
|
|
TSParser ts_parser_make(const TSLanguage *);
|
|
void ts_parser_destroy(TSParser *);
|
|
const TSTree *ts_parser_parse(TSParser *parser, TSInput input,
|
|
TSInputEdit *edit);
|
|
void ts_parser_start(TSParser *parser, TSInput input, TSInputEdit *edit);
|
|
TSTree *ts_parser_step(TSParser *parser);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif // RUNTIME_PARSER_H_
|