2014-07-30 23:40:02 -07:00
|
|
|
#ifndef RUNTIME_LEXER_H_
|
|
|
|
|
#define RUNTIME_LEXER_H_
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "tree_sitter/parser.h"
|
2016-10-05 14:02:49 -07:00
|
|
|
#include "tree_sitter/runtime.h"
|
|
|
|
|
#include "runtime/length.h"
|
2014-07-30 23:40:02 -07:00
|
|
|
|
2016-10-05 14:02:49 -07:00
|
|
|
#define TS_DEBUG_BUFFER_SIZE 512
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
TSLexer data;
|
2016-11-09 20:59:05 -08:00
|
|
|
Length current_position;
|
|
|
|
|
Length token_start_position;
|
2016-10-05 14:02:49 -07:00
|
|
|
|
|
|
|
|
const char *chunk;
|
2016-11-14 12:15:24 -08:00
|
|
|
uint32_t chunk_start;
|
|
|
|
|
uint32_t chunk_size;
|
2016-10-05 14:02:49 -07:00
|
|
|
|
2016-11-14 12:15:24 -08:00
|
|
|
uint32_t lookahead_size;
|
2016-10-05 14:02:49 -07:00
|
|
|
|
|
|
|
|
TSInput input;
|
|
|
|
|
TSLogger logger;
|
|
|
|
|
char debug_buffer[TS_DEBUG_BUFFER_SIZE];
|
2017-01-07 21:45:28 -08:00
|
|
|
const TSExternalTokenState *last_external_token_state;
|
2016-10-05 14:02:49 -07:00
|
|
|
} Lexer;
|
|
|
|
|
|
|
|
|
|
void ts_lexer_init(Lexer *);
|
|
|
|
|
void ts_lexer_set_input(Lexer *, TSInput);
|
2016-11-09 20:59:05 -08:00
|
|
|
void ts_lexer_reset(Lexer *, Length);
|
2016-12-02 22:03:48 -08:00
|
|
|
void ts_lexer_start(Lexer *);
|
2014-07-30 23:40:02 -07:00
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif // RUNTIME_LEXER_H_
|