2014-07-30 23:40:02 -07:00
|
|
|
#ifndef RUNTIME_PARSER_H_
|
|
|
|
|
#define RUNTIME_PARSER_H_
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-09-18 18:04:52 -07:00
|
|
|
#include "runtime/stack.h"
|
2016-02-17 20:41:29 -08:00
|
|
|
#include "runtime/array.h"
|
2016-10-05 14:02:49 -07:00
|
|
|
#include "runtime/lexer.h"
|
2016-05-09 14:31:44 -07:00
|
|
|
#include "runtime/reduce_action.h"
|
2016-02-17 14:45:00 -08:00
|
|
|
|
2016-07-01 15:08:19 -07:00
|
|
|
typedef struct {
|
|
|
|
|
TSTree *tree;
|
|
|
|
|
size_t char_index;
|
|
|
|
|
} ReusableNode;
|
|
|
|
|
|
2014-07-30 23:40:02 -07:00
|
|
|
typedef struct {
|
2016-10-05 14:02:49 -07:00
|
|
|
Lexer lexer;
|
2015-09-18 18:04:52 -07:00
|
|
|
Stack *stack;
|
2014-07-30 23:40:02 -07:00
|
|
|
const TSLanguage *language;
|
2016-05-09 14:31:44 -07:00
|
|
|
ReduceActionSet reduce_actions;
|
2015-12-24 22:04:20 -08:00
|
|
|
TSTree *finished_tree;
|
2015-12-09 14:33:54 -08:00
|
|
|
bool is_split;
|
2016-02-23 11:16:50 -08:00
|
|
|
bool print_debugging_graphs;
|
2016-04-24 00:54:20 -07:00
|
|
|
TSTree scratch_tree;
|
2016-07-01 15:08:19 -07:00
|
|
|
TSTree *cached_token;
|
|
|
|
|
size_t cached_token_char_index;
|
|
|
|
|
ReusableNode reusable_node;
|
2016-08-29 12:08:58 -07:00
|
|
|
} Parser;
|
2014-07-30 23:40:02 -07:00
|
|
|
|
2016-08-29 12:08:58 -07:00
|
|
|
bool parser_init(Parser *);
|
|
|
|
|
void parser_destroy(Parser *);
|
|
|
|
|
TSTree *parser_parse(Parser *, TSInput, TSTree *);
|
2014-07-30 23:40:02 -07:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // RUNTIME_PARSER_H_
|