aboutsummaryrefslogtreecommitdiffstats
path: root/src/treesit.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/treesit.h')
-rw-r--r--src/treesit.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/treesit.h b/src/treesit.h
index 0d4635f4253..b6a3f3a652c 100644
--- a/src/treesit.h
+++ b/src/treesit.h
@@ -26,6 +26,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
26 26
27#include <tree_sitter/api.h> 27#include <tree_sitter/api.h>
28#include "lisp.h" 28#include "lisp.h"
29#include "buffer.h"
29 30
30INLINE_HEADER_BEGIN 31INLINE_HEADER_BEGIN
31 32
@@ -97,6 +98,14 @@ struct Lisp_TS_Parser
97 (ref:visible-beg-null) in treesit.c for more explanation. */ 98 (ref:visible-beg-null) in treesit.c for more explanation. */
98 ptrdiff_t visible_beg; 99 ptrdiff_t visible_beg;
99 ptrdiff_t visible_end; 100 ptrdiff_t visible_end;
101 /* Caches the line and column number of VISIBLE_BEG. It's always
102 valid and matches VISIBLE_BEG (because it's updated at each buffer
103 edit). (It has to be, because in treesit_record_change, we need to
104 calculate the line/col offset of old_end_linecol, the exact reason
105 why is left as an exercise to the reader.) */
106 struct ts_linecol visi_beg_linecol;
107 /* Similar to VISI_BEG_LINECOL but caches VISIBLE_END. */
108 struct ts_linecol visi_end_linecol;
100 /* This counter is incremented every time a change is made to the 109 /* This counter is incremented every time a change is made to the
101 buffer in treesit_record_change. The node retrieved from this parser 110 buffer in treesit_record_change. The node retrieved from this parser
102 inherits this timestamp. This way we can make sure the node is 111 inherits this timestamp. This way we can make sure the node is
@@ -222,7 +231,19 @@ CHECK_TS_COMPILED_QUERY (Lisp_Object query)
222 231
223INLINE_HEADER_END 232INLINE_HEADER_END
224 233
225extern void treesit_record_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); 234/* A linecol_cache that points to BOB, this is always valid. */
235static const struct ts_linecol TREESIT_BOB_LINECOL = { 1, 1, 1, 0 };
236/* An uninitialized linecol. */
237static const struct ts_linecol TREESIT_EMPTY_LINECOL = { 0, 0, 0, 0 };
238static const TSPoint TREESIT_TS_POINT_1_0 = { 1, 0 };
239
240extern struct ts_linecol linecol_offset (struct ts_linecol,
241 struct ts_linecol);
242extern struct ts_linecol treesit_linecol_maybe (ptrdiff_t, ptrdiff_t,
243 struct ts_linecol);
244extern void treesit_record_change (ptrdiff_t, ptrdiff_t, ptrdiff_t,
245 struct ts_linecol, struct ts_linecol,
246 ptrdiff_t);
226extern Lisp_Object make_treesit_parser (Lisp_Object, TSParser *, TSTree *, 247extern Lisp_Object make_treesit_parser (Lisp_Object, TSParser *, TSTree *,
227 Lisp_Object, Lisp_Object); 248 Lisp_Object, Lisp_Object);
228extern Lisp_Object make_treesit_node (Lisp_Object, TSNode); 249extern Lisp_Object make_treesit_node (Lisp_Object, TSNode);