Bump tree-sitter-cli to 0.19

This commit is contained in:
Max Brunsfeld 2021-03-04 14:44:19 -08:00
parent e882c98b5e
commit f13775ea60
14 changed files with 337 additions and 367 deletions

2
.gitignore vendored
View File

@ -1,4 +1,6 @@
node_modules
build
target
*.log
package-lock.json
Cargo.lock

3
.npmignore Normal file
View File

@ -0,0 +1,3 @@
build
target
Cargo.lock

26
Cargo.toml Normal file
View File

@ -0,0 +1,26 @@
[package]
name = "tree-sitter-css"
description = "css grammar for the tree-sitter parsing library"
version = "0.0.1"
keywords = ["incremental", "parsing", "css"]
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"

View File

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

19
bindings/node/index.js Normal file
View File

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

16
bindings/rust/build.rs Normal file
View File

@ -0,0 +1,16 @@
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");
let scanner_path = src_dir.join("scanner.c");
c_config.file(&parser_path);
c_config.file(&scanner_path);
println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap());
println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap());
c_config.compile("parser");
}

47
bindings/rust/lib.rs Normal file
View File

@ -0,0 +1,47 @@
//! This crate provides css 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_css::language()).expect("Error loading css 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_css() -> 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_css() }
}
/// 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");
pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.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 css language");
}
}

View File

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

View File

