aboutsummaryrefslogtreecommitdiff
path: root/src/tree_sitter/lexer.h
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2019-06-06 10:34:01 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2019-09-28 14:30:48 +0200
commit3bddf050230635febc16aabe0ba4f73abeed6663 (patch)
tree96cee8145c473378ee33083493fbd4e9a62cedf5 /src/tree_sitter/lexer.h
parent0d9a3c86a1c7143187398e6cb6005ed06a5e2fde (diff)
downloadrneovim-3bddf050230635febc16aabe0ba4f73abeed6663.tar.gz
rneovim-3bddf050230635febc16aabe0ba4f73abeed6663.tar.bz2
rneovim-3bddf050230635febc16aabe0ba4f73abeed6663.zip
tree-sitter: vendor tree-sitter runtime
tree-sitter/tree-sitter commit 7685b7861ca475664b6ef57e14d1da9acf741275 Included files are: lib/include/tree-sitter/*.h lib/src/*.[ch] LICENSE
Diffstat (limited to 'src/tree_sitter/lexer.h')
-rw-r--r--src/tree_sitter/lexer.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/tree_sitter/lexer.h b/src/tree_sitter/lexer.h
new file mode 100644
index 0000000000..f523d88f65
--- /dev/null
+++ b/src/tree_sitter/lexer.h
@@ -0,0 +1,48 @@
+#ifndef TREE_SITTER_LEXER_H_
+#define TREE_SITTER_LEXER_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "./length.h"
+#include "./subtree.h"
+#include "tree_sitter/api.h"
+#include "tree_sitter/parser.h"
+
+typedef struct {
+ TSLexer data;
+ Length current_position;
+ Length token_start_position;
+ Length token_end_position;
+
+ TSRange * included_ranges;
+ size_t included_range_count;
+ size_t current_included_range_index;
+
+ const char *chunk;
+ uint32_t chunk_start;
+ uint32_t chunk_size;
+ uint32_t lookahead_size;
+
+ TSInput input;
+ TSLogger logger;
+ char debug_buffer[TREE_SITTER_SERIALIZATION_BUFFER_SIZE];
+} Lexer;
+
+void ts_lexer_init(Lexer *);
+void ts_lexer_delete(Lexer *);
+void ts_lexer_set_input(Lexer *, TSInput);
+void ts_lexer_reset(Lexer *, Length);
+void ts_lexer_start(Lexer *);
+void ts_lexer_finish(Lexer *, uint32_t *);
+void ts_lexer_advance_to_end(Lexer *);
+void ts_lexer_mark_end(Lexer *);
+void ts_lexer_set_included_ranges(Lexer *self, const TSRange *ranges, uint32_t count);
+TSRange *ts_lexer_included_ranges(const Lexer *self, uint32_t *count);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // TREE_SITTER_LEXER_H_