regenerate with tree-sitter-cli 19.2

pull/261/head
Tormod Alf Try Tufteland 2021-03-10 22:20:00 +07:00 committed by Zsombor Gegesy
parent 1e5eb8c230
commit e9e0b08fc6
13 changed files with 342 additions and 209 deletions

@ -0,0 +1,26 @@
[package]
name = "tree-sitter-kotlin"
description = "kotlin grammar for the tree-sitter parsing library"
version = "0.0.1"
keywords = ["incremental", "parsing", "kotlin"]
categories = ["parsing", "text-editors"]
repository = "https://github.com/tree-sitter/tree-sitter-javascript"
edition = "2018"
license = "MIT"
build = "bindings/rust/build.rs"
include = [
"bindings/rust/*",
"grammar.js",
"queries/*",
"src/*",
]
[lib]
path = "bindings/rust/lib.rs"
[dependencies]
tree-sitter = "0.17"
[build-dependencies]
cc = "1.0"

@ -8,7 +8,7 @@
],
"sources": [
"src/parser.c",
"src/binding.cc"
"bindings/node/binding.cc"
],
"cflags_c": [
"-std=c99",

@ -0,0 +1,19 @@
try {
module.exports = require("../../build/Release/tree_sitter_kotlin_binding");
} catch (error1) {
if (error1.code !== 'MODULE_NOT_FOUND') {
throw error1;
}
try {
module.exports = require("../../build/Debug/tree_sitter_kotlin_binding");
} catch (error2) {
if (error2.code !== 'MODULE_NOT_FOUND') {
throw error2;
}
throw error1
}
}
try {
module.exports.nodeTypeInfo = require("../../src/node-types.json");
} catch (_) {}

@ -0,0 +1,40 @@
fn main() {
let src_dir = std::path::Path::new("src");
let mut c_config = cc::Build::new();
c_config.include(&src_dir);
c_config
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable")
.flag_if_supported("-Wno-trigraphs");
let parser_path = src_dir.join("parser.c");
c_config.file(&parser_path);
// If your language uses an external scanner written in C,
// then include this block of code:
/*
let scanner_path = src_dir.join("scanner.c");
c_config.file(&scanner_path);
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
*/
c_config.compile("parser");
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
// If your language uses an external scanner written in C++,
// then include this block of code:
/*
let mut cpp_config = cc::Build::new();
cpp_config.cpp(true);
cpp_config.include(&src_dir);
cpp_config
.flag_if_supported("-Wno-unused-parameter")
.flag_if_supported("-Wno-unused-but-set-variable");
let scanner_path = src_dir.join("scanner.cc");
cpp_config.file(&scanner_path);
cpp_config.compile("scanner");
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
*/
}

@ -0,0 +1,52 @@
//! This crate provides kotlin language support for the [tree-sitter][] parsing library.
//!
//! Typically, you will use the [language][language func] function to add this language to a
//! tree-sitter [Parser][], and then use the parser to parse some code:
//!
//! ```
//! let code = "";
//! let mut parser = tree_sitter::Parser::new();
//! parser.set_language(tree_sitter_kotlin::language()).expect("Error loading kotlin grammar");
//! let tree = parser.parse(code, None).unwrap();
//! ```
//!
//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
//! [language func]: fn.language.html
//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html
//! [tree-sitter]: https://tree-sitter.github.io/
use tree_sitter::Language;
extern "C" {
fn tree_sitter_kotlin() -> Language;
}
/// Get the tree-sitter [Language][] for this grammar.
///
/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html
pub fn language() -> Language {
unsafe { tree_sitter_kotlin() }
}
/// The content of the [`node-types.json`][] file for this grammar.
///
/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types
pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json");
// Uncomment these to include any queries that this grammar contains
// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm");
// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm");
// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm");
// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm");
#[cfg(test)]
mod tests {
#[test]
fn test_can_load_grammar() {
let mut parser = tree_sitter::Parser::new();
parser
.set_language(super::language())
.expect("Error loading kotlin language");
}
}

@ -1,13 +0,0 @@
try {
module.exports = require("./build/Release/tree_sitter_kotlin_binding");
} catch (error) {
try {
module.exports = require("./build/Debug/tree_sitter_kotlin_binding");
} catch (_) {
throw error
}
}
try {
module.exports.nodeTypeInfo = require("./src/node-types.json");
} catch (_) {}

89
package-lock.json generated

@ -1,46 +1,47 @@
{
"name": "tree-sitter-kotlin",
"version": "0.2.6",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.2.6",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"nan": "^2.12.1"
},
"devDependencies": {
"tree-sitter-cli": "^0.16.9"
}
},
"node_modules/nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
},
"node_modules/tree-sitter-cli": {
"version": "0.16.9",
"resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.16.9.tgz",
"integrity": "sha512-Aguz2Ns7qG6t71MP9odhh4t9q3+f29BAmZq8XsTDMtoi5o/e9k+Umeqz6brNngCAz3vMBl1OX95ozdnYzhJWIA==",
"dev": true,
"bin": {
"tree-sitter": "cli.js"
}
}
},
"dependencies": {
"nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
},
"tree-sitter-cli": {
"version": "0.16.9",
"resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.16.9.tgz",
"integrity": "sha512-Aguz2Ns7qG6t71MP9odhh4t9q3+f29BAmZq8XsTDMtoi5o/e9k+Umeqz6brNngCAz3vMBl1OX95ozdnYzhJWIA==",
"dev": true
}
}
"name": "tree-sitter-kotlin",
"version": "0.2.6",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.2.6",
"hasInstallScript": true,
"license": "MIT",
"dependencies": {
"nan": "^2.12.1"
},
"devDependencies": {
"tree-sitter-cli": "^0.19.2"
}
},
"node_modules/nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
},
"node_modules/tree-sitter-cli": {
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.19.5.tgz",
"integrity": "sha512-kRzKrUAwpDN9AjA3b0tPBwT1hd8N2oQvvvHup2OEsX6mdsSMLmAvR+NSqK9fe05JrRbVvG8mbteNUQsxlMQohQ==",
"dev": true,
"hasInstallScript": true,
"bin": {
"tree-sitter": "cli.js"
}
}
},
"dependencies": {
"nan": {
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz",
"integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg=="
},
"tree-sitter-cli": {
"version": "0.19.5",
"resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.19.5.tgz",
"integrity": "sha512-kRzKrUAwpDN9AjA3b0tPBwT1hd8N2oQvvvHup2OEsX6mdsSMLmAvR+NSqK9fe05JrRbVvG8mbteNUQsxlMQohQ==",
"dev": true
}
}
}

