diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..d3a8b5b --- /dev/null +++ b/.editorconfig @@ -0,0 +1,39 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{json,toml,yml,gyp}] +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space +indent_size = 2 + +[*.rs] +indent_style = space +indent_size = 4 + +[*.{c,cc,h}] +indent_style = space +indent_size = 4 + +[*.{py,pyi}] +indent_style = space +indent_size = 4 + +[*.swift] +indent_style = space +indent_size = 4 + +[*.go] +indent_style = tab +indent_size = 8 + +[Makefile] +indent_style = tab +indent_size = 8 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..ffb52ab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +* text eol=lf + +src/*.json linguist-generated +src/parser.c linguist-generated +src/tree_sitter/* linguist-generated + +bindings/** linguist-generated +binding.gyp linguist-generated +setup.py linguist-generated +Makefile linguist-generated +Package.swift linguist-generated diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..861492d --- /dev/null +++ b/Makefile @@ -0,0 +1,112 @@ +VERSION := 0.0.1 + +LANGUAGE_NAME := tree-sitter-slim + +# repository +SRC_DIR := src + +PARSER_REPO_URL := $(shell git -C $(SRC_DIR) remote get-url origin 2>/dev/null) + +ifeq ($(PARSER_URL),) + PARSER_URL := $(subst .git,,$(PARSER_REPO_URL)) +ifeq ($(shell echo $(PARSER_URL) | grep '^[a-z][-+.0-9a-z]*://'),) + PARSER_URL := $(subst :,/,$(PARSER_URL)) + PARSER_URL := $(subst git@,https://,$(PARSER_URL)) +endif +endif + +TS ?= tree-sitter + +# ABI versioning +SONAME_MAJOR := $(word 1,$(subst ., ,$(VERSION))) +SONAME_MINOR := $(word 2,$(subst ., ,$(VERSION))) + +# install directory layout +PREFIX ?= /usr/local +INCLUDEDIR ?= $(PREFIX)/include +LIBDIR ?= $(PREFIX)/lib +PCLIBDIR ?= $(LIBDIR)/pkgconfig + +# source/object files +PARSER := $(SRC_DIR)/parser.c +EXTRAS := $(filter-out $(PARSER),$(wildcard $(SRC_DIR)/*.c)) +OBJS := $(patsubst %.c,%.o,$(PARSER) $(EXTRAS)) + +# flags +ARFLAGS ?= rcs +override CFLAGS += -I$(SRC_DIR) -std=c11 -fPIC + +# OS-specific bits +ifeq ($(OS),Windows_NT) + $(error "Windows is not supported") +else ifeq ($(shell uname),Darwin) + SOEXT = dylib + SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib + SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib + LINKSHARED := $(LINKSHARED)-dynamiclib -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS), + endif + LINKSHARED := $(LINKSHARED)-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SONAME_MAJOR).dylib,-rpath,@executable_path/../Frameworks +else + SOEXT = so + SOEXTVER_MAJOR = so.$(SONAME_MAJOR) + SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR) + LINKSHARED := $(LINKSHARED)-shared -Wl, + ifneq ($(ADDITIONAL_LIBS),) + LINKSHARED := $(LINKSHARED)$(ADDITIONAL_LIBS) + endif + LINKSHARED := $(LINKSHARED)-soname,lib$(LANGUAGE_NAME).so.$(SONAME_MAJOR) +endif +ifneq ($(filter $(shell uname),FreeBSD NetBSD DragonFly),) + PCLIBDIR := $(PREFIX)/libdata/pkgconfig +endif + +all: lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) $(LANGUAGE_NAME).pc + +lib$(LANGUAGE_NAME).a: $(OBJS) + $(AR) $(ARFLAGS) $@ $^ + +lib$(LANGUAGE_NAME).$(SOEXT): $(OBJS) + $(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@ +ifneq ($(STRIP),) + $(STRIP) $@ +endif + +$(LANGUAGE_NAME).pc: bindings/c/$(LANGUAGE_NAME).pc.in + sed -e 's|@URL@|$(PARSER_URL)|' \ + -e 's|@VERSION@|$(VERSION)|' \ + -e 's|@LIBDIR@|$(LIBDIR)|' \ + -e 's|@INCLUDEDIR@|$(INCLUDEDIR)|' \ + -e 's|@REQUIRES@|$(REQUIRES)|' \ + -e 's|@ADDITIONAL_LIBS@|$(ADDITIONAL_LIBS)|' \ + -e 's|=$(PREFIX)|=$${prefix}|' \ + -e 's|@PREFIX@|$(PREFIX)|' $< > $@ + +$(PARSER): $(SRC_DIR)/grammar.json + $(TS) generate --no-bindings $^ + +install: all + install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter '$(DESTDIR)$(PCLIBDIR)' '$(DESTDIR)$(LIBDIR)' + install -m644 bindings/c/$(LANGUAGE_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h + install -m644 $(LANGUAGE_NAME).pc '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + install -m644 lib$(LANGUAGE_NAME).a '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a + install -m755 lib$(LANGUAGE_NAME).$(SOEXT) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) + ln -sf lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) + +uninstall: + $(RM) '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).a \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXTVER_MAJOR) \ + '$(DESTDIR)$(LIBDIR)'/lib$(LANGUAGE_NAME).$(SOEXT) \ + '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/$(LANGUAGE_NAME).h \ + '$(DESTDIR)$(PCLIBDIR)'/$(LANGUAGE_NAME).pc + +clean: + $(RM) $(OBJS) $(LANGUAGE_NAME).pc lib$(LANGUAGE_NAME).a lib$(LANGUAGE_NAME).$(SOEXT) + +test: + $(TS) test + +.PHONY: all install uninstall clean test diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..04c865c --- /dev/null +++ b/Package.swift @@ -0,0 +1,47 @@ +// swift-tools-version:5.3 +import PackageDescription + +let package = Package( + name: "TreeSitterSlim", + products: [ + .library(name: "TreeSitterSlim", targets: ["TreeSitterSlim"]), + ], + dependencies: [], + targets: [ + .target(name: "TreeSitterSlim", + path: ".", + exclude: [ + "Cargo.toml", + "Makefile", + "binding.gyp", + "bindings/c", + "bindings/go", + "bindings/node", + "bindings/python", + "bindings/rust", + "prebuilds", + "grammar.js", + "package.json", + "package-lock.json", + "pyproject.toml", + "setup.py", + "test", + "examples", + ".editorconfig", + ".github", + ".gitignore", + ".gitattributes", + ".gitmodules", + ], + sources: [ + "src/parser.c", + // NOTE: if your language has an external scanner, add it here. + ], + resources: [ + .copy("queries") + ], + publicHeadersPath: "bindings/swift", + cSettings: [.headerSearchPath("src")]) + ], + cLanguageStandard: .c11 +) diff --git a/binding.gyp b/binding.gyp index 3da4b27..e7dbe3b 100644 --- a/binding.gyp +++ b/binding.gyp @@ -2,18 +2,29 @@ "targets": [ { "target_name": "tree_sitter_slim_binding", + "dependencies": [ + " -#include "nan.h" +#include -using namespace v8; +typedef struct TSLanguage TSLanguage; -extern "C" TSLanguage * tree_sitter_slim(); +extern "C" TSLanguage *tree_sitter_slim(); -namespace { +// "tree-sitter", "language" hashed with BLAKE2 +const napi_type_tag LANGUAGE_TYPE_TAG = { + 0x8AF2E5212AD58ABF, 0xD5006CAD83ABBA16 +}; -NAN_METHOD(New) {} - -void Init(Local exports, Local module) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("Language").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - Local constructor = Nan::GetFunction(tpl).ToLocalChecked(); - Local instance = constructor->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); - Nan::SetInternalFieldPointer(instance, 0, tree_sitter_slim()); - - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("slim").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); +Napi::Object Init(Napi::Env env, Napi::Object exports) { + exports["name"] = Napi::String::New(env, "slim"); + auto language = Napi::External::New(env, tree_sitter_slim()); + language.TypeTag(&LANGUAGE_TYPE_TAG); + exports["language"] = language; + return exports; } -NODE_MODULE(tree_sitter_slim_binding, Init) - -} // namespace +NODE_API_MODULE(tree_sitter_slim_binding, Init) diff --git a/bindings/node/index.d.ts b/bindings/node/index.d.ts new file mode 100644 index 0000000..efe259e --- /dev/null +++ b/bindings/node/index.d.ts @@ -0,0 +1,28 @@ +type BaseNode = { + type: string; + named: boolean; +}; + +type ChildNode = { + multiple: boolean; + required: boolean; + types: BaseNode[]; +}; + +type NodeInfo = + | (BaseNode & { + subtypes: BaseNode[]; + }) + | (BaseNode & { + fields: { [name: string]: ChildNode }; + children: ChildNode[]; + }); + +type Language = { + name: string; + language: unknown; + nodeTypeInfo: NodeInfo[]; +}; + +declare const language: Language; +export = language; diff --git a/bindings/node/index.js b/bindings/node/index.js index e722c74..6657bcf 100644 --- a/bindings/node/index.js +++ b/bindings/node/index.js @@ -1,18 +1,6 @@ -try { - module.exports = require("../../build/Release/tree_sitter_slim_binding"); -} catch (error1) { - if (error1.code !== 'MODULE_NOT_FOUND') { - throw error1; - } - try { - module.exports = require("../../build/Debug/tree_sitter_slim_binding"); - } catch (error2) { - if (error2.code !== 'MODULE_NOT_FOUND') { - throw error2; - } - throw error1 - } -} +const root = require("path").join(__dirname, "..", ".."); + +module.exports = require("node-gyp-build")(root); try { module.exports.nodeTypeInfo = require("../../src/node-types.json"); diff --git a/bindings/python/tree_sitter_slim/__init__.py b/bindings/python/tree_sitter_slim/__init__.py new file mode 100644 index 0000000..cac7726 --- /dev/null +++ b/bindings/python/tree_sitter_slim/__init__.py @@ -0,0 +1,5 @@ +"Slim grammar for tree-sitter" + +from ._binding import language + +__all__ = ["language"] diff --git a/bindings/python/tree_sitter_slim/__init__.pyi b/bindings/python/tree_sitter_slim/__init__.pyi new file mode 100644 index 0000000..5416666 --- /dev/null +++ b/bindings/python/tree_sitter_slim/__init__.pyi @@ -0,0 +1 @@ +def language() -> int: ... diff --git a/bindings/python/tree_sitter_slim/binding.c b/bindings/python/tree_sitter_slim/binding.c new file mode 100644 index 0000000..e49563f --- /dev/null +++ b/bindings/python/tree_sitter_slim/binding.c @@ -0,0 +1,27 @@ +#include + +typedef struct TSLanguage TSLanguage; + +TSLanguage *tree_sitter_slim(void); + +static PyObject* _binding_language(PyObject *self, PyObject *args) { + return PyLong_FromVoidPtr(tree_sitter_slim()); +} + +static PyMethodDef methods[] = { + {"language", _binding_language, METH_NOARGS, + "Get the tree-sitter language for this grammar."}, + {NULL, NULL, 0, NULL} +}; + +static struct PyModuleDef module = { + .m_base = PyModuleDef_HEAD_INIT, + .m_name = "_binding", + .m_doc = NULL, + .m_size = -1, + .m_methods = methods +}; + +PyMODINIT_FUNC PyInit__binding(void) { + return PyModule_Create(&module); +} diff --git a/bindings/python/tree_sitter_slim/py.typed b/bindings/python/tree_sitter_slim/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/bindings/rust/build.rs b/bindings/rust/build.rs index 618e90a..2faa390 100644 --- a/bindings/rust/build.rs +++ b/bindings/rust/build.rs @@ -7,6 +7,9 @@ fn main() { .flag_if_supported("-Wno-unused-parameter") .flag_if_supported("-Wno-unused-but-set-variable") .flag_if_supported("-Wno-trigraphs"); + #[cfg(target_env = "msvc")] + c_config.flag("-utf-8"); + let parser_path = src_dir.join("parser.c"); c_config.file(&parser_path); diff --git a/bindings/swift/TreeSitterSlim/slim.h b/bindings/swift/TreeSitterSlim/slim.h new file mode 100644 index 0000000..454a822 --- /dev/null +++ b/bindings/swift/TreeSitterSlim/slim.h @@ -0,0 +1,16 @@ +#ifndef TREE_SITTER_SLIM_H_ +#define TREE_SITTER_SLIM_H_ + +typedef struct TSLanguage TSLanguage; + +#ifdef __cplusplus +extern "C" { +#endif + +const TSLanguage *tree_sitter_slim(void); + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_SLIM_H_ diff --git a/package.json b/package.json index 23164de..0dc4bf5 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,11 @@ "version": "0.0.1", "description": "A tree-sitter based parser for slim template language", "main": "bindings/node", + "types": "bindings/node", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "echo \"Error: no test specified\" && exit 1", + "install": "node-gyp-build", + "prebuildify": "prebuildify --napi --strip" }, "keywords": [ "tree-sitter", @@ -15,13 +18,31 @@ "syntax", "ide" ], + "files": [ + "grammar.js", + "binding.gyp", + "prebuilds/**", + "bindings/node/*", + "queries/*", + "src/**" + ], "author": "", "license": "MIT", "dependencies": { - "nan": "^2.15.0" + "node-addon-api": "^7.1.0", + "node-gyp-build": "^4.8.0" + }, + "peerDependencies": { + "tree-sitter": "^0.21.0" + }, + "peerDependenciesMeta": { + "tree_sitter": { + "optional": true + } }, "devDependencies": { - "tree-sitter-cli": "^0.20.0" + "tree-sitter-cli": "^0.20.0", + "prebuildify": "^6.0.0" }, "tree-sitter": [ { diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1f46587 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "tree-sitter-slim" +description = "Slim grammar for tree-sitter" +version = "0.0.1" +keywords = ["incremental", "parsing", "tree-sitter", "slim"] +classifiers = [ + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Topic :: Software Development :: Compilers", + "Topic :: Text Processing :: Linguistic", + "Typing :: Typed" +] +requires-python = ">=3.8" +license.text = "MIT" +readme = "README.md" + +[project.urls] +Homepage = "https://github.com/tree-sitter/tree-sitter-slim" + +[project.optional-dependencies] +core = ["tree-sitter~=0.21"] + +[tool.cibuildwheel] +build = "cp38-*" +build-frontend = "build" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..f723849 --- /dev/null +++ b/setup.py @@ -0,0 +1,60 @@ +from os.path import isdir, join +from platform import system + +from setuptools import Extension, find_packages, setup +from setuptools.command.build import build +from wheel.bdist_wheel import bdist_wheel + + +class Build(build): + def run(self): + if isdir("queries"): + dest = join(self.build_lib, "tree_sitter_slim", "queries") + self.copy_tree("queries", dest) + super().run() + + +class BdistWheel(bdist_wheel): + def get_tag(self): + python, abi, platform = super().get_tag() + if python.startswith("cp"): + python, abi = "cp38", "abi3" + return python, abi, platform + + +setup( + packages=find_packages("bindings/python"), + package_dir={"": "bindings/python"}, + package_data={ + "tree_sitter_slim": ["*.pyi", "py.typed"], + "tree_sitter_slim.queries": ["*.scm"], + }, + ext_package="tree_sitter_slim", + ext_modules=[ + Extension( + name="_binding", + sources=[ + "bindings/python/tree_sitter_slim/binding.c", + "src/parser.c", + # NOTE: if your language uses an external scanner, add it here. + ], + extra_compile_args=[ + "-std=c11", + ] if system() != "Windows" else [ + "/std:c11", + "/utf-8", + ], + define_macros=[ + ("Py_LIMITED_API", "0x03080000"), + ("PY_SSIZE_T_CLEAN", None) + ], + include_dirs=["src"], + py_limited_api=True, + ) + ], + cmdclass={ + "build": Build, + "bdist_wheel": BdistWheel + }, + zip_safe=False +) diff --git a/src/parser.c b/src/parser.c index 922080f..8f7cc8a 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,7 +1,6 @@ #include "tree_sitter/parser.h" #if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif @@ -1299,35 +1298,10 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [279] = 279, }; -static inline bool sym__attr_name_character_set_1(int32_t c) { - return (c < '/' - ? (c < '"' - ? (c < '\n' - ? c == 0 - : c <= '\n') - : (c <= '"' || (c >= '\'' && c <= ')'))) - : (c <= '0' || (c < '{' - ? (c < '[' - ? (c >= '<' && c <= '>') - : c <= ']') - : (c <= '{' || c == '}')))); -} - -static inline bool sym__attr_name_character_set_2(int32_t c) { - return (c < '/' - ? (c < ' ' - ? (c < '\t' - ? c == 0 - : c <= '\n') - : (c <= ' ' || (c < '\'' - ? c == '"' - : c <= ')'))) - : (c <= '0' || (c < '{' - ? (c < '[' - ? (c >= '<' && c <= '>') - : c <= ']') - : (c <= '{' || c == '}')))); -} +static TSCharacterRange sym__attr_name_character_set_1[] = { + {0, 0x08}, {0x0b, 0x1f}, {'!', '!'}, {'#', '&'}, {'*', '.'}, {'1', ';'}, {'?', 'Z'}, {'^', 'z'}, + {'|', '|'}, {'~', 0x10ffff}, +}; static bool ts_lex(TSLexer *lexer, TSStateId state) { START_LEXER(); @@ -1335,42 +1309,44 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { switch (state) { case 0: if (eof) ADVANCE(59); - if (lookahead == '\n') ADVANCE(256); - if (lookahead == '#') ADVANCE(112); - if (lookahead == '\'') ADVANCE(230); - if (lookahead == '(') ADVANCE(118); - if (lookahead == ')') ADVANCE(119); - if (lookahead == '*') ADVANCE(117); - if (lookahead == '-') ADVANCE(223); - if (lookahead == '.') ADVANCE(111); - if (lookahead == '/') ADVANCE(61); - if (lookahead == '0') ADVANCE(209); - if (lookahead == '5') ADVANCE(214); - if (lookahead == ':') ADVANCE(231); - if (lookahead == '<') ADVANCE(228); - if (lookahead == '=') ADVANCE(224); - if (lookahead == '>') ADVANCE(229); - if (lookahead == '[') ADVANCE(120); - if (lookahead == ']') ADVANCE(121); - if (lookahead == 'b') ADVANCE(124); - if (lookahead == 'c') ADVANCE(171); - if (lookahead == 'd') ADVANCE(172); - if (lookahead == 'f') ADVANCE(179); - if (lookahead == 'h') ADVANCE(198); - if (lookahead == 'j') ADVANCE(125); - if (lookahead == 'l') ADVANCE(147); - if (lookahead == 'm') ADVANCE(127); - if (lookahead == 'r') ADVANCE(140); - if (lookahead == 's') ADVANCE(131); - if (lookahead == 't') ADVANCE(141); - if (lookahead == 'x') ADVANCE(165); - if (lookahead == '{') ADVANCE(122); - if (lookahead == '|') ADVANCE(242); - if (lookahead == '}') ADVANCE(123); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(254); - if (lookahead == '"' || - lookahead == '\\') ADVANCE(116); + ADVANCE_MAP( + '\n', 256, + '#', 112, + '\'', 230, + '(', 118, + ')', 119, + '*', 117, + '-', 223, + '.', 111, + '/', 61, + '0', 209, + '5', 214, + ':', 231, + '<', 228, + '=', 224, + '>', 229, + '[', 120, + ']', 121, + 'b', 124, + 'c', 171, + 'd', 172, + 'f', 179, + 'h', 198, + 'j', 125, + 'l', 147, + 'm', 127, + 'r', 140, + 's', 131, + 't', 141, + 'x', 165, + '{', 122, + '|', 242, + '}', 123, + '\t', 254, + ' ', 254, + '"', 116, + '\\', 116, + ); if (('1' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || @@ -1378,46 +1354,48 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead != 0) ADVANCE(113); END_STATE(); case 1: - if (lookahead == '\n') ADVANCE(257); - if (lookahead == ')') ADVANCE(119); - if (lookahead == '*') ADVANCE(117); - if (lookahead == '=') ADVANCE(206); - if (lookahead == ']') ADVANCE(121); - if (lookahead == '}') ADVANCE(123); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(255); + ADVANCE_MAP( + '\n', 257, + ')', 119, + '*', 117, + '=', 206, + ']', 121, + '}', 123, + '\t', 255, + ' ', 255, + ); if (lookahead != 0 && lookahead != '"' && - lookahead != '\'' && - lookahead != '(' && + (lookahead < '\'' || '*' < lookahead) && lookahead != '/' && lookahead != '0' && (lookahead < '<' || '>' < lookahead) && - lookahead != '[' && - lookahead != '\\' && + (lookahead < '[' || ']' < lookahead) && lookahead != '{') ADVANCE(205); END_STATE(); case 2: - if (lookahead == '#') ADVANCE(112); - if (lookahead == '\'') ADVANCE(230); - if (lookahead == '(') ADVANCE(118); - if (lookahead == '.') ADVANCE(111); - if (lookahead == '/') ADVANCE(62); - if (lookahead == ':') ADVANCE(60); - if (lookahead == '<') ADVANCE(228); - if (lookahead == '=') ADVANCE(225); - if (lookahead == '>') ADVANCE(229); - if (lookahead == '[') ADVANCE(120); - if (lookahead == '{') ADVANCE(122); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(258); - if (lookahead == '\n' || - lookahead == '0') ADVANCE(209); - if (lookahead == '"' || - lookahead == ')' || - lookahead == '\\' || - lookahead == ']' || - lookahead == '}') ADVANCE(116); + ADVANCE_MAP( + '#', 112, + '\'', 230, + '(', 118, + '.', 111, + '/', 62, + ':', 60, + '<', 228, + '=', 225, + '>', 229, + '[', 120, + '{', 122, + '\t', 258, + ' ', 258, + '\n', 209, + '0', 209, + '"', 116, + ')', 116, + '\\', 116, + ']', 116, + '}', 116, + ); if (('-' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || @@ -1425,40 +1403,45 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead != 0) ADVANCE(113); END_STATE(); case 3: - if (lookahead == '#') ADVANCE(112); - if (lookahead == '\'') ADVANCE(243); - if (lookahead == '-') ADVANCE(223); - if (lookahead == '.') ADVANCE(111); - if (lookahead == '/') ADVANCE(250); - if (lookahead == '=') ADVANCE(225); - if (lookahead == 'c') ADVANCE(86); - if (lookahead == 'd') ADVANCE(87); - if (lookahead == 'j') ADVANCE(63); - if (lookahead == 'l') ADVANCE(77); - if (lookahead == 'm') ADVANCE(64); - if (lookahead == 'r') ADVANCE(72); - if (lookahead == 's') ADVANCE(66); - if (lookahead == 't') ADVANCE(75); - if (lookahead == '|') ADVANCE(242); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(260); + ADVANCE_MAP( + '#', 112, + '\'', 243, + '-', 223, + '.', 111, + '/', 250, + '=', 225, + 'c', 86, + 'd', 87, + 'j', 63, + 'l', 77, + 'm', 64, + 'r', 72, + 's', 66, + 't', 75, + '|', 242, + '\t', 260, + ' ', 260, + ); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(110); if (lookahead != 0 && + lookahead != '\t' && lookahead != '\n') ADVANCE(116); END_STATE(); case 4: - if (lookahead == '#') ADVANCE(112); - if (lookahead == '.') ADVANCE(111); - if (lookahead == 'c') ADVANCE(86); - if (lookahead == 'j') ADVANCE(63); - if (lookahead == 'l') ADVANCE(77); - if (lookahead == 'm') ADVANCE(64); - if (lookahead == 'r') ADVANCE(72); - if (lookahead == 's') ADVANCE(66); - if (lookahead == 't') ADVANCE(75); + ADVANCE_MAP( + '#', 112, + '.', 111, + 'c', 86, + 'j', 63, + 'l', 77, + 'm', 64, + 'r', 72, + 's', 66, + 't', 75, + ); if (('0' <= lookahead && lookahead <= '9') || ('A' <= lookahead && lookahead <= 'Z') || lookahead == '_' || @@ -1467,46 +1450,51 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead != '\t' && lookahead != '\n' && lookahead != ' ' && - lookahead != '-') ADVANCE(116); + lookahead != '-' && + lookahead != '.') ADVANCE(116); END_STATE(); case 5: - if (lookahead == '\'') ADVANCE(230); - if (lookahead == '(') ADVANCE(118); - if (lookahead == '/') ADVANCE(62); - if (lookahead == ':') ADVANCE(60); - if (lookahead == '<') ADVANCE(228); - if (lookahead == '=') ADVANCE(225); - if (lookahead == '>') ADVANCE(229); - if (lookahead == '[') ADVANCE(120); - if (lookahead == '{') ADVANCE(122); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(258); - if (lookahead == '\n' || - lookahead == '"' || - lookahead == ')' || - lookahead == '0' || - lookahead == '\\' || - lookahead == ']' || - lookahead == '}') ADVANCE(209); + ADVANCE_MAP( + '\'', 230, + '(', 118, + '/', 62, + ':', 60, + '<', 228, + '=', 225, + '>', 229, + '[', 120, + '{', 122, + '\t', 258, + ' ', 258, + '\n', 209, + '"', 209, + ')', 209, + '0', 209, + '\\', 209, + ']', 209, + '}', 209, + ); if (lookahead != 0) ADVANCE(205); END_STATE(); case 6: - if (lookahead == '(') ADVANCE(118); - if (lookahead == '1') ADVANCE(11); - if (lookahead == '5') ADVANCE(214); - if (lookahead == ':') ADVANCE(231); - if (lookahead == '[') ADVANCE(120); - if (lookahead == ']') ADVANCE(121); - if (lookahead == 'b') ADVANCE(17); - if (lookahead == 'f') ADVANCE(43); - if (lookahead == 'h') ADVANCE(53); - if (lookahead == 'm') ADVANCE(41); - if (lookahead == 's') ADVANCE(51); - if (lookahead == 't') ADVANCE(44); - if (lookahead == 'x') ADVANCE(36); - if (lookahead == '{') ADVANCE(122); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(260); + ADVANCE_MAP( + '(', 118, + '1', 11, + '5', 214, + ':', 231, + '[', 120, + ']', 121, + 'b', 17, + 'f', 43, + 'h', 53, + 'm', 41, + 's', 51, + 't', 44, + 'x', 36, + '{', 122, + '\t', 260, + ' ', 260, + ); END_STATE(); case 7: if (lookahead == '*') ADVANCE(117); @@ -1530,7 +1518,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == ':') ADVANCE(231); if (lookahead == '\t' || lookahead == ' ') ADVANCE(260); - if (!sym__attr_name_character_set_1(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 9: if (lookahead == '*') ADVANCE(117); @@ -1595,6 +1583,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead == '}') ADVANCE(209); if (lookahead != 0 && lookahead != '\t' && + lookahead != '\n' && lookahead != ' ') ADVANCE(205); END_STATE(); case 16: @@ -2322,417 +2311,417 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { case 124: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'a') ADVANCE(182); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 125: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'a') ADVANCE(200); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 126: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'a') ADVANCE(170); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 127: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'a') ADVANCE(178); if (lookahead == 'o') ADVANCE(133); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 128: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'a') ADVANCE(167); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 129: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'a') ADVANCE(162); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 130: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'a') ADVANCE(188); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 131: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'a') ADVANCE(190); if (lookahead == 'c') ADVANCE(192); if (lookahead == 't') ADVANCE(180); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 132: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'b') ADVANCE(203); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 133: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'b') ADVANCE(155); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 134: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'c') ADVANCE(234); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 135: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'c') ADVANCE(219); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 136: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'c') ADVANCE(196); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 137: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'c') ADVANCE(193); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 138: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'c') ADVANCE(181); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 139: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'd') ADVANCE(173); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 140: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'd') ADVANCE(174); if (lookahead == 'u') ADVANCE(132); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 141: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(202); if (lookahead == 'r') ADVANCE(126); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 142: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(235); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 143: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(218); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 144: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(211); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 145: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(233); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 146: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(142); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 147: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(187); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 148: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(194); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 149: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'e') ADVANCE(191); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 150: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'f') ADVANCE(146); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 151: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'f') ADVANCE(150); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 152: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'i') ADVANCE(177); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 153: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'i') ADVANCE(175); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 154: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'i') ADVANCE(135); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 155: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'i') ADVANCE(163); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 156: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'i') ADVANCE(197); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 157: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'i') ADVANCE(137); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 158: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'i') ADVANCE(164); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 159: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'k') ADVANCE(139); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 160: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'l') ADVANCE(221); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 161: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'l') ADVANCE(213); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 162: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'l') ADVANCE(220); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 163: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'l') ADVANCE(143); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 164: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'l') ADVANCE(145); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 165: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'm') ADVANCE(160); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 166: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'm') ADVANCE(161); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 167: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'm') ADVANCE(149); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 168: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'n') ADVANCE(232); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 169: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'n') ADVANCE(129); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 170: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'n') ADVANCE(189); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 171: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'o') ADVANCE(151); if (lookahead == 's') ADVANCE(183); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 172: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'o') ADVANCE(136); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 173: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'o') ADVANCE(201); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 174: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'o') ADVANCE(134); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 175: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'o') ADVANCE(169); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 176: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'p') ADVANCE(144); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 177: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'p') ADVANCE(195); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 178: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'r') ADVANCE(159); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 179: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'r') ADVANCE(128); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 180: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'r') ADVANCE(157); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 181: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'r') ADVANCE(152); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 182: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(154); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 183: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(240); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 184: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(236); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 185: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(237); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 186: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(238); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 187: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(184); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 188: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(138); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 189: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(156); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 190: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(185); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 191: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(148); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 192: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 's') ADVANCE(186); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 193: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 't') ADVANCE(216); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 194: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 't') ADVANCE(217); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 195: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 't') ADVANCE(239); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 196: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 't') ADVANCE(204); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 197: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 't') ADVANCE(153); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 198: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 't') ADVANCE(166); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 199: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 't') ADVANCE(158); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 200: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'v') ADVANCE(130); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 201: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'w') ADVANCE(168); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 202: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'x') ADVANCE(199); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 203: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'y') ADVANCE(241); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 204: ACCEPT_TOKEN(sym__attr_name); if (lookahead == 'y') ADVANCE(176); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 205: ACCEPT_TOKEN(sym__attr_name); - if (!sym__attr_name_character_set_2(lookahead)) ADVANCE(205); + if ((!eof && set_contains(sym__attr_name_character_set_1, 10, lookahead))) ADVANCE(205); END_STATE(); case 206: ACCEPT_TOKEN(sym_attr_assignment); @@ -2902,6 +2891,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(248); if (lookahead != 0 && + lookahead != '\t' && lookahead != '\n') ADVANCE(247); END_STATE(); case 248: @@ -2931,6 +2921,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(252); if (lookahead != 0 && + lookahead != '\t' && lookahead != '\n') ADVANCE(251); END_STATE(); case 251: @@ -2943,6 +2934,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead == '_' || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(252); if (lookahead != 0 && + lookahead != '\t' && lookahead != '\n') ADVANCE(251); END_STATE(); case 252: @@ -7094,7 +7086,7 @@ static const uint32_t ts_small_parse_table_map[] = { 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}}, REDUCE(sym_source_file, 0), + [3] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 0, 0, 0), [5] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), [7] = {.entry = {.count = 1, .reusable = false}}, SHIFT(9), [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(275), @@ -7124,119 +7116,119 @@ static const TSParseActionEntry ts_parse_actions[] = { [57] = {.entry = {.count = 1, .reusable = true}}, SHIFT(28), [59] = {.entry = {.count = 1, .reusable = false}}, SHIFT(31), [61] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), - [63] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 1, .production_id = 1), + [63] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 1, 0, 1), [65] = {.entry = {.count = 1, .reusable = true}}, SHIFT(246), [67] = {.entry = {.count = 1, .reusable = false}}, SHIFT(32), - [69] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, .production_id = 1), + [69] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, 0, 1), [71] = {.entry = {.count = 1, .reusable = true}}, SHIFT(243), [73] = {.entry = {.count = 1, .reusable = false}}, SHIFT(30), - [75] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, .production_id = 3), + [75] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, 0, 3), [77] = {.entry = {.count = 1, .reusable = true}}, SHIFT(188), [79] = {.entry = {.count = 1, .reusable = false}}, SHIFT(33), - [81] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, .production_id = 3), + [81] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, 0, 3), [83] = {.entry = {.count = 1, .reusable = true}}, SHIFT(248), [85] = {.entry = {.count = 1, .reusable = false}}, SHIFT(34), - [87] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 1, .production_id = 2), + [87] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 1, 0, 2), [89] = {.entry = {.count = 1, .reusable = true}}, SHIFT(204), [91] = {.entry = {.count = 1, .reusable = false}}, SHIFT(29), - [93] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, .production_id = 2), - [95] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2), - [97] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2), SHIFT_REPEAT(275), - [100] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2), SHIFT_REPEAT(273), - [103] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2), SHIFT_REPEAT(25), - [106] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2), - [108] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_shortcuts, 1), - [110] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_shortcuts, 1), + [93] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, 0, 2), + [95] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2, 0, 0), + [97] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2, 0, 0), SHIFT_REPEAT(275), + [100] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2, 0, 0), SHIFT_REPEAT(273), + [103] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2, 0, 0), SHIFT_REPEAT(25), + [106] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_attr_shortcuts_repeat1, 2, 0, 0), + [108] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_shortcuts, 1, 0, 0), + [110] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_shortcuts, 1, 0, 0), [112] = {.entry = {.count = 1, .reusable = true}}, SHIFT(189), [114] = {.entry = {.count = 1, .reusable = false}}, SHIFT(48), - [116] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, .production_id = 10), + [116] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, 0, 10), [118] = {.entry = {.count = 1, .reusable = true}}, SHIFT(191), [120] = {.entry = {.count = 1, .reusable = false}}, SHIFT(44), - [122] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, .production_id = 8), + [122] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, 0, 8), [124] = {.entry = {.count = 1, .reusable = true}}, SHIFT(213), [126] = {.entry = {.count = 1, .reusable = false}}, SHIFT(54), - [128] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 12), - [130] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_shortcut_id, 2), - [132] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_shortcut_id, 2), + [128] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 12), + [130] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_shortcut_id, 2, 0, 0), + [132] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_shortcut_id, 2, 0, 0), [134] = {.entry = {.count = 1, .reusable = true}}, SHIFT(242), [136] = {.entry = {.count = 1, .reusable = false}}, SHIFT(45), - [138] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, .production_id = 4), + [138] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, 0, 4), [140] = {.entry = {.count = 1, .reusable = true}}, SHIFT(207), [142] = {.entry = {.count = 1, .reusable = false}}, SHIFT(56), - [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, .production_id = 5), - [146] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_shortcut_class, 2), - [148] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_shortcut_class, 2), - [150] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_shortcut, 1), - [152] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_shortcut, 1), + [144] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2, 0, 5), + [146] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_shortcut_class, 2, 0, 0), + [148] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_shortcut_class, 2, 0, 0), + [150] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_shortcut, 1, 0, 0), + [152] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_shortcut, 1, 0, 0), [154] = {.entry = {.count = 1, .reusable = true}}, SHIFT(199), [156] = {.entry = {.count = 1, .reusable = false}}, SHIFT(52), - [158] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, .production_id = 7), - [160] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__output_modifiers, 2), - [162] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__output_modifiers, 2), - [164] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__output_modifiers, 2), SHIFT_REPEAT(28), - [167] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__output_modifier, 1), - [169] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__output_modifier, 1), + [158] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, 0, 7), + [160] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__output_modifiers, 2, 0, 0), + [162] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__output_modifiers, 2, 0, 0), + [164] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__output_modifiers, 2, 0, 0), SHIFT_REPEAT(28), + [167] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__output_modifier, 1, 0, 0), + [169] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__output_modifier, 1, 0, 0), [171] = {.entry = {.count = 1, .reusable = true}}, SHIFT(263), [173] = {.entry = {.count = 1, .reusable = false}}, SHIFT(75), [175] = {.entry = {.count = 1, .reusable = false}}, SHIFT(101), [177] = {.entry = {.count = 1, .reusable = false}}, SHIFT(107), [179] = {.entry = {.count = 1, .reusable = true}}, SHIFT(111), [181] = {.entry = {.count = 1, .reusable = true}}, SHIFT(169), - [183] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, .production_id = 2), - [185] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, .production_id = 1), - [187] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 3), - [189] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_plain_repeat1, 2), - [191] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_plain_repeat1, 2), SHIFT_REPEAT(263), - [194] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_plain_repeat1, 2), SHIFT_REPEAT(76), - [197] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_plain_repeat1, 2), - [199] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_plain_repeat1, 2), SHIFT_REPEAT(169), - [202] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_plain, 2), - [204] = {.entry = {.count = 2, .reusable = false}}, REDUCE(sym__attrs_plain, 2), SHIFT(76), - [207] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_plain, 2), - [209] = {.entry = {.count = 2, .reusable = false}}, REDUCE(sym__attrs_plain, 2), SHIFT(169), + [183] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, 0, 2), + [185] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, 0, 1), + [187] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 3), + [189] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_plain_repeat1, 2, 0, 0), + [191] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_plain_repeat1, 2, 0, 0), SHIFT_REPEAT(263), + [194] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_plain_repeat1, 2, 0, 0), SHIFT_REPEAT(76), + [197] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_plain_repeat1, 2, 0, 0), + [199] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_plain_repeat1, 2, 0, 0), SHIFT_REPEAT(169), + [202] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_plain, 2, 0, 0), + [204] = {.entry = {.count = 2, .reusable = false}}, REDUCE(sym__attrs_plain, 2, 0, 0), SHIFT(76), + [207] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_plain, 2, 0, 0), + [209] = {.entry = {.count = 2, .reusable = false}}, REDUCE(sym__attrs_plain, 2, 0, 0), SHIFT(169), [212] = {.entry = {.count = 1, .reusable = true}}, SHIFT(241), [214] = {.entry = {.count = 1, .reusable = true}}, SHIFT(240), [216] = {.entry = {.count = 1, .reusable = true}}, SHIFT(185), - [218] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr, 3, .production_id = 14), - [220] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr, 3, .production_id = 14), + [218] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr, 3, 0, 14), + [220] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr, 3, 0, 14), [222] = {.entry = {.count = 1, .reusable = true}}, SHIFT(67), [224] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), [226] = {.entry = {.count = 1, .reusable = true}}, SHIFT(69), [228] = {.entry = {.count = 1, .reusable = true}}, SHIFT(109), [230] = {.entry = {.count = 1, .reusable = true}}, SHIFT(108), - [232] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_value, 1, .production_id = 15), - [234] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_value, 1, .production_id = 15), - [236] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr, 2), - [238] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr, 2), - [240] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_value, 1), - [242] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_value, 1), + [232] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_value, 1, 0, 15), + [234] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_value, 1, 0, 15), + [236] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr, 2, 0, 0), + [238] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr, 2, 0, 0), + [240] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_value, 1, 0, 0), + [242] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_value, 1, 0, 0), [244] = {.entry = {.count = 1, .reusable = true}}, SHIFT(97), - [246] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 8), - [248] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, .production_id = 4), - [250] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_s, 3), - [252] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_s, 3), - [254] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_s, 2), - [256] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_s, 2), - [258] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 10), - [260] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_p, 3), - [262] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_p, 3), - [264] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_b, 4), - [266] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_b, 4), - [268] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_s, 4), - [270] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_s, 4), - [272] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 7), - [274] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_p, 2), - [276] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_p, 2), - [278] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, .production_id = 12), - [280] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_p, 4), - [282] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_p, 4), - [284] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, .production_id = 5), - [286] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_b, 2), - [288] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_b, 2), - [290] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_b, 3), - [292] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_b, 3), - [294] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attrs, 1), - [296] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attrs, 1), + [246] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 8), + [248] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, 0, 4), + [250] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_s, 3, 0, 0), + [252] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_s, 3, 0, 0), + [254] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_s, 2, 0, 0), + [256] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_s, 2, 0, 0), + [258] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 10), + [260] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_p, 3, 0, 0), + [262] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_p, 3, 0, 0), + [264] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_b, 4, 0, 0), + [266] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_b, 4, 0, 0), + [268] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_s, 4, 0, 0), + [270] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_s, 4, 0, 0), + [272] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 7), + [274] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_p, 2, 0, 0), + [276] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_p, 2, 0, 0), + [278] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, 0, 12), + [280] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_p, 4, 0, 0), + [282] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_p, 4, 0, 0), + [284] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3, 0, 5), + [286] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_b, 2, 0, 0), + [288] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_b, 2, 0, 0), + [290] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attrs_delimited_b, 3, 0, 0), + [292] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attrs_delimited_b, 3, 0, 0), + [294] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attrs, 1, 0, 0), + [296] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attrs, 1, 0, 0), [298] = {.entry = {.count = 1, .reusable = true}}, SHIFT(255), [300] = {.entry = {.count = 1, .reusable = true}}, SHIFT(267), [302] = {.entry = {.count = 1, .reusable = false}}, SHIFT(76), @@ -7248,10 +7240,10 @@ static const TSParseActionEntry ts_parse_actions[] = { [314] = {.entry = {.count = 1, .reusable = true}}, SHIFT(254), [316] = {.entry = {.count = 1, .reusable = true}}, SHIFT(251), [318] = {.entry = {.count = 1, .reusable = true}}, SHIFT(78), - [320] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2), SHIFT_REPEAT(253), - [323] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2), - [325] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2), SHIFT_REPEAT(76), - [328] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2), SHIFT_REPEAT(106), + [320] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2, 0, 0), SHIFT_REPEAT(253), + [323] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2, 0, 0), + [325] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2, 0, 0), SHIFT_REPEAT(76), + [328] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2, 0, 0), SHIFT_REPEAT(106), [331] = {.entry = {.count = 1, .reusable = true}}, SHIFT(265), [333] = {.entry = {.count = 1, .reusable = true}}, SHIFT(83), [335] = {.entry = {.count = 1, .reusable = true}}, SHIFT(253), @@ -7265,37 +7257,37 @@ static const TSParseActionEntry ts_parse_actions[] = { [351] = {.entry = {.count = 1, .reusable = true}}, SHIFT(84), [353] = {.entry = {.count = 1, .reusable = true}}, SHIFT(259), [355] = {.entry = {.count = 1, .reusable = true}}, SHIFT(88), - [357] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2), SHIFT_REPEAT(254), - [360] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2), - [362] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2), SHIFT_REPEAT(76), - [365] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2), SHIFT_REPEAT(93), + [357] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2, 0, 0), SHIFT_REPEAT(254), + [360] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2, 0, 0), + [362] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2, 0, 0), SHIFT_REPEAT(76), + [365] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2, 0, 0), SHIFT_REPEAT(93), [368] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46), [370] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86), [372] = {.entry = {.count = 1, .reusable = true}}, SHIFT(47), [374] = {.entry = {.count = 1, .reusable = true}}, SHIFT(80), - [376] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2), SHIFT_REPEAT(255), - [379] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2), - [381] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2), SHIFT_REPEAT(76), - [384] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2), SHIFT_REPEAT(94), - [387] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_name, 1), - [389] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_name, 1), + [376] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2, 0, 0), SHIFT_REPEAT(255), + [379] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2, 0, 0), + [381] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2, 0, 0), SHIFT_REPEAT(76), + [384] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2, 0, 0), SHIFT_REPEAT(94), + [387] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_name, 1, 0, 0), + [389] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_name, 1, 0, 0), [391] = {.entry = {.count = 1, .reusable = false}}, SHIFT(157), [393] = {.entry = {.count = 1, .reusable = false}}, SHIFT(121), [395] = {.entry = {.count = 1, .reusable = true}}, SHIFT(261), - [397] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 2), + [397] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 2, 0, 0), [399] = {.entry = {.count = 1, .reusable = true}}, SHIFT(55), [401] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), [403] = {.entry = {.count = 1, .reusable = true}}, SHIFT(260), [405] = {.entry = {.count = 1, .reusable = true}}, SHIFT(252), - [407] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_plain_repeat1, 2), SHIFT_REPEAT(266), - [410] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_plain_repeat1, 2), SHIFT_REPEAT(158), + [407] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_plain_repeat1, 2, 0, 0), SHIFT_REPEAT(266), + [410] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__attrs_plain_repeat1, 2, 0, 0), SHIFT_REPEAT(158), [413] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), [415] = {.entry = {.count = 1, .reusable = true}}, SHIFT(257), [417] = {.entry = {.count = 1, .reusable = true}}, SHIFT(266), [419] = {.entry = {.count = 1, .reusable = true}}, SHIFT(158), [421] = {.entry = {.count = 1, .reusable = true}}, SHIFT(170), [423] = {.entry = {.count = 1, .reusable = true}}, SHIFT(131), - [425] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 3), + [425] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 3, 0, 0), [427] = {.entry = {.count = 1, .reusable = true}}, SHIFT(159), [429] = {.entry = {.count = 1, .reusable = true}}, SHIFT(117), [431] = {.entry = {.count = 1, .reusable = true}}, SHIFT(123), @@ -7304,12 +7296,12 @@ static const TSParseActionEntry ts_parse_actions[] = { [437] = {.entry = {.count = 1, .reusable = true}}, SHIFT(121), [439] = {.entry = {.count = 1, .reusable = true}}, SHIFT(133), [441] = {.entry = {.count = 1, .reusable = true}}, SHIFT(140), - [443] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__html_comment_conditional_incomplete, 1), + [443] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__html_comment_conditional_incomplete, 1, 0, 0), [445] = {.entry = {.count = 1, .reusable = true}}, SHIFT(160), [447] = {.entry = {.count = 1, .reusable = true}}, SHIFT(132), - [449] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 1), - [451] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_boolean, 1), - [453] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_boolean, 1), + [449] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 1, 0, 0), + [451] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attr_boolean, 1, 0, 0), + [453] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_attr_boolean, 1, 0, 0), [455] = {.entry = {.count = 1, .reusable = false}}, SHIFT(172), [457] = {.entry = {.count = 1, .reusable = true}}, SHIFT(172), [459] = {.entry = {.count = 1, .reusable = true}}, SHIFT(118), @@ -7319,94 +7311,94 @@ static const TSParseActionEntry ts_parse_actions[] = { [467] = {.entry = {.count = 1, .reusable = true}}, SHIFT(178), [469] = {.entry = {.count = 1, .reusable = true}}, SHIFT(139), [471] = {.entry = {.count = 1, .reusable = true}}, SHIFT(115), - [473] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 2), + [473] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 2, 0, 0), [475] = {.entry = {.count = 1, .reusable = false}}, SHIFT(179), [477] = {.entry = {.count = 1, .reusable = true}}, SHIFT(179), [479] = {.entry = {.count = 1, .reusable = true}}, SHIFT(119), - [481] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__output_modifiers, 2), SHIFT_REPEAT(159), + [481] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__output_modifiers, 2, 0, 0), SHIFT_REPEAT(159), [484] = {.entry = {.count = 1, .reusable = true}}, SHIFT(278), [486] = {.entry = {.count = 1, .reusable = true}}, SHIFT(174), [488] = {.entry = {.count = 1, .reusable = true}}, SHIFT(212), - [490] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine_name, 1), - [492] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 4), - [494] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_element_text_repeat1, 2), SHIFT_REPEAT(118), - [497] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_element_text_repeat1, 2), - [499] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 4), + [490] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine_name, 1, 0, 0), + [492] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 4, 0, 0), + [494] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_element_text_repeat1, 2, 0, 0), SHIFT_REPEAT(118), + [497] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_element_text_repeat1, 2, 0, 0), + [499] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 4, 0, 0), [501] = {.entry = {.count = 1, .reusable = true}}, SHIFT(215), [503] = {.entry = {.count = 1, .reusable = true}}, SHIFT(217), [505] = {.entry = {.count = 1, .reusable = true}}, SHIFT(137), - [507] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 3), - [509] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_control, 2), - [511] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 2), - [513] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 3), - [515] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__text_nested_repeat1, 2), SHIFT_REPEAT(278), - [518] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__text_nested_repeat1, 2), - [520] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__text_nested_repeat1, 2), SHIFT_REPEAT(274), - [523] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 3), - [525] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 2), + [507] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 3, 0, 0), + [509] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_control, 2, 0, 0), + [511] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 2, 0, 0), + [513] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 3, 0, 0), + [515] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__text_nested_repeat1, 2, 0, 0), SHIFT_REPEAT(278), + [518] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__text_nested_repeat1, 2, 0, 0), + [520] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__text_nested_repeat1, 2, 0, 0), SHIFT_REPEAT(274), + [523] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 3, 0, 0), + [525] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 2, 0, 0), [527] = {.entry = {.count = 1, .reusable = true}}, SHIFT(177), [529] = {.entry = {.count = 1, .reusable = true}}, SHIFT(208), - [531] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_conditional, 3), + [531] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_conditional, 3, 0, 0), [533] = {.entry = {.count = 1, .reusable = true}}, SHIFT(196), [535] = {.entry = {.count = 1, .reusable = true}}, SHIFT(197), [537] = {.entry = {.count = 1, .reusable = true}}, SHIFT(135), - [539] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 4), - [541] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_conditional, 2), - [543] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2, .production_id = 11), - [545] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2, .production_id = 11), - [547] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 5), - [549] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_value_s, 1), - [551] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_value_s, 1), - [553] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 4), - [555] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_condition, 1), - [557] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__html_comment_conditional_incomplete, 2), - [559] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_splat_p, 2), - [561] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_splat_p, 2), - [563] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_s, 1), - [565] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_s, 1), - [567] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_s, 3, .production_id = 14), - [569] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_s, 3, .production_id = 14), - [571] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text, 1), - [573] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 1, .production_id = 6), - [575] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 1, .production_id = 6), - [577] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_splat_s, 2), - [579] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_splat_s, 2), - [581] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_p, 1), - [583] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_p, 1), - [585] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2, .production_id = 11), - [587] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2, .production_id = 11), - [589] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_p, 3, .production_id = 14), - [591] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_p, 3, .production_id = 14), - [593] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_value_p, 1), - [595] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_value_p, 1), - [597] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_splat_b, 2), - [599] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_splat_b, 2), - [601] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2, .production_id = 11), - [603] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2, .production_id = 11), - [605] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_b, 1), - [607] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_b, 1), - [609] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 1, .production_id = 6), - [611] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 1, .production_id = 6), - [613] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_code_comment, 1), - [615] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment, 1), + [539] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 4, 0, 0), + [541] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_conditional, 2, 0, 0), + [543] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2, 0, 11), + [545] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 2, 0, 11), + [547] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 5, 0, 0), + [549] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_value_s, 1, 0, 0), + [551] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_value_s, 1, 0, 0), + [553] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 4, 0, 0), + [555] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_condition, 1, 0, 0), + [557] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__html_comment_conditional_incomplete, 2, 0, 0), + [559] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_splat_p, 2, 0, 0), + [561] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_splat_p, 2, 0, 0), + [563] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_s, 1, 0, 0), + [565] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_s, 1, 0, 0), + [567] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_s, 3, 0, 14), + [569] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_s, 3, 0, 14), + [571] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text, 1, 0, 0), + [573] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 1, 0, 6), + [575] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 1, 0, 6), + [577] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_splat_s, 2, 0, 0), + [579] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_splat_s, 2, 0, 0), + [581] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_p, 1, 0, 0), + [583] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_p, 1, 0, 0), + [585] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2, 0, 11), + [587] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_s_repeat1, 2, 0, 11), + [589] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_p, 3, 0, 14), + [591] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_p, 3, 0, 14), + [593] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_value_p, 1, 0, 0), + [595] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_value_p, 1, 0, 0), + [597] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_splat_b, 2, 0, 0), + [599] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_splat_b, 2, 0, 0), + [601] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2, 0, 11), + [603] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 2, 0, 11), + [605] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_b, 1, 0, 0), + [607] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_b, 1, 0, 0), + [609] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 1, 0, 6), + [611] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_b_repeat1, 1, 0, 6), + [613] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_code_comment, 1, 0, 0), + [615] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment, 1, 0, 0), [617] = {.entry = {.count = 1, .reusable = true}}, SHIFT(144), - [619] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_verbatim_text, 1), - [621] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 1, .production_id = 6), - [623] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 1, .production_id = 6), - [625] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_value_b, 1), - [627] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_value_b, 1), - [629] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_b, 3, .production_id = 14), - [631] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_b, 3, .production_id = 14), - [633] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__block_repeat1, 2), - [635] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__block_repeat1, 2), SHIFT_REPEAT(6), + [619] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_verbatim_text, 1, 0, 0), + [621] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 1, 0, 6), + [623] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym__attrs_delimited_p_repeat1, 1, 0, 6), + [625] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_value_b, 1, 0, 0), + [627] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_value_b, 1, 0, 0), + [629] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__attr_delimited_b, 3, 0, 14), + [631] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym__attr_delimited_b, 3, 0, 14), + [633] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym__block_repeat1, 2, 0, 0), + [635] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym__block_repeat1, 2, 0, 0), SHIFT_REPEAT(6), [638] = {.entry = {.count = 1, .reusable = true}}, SHIFT(166), [640] = {.entry = {.count = 1, .reusable = true}}, SHIFT(42), [642] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), - [644] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text_nested, 3), + [644] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text_nested, 3, 0, 0), [646] = {.entry = {.count = 1, .reusable = true}}, SHIFT(258), [648] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [650] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text_nested, 5), - [652] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text_nested, 4), + [650] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text_nested, 5, 0, 0), + [652] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text_nested, 4, 0, 0), [654] = {.entry = {.count = 1, .reusable = true}}, SHIFT(136), [656] = {.entry = {.count = 1, .reusable = true}}, SHIFT(150), [658] = {.entry = {.count = 1, .reusable = true}}, SHIFT(4), @@ -7416,50 +7408,50 @@ static const TSParseActionEntry ts_parse_actions[] = { [666] = {.entry = {.count = 1, .reusable = true}}, SHIFT(231), [668] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), [670] = {.entry = {.count = 1, .reusable = true}}, SHIFT(192), - [672] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__doctype_xml, 1), - [674] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__nested_inline_expansion, 2), - [676] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 5, .production_id = 16), - [678] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__doctype_xml, 2), - [680] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 4, .production_id = 13), - [682] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 4, .production_id = 13), - [684] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_conditional, 4, .production_id = 13), + [672] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__doctype_xml, 1, 0, 0), + [674] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__nested_inline_expansion, 2, 0, 0), + [676] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 5, 0, 16), + [678] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__doctype_xml, 2, 0, 0), + [680] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 4, 0, 13), + [682] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 4, 0, 13), + [684] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_conditional, 4, 0, 13), [686] = {.entry = {.count = 1, .reusable = true}}, SHIFT(184), - [688] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 4), + [688] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 4), [690] = {.entry = {.count = 1, .reusable = false}}, SHIFT(182), [692] = {.entry = {.count = 1, .reusable = true}}, SHIFT(182), - [694] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 1), - [696] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 5), + [694] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 1), + [696] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 5), [698] = {.entry = {.count = 1, .reusable = true}}, SHIFT(176), - [700] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, .production_id = 7), - [702] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, .production_id = 3), - [704] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, .production_id = 8), - [706] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_conditional, 3, .production_id = 9), + [700] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, 0, 7), + [702] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, 0, 3), + [704] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, 0, 8), + [706] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment_conditional, 3, 0, 9), [708] = {.entry = {.count = 1, .reusable = true}}, SHIFT(226), - [710] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text, 2), - [712] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_verbatim_text, 2), - [714] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 5, .production_id = 16), - [716] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, .production_id = 10), - [718] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 3, .production_id = 9), - [720] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 5), - [722] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 6, .production_id = 12), - [724] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 6), - [726] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 3, .production_id = 9), - [728] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__line, 1), - [730] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__block, 3), - [732] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__ruby_block, 1), - [734] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, .production_id = 2), - [736] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nested, 1), - [738] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_control, 3, .production_id = 9), - [740] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_doctype, 3), - [742] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__block, 4), - [744] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nested_inline, 1), - [746] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_doctype_xhtml, 1), - [748] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_doctype_html5, 1), - [750] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__block, 5), + [710] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__text, 2, 0, 0), + [712] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_verbatim_text, 2, 0, 0), + [714] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 5, 0, 16), + [716] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 5, 0, 10), + [718] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output_noescape, 3, 0, 9), + [720] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element_text, 5, 0, 0), + [722] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 6, 0, 12), + [724] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_embedded_engine, 6, 0, 0), + [726] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_output, 3, 0, 9), + [728] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__line, 1, 0, 0), + [730] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__block, 3, 0, 0), + [732] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__ruby_block, 1, 0, 0), + [734] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 4, 0, 2), + [736] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nested, 1, 0, 0), + [738] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_ruby_block_control, 3, 0, 9), + [740] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_doctype, 3, 0, 0), + [742] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__block, 4, 0, 0), + [744] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_nested_inline, 1, 0, 0), + [746] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_doctype_xhtml, 1, 0, 0), + [748] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_doctype_html5, 1, 0, 0), + [750] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__block, 5, 0, 0), [752] = {.entry = {.count = 1, .reusable = false}}, SHIFT(173), [754] = {.entry = {.count = 1, .reusable = true}}, SHIFT(173), - [756] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_code_comment, 2), - [758] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment, 2), + [756] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_code_comment, 2, 0, 0), + [758] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_html_comment, 2, 0, 0), [760] = {.entry = {.count = 1, .reusable = true}}, SHIFT(152), [762] = {.entry = {.count = 1, .reusable = true}}, SHIFT(146), [764] = {.entry = {.count = 1, .reusable = true}}, SHIFT(141), @@ -7472,7 +7464,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [778] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), [780] = {.entry = {.count = 1, .reusable = true}}, SHIFT(21), [782] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), - [784] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1), + [784] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_source_file, 1, 0, 0), [786] = {.entry = {.count = 1, .reusable = true}}, SHIFT(114), [788] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), }; @@ -7573,11 +7565,15 @@ bool tree_sitter_slim_external_scanner_scan(void *, TSLexer *, const bool *); unsigned tree_sitter_slim_external_scanner_serialize(void *, char *); void tree_sitter_slim_external_scanner_deserialize(void *, const char *, unsigned); -#ifdef _WIN32 -#define extern __declspec(dllexport) +#ifdef TREE_SITTER_HIDE_SYMBOLS +#define TS_PUBLIC +#elif defined(_WIN32) +#define TS_PUBLIC __declspec(dllexport) +#else +#define TS_PUBLIC __attribute__((visibility("default"))) #endif -extern const TSLanguage *tree_sitter_slim(void) { +TS_PUBLIC const TSLanguage *tree_sitter_slim(void) { static const TSLanguage language = { .version = LANGUAGE_VERSION, .symbol_count = SYMBOL_COUNT, diff --git a/src/tree_sitter/alloc.h b/src/tree_sitter/alloc.h new file mode 100644 index 0000000..1f4466d --- /dev/null +++ b/src/tree_sitter/alloc.h @@ -0,0 +1,54 @@ +#ifndef TREE_SITTER_ALLOC_H_ +#define TREE_SITTER_ALLOC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR + +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); + +#ifndef ts_malloc +#define ts_malloc ts_current_malloc +#endif +#ifndef ts_calloc +#define ts_calloc ts_current_calloc +#endif +#ifndef ts_realloc +#define ts_realloc ts_current_realloc +#endif +#ifndef ts_free +#define ts_free ts_current_free +#endif + +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ALLOC_H_ diff --git a/src/tree_sitter/array.h b/src/tree_sitter/array.h new file mode 100644 index 0000000..15a3b23 --- /dev/null +++ b/src/tree_sitter/array.h @@ -0,0 +1,290 @@ +#ifndef TREE_SITTER_ARRAY_H_ +#define TREE_SITTER_ARRAY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "./alloc.h" + +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + +#define Array(T) \ + struct { \ + T *contents; \ + uint32_t size; \ + uint32_t capacity; \ + } + +/// Initialize an array. +#define array_init(self) \ + ((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL) + +/// Create an empty array. +#define array_new() \ + { NULL, 0, 0 } + +/// Get a pointer to the element at a given `index` in the array. +#define array_get(self, _index) \ + (assert((uint32_t)(_index) < (self)->size), &(self)->contents[_index]) + +/// Get a pointer to the first element in the array. +#define array_front(self) array_get(self, 0) + +/// Get a pointer to the last element in the array. +#define array_back(self) array_get(self, (self)->size - 1) + +/// Clear the array, setting its size to zero. Note that this does not free any +/// memory allocated for the array's contents. +#define array_clear(self) ((self)->size = 0) + +/// Reserve `new_capacity` elements of space in the array. If `new_capacity` is +/// less than the array's current capacity, this function has no effect. +#define array_reserve(self, new_capacity) \ + _array__reserve((Array *)(self), array_elem_size(self), new_capacity) + +/// Free any memory allocated for this array. Note that this does not free any +/// memory allocated for the array's contents. +#define array_delete(self) _array__delete((Array *)(self)) + +/// Push a new `element` onto the end of the array. +#define array_push(self, element) \ + (_array__grow((Array *)(self), 1, array_elem_size(self)), \ + (self)->contents[(self)->size++] = (element)) + +/// Increase the array's size by `count` elements. +/// New elements are zero-initialized. +#define array_grow_by(self, count) \ + do { \ + if ((count) == 0) break; \ + _array__grow((Array *)(self), count, array_elem_size(self)); \ + memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \ + (self)->size += (count); \ + } while (0) + +/// Append all elements from one array to the end of another. +#define array_push_all(self, other) \ + array_extend((self), (other)->size, (other)->contents) + +/// Append `count` elements to the end of the array, reading their values from the +/// `contents` pointer. +#define array_extend(self, count, contents) \ + _array__splice( \ + (Array *)(self), array_elem_size(self), (self)->size, \ + 0, count, contents \ + ) + +/// Remove `old_count` elements from the array starting at the given `index`. At +/// the same index, insert `new_count` new elements, reading their values from the +/// `new_contents` pointer. +#define array_splice(self, _index, old_count, new_count, new_contents) \ + _array__splice( \ + (Array *)(self), array_elem_size(self), _index, \ + old_count, new_count, new_contents \ + ) + +/// Insert one `element` into the array at the given `index`. +#define array_insert(self, _index, element) \ + _array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element)) + +/// Remove one element from the array at the given `index`. +#define array_erase(self, _index) \ + _array__erase((Array *)(self), array_elem_size(self), _index) + +/// Pop the last element off the array, returning the element by value. +#define array_pop(self) ((self)->contents[--(self)->size]) + +/// Assign the contents of one array to another, reallocating if necessary. +#define array_assign(self, other) \ + _array__assign((Array *)(self), (const Array *)(other), array_elem_size(self)) + +/// Swap one array with another +#define array_swap(self, other) \ + _array__swap((Array *)(self), (Array *)(other)) + +/// Get the size of the array contents +#define array_elem_size(self) (sizeof *(self)->contents) + +/// Search a sorted array for a given `needle` value, using the given `compare` +/// callback to determine the order. +/// +/// If an existing element is found to be equal to `needle`, then the `index` +/// out-parameter is set to the existing value's index, and the `exists` +/// out-parameter is set to true. Otherwise, `index` is set to an index where +/// `needle` should be inserted in order to preserve the sorting, and `exists` +/// is set to false. +#define array_search_sorted_with(self, compare, needle, _index, _exists) \ + _array__search_sorted(self, 0, compare, , needle, _index, _exists) + +/// Search a sorted array for a given `needle` value, using integer comparisons +/// of a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_with`. +#define array_search_sorted_by(self, field, needle, _index, _exists) \ + _array__search_sorted(self, 0, _compare_int, field, needle, _index, _exists) + +/// Insert a given `value` into a sorted array, using the given `compare` +/// callback to determine the order. +#define array_insert_sorted_with(self, compare, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_with(self, compare, &(value), &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +/// Insert a given `value` into a sorted array, using integer comparisons of +/// a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_by`. +#define array_insert_sorted_by(self, field, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_by(self, field, (value) field, &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +// Private + +typedef Array(void) Array; + +/// This is not what you're looking for, see `array_delete`. +static inline void _array__delete(Array *self) { + if (self->contents) { + ts_free(self->contents); + self->contents = NULL; + self->size = 0; + self->capacity = 0; + } +} + +/// This is not what you're looking for, see `array_erase`. +static inline void _array__erase(Array *self, size_t element_size, + uint32_t index) { + assert(index < self->size); + char *contents = (char *)self->contents; + memmove(contents + index * element_size, contents + (index + 1) * element_size, + (self->size - index - 1) * element_size); + self->size--; +} + +/// This is not what you're looking for, see `array_reserve`. +static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) { + if (new_capacity > self->capacity) { + if (self->contents) { + self->contents = ts_realloc(self->contents, new_capacity * element_size); + } else { + self->contents = ts_malloc(new_capacity * element_size); + } + self->capacity = new_capacity; + } +} + +/// This is not what you're looking for, see `array_assign`. +static inline void _array__assign(Array *self, const Array *other, size_t element_size) { + _array__reserve(self, element_size, other->size); + self->size = other->size; + memcpy(self->contents, other->contents, self->size * element_size); +} + +/// This is not what you're looking for, see `array_swap`. +static inline void _array__swap(Array *self, Array *other) { + Array swap = *other; + *other = *self; + *self = swap; +} + +/// This is not what you're looking for, see `array_push` or `array_grow_by`. +static inline void _array__grow(Array *self, uint32_t count, size_t element_size) { + uint32_t new_size = self->size + count; + if (new_size > self->capacity) { + uint32_t new_capacity = self->capacity * 2; + if (new_capacity < 8) new_capacity = 8; + if (new_capacity < new_size) new_capacity = new_size; + _array__reserve(self, element_size, new_capacity); + } +} + +/// This is not what you're looking for, see `array_splice`. +static inline void _array__splice(Array *self, size_t element_size, + uint32_t index, uint32_t old_count, + uint32_t new_count, const void *elements) { + uint32_t new_size = self->size + new_count - old_count; + uint32_t old_end = index + old_count; + uint32_t new_end = index + new_count; + assert(old_end <= self->size); + + _array__reserve(self, element_size, new_size); + + char *contents = (char *)self->contents; + if (self->size > old_end) { + memmove( + contents + new_end * element_size, + contents + old_end * element_size, + (self->size - old_end) * element_size + ); + } + if (new_count > 0) { + if (elements) { + memcpy( + (contents + index * element_size), + elements, + new_count * element_size + ); + } else { + memset( + (contents + index * element_size), + 0, + new_count * element_size + ); + } + } + self->size += new_count - old_count; +} + +/// A binary search routine, based on Rust's `std::slice::binary_search_by`. +/// This is not what you're looking for, see `array_search_sorted_with` or `array_search_sorted_by`. +#define _array__search_sorted(self, start, compare, suffix, needle, _index, _exists) \ + do { \ + *(_index) = start; \ + *(_exists) = false; \ + uint32_t size = (self)->size - *(_index); \ + if (size == 0) break; \ + int comparison; \ + while (size > 1) { \ + uint32_t half_size = size / 2; \ + uint32_t mid_index = *(_index) + half_size; \ + comparison = compare(&((self)->contents[mid_index] suffix), (needle)); \ + if (comparison <= 0) *(_index) = mid_index; \ + size -= half_size; \ + } \ + comparison = compare(&((self)->contents[*(_index)] suffix), (needle)); \ + if (comparison == 0) *(_exists) = true; \ + else if (comparison < 0) *(_index) += 1; \ + } while (0) + +/// Helper macro for the `_sorted_by` routines below. This takes the left (existing) +/// parameter by reference in order to work with the generic sorting function above. +#define _compare_int(a, b) ((int)*(a) - (int)(b)) + +#ifdef _MSC_VER +#pragma warning(default : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ARRAY_H_ diff --git a/src/tree_sitter/parser.h b/src/tree_sitter/parser.h index 17b4fde..17f0e94 100644 --- a/src/tree_sitter/parser.h +++ b/src/tree_sitter/parser.h @@ -86,6 +86,11 @@ typedef union { } entry; } TSParseActionEntry; +typedef struct { + int32_t start; + int32_t end; +} TSCharacterRange; + struct TSLanguage { uint32_t version; uint32_t symbol_count; @@ -125,6 +130,24 @@ struct TSLanguage { const TSStateId *primary_state_ids; }; +static inline bool set_contains(TSCharacterRange *ranges, uint32_t len, int32_t lookahead) { + uint32_t index = 0; + uint32_t size = len - index; + while (size > 1) { + uint32_t half_size = size / 2; + uint32_t mid_index = index + half_size; + TSCharacterRange *range = &ranges[mid_index]; + if (lookahead >= range->start && lookahead <= range->end) { + return true; + } else if (lookahead > range->end) { + index = mid_index; + } + size -= half_size; + } + TSCharacterRange *range = &ranges[index]; + return (lookahead >= range->start && lookahead <= range->end); +} + /* * Lexer Macros */ @@ -154,6 +177,17 @@ struct TSLanguage { goto next_state; \ } +#define ADVANCE_MAP(...) \ + { \ + static const uint16_t map[] = { __VA_ARGS__ }; \ + for (uint32_t i = 0; i < sizeof(map) / sizeof(map[0]); i += 2) { \ + if (map[i] == lookahead) { \ + state = map[i + 1]; \ + goto next_state; \ + } \ + } \ + } + #define SKIP(state_value) \ { \ skip = true; \ @@ -203,14 +237,15 @@ struct TSLanguage { } \ }} -#define REDUCE(symbol_val, child_count_val, ...) \ - {{ \ - .reduce = { \ - .type = TSParseActionTypeReduce, \ - .symbol = symbol_val, \ - .child_count = child_count_val, \ - __VA_ARGS__ \ - }, \ +#define REDUCE(symbol_name, children, precedence, prod_id) \ + {{ \ + .reduce = { \ + .type = TSParseActionTypeReduce, \ + .symbol = symbol_name, \ + .child_count = children, \ + .dynamic_precedence = precedence, \ + .production_id = prod_id \ + }, \ }} #define RECOVER() \