Add version number to TSLanguage structs

This commit is contained in:
Max Brunsfeld 2017-01-31 10:21:47 -08:00
parent 672d491775
commit d853b6504d
6 changed files with 24 additions and 1 deletions

View file

@ -65,6 +65,7 @@ typedef union {
} TSParseActionEntry;
typedef struct TSLanguage {
uint32_t version;
uint32_t symbol_count;
uint32_t token_count;
uint32_t external_token_count;
@ -166,6 +167,7 @@ typedef struct TSLanguage {
#define GET_LANGUAGE(...) \
static TSLanguage language = { \
.version = LANGUAGE_VERSION, \
.symbol_count = SYMBOL_COUNT, \
.token_count = TOKEN_COUNT, \
.symbol_metadata = ts_symbol_metadata, \

View file

@ -9,6 +9,8 @@ extern "C" {
#include <stdint.h>
#include <stdbool.h>
#define TREE_SITTER_LANGUAGE_VERSION 1
typedef unsigned short TSSymbol;
typedef struct TSLanguage TSLanguage;
typedef struct TSDocument TSDocument;
@ -114,6 +116,7 @@ uint32_t ts_document_parse_count(const TSDocument *);
uint32_t ts_language_symbol_count(const TSLanguage *);
const char *ts_language_symbol_name(const TSLanguage *, TSSymbol);
uint32_t ts_language_version(const TSLanguage *);
#ifdef __cplusplus
}