@ -1,36 +1,36 @@
{
"name": "tree-sitter-kotlin",
"version": "0.2.6",
"description": "Tree-Sitter grammar for Kotlin",
"main": "index.js",
"scripts": {
"test": "tree-sitter test",
"install": "node-gyp rebuild",
"generate": "tree-sitter generate",
"parse": "tree-sitter parse",
"build-wasm": "tree-sitter build-wasm",
"web-ui": "tree-sitter web-ui"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fwcd/tree-sitter-kotlin.git"
},
"keywords": [
"tree-sitter",
"kotlin",
"grammar"
],
"author": "fwcd",
"license": "MIT",
"gypfile": true,
"bugs": {
"url": "https://github.com/fwcd/tree-sitter-kotlin/issues"
},
"homepage": "https://github.com/fwcd/tree-sitter-kotlin#readme",
"dependencies": {
"nan": "^2.12.1"
},
"devDependencies": {
"tree-sitter-cli": "^0.16.9"
}
"name": "tree-sitter-kotlin",
"version": "0.2.6",
"description": "Tree-Sitter grammar for Kotlin",
"main": "bindings/node",
"scripts": {
"test": "tree-sitter test",
"install": "node-gyp rebuild",
"generate": "tree-sitter generate",
"parse": "tree-sitter parse",
"build-wasm": "tree-sitter build-wasm",
"web-ui": "tree-sitter web-ui"
},
"repository": {
"type": "git",
"url": "git+https://github.com/fwcd/tree-sitter-kotlin.git"
},
"keywords": [
"tree-sitter",
"kotlin",
"grammar"
],
"author": "fwcd",
"license": "MIT",
"gypfile": true,
"bugs": {
"url": "https://github.com/fwcd/tree-sitter-kotlin/issues"
},
"homepage": "https://github.com/fwcd/tree-sitter-kotlin#readme",
"dependencies": {
"nan": "^2.12.1"
},
"devDependencies": {
"tree-sitter-cli": "^0.19.2"
}
}