@ -2,7 +2,7 @@
"name": "tree-sitter-css",
"version": "0.16.0",
"description": "CSS grammar for tree-sitter",
"main": "index.js",
"main": "bindings/node",
"keywords": [
"parser",
"lexer"
@ -10,10 +10,10 @@
"author": "Max Brunsfeld",
"license": "MIT",
"dependencies": {
"nan": "^2.11.1"
"nan": "^2.14.1"
},
"devDependencies": {
"tree-sitter-cli": "^0.16.7"
"tree-sitter-cli": "^0.19.1"
},
"scripts": {
"test": "tree-sitter test && tree-sitter parse examples/*.css --quiet --time",

5
src/grammar.json vendored
View File

@ -1659,7 +1659,7 @@
},
{
"type": "PATTERN",
"value": "[^*]*\\*+([^\\/*][^*]*\\*+)*"
"value": "[^*]*\\*+([^/*][^*]*\\*+)*"
},
{
"type": "STRING",
@ -1700,7 +1700,7 @@
"members": [
{
"type": "PATTERN",
"value": "[^\\/\\s,;!{}()\\[\\]]"
"value": "[^/\\s,;!{}()\\[\\]]"
},
{
"type": "PATTERN",
@ -1729,6 +1729,7 @@
"declaration"
]
],
"precedences": [],
"externals": [
{
"type": "SYMBOL",

4
src/node-types.json vendored
View File

@ -1727,6 +1727,10 @@
"type": "class_name",
"named": true
},
{
"type": "comment",
"named": true
},
{
"type": "feature_name",
"named": true

403
src/parser.c vendored
View File

@ -5,15 +5,16 @@
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
#define LANGUAGE_VERSION 11
#define LANGUAGE_VERSION 13
#define STATE_COUNT 278
#define LARGE_STATE_COUNT 2
#define SYMBOL_COUNT 102
#define ALIAS_COUNT 10
#define ALIAS_COUNT 9
#define TOKEN_COUNT 52
#define EXTERNAL_TOKEN_COUNT 1
#define FIELD_COUNT 0
#define MAX_ALIAS_SEQUENCE_LENGTH 6
#define PRODUCTION_ID_COUNT 15
enum {
anon_sym_ATimport = 1,
@ -117,16 +118,15 @@ enum {
aux_sym_pseudo_class_arguments_repeat2 = 99,
aux_sym_declaration_repeat1 = 100,
aux_sym_arguments_repeat1 = 101,
alias_sym_attribute_name = 102,
alias_sym_class_name = 103,
alias_sym_feature_name = 104,
alias_sym_function_name = 105,
alias_sym_id_name = 106,
alias_sym_keyframes_name = 107,
alias_sym_keyword_query = 108,
alias_sym_namespace_name = 109,
alias_sym_property_name = 110,
alias_sym_tag_name = 111,
alias_sym_class_name = 102,
alias_sym_feature_name = 103,
alias_sym_function_name = 104,
alias_sym_id_name = 105,
alias_sym_keyframes_name = 106,
alias_sym_keyword_query = 107,
alias_sym_namespace_name = 108,
alias_sym_property_name = 109,
alias_sym_tag_name = 110,
};
static const char *ts_symbol_names[] = {
@ -177,7 +177,7 @@ static const char *ts_symbol_names[] = {
[sym_unit] = "unit",
[anon_sym_DASH] = "-",
[anon_sym_SLASH] = "/",
[sym_identifier] = "identifier",
[sym_identifier] = "attribute_name",
[sym_at_keyword] = "at_keyword",
[sym_comment] = "comment",
[sym_plain_value] = "plain_value",
@ -232,7 +232,6 @@ static const char *ts_symbol_names[] = {
[aux_sym_pseudo_class_arguments_repeat2] = "pseudo_class_arguments_repeat2",
[aux_sym_declaration_repeat1] = "declaration_repeat1",
[aux_sym_arguments_repeat1] = "arguments_repeat1",
[alias_sym_attribute_name] = "attribute_name",
[alias_sym_class_name] = "class_name",
[alias_sym_feature_name] = "feature_name",
[alias_sym_function_name] = "function_name",
@ -347,7 +346,6 @@ static TSSymbol ts_symbol_map[] = {
[aux_sym_pseudo_class_arguments_repeat2] = aux_sym_pseudo_class_arguments_repeat2,
[aux_sym_declaration_repeat1] = aux_sym_declaration_repeat1,
[aux_sym_arguments_repeat1] = aux_sym_arguments_repeat1,
[alias_sym_attribute_name] = alias_sym_attribute_name,
[alias_sym_class_name] = alias_sym_class_name,
[alias_sym_feature_name] = alias_sym_feature_name,
[alias_sym_function_name] = alias_sym_function_name,
@ -768,10 +766,6 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
.visible = false,
.named = false,
},
[alias_sym_attribute_name] = {
.visible = true,
.named = true,
},
[alias_sym_class_name] = {
.visible = true,
.named = true,
@ -810,7 +804,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
},
};
static TSSymbol ts_alias_sequences[17][MAX_ALIAS_SEQUENCE_LENGTH] = {
static TSSymbol ts_alias_sequences[PRODUCTION_ID_COUNT][MAX_ALIAS_SEQUENCE_LENGTH] = {
[0] = {0},
[1] = {
[0] = alias_sym_tag_name,
@ -837,31 +831,65 @@ static TSSymbol ts_alias_sequences[17][MAX_ALIAS_SEQUENCE_LENGTH] = {
[1] = alias_sym_keyframes_name,
},
[9] = {
[1] = alias_sym_attribute_name,
},
[10] = {
[2] = alias_sym_class_name,
},
[11] = {
[10] = {
[2] = alias_sym_tag_name,
},
[12] = {
[11] = {
[2] = alias_sym_id_name,
},
[13] = {
[12] = {
[1] = alias_sym_namespace_name,
},
[14] = {
[13] = {
[0] = alias_sym_property_name,
},
[15] = {
[2] = alias_sym_attribute_name,
},
[16] = {
[14] = {
[1] = alias_sym_feature_name,
},
};
static uint16_t ts_non_terminal_alias_map[] = {
0,
};
static inline bool sym_plain_value_character_set_1(int32_t c) {
return (c < ','
? (c < '\r'
? (c < '\t'
? c == 0
: c <= '\n')
: (c <= '\r' || (c < '('
? (c >= ' ' && c <= '!')
: c <= ')')))
: (c <= ',' || (c < ']'
? (c < '['
? c == ';'
: c <= '[')
: (c <= ']' || (c < '}'
? c == '{'
: c <= '}')))));
}
static inline bool sym_plain_value_character_set_2(int32_t c) {
return (c < ','
? (c < '\r'
? (c < '\t'
? c == 0
: c <= '\n')
: (c <= '\r' || (c < '('
? (c >= ' ' && c <= '!')
: c <= '*')))
: (c <= ',' || (c < ']'
? (c < '['
? c == ';'
: c <= '[')
: (c <= ']' || (c < '}'
? c == '{'
: c <= '}')))));
}
static bool ts_lex(TSLexer *lexer, TSStateId state) {
START_LEXER();
eof = lexer->eof(lexer);
@ -1054,7 +1082,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 6:
if (lookahead == '"') ADVANCE(156);
if (lookahead == '\\') ADVANCE(69);
if (lookahead == '\\') ADVANCE(71);
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(6);
END_STATE();
@ -1103,7 +1131,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 9:
if (lookahead == '\'') ADVANCE(156);
if (lookahead == '\\') ADVANCE(70);
if (lookahead == '\\') ADVANCE(72);
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(9);
END_STATE();
@ -1199,20 +1227,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 16:
if (lookahead == '*') ADVANCE(18);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(27);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(27);
END_STATE();
case 17:
if (lookahead == '*') ADVANCE(17);
@ -1288,7 +1303,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
('a' <= lookahead && lookahead <= 'f')) ADVANCE(68);
END_STATE();
case 27:
if (lookahead == '/') ADVANCE(71);
if (lookahead == '/') ADVANCE(69);
if (lookahead == '-' ||
lookahead == '_') ADVANCE(27);
if (('A' <= lookahead && lookahead <= 'Z') ||
@ -1448,48 +1463,24 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
('a' <= lookahead && lookahead <= 'f')) ADVANCE(67);
END_STATE();
case 69:
if (!sym_plain_value_character_set_2(lookahead)) ADVANCE(27);
END_STATE();
case 70:
if (!sym_plain_value_character_set_2(lookahead)) ADVANCE(263);
END_STATE();
case 71:
if (lookahead != 0 &&
lookahead != '"' &&
lookahead != '\\') ADVANCE(6);
if (lookahead == '"') ADVANCE(157);
if (lookahead == '\\') ADVANCE(69);
if (lookahead == '\\') ADVANCE(71);
END_STATE();
case 70:
case 72:
if (lookahead != 0 &&
lookahead != '\'' &&
lookahead != '\\') ADVANCE(9);
if (lookahead == '\'') ADVANCE(158);
if (lookahead == '\\') ADVANCE(70);
END_STATE();
case 71:
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
(lookahead < '(' || '*' < lookahead) &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(27);
END_STATE();
case 72:
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
(lookahead < '(' || '*' < lookahead) &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (lookahead == '\\') ADVANCE(72);
END_STATE();
case 73:
if (eof) ADVANCE(76);
@ -1871,45 +1862,45 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '.') ADVANCE(64);
if (lookahead == 'E' ||
lookahead == 'e') ADVANCE(127);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(133);
if (('A' <= lookahead && lookahead <= 'F') ||
('a' <= lookahead && lookahead <= 'f')) ADVANCE(126);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(133);
END_STATE();
case 135:
ACCEPT_TOKEN(aux_sym_color_value_token1);
if (lookahead == '.') ADVANCE(64);
if (lookahead == 'E' ||
lookahead == 'e') ADVANCE(129);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(136);
if (('A' <= lookahead && lookahead <= 'F') ||
('a' <= lookahead && lookahead <= 'f')) ADVANCE(149);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(136);
END_STATE();
case 136:
ACCEPT_TOKEN(aux_sym_color_value_token1);
if (lookahead == '.') ADVANCE(64);
if (lookahead == 'E' ||
lookahead == 'e') ADVANCE(130);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(137);
if (('A' <= lookahead && lookahead <= 'F') ||
('a' <= lookahead && lookahead <= 'f')) ADVANCE(147);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(137);
END_STATE();
case 137:
ACCEPT_TOKEN(aux_sym_color_value_token1);
if (lookahead == '.') ADVANCE(64);
if (lookahead == 'E' ||
lookahead == 'e') ADVANCE(128);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(134);
if (('A' <= lookahead && lookahead <= 'F') ||
('a' <= lookahead && lookahead <= 'f')) ADVANCE(145);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(134);
END_STATE();
case 138:
ACCEPT_TOKEN(aux_sym_color_value_token1);
if (lookahead == '.') ADVANCE(64);
if (lookahead == 'E' ||
lookahead == 'e') ADVANCE(131);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(135);
if (('A' <= lookahead && lookahead <= 'F') ||
('a' <= lookahead && lookahead <= 'f')) ADVANCE(151);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(135);
END_STATE();
case 139:
ACCEPT_TOKEN(aux_sym_color_value_token1);
@ -2039,14 +2030,14 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 157:
ACCEPT_TOKEN(sym_string_value);
if (lookahead == '"') ADVANCE(156);
if (lookahead == '\\') ADVANCE(69);
if (lookahead == '\\') ADVANCE(71);
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(6);
END_STATE();
case 158:
ACCEPT_TOKEN(sym_string_value);
if (lookahead == '\'') ADVANCE(156);
if (lookahead == '\\') ADVANCE(70);
if (lookahead == '\\') ADVANCE(72);
if (lookahead != 0 &&
lookahead != '\n') ADVANCE(9);
END_STATE();
@ -2062,9 +2053,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '.') ADVANCE(64);
if (lookahead == 'E' ||
lookahead == 'e') ADVANCE(132);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(138);
if (('A' <= lookahead && lookahead <= 'F') ||
('a' <= lookahead && lookahead <= 'f')) ADVANCE(153);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(138);
END_STATE();
case 161:
ACCEPT_TOKEN(aux_sym_integer_value_token1);
@ -2082,9 +2073,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
if (lookahead == '.') ADVANCE(64);
if (lookahead == 'E' ||
lookahead == 'e') ADVANCE(21);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(160);
if (('A' <= lookahead && lookahead <= 'F') ||
('a' <= lookahead && lookahead <= 'f')) ADVANCE(67);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(160);
END_STATE();
case 163:
ACCEPT_TOKEN(aux_sym_integer_value_token1);
@ -2092,26 +2083,13 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 164:
ACCEPT_TOKEN(aux_sym_float_value_token1);
if (lookahead == '/') ADVANCE(72);
if (lookahead == '/') ADVANCE(70);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(164);
if (lookahead == '-' ||
('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(197);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(263);
END_STATE();
case 165:
ACCEPT_TOKEN(aux_sym_float_value_token1);
@ -2270,70 +2248,31 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
ACCEPT_TOKEN(sym_unit);
if (lookahead == '%') ADVANCE(184);
if (lookahead == '-') ADVANCE(196);
if (lookahead == '/') ADVANCE(72);
if (lookahead == '/') ADVANCE(70);
if (lookahead == '_') ADVANCE(197);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(164);
if (('A' <= lookahead && lookahead <= 'Z') ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(183);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(263);
END_STATE();
case 183:
ACCEPT_TOKEN(sym_unit);
if (lookahead == '%') ADVANCE(184);
if (lookahead == '/') ADVANCE(72);
if (lookahead == '/') ADVANCE(70);
if (lookahead == '-' ||
('0' <= lookahead && lookahead <= '9') ||
lookahead == '_') ADVANCE(197);
if (('A' <= lookahead && lookahead <= 'Z') ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(183);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(263);
END_STATE();
case 184:
ACCEPT_TOKEN(sym_unit);
if (lookahead == '/') ADVANCE(72);
if (lookahead == '/') ADVANCE(70);
if (lookahead == '%' ||
('A' <= lookahead && lookahead <= 'Z') ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(184);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(263);
END_STATE();
case 185:
ACCEPT_TOKEN(sym_unit);
@ -2347,7 +2286,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 187:
ACCEPT_TOKEN(anon_sym_DASH);
if (lookahead == '.') ADVANCE(64);
if (lookahead == '/') ADVANCE(71);
if (lookahead == '/') ADVANCE(69);
if (lookahead == '-' ||
lookahead == '_') ADVANCE(195);
if (lookahead == 'E' ||
@ -2378,43 +2317,17 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 191:
ACCEPT_TOKEN(anon_sym_SLASH);
if (lookahead == '*') ADVANCE(18);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(27);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(27);
END_STATE();
case 192:
ACCEPT_TOKEN(sym_identifier);
if (lookahead == '-') ADVANCE(196);
if (lookahead == '/') ADVANCE(72);
if (lookahead == '/') ADVANCE(70);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(164);
if (('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(197);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(263);
END_STATE();
case 193:
ACCEPT_TOKEN(sym_identifier);
@ -2427,7 +2340,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
case 194:
ACCEPT_TOKEN(sym_identifier);
if (lookahead == '.') ADVANCE(64);
if (lookahead == '/') ADVANCE(71);
if (lookahead == '/') ADVANCE(69);
if (lookahead == '-' ||
lookahead == '_') ADVANCE(195);
if (lookahead == 'E' ||
@ -2438,7 +2351,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 195:
ACCEPT_TOKEN(sym_identifier);
if (lookahead == '/') ADVANCE(71);
if (lookahead == '/') ADVANCE(69);
if (lookahead == '-' ||
lookahead == '_') ADVANCE(195);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(213);
@ -2447,49 +2360,23 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 196:
ACCEPT_TOKEN(sym_identifier);
if (lookahead == '/') ADVANCE(72);
if (lookahead == '/') ADVANCE(70);
if (('0' <= lookahead && lookahead <= '9')) ADVANCE(164);
if (lookahead == '-' ||
('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(197);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(263);
END_STATE();
case 197:
ACCEPT_TOKEN(sym_identifier);
if (lookahead == '/') ADVANCE(72);
if (lookahead == '/') ADVANCE(70);
if (lookahead == '-' ||
('0' <= lookahead && lookahead <= '9') ||
('A' <= lookahead && lookahead <= 'Z') ||
lookahead == '_' ||
('a' <= lookahead && lookahead <= 'z')) ADVANCE(197);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(263);
END_STATE();
case 198:
ACCEPT_TOKEN(sym_identifier);
@ -3069,21 +2956,8 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) {
END_STATE();
case 263:
ACCEPT_TOKEN(sym_plain_value);
if (lookahead == '/') ADVANCE(72);
if (lookahead != 0 &&
lookahead != '\t' &&
lookahead != '\n' &&
lookahead != '\r' &&
lookahead != ' ' &&
lookahead != '!' &&
lookahead != '(' &&
lookahead != ')' &&
lookahead != ',' &&
lookahead != ';' &&
lookahead != '[' &&
lookahead != ']' &&
lookahead != '{' &&
lookahead != '}') ADVANCE(263);
if (lookahead == '/') ADVANCE(70);
if (!sym_plain_value_character_set_1(lookahead)) ADVANCE(263);
END_STATE();
default:
return false;
@ -9149,7 +9023,7 @@ static TSParseActionEntry ts_parse_actions[] = {
[181] = {.entry = {.count = 1, .reusable = true}}, SHIFT(153),
[183] = {.entry = {.count = 1, .reusable = true}}, SHIFT(108),
[185] = {.entry = {.count = 1, .reusable = true}}, SHIFT(67),
[187] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_last_declaration, 3, .production_id = 14),
[187] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_last_declaration, 3, .production_id = 13),
[189] = {.entry = {.count = 1, .reusable = true}}, SHIFT(109),
[191] = {.entry = {.count = 1, .reusable = true}}, SHIFT(247),
[193] = {.entry = {.count = 1, .reusable = false}}, SHIFT(109),
@ -9190,15 +9064,15 @@ static TSParseActionEntry ts_parse_actions[] = {
[269] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_declaration_repeat1, 2), SHIFT_REPEAT(57),
[272] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_declaration_repeat1, 2), SHIFT_REPEAT(100),
[275] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63),
[277] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_last_declaration, 4, .production_id = 14),
[277] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_last_declaration, 4, .production_id = 13),
[279] = {.entry = {.count = 1, .reusable = true}}, SHIFT(244),
[281] = {.entry = {.count = 1, .reusable = true}}, SHIFT(189),
[283] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_keyframe_block_list, 3),
[285] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_keyframe_block_list, 3),
[287] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_at_rule, 2),
[289] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_at_rule, 2),
[291] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_namespace_statement, 4, .production_id = 13),
[293] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_namespace_statement, 4, .production_id = 13),
[291] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_namespace_statement, 4, .production_id = 12),
[293] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_namespace_statement, 4, .production_id = 12),
[295] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_media_statement, 4),
[297] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_media_statement, 4),
[299] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import_statement, 3),
@ -9217,8 +9091,8 @@ static TSParseActionEntry ts_parse_actions[] = {
[329] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_pseudo_class_arguments_repeat1, 2), SHIFT_REPEAT(80),
[332] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_pseudo_class_arguments_repeat1, 2), SHIFT_REPEAT(57),
[335] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_pseudo_class_arguments_repeat1, 2), SHIFT_REPEAT(110),
[338] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_declaration, 4, .production_id = 14),
[340] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_declaration, 4, .production_id = 14),
[338] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_declaration, 4, .production_id = 13),
[340] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_declaration, 4, .production_id = 13),
[342] = {.entry = {.count = 1, .reusable = true}}, SHIFT(257),
[344] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12),
[346] = {.entry = {.count = 1, .reusable = true}}, SHIFT(135),
@ -9226,8 +9100,8 @@ static TSParseActionEntry ts_parse_actions[] = {
[350] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_import_statement, 5),
[352] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_at_rule, 4),
[354] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_at_rule, 4),
[356] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_declaration, 5, .production_id = 14),
[358] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_declaration, 5, .production_id = 14),
[356] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_declaration, 5, .production_id = 13),
[358] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_declaration, 5, .production_id = 13),
[360] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 4),
[362] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_block, 4),
[364] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_arguments_repeat1, 2),
@ -9235,8 +9109,8 @@ static TSParseActionEntry ts_parse_actions[] = {
[368] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_at_rule, 3),
[370] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_charset_statement, 3),
[372] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_charset_statement, 3),
[374] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_declaration, 6, .production_id = 14),
[376] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_declaration, 6, .production_id = 14),
[374] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_declaration, 6, .production_id = 13),
[376] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_declaration, 6, .production_id = 13),
[378] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 2),
[380] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_block, 2),
[382] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_rule_set, 2),
@ -9328,8 +9202,8 @@ static TSParseActionEntry ts_parse_actions[] = {
[554] = {.entry = {.count = 1, .reusable = false}}, SHIFT(210),
[556] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30),
[558] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6),
[560] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_class_selector, 3, .production_id = 10),
[562] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_class_selector, 3, .production_id = 10),
[560] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_class_selector, 3, .production_id = 9),
[562] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_class_selector, 3, .production_id = 9),
[564] = {.entry = {.count = 1, .reusable = true}}, SHIFT(89),
[566] = {.entry = {.count = 1, .reusable = false}}, SHIFT(89),
[568] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13),
@ -9344,12 +9218,12 @@ static TSParseActionEntry ts_parse_actions[] = {
[586] = {.entry = {.count = 1, .reusable = false}}, SHIFT(85),
[588] = {.entry = {.count = 1, .reusable = true}}, SHIFT(14),
[590] = {.entry = {.count = 1, .reusable = false}}, SHIFT(14),
[592] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_element_selector, 3, .production_id = 11),
[594] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_element_selector, 3, .production_id = 11),
[596] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute_selector, 5, .production_id = 9),
[598] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attribute_selector, 5, .production_id = 9),
[600] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_id_selector, 3, .production_id = 12),
[602] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_id_selector, 3, .production_id = 12),
[592] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_element_selector, 3, .production_id = 10),
[594] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_element_selector, 3, .production_id = 10),
[596] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute_selector, 5),
[598] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attribute_selector, 5),
[600] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_id_selector, 3, .production_id = 11),
[602] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_id_selector, 3, .production_id = 11),
[604] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_class_selector, 2, .production_id = 4),
[606] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_class_selector, 2, .production_id = 4),
[608] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_child_selector, 3),
@ -9365,21 +9239,21 @@ static TSParseActionEntry ts_parse_actions[] = {
[628] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_id_selector, 2, .production_id = 6),
[630] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_class_selector, 3, .production_id = 4),
[632] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_class_selector, 3, .production_id = 4),
[634] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute_selector, 3, .production_id = 9),
[636] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attribute_selector, 3, .production_id = 9),
[638] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute_selector, 6, .production_id = 15),
[640] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attribute_selector, 6, .production_id = 15),
[634] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute_selector, 3),
[636] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attribute_selector, 3),
[638] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute_selector, 6),
[640] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attribute_selector, 6),
[642] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86),
[644] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_class_arguments, 3),
[646] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_class_arguments, 3),
[648] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_class_arguments, 4),
[650] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_class_arguments, 4),
[652] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_class_selector, 4, .production_id = 10),
[654] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_class_selector, 4, .production_id = 10),
[656] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute_selector, 4, .production_id = 15),
[658] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attribute_selector, 4, .production_id = 15),
[660] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_class_selector, 3, .production_id = 10),
[662] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_class_selector, 3, .production_id = 10),
[652] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_pseudo_class_selector, 4, .production_id = 9),
[654] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_pseudo_class_selector, 4, .production_id = 9),
[656] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute_selector, 4),
[658] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attribute_selector, 4),
[660] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_class_selector, 3, .production_id = 9),
[662] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_class_selector, 3, .production_id = 9),
[664] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_descendant_selector, 3),
[666] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_descendant_selector, 3),
[668] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18),
@ -9425,7 +9299,7 @@ static TSParseActionEntry ts_parse_actions[] = {
[751] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_keyframe_block_list_repeat1, 2), SHIFT_REPEAT(240),
[754] = {.entry = {.count = 1, .reusable = true}}, SHIFT(29),
[756] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__query, 1, .production_id = 3),
[758] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_feature_query, 5, .production_id = 16),
[758] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_feature_query, 5, .production_id = 14),
[760] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_selector_query, 4),
[762] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_parenthesized_query, 3),
[764] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_binary_query, 3),
@ -9471,7 +9345,7 @@ static TSParseActionEntry ts_parse_actions[] = {
[848] = {.entry = {.count = 1, .reusable = false}}, SHIFT(130),
[850] = {.entry = {.count = 1, .reusable = true}}, SHIFT(156),
[852] = {.entry = {.count = 1, .reusable = true}}, SHIFT(61),
[854] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_last_declaration, 5, .production_id = 14),
[854] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_last_declaration, 5, .production_id = 13),
[856] = {.entry = {.count = 1, .reusable = true}}, SHIFT(187),
[858] = {.entry = {.count = 1, .reusable = true}}, SHIFT(88),
[860] = {.entry = {.count = 1, .reusable = true}}, SHIFT(122),
@ -9519,20 +9393,23 @@ extern const TSLanguage *tree_sitter_css(void) {
.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,
.production_id_count = PRODUCTION_ID_COUNT,
.field_count = FIELD_COUNT,
.max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH,
.parse_table = (const uint16_t *)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,
.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_map = ts_non_terminal_alias_map,
.alias_sequences = (const TSSymbol *)ts_alias_sequences,
.field_count = FIELD_COUNT,
.max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH,
.lex_modes = ts_lex_modes,
.lex_fn = ts_lex,
.external_token_count = EXTERNAL_TOKEN_COUNT,
.external_scanner = {
(const bool *)ts_external_scanner_states,
ts_external_scanner_symbol_map,

View File

@ -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 {
typedef union {
struct {
uint8_t type;
TSStateId state;
bool extra : 1;
bool repetition : 1;
bool extra;
bool repetition;
} shift;
struct {
uint8_t type;
uint8_t child_count;
TSSymbol symbol;
int16_t dynamic_precedence;
uint8_t child_count;
uint8_t production_id;
uint16_t production_id;
} reduce;
} params;
TSParseActionType type : 4;
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;
const uint16_t *parse_table;
const TSParseActionEntry *parse_actions;
const TSLexMode *lex_modes;
const TSSymbol *alias_sequences;
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 char **symbol_names;
const char **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;
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;
};
/*
@ -168,65 +172,49 @@ struct TSLanguage {
#define ACTIONS(id) id
#define SHIFT(state_value) \
{ \
{ \
.params = { \
{{ \
.shift = { \
.type = TSParseActionTypeShift, \
.state = state_value \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
}}
#define SHIFT_REPEAT(state_value) \
{ \
{ \
.params = { \
{{ \
.shift = { \
.type = TSParseActionTypeShift, \
.state = state_value, \
.repetition = true \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
#define RECOVER() \
{ \
{ .type = TSParseActionTypeRecover } \
}
}}
#define SHIFT_EXTRA() \
{ \
{ \
.params = { \
{{ \
.shift = { \
.type = TSParseActionTypeShift, \
.extra = true \
} \
}, \
.type = TSParseActionTypeShift \
} \
}
}}
#define REDUCE(symbol_val, child_count_val, ...) \
{ \
{ \
.params = { \
{{ \
.reduce = { \
.type = TSParseActionTypeReduce, \
.symbol = symbol_val, \
.child_count = child_count_val, \
__VA_ARGS__ \
}, \
}, \
.type = TSParseActionTypeReduce \
} \
}
}}
#define RECOVER() \
{{ \
.type = TSParseActionTypeRecover \
}}
#define ACCEPT_INPUT() \
{ \
{ .type = TSParseActionTypeAccept } \
}
{{ \
.type = TSParseActionTypeAccept \
}}
#ifdef __cplusplus
}