Rizin
unix-like reverse engineering framework and cli tools
tags.h
Go to the documentation of this file.
1 #ifndef TREE_SITTER_TAGS_H_
2 #define TREE_SITTER_TAGS_H_
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #include <stdint.h>
9 #include "tree_sitter/api.h"
10 
11 typedef enum {
20 } TSTagsError;
21 
22 typedef struct {
37 } TSTag;
38 
39 typedef struct TSTagger TSTagger;
40 typedef struct TSTagsBuffer TSTagsBuffer;
41 
42 // Construct a tagger.
44 
45 // Delete a tagger.
47 
48 // Add a `TSLanguage` to a tagger. The language is associated with a scope name,
49 // which can be used later to select a language for tagging. Along with the language,
50 // you must provide two tree query strings, one for matching tags themselves, and one
51 // specifying local variable definitions.
53  TSTagger *self,
54  const char *scope_name,
55  const TSLanguage *language,
56  const char *tags_query,
57  const char *locals_query,
58  uint32_t tags_query_len,
59  uint32_t locals_query_len
60 );
61 
62 // Compute syntax highlighting for a given document. You must first
63 // create a `TSTagsBuffer` to hold the output.
65  const TSTagger *self,
66  const char *scope_name,
67  const char *source_code,
68  uint32_t source_code_len,
70  const size_t *cancellation_flag
71 );
72 
73 // A tags buffer stores the results produced by a tagging call. It can be reused
74 // for multiple calls.
76 
77 // Delete a tags buffer.
79 
80 // Access the tags within a tag buffer.
83 
84 // Access the string containing all of the docs
85 const char *ts_tags_buffer_docs(const TSTagsBuffer *);
87 
88 // Get the syntax kinds for a scope.
89 const char **ts_tagger_syntax_kinds_for_scope_name(const TSTagger *, const char *scope_name, uint32_t *len);
90 
91 // Determine whether a parse error was encountered while tagging.
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif // TREE_SITTER_TAGS_H_
size_t len
Definition: 6502dis.c:15
unsigned int uint32_t
Definition: sftypes.h:29
Definition: api.h:55
Definition: tags.h:22
uint32_t docs_end_byte
Definition: tags.h:34
uint32_t name_end_byte
Definition: tags.h:26
uint32_t line_start_byte
Definition: tags.h:27
uint32_t start_byte
Definition: tags.h:23
uint32_t utf16_end_column
Definition: tags.h:32
uint32_t syntax_type_id
Definition: tags.h:35
TSPoint end_point
Definition: tags.h:30
uint32_t utf16_start_column
Definition: tags.h:31
TSPoint start_point
Definition: tags.h:29
uint32_t end_byte
Definition: tags.h:24
bool is_definition
Definition: tags.h:36
uint32_t docs_start_byte
Definition: tags.h:33
uint32_t line_end_byte
Definition: tags.h:28
uint32_t name_start_byte
Definition: tags.h:25
TSTagsBuffer * ts_tags_buffer_new()
struct TSTagger TSTagger
Definition: tags.h:39
uint32_t ts_tags_buffer_docs_len(const TSTagsBuffer *)
const TSTag * ts_tags_buffer_tags(const TSTagsBuffer *)
TSTagsError
Definition: tags.h:11
@ TSTagsInvalidLanguage
Definition: tags.h:15
@ TSTagsUnknownScope
Definition: tags.h:13
@ TSTagsOk
Definition: tags.h:12
@ TSTagsInvalidCapture
Definition: tags.h:19
@ TSTagsInvalidRegex
Definition: tags.h:17
@ TSTagsTimeout
Definition: tags.h:14
@ TSTagsInvalidUtf8
Definition: tags.h:16
@ TSTagsInvalidQuery
Definition: tags.h:18
TSTagsError ts_tagger_tag(const TSTagger *self, const char *scope_name, const char *source_code, uint32_t source_code_len, TSTagsBuffer *output, const size_t *cancellation_flag)
struct TSTagsBuffer TSTagsBuffer
Definition: tags.h:40
void ts_tagger_delete(TSTagger *)
TSTagger * ts_tagger_new()
bool ts_tags_buffer_found_parse_error(const TSTagsBuffer *)
TSTagsError ts_tagger_add_language(TSTagger *self, const char *scope_name, const TSLanguage *language, const char *tags_query, const char *locals_query, uint32_t tags_query_len, uint32_t locals_query_len)
uint32_t ts_tags_buffer_tags_len(const TSTagsBuffer *)
const char ** ts_tagger_syntax_kinds_for_scope_name(const TSTagger *, const char *scope_name, uint32_t *len)
void ts_tags_buffer_delete(TSTagsBuffer *)
const char * ts_tags_buffer_docs(const TSTagsBuffer *)
diff_output_t output
Definition: zipcmp.c:237