1
src/grammar.json vendored

@ -5690,6 +5690,7 @@
"_unescaped_annotation"
]
],
"precedences": [],
"externals": [],
"inline": [],
"supertypes": []

@ -9323,6 +9323,10 @@
"type": "class",
"named": false
},
{
"type": "comment",
"named": true
},
{
"type": "companion",
"named": false

81
src/parser.c vendored

@ -13,7 +13,7 @@
#pragma GCC optimize ("O0")
#endif
#define LANGUAGE_VERSION 11
#define LANGUAGE_VERSION 13
#define STATE_COUNT 18195
#define LARGE_STATE_COUNT 3882
#define SYMBOL_COUNT 345
@ -22,6 +22,7 @@
#define EXTERNAL_TOKEN_COUNT 0
#define FIELD_COUNT 0
#define MAX_ALIAS_SEQUENCE_LENGTH 10
#define PRODUCTION_ID_COUNT 7
enum {
anon_sym_POUND_BANG = 1,
@ -373,7 +374,7 @@ enum {
alias_sym_type_identifier = 347,
};
static const char *ts_symbol_names[] = {
static const char * const ts_symbol_names[] = {
[ts_builtin_sym_end] = "end",
[anon_sym_POUND_BANG] = "#!",
[aux_sym_shebang_line_token1] = "shebang_line_token1",
@ -424,7 +425,7 @@ static const char *ts_symbol_names[] = {
[anon_sym_do] = "do",
[aux_sym__semi_token1] = "_semi_token1",
[anon_sym_DOT_DOT] = "..",
[anon_sym_QMARK_COLON] = "?:",
[anon_sym_QMARK_COLON] = "\?:",
[anon_sym_AMP_AMP] = "&&",
[anon_sym_PIPE_PIPE] = "||",
[anon_sym_null] = "null",
@ -460,7 +461,7 @@ static const char *ts_symbol_names[] = {
[anon_sym_DASH] = "-",
[anon_sym_SLASH] = "/",
[anon_sym_PERCENT] = "%",
[anon_sym_as_QMARK] = "as?",
[anon_sym_as_QMARK] = "as\?",
[anon_sym_PLUS_PLUS] = "++",
[anon_sym_DASH_DASH] = "--",
[anon_sym_BANG] = "!",
@ -724,7 +725,7 @@ static const char *ts_symbol_names[] = {
[alias_sym_type_identifier] = "type_identifier",
};
static TSSymbol ts_symbol_map[] = {
static const TSSymbol ts_symbol_map[] = {
[ts_builtin_sym_end] = ts_builtin_sym_end,
[anon_sym_POUND_BANG] = anon_sym_POUND_BANG,
[aux_sym_shebang_line_token1] = aux_sym_shebang_line_token1,
@ -2470,7 +2471,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
},
};
static TSSymbol ts_alias_sequences[7][MAX_ALIAS_SEQUENCE_LENGTH] = {
static const TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = {
[0] = {0},
[1] = {
[0] = alias_sym_type_identifier,
@ -2492,6 +2493,17 @@ static TSSymbol ts_alias_sequences[7][MAX_ALIAS_SEQUENCE_LENGTH] = {
},
};
static const uint16_t ts_non_terminal_alias_map[] = {
sym__expression, 2,
sym__expression,
alias_sym_interpolated_expression,
sym_simple_identifier, 3,
sym_simple_identifier,
alias_sym_interpolated_identifier,
alias_sym_type_identifier,
0,
};
static bool ts_lex(TSLexer *lexer, TSStateId state) {
START_LEXER();
eof = lexer->eof(lexer);
@ -10973,7 +10985,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 226:
if (lookahead == '*') ADVANCE(228);
if (lookahead == '/') ADVANCE(844);
if (lookahead == '/') ADVANCE(846);
END_STATE();
case 227:
if (lookahead == '*') ADVANCE(227);
@ -12352,7 +12364,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 575:
ACCEPT_TOKEN(aux_sym_shebang_line_token1);
if (lookahead == '\r') ADVANCE(844);
if (lookahead == '\r') ADVANCE(846);
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(575);
END_STATE();
@ -13179,12 +13191,12 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 736:
ACCEPT_TOKEN(anon_sym_SLASH);
if (lookahead == '*') ADVANCE(228);
if (lookahead == '/') ADVANCE(844);
if (lookahead == '/') ADVANCE(846);
END_STATE();
case 737:
ACCEPT_TOKEN(anon_sym_SLASH);
if (lookahead == '*') ADVANCE(228);
if (lookahead == '/') ADVANCE(844);
if (lookahead == '/') ADVANCE(846);
if (lookahead == '=') ADVANCE(719);
END_STATE();
case 738:
@ -13777,20 +13789,22 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '\n') ADVANCE(1374);
if (lookahead == '"' ||
lookahead == '$' ||
lookahead == '\\') ADVANCE(844);
lookahead == '\\') ADVANCE(846);
if (lookahead != 0) ADVANCE(842);
END_STATE();
case 843:
ACCEPT_TOKEN(sym_comment);
if (lookahead == '\n') ADVANCE(1379);
if (lookahead == '"' ||
lookahead == '$') ADVANCE(844);
lookahead == '$') ADVANCE(846);
if (lookahead != 0) ADVANCE(843);
END_STATE();
case 844:
ACCEPT_TOKEN(sym_comment);
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(844);
lookahead != '"' &&
lookahead != '$' &&
lookahead != '\\') ADVANCE(1374);
END_STATE();
case 845:
ACCEPT_TOKEN(sym_comment);
@ -13801,9 +13815,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 846:
ACCEPT_TOKEN(sym_comment);
if (lookahead != 0 &&
lookahead != '"' &&
lookahead != '$' &&
lookahead != '\\') ADVANCE(1374);
lookahead != '\n') ADVANCE(846);
END_STATE();
case 847:
ACCEPT_TOKEN(anon_sym_return_AT);
@ -13938,7 +13950,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 870:
ACCEPT_TOKEN(aux_sym_character_literal_token1);
if (lookahead == '*') ADVANCE(228);
if (lookahead == '/') ADVANCE(844);
if (lookahead == '/') ADVANCE(846);
END_STATE();
case 871:
ACCEPT_TOKEN(aux_sym_character_literal_token1);
@ -18283,7 +18295,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 1371:
ACCEPT_TOKEN(sym__line_str_text);
if (lookahead == '*') ADVANCE(1371);
if (lookahead == '/') ADVANCE(846);
if (lookahead == '/') ADVANCE(844);
if (lookahead == '"' ||
lookahead == '$' ||
lookahead == '\\') ADVANCE(228);
@ -18361,7 +18373,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
}
}
static TSLexMode ts_lex_modes[STATE_COUNT] = {
static const TSLexMode ts_lex_modes[STATE_COUNT] = {
[0] = {.lex_state = 0},
[1] = {.lex_state = 570},
[2] = {.lex_state = 10},
@ -36559,7 +36571,7 @@ static TSLexMode ts_lex_modes[STATE_COUNT] = {
[18194] = {.lex_state = 0},
};
static uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
[0] = {
[ts_builtin_sym_end] = ACTIONS(1),
[anon_sym_POUND_BANG] = ACTIONS(1),
@ -407075,7 +407087,7 @@ static uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = {
},
};
static uint16_t ts_small_parse_table[] = {
static const uint16_t ts_small_parse_table[] = {
[0] = 45,
ACTIONS(3), 1,
sym_comment,
@ -947070,7 +947082,7 @@ static uint16_t ts_small_parse_table[] = {
anon_sym_LPAREN,
};
static uint32_t ts_small_parse_table_map[] = {
static const uint32_t ts_small_parse_table_map[] = {
[SMALL_STATE(3882)] = 0,
[SMALL_STATE(3883)] = 155,
[SMALL_STATE(3884)] = 310,
@ -961386,7 +961398,7 @@ static uint32_t ts_small_parse_table_map[] = {
[SMALL_STATE(18194)] = 656492,
};
static TSParseActionEntry ts_parse_actions[] = {
static const TSParseActionEntry ts_parse_actions[] = {
[0] = {.entry = {.count = 0, .reusable = false}},
[1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(),
[3] = {.entry = {.count = 1, .reusable = true}}, SHIFT_EXTRA(),
@ -971343,25 +971355,28 @@ extern "C" {
#endif
extern const TSLanguage *tree_sitter_kotlin(void) {
static TSLanguage language = {
static const TSLanguage language = {
.version = LANGUAGE_VERSION,
.symbol_count = SYMBOL_COUNT,
.alias_count = ALIAS_COUNT,
.token_count = TOKEN_COUNT,
.external_token_count = EXTERNAL_TOKEN_COUNT,
.state_count = STATE_COUNT,
.large_state_count = LARGE_STATE_COUNT,
.symbol_metadata = ts_symbol_metadata,
.parse_table = (const unsigned short *)ts_parse_table,
.small_parse_table = (const uint16_t *)ts_small_parse_table,
.small_parse_table_map = (const uint32_t *)ts_small_parse_table_map,
.production_id_count = PRODUCTION_ID_COUNT,
.field_count = FIELD_COUNT,
.max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH,
.parse_table = &ts_parse_table[0][0],
.small_parse_table = ts_small_parse_table,
.small_parse_table_map = ts_small_parse_table_map,
.parse_actions = ts_parse_actions,
.lex_modes = ts_lex_modes,
.symbol_names = ts_symbol_names,
.symbol_metadata = ts_symbol_metadata,
.public_symbol_map = ts_symbol_map,
.alias_sequences = (const TSSymbol *)ts_alias_sequences,
.field_count = FIELD_COUNT,
.max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH,
.alias_map = ts_non_terminal_alias_map,
.alias_sequences = &ts_alias_sequences[0][0],
.lex_modes = ts_lex_modes,
.lex_fn = ts_lex,
.external_token_count = EXTERNAL_TOKEN_COUNT,
};
return &language;
}

@ -13,6 +13,8 @@ extern "C" {
#define ts_builtin_sym_end 0
#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024
typedef uint16_t TSStateId;
#ifndef TREE_SITTER_API_H_
typedef uint16_t TSSymbol;
typedef uint16_t TSFieldId;
@ -30,11 +32,10 @@ typedef struct {
uint16_t length;
} TSFieldMapSlice;
typedef uint16_t TSStateId;
typedef struct {
bool visible : 1;
bool named : 1;
bool visible;
bool named;
bool supertype;
} TSSymbolMetadata;
typedef struct TSLexer TSLexer;
@ -56,21 +57,21 @@ typedef enum {
TSParseActionTypeRecover,
} TSParseActionType;
typedef struct {
union {
struct {
TSStateId state;
bool extra : 1;
bool repetition : 1;
} shift;
struct {
TSSymbol symbol;
int16_t dynamic_precedence;
uint8_t child_count;
uint8_t production_id;
} reduce;
} params;
TSParseActionType type : 4;
typedef union {
struct {
uint8_t type;
TSStateId state;
bool extra;
bool repetition;
} shift;
struct {
uint8_t type;
uint8_t child_count;
TSSymbol symbol;
int16_t dynamic_precedence;
uint16_t production_id;
} reduce;
uint8_t type;
} TSParseAction;
typedef struct {
@ -82,7 +83,7 @@ typedef union {
TSParseAction action;
struct {
uint8_t count;
bool reusable : 1;
bool reusable;
} entry;
} TSParseActionEntry;
@ -92,13 +93,24 @@ struct TSLanguage {
uint32_t alias_count;
uint32_t token_count;
uint32_t external_token_count;
const char **symbol_names;
const TSSymbolMetadata *symbol_metadata;
uint32_t state_count;
uint32_t large_state_count;
uint32_t production_id_count;
uint32_t field_count;
uint16_t max_alias_sequence_length;
const uint16_t *parse_table;
const uint16_t *small_parse_table;
const uint32_t *small_parse_table_map;
const TSParseActionEntry *parse_actions;
const TSLexMode *lex_modes;
const char * const *symbol_names;
const char * const *field_names;
const TSFieldMapSlice *field_map_slices;
const TSFieldMapEntry *field_map_entries;
const TSSymbolMetadata *symbol_metadata;
const TSSymbol *public_symbol_map;
const uint16_t *alias_map;
const TSSymbol *alias_sequences;
uint16_t max_alias_sequence_length;
const TSLexMode *lex_modes;
bool (*lex_fn)(TSLexer *, TSStateId);
bool (*keyword_lex_fn)(TSLexer *, TSStateId);
TSSymbol keyword_capture_token;
@ -111,14 +123,6 @@ struct TSLanguage {
unsigned (*serialize)(void *, char *);
void (*deserialize)(void *, const char *, unsigned);
} external_scanner;
uint32_t field_count;
const TSFieldMapSlice *field_map_slices;
const TSFieldMapEntry *field_map_entries;
const char **field_names;
uint32_t large_state_count;
const uint16_t *small_parse_table;
const uint32_t *small_parse_table_map;
const TSSymbol *public_symbol_map;
};
/*
@ -167,66 +171,50 @@ struct TSLanguage {
#define ACTIONS(id) id
#define SHIFT(state_value) \
{ \
{ \
.params = { \
.shift = { \
.state = state_value \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
#define SHIFT(state_value) \
{{ \
.shift = { \
.type = TSParseActionTypeShift, \
.state = state_value \
} \
}}
#define SHIFT_REPEAT(state_value) \
{ \
{ \
.params = { \
.shift = { \
.state = state_value, \
.repetition = true \
} \
}, \
.type = TSParseActionTypeShift \
{{ \
.shift = { \
.type = TSParseActionTypeShift, \
.state = state_value, \
.repetition = true \
} \
}
#define RECOVER() \
{ \
{ .type = TSParseActionTypeRecover } \
}
}}
#define SHIFT_EXTRA() \
{ \
{ \
.params = { \
.shift = { \
.extra = true \
} \
}, \
.type = TSParseActionTypeShift \
{{ \
.shift = { \
.type = TSParseActionTypeShift, \
.extra = true \
} \
}
}}
#define REDUCE(symbol_val, child_count_val, ...) \
{ \
{ \
.params = { \
.reduce = { \
.symbol = symbol_val, \
.child_count = child_count_val, \
__VA_ARGS__ \
}, \
}, \
.type = TSParseActionTypeReduce \
} \
}
#define ACCEPT_INPUT() \
{ \
{ .type = TSParseActionTypeAccept } \
}
{{ \
.reduce = { \
.type = TSParseActionTypeReduce, \
.symbol = symbol_val, \
.child_count = child_count_val, \
__VA_ARGS__ \
}, \
}}
#define RECOVER() \
{{ \
.type = TSParseActionTypeRecover \
}}
#define ACCEPT_INPUT() \
{{ \
.type = TSParseActionTypeAccept \
}}
#ifdef __cplusplus
}