tree-sitter/src/runtime/parser.h

46 lines
940 B
C
Raw Normal View History

#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"
#include "runtime/lexer.h"
#include "runtime/reusable_node.h"
#include "runtime/reduce_action.h"
2016-02-17 14:45:00 -08:00
typedef struct {
Tree *token;
Tree *last_external_token;
uint32_t byte_index;
} TokenCache;
typedef struct {
Lexer lexer;
2015-09-18 18:04:52 -07:00
Stack *stack;
const TSLanguage *language;
ReduceActionSet reduce_actions;
Tree *finished_tree;
Tree scratch_tree;
TokenCache token_cache;
ReusableNode reusable_node;
TreePath tree_path1;
TreePath tree_path2;
void *external_scanner_payload;
2017-08-31 12:50:10 -07:00
bool in_ambiguity;
bool print_debugging_graphs;
2016-08-29 12:08:58 -07:00
} Parser;
2016-08-29 12:08:58 -07:00
bool parser_init(Parser *);
void parser_destroy(Parser *);
Tree *parser_parse(Parser *, TSInput, Tree *, bool halt_on_error);
void parser_set_language(Parser *, const TSLanguage *);
#ifdef __cplusplus
}
#endif
#endif // RUNTIME_PARSER_H_