From 908ba6accbd9cd3fdf0a208fdc186b9ca3db123c Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 23 Nov 2024 10:03:29 +0200 Subject: [PATCH] feat: update to tree-sitter 0.24 --- .editorconfig | 44 +- .gitattributes | 39 +- .github/dependabot.yml | 27 + .github/workflows/ci.yml | 16 +- .github/workflows/release.yml | 19 + .gitignore | 40 +- CMakeLists.txt | 58 + Cargo.lock | 96 + Cargo.toml | 27 +- Makefile | 94 + Package.resolved | 25 + Package.swift | 41 + README.md | 6 +- binding.gyp | 29 +- bindings/c/tree-sitter-poe-filter.h | 16 + bindings/c/tree-sitter-poe-filter.pc.in | 10 + bindings/go/binding.go | 15 + bindings/go/binding_test.go | 15 + bindings/node/binding.cc | 35 +- bindings/node/binding_test.js | 9 + bindings/node/index.d.ts | 27 + bindings/node/index.js | 22 +- bindings/python/tests/test_binding.py | 11 + .../python/tree_sitter_poe_filter/__init__.py | 30 + .../tree_sitter_poe_filter/__init__.pyi | 5 + .../python/tree_sitter_poe_filter/binding.c | 27 + .../python/tree_sitter_poe_filter/py.typed | 0 bindings/rust/build.rs | 16 +- bindings/rust/lib.rs | 27 +- .../swift/TreeSitterPoEFilter/poe_filter.h | 16 + .../TreeSitterPoEFilterTests.swift | 12 + examples/NeverSink-Filter | 2 +- go.mod | 7 + go.sum | 36 + jsconfig.json | 9 - package-lock.json | 374 ++- package.json | 62 +- pyproject.toml | 29 + setup.py | 73 + src/grammar.json | 1 + src/node-types.json | 1 + src/parser.c | 2032 +++++------------ src/tree_sitter/alloc.h | 54 + src/tree_sitter/array.h | 290 +++ src/tree_sitter/parser.h | 52 +- tree-sitter.json | 29 + 46 files changed, 2299 insertions(+), 1606 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/release.yml create mode 100644 CMakeLists.txt create mode 100644 Cargo.lock create mode 100644 Makefile create mode 100644 Package.resolved create mode 100644 Package.swift create mode 100644 bindings/c/tree-sitter-poe-filter.h create mode 100644 bindings/c/tree-sitter-poe-filter.pc.in create mode 100644 bindings/go/binding.go create mode 100644 bindings/go/binding_test.go create mode 100644 bindings/node/binding_test.js create mode 100644 bindings/node/index.d.ts create mode 100644 bindings/python/tests/test_binding.py create mode 100644 bindings/python/tree_sitter_poe_filter/__init__.py create mode 100644 bindings/python/tree_sitter_poe_filter/__init__.pyi create mode 100644 bindings/python/tree_sitter_poe_filter/binding.c create mode 100644 bindings/python/tree_sitter_poe_filter/py.typed create mode 100644 bindings/swift/TreeSitterPoEFilter/poe_filter.h create mode 100644 bindings/swift/TreeSitterPoEFilterTests/TreeSitterPoEFilterTests.swift create mode 100644 go.mod create mode 100644 go.sum delete mode 100644 jsconfig.json create mode 100644 pyproject.toml create mode 100644 setup.py create mode 100644 src/tree_sitter/alloc.h create mode 100644 src/tree_sitter/array.h create mode 100644 tree-sitter.json diff --git a/.editorconfig b/.editorconfig index f8fe7c7..65330c4 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,11 +2,45 @@ root = true [*] charset = utf-8 -end_of_line = lf + +[*.{json,toml,yml,gyp}] +indent_style = space +indent_size = 2 + +[*.js] +indent_style = space indent_size = 2 + +[*.scm] +indent_style = space +indent_size = 2 + +[*.{c,cc,h}] +indent_style = space +indent_size = 4 + +[*.rs] +indent_style = space +indent_size = 4 + +[*.{py,pyi}] +indent_style = space +indent_size = 4 + +[*.swift] indent_style = space -insert_final_newline = true -trim_trailing_whitespace = true +indent_size = 4 -[grammar.js] -quote_type = single +[*.go] +indent_style = tab +indent_size = 8 + +[Makefile] +indent_style = tab +indent_size = 8 + +[parser.c] +indent_size = 2 + +[{alloc,array,parser}.h] +indent_size = 2 diff --git a/.gitattributes b/.gitattributes index 4eb6b22..7e2cae0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,37 @@ -* text eol=lf +* text=auto eol=lf -src/** linguist-generated -bindings/** linguist-generated -binding.gyp linguist-generated +# Generated source files +src/*.json linguist-generated +src/parser.c linguist-generated +src/tree_sitter/* linguist-generated + +# C bindings +bindings/c/* linguist-generated +CMakeLists.txt linguist-generated +Makefile linguist-generated + +# Rust bindings +bindings/rust/* linguist-generated Cargo.toml linguist-generated +Cargo.lock linguist-generated + +# Node.js bindings +bindings/node/* linguist-generated +binding.gyp linguist-generated +package.json linguist-generated +package-lock.json linguist-generated + +# Python bindings +bindings/python/** linguist-generated +setup.py linguist-generated +pyproject.toml linguist-generated + +# Go bindings +bindings/go/* linguist-generated +go.mod linguist-generated +go.sum linguist-generated + +# Swift bindings +bindings/swift/** linguist-generated +Package.swift linguist-generated +Package.resolved linguist-generated diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..a71e41d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,27 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: sunday + commit-message: + prefix: ci + labels: + - dependencies + groups: + actions: + patterns: ["*"] + + - package-ecosystem: gitsubmodule + directory: / + schedule: + interval: weekly + day: sunday + commit-message: + prefix: test(deps) + labels: + - dependencies + groups: + actions: + patterns: ["*"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1634ec1..4a81a2c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,12 +6,14 @@ on: paths: - grammar.js - src/** + - test/** - bindings/** - binding.gyp pull_request: paths: - grammar.js - src/** + - test/** - bindings/** - binding.gyp @@ -28,13 +30,15 @@ jobs: matrix: os: [ubuntu-latest, windows-latest, macos-14] steps: - - name: Set up repository - uses: tree-sitter/parser-setup-action@v1.1 + - name: Checkout repository + uses: actions/checkout@v4 with: submodules: true - node-version: ${{vars.NODE_VERSION}} + - name: Set up tree-sitter + uses: tree-sitter/setup-action/cli@v2 - name: Run tests - uses: tree-sitter/parser-test-action@v1.2 + uses: tree-sitter/parser-test-action@v2 + - name: Parse examples + uses: tree-sitter/parse-action@v4 with: - test-library: ${{runner.os == 'Linux'}} - corpus-files: examples/NeverSink-Filter/**/*.filter + files: examples/NeverSink-Filter/**/*.filter diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0726f92 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,19 @@ +name: Release + +on: + push: + tags: ["*"] + +concurrency: + group: ${{github.workflow}}-${{github.ref}} + cancel-in-progress: true + +jobs: + github: + uses: tree-sitter/workflows/.github/workflows/release.yml@main + with: + attestations: true + permissions: + contents: write + id-token: write + attestations: write diff --git a/.gitignore b/.gitignore index a3d18fc..308fcab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,40 @@ -node_modules/ -yarn.lock -Cargo.lock +# Rust artifacts +target/ +# Node artifacts build/ -target/ +prebuilds/ +node_modules/ + +# Swift artifacts +.build/ + +# Go artifacts +_obj/ + +# Python artifacts +.venv/ +dist/ +*.egg-info +*.whl + +# C artifacts +*.a +*.so +*.so.* +*.dylib +*.dll +*.pc + +# Example dirs +/examples/*/ + +# Grammar volatiles *.wasm +*.obj *.o + +# Archives +*.tar.gz +*.tgz +*.zip diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..07cea06 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,58 @@ +cmake_minimum_required(VERSION 3.13) + +project(tree-sitter-poe-filter + VERSION "0.4.0" + DESCRIPTION "PoE item filter grammar for tree-sitter" + HOMEPAGE_URL "https://github.com/tree-sitter-grammars/tree-sitter-poe-filter" + LANGUAGES C) + +option(BUILD_SHARED_LIBS "Build using shared libraries" ON) +option(TREE_SITTER_REUSE_ALLOCATOR "Reuse the library allocator" OFF) + +set(TREE_SITTER_ABI_VERSION 15 CACHE STRING "Tree-sitter ABI version") +if(NOT ${TREE_SITTER_ABI_VERSION} MATCHES "^[0-9]+$") + unset(TREE_SITTER_ABI_VERSION CACHE) + message(FATAL_ERROR "TREE_SITTER_ABI_VERSION must be an integer") +endif() + +find_program(TREE_SITTER_CLI tree-sitter DOC "Tree-sitter CLI") + +add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/src/parser.c" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/grammar.json" + COMMAND "${TREE_SITTER_CLI}" generate src/grammar.json + --abi=${TREE_SITTER_ABI_VERSION} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "Generating parser.c") + +add_library(tree-sitter-poe-filter src/parser.c) +if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/scanner.c) + target_sources(tree-sitter-poe-filter PRIVATE src/scanner.c) +endif() +target_include_directories(tree-sitter-poe-filter PRIVATE src) + +target_compile_definitions(tree-sitter-poe-filter PRIVATE + $<$:TREE_SITTER_REUSE_ALLOCATOR> + $<$:TREE_SITTER_DEBUG>) + +set_target_properties(tree-sitter-poe-filter + PROPERTIES + C_STANDARD 11 + POSITION_INDEPENDENT_CODE ON + SOVERSION "${TREE_SITTER_ABI_VERSION}.${PROJECT_VERSION_MAJOR}" + DEFINE_SYMBOL "") + +configure_file(bindings/c/tree-sitter-poe-filter.pc.in + "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-poe-filter.pc" @ONLY) + +include(GNUInstallDirs) + +install(FILES bindings/c/tree-sitter-poe-filter.h + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/tree_sitter") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/tree-sitter-poe-filter.pc" + DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig") +install(TARGETS tree-sitter-poe-filter + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") + +add_custom_target(ts-test "${TREE_SITTER_CLI}" test + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMENT "tree-sitter test") diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..5583d8a --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,96 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "cc" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +dependencies = [ + "shlex", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "streaming-iterator" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b2231b7c3057d5e4ad0156fb3dc807d900806020c5ffa3ee6ff2c8c76fb8520" + +[[package]] +name = "tree-sitter" +version = "0.24.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67baf55e7e1b6806063b1e51041069c90afff16afcbbccd278d899f9d84bca4" +dependencies = [ + "cc", + "regex", + "regex-syntax", + "streaming-iterator", + "tree-sitter-language", +] + +[[package]] +name = "tree-sitter-language" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ddffe35a0e5eeeadf13ff7350af564c6e73993a24db62caee1822b185c2600" + +[[package]] +name = "tree-sitter-poe-filter" +version = "0.4.0" +dependencies = [ + "cc", + "tree-sitter", + "tree-sitter-language", +] diff --git a/Cargo.toml b/Cargo.toml index 03cb805..c2d44fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,26 +1,27 @@ [package] name = "tree-sitter-poe-filter" -description = "poe-filter grammar for the tree-sitter parsing library" -version = "0.3.1" -keywords = ["incremental", "parsing", "poe-filter"] -categories = ["parsing", "text-editors"] +description = "PoE item filter grammar for tree-sitter" +version = "0.4.0" +authors = ["ObserverOfTime "] +license = "MIT" +readme = "README.md" +keywords = ["incremental", "parsing", "tree-sitter", "poe"] +categories = ["parser-implementations", "parsing", "text-editors"] repository = "https://github.com/tree-sitter-grammars/tree-sitter-poe-filter" edition = "2021" -license = "MIT" +autoexamples = false build = "bindings/rust/build.rs" -include = [ - "bindings/rust/*", - "grammar.js", - "src/*", - "queries/*", -] +include = ["bindings/rust/*", "grammar.js", "queries/*", "src/*", "tree-sitter.json"] [lib] path = "bindings/rust/lib.rs" [dependencies] -tree-sitter = "~0.20.10" +tree-sitter-language = "0.1" [build-dependencies] -cc = "1.0" +cc = "1.1.22" + +[dev-dependencies] +tree-sitter = "0.24.4" diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c3c1125 --- /dev/null +++ b/Makefile @@ -0,0 +1,94 @@ +ifeq ($(OS),Windows_NT) +$(error Windows is not supported) +endif + +LANGUAGE_NAME := tree-sitter-poe-filter +HOMEPAGE_URL := https://github.com/tree-sitter-grammars/tree-sitter-poe-filter +VERSION := 0.4.0 + +# repository +SRC_DIR := src + +TS ?= tree-sitter + +# 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 + +# ABI versioning +SONAME_MAJOR = $(shell sed -n 's/\#define LANGUAGE_VERSION //p' $(PARSER)) +SONAME_MINOR = $(word 1,$(subst ., ,$(VERSION))) + +# OS-specific bits +ifeq ($(shell uname),Darwin) + SOEXT = dylib + SOEXTVER_MAJOR = $(SONAME_MAJOR).$(SOEXT) + SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).$(SOEXT) + LINKSHARED = -dynamiclib -Wl,-install_name,$(LIBDIR)/lib$(LANGUAGE_NAME).$(SOEXTVER),-rpath,@executable_path/../Frameworks +else + SOEXT = so + SOEXTVER_MAJOR = $(SOEXT).$(SONAME_MAJOR) + SOEXTVER = $(SOEXT).$(SONAME_MAJOR).$(SONAME_MINOR) + LINKSHARED = -shared -Wl,-soname,lib$(LANGUAGE_NAME).$(SOEXTVER) +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|@PROJECT_VERSION@|$(VERSION)|' \ + -e 's|@CMAKE_INSTALL_LIBDIR@|$(LIBDIR:$(PREFIX)/%=%)|' \ + -e 's|@CMAKE_INSTALL_INCLUDEDIR@|$(INCLUDEDIR:$(PREFIX)/%=%)|' \ + -e 's|@PROJECT_DESCRIPTION@|$(DESCRIPTION)|' \ + -e 's|@PROJECT_HOMEPAGE_URL@|$(HOMEPAGE_URL)|' \ + -e 's|@CMAKE_INSTALL_PREFIX@|$(PREFIX)|' $< > $@ + +$(PARSER): $(SRC_DIR)/grammar.json + $(TS) generate $^ + +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.resolved b/Package.resolved new file mode 100644 index 0000000..8224d09 --- /dev/null +++ b/Package.resolved @@ -0,0 +1,25 @@ +{ + "object": { + "pins": [ + { + "package": "SwiftTreeSitter", + "repositoryURL": "https://github.com/ChimeHQ/SwiftTreeSitter", + "state": { + "branch": null, + "revision": "36aa61d1b531f744f35229f010efba9c6d6cbbdd", + "version": "0.9.0" + } + }, + { + "package": "TreeSitter", + "repositoryURL": "https://github.com/tree-sitter/tree-sitter", + "state": { + "branch": null, + "revision": "d97db6d63507eb62c536bcb2c4ac7d70c8ec665e", + "version": "0.23.2" + } + } + ] + }, + "version": 1 +} diff --git a/Package.swift b/Package.swift new file mode 100644 index 0000000..4f39106 --- /dev/null +++ b/Package.swift @@ -0,0 +1,41 @@ +// swift-tools-version:5.3 + +import Foundation +import PackageDescription + +var sources = ["src/parser.c"] +if FileManager.default.fileExists(atPath: "src/scanner.c") { + sources.append("src/scanner.c") +} + +let package = Package( + name: "TreeSitterPoEFilter", + products: [ + .library(name: "TreeSitterPoEFilter", targets: ["TreeSitterPoEFilter"]), + ], + dependencies: [ + .package(url: "https://github.com/ChimeHQ/SwiftTreeSitter", from: "0.8.0"), + ], + targets: [ + .target( + name: "TreeSitterPoEFilter", + dependencies: [], + path: ".", + sources: sources, + resources: [ + .copy("queries") + ], + publicHeadersPath: "bindings/swift", + cSettings: [.headerSearchPath("src")] + ), + .testTarget( + name: "TreeSitterPoEFilterTests", + dependencies: [ + "SwiftTreeSitter", + "TreeSitterPoEFilter", + ], + path: "bindings/swift/TreeSitterPoEFilterTests" + ) + ], + cLanguageStandard: .c11 +) diff --git a/README.md b/README.md index 73f5a2d..3142940 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![CI][ci]](https://github.com/tree-sitter-grammars/tree-sitter-poe-filter/actions) [![discord][discord]](https://discord.gg/w7nTvsVJhm) -[![matrix][matrix]](https://matrix.to/#/#nvim-treesitter:matrix.org) +[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org) A tree-sitter parser for Path of Exile item filters. @@ -20,5 +20,5 @@ A tree-sitter parser for Path of Exile item filters. - [ ] Zed [ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter-grammars/tree-sitter-poe-filter/ci.yml?logo=github&label=CI -[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=tree-sitter -[matrix]: https://img.shields.io/matrix/nvim-treesitter%3Amatrix.org?logo=matrix&label=nvim-treesitter +[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord +[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix diff --git a/binding.gyp b/binding.gyp index d81143a..516e4fa 100644 --- a/binding.gyp +++ b/binding.gyp @@ -2,21 +2,34 @@ "targets": [ { "target_name": "tree_sitter_poe_filter_binding", + "dependencies": [ + " -#include "nan.h" +#include -using namespace v8; +typedef struct TSLanguage TSLanguage; -extern "C" TSLanguage * tree_sitter_poe_filter(); +extern "C" TSLanguage *tree_sitter_poe_filter(); -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_poe_filter()); - - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("poe_filter").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); +Napi::Object Init(Napi::Env env, Napi::Object exports) { + auto language = Napi::External::New(env, tree_sitter_poe_filter()); + language.TypeTag(&LANGUAGE_TYPE_TAG); + exports["language"] = language; + return exports; } -NODE_MODULE(tree_sitter_poe_filter_binding, Init) - -} // namespace +NODE_API_MODULE(tree_sitter_poe_filter_binding, Init) diff --git a/bindings/node/binding_test.js b/bindings/node/binding_test.js new file mode 100644 index 0000000..55becac --- /dev/null +++ b/bindings/node/binding_test.js @@ -0,0 +1,9 @@ +const assert = require("node:assert"); +const { test } = require("node:test"); + +const Parser = require("tree-sitter"); + +test("can load grammar", () => { + const parser = new Parser(); + assert.doesNotThrow(() => parser.setLanguage(require("."))); +}); diff --git a/bindings/node/index.d.ts b/bindings/node/index.d.ts new file mode 100644 index 0000000..528e060 --- /dev/null +++ b/bindings/node/index.d.ts @@ -0,0 +1,27 @@ +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 = { + language: unknown; + nodeTypeInfo: NodeInfo[]; +}; + +declare const language: Language; +export = language; diff --git a/bindings/node/index.js b/bindings/node/index.js index ae7796a..a885bd2 100644 --- a/bindings/node/index.js +++ b/bindings/node/index.js @@ -1,18 +1,10 @@ -try { - module.exports = require("../../build/Release/tree_sitter_poe_filter_binding"); -} catch (error1) { - if (error1.code !== 'MODULE_NOT_FOUND') { - throw error1; - } - try { - module.exports = require("../../build/Debug/tree_sitter_poe_filter_binding"); - } catch (error2) { - if (error2.code !== 'MODULE_NOT_FOUND') { - throw error2; - } - throw error1 - } -} +const root = require("path").join(__dirname, "..", ".."); + +module.exports = + typeof process.versions.bun === "string" + // Support `bun build --compile` by being statically analyzable enough to find the .node file at build-time + ? require(`../../prebuilds/${process.platform}-${process.arch}/tree-sitter-poe-filter.node`) + : require("node-gyp-build")(root); try { module.exports.nodeTypeInfo = require("../../src/node-types.json"); diff --git a/bindings/python/tests/test_binding.py b/bindings/python/tests/test_binding.py new file mode 100644 index 0000000..32754a2 --- /dev/null +++ b/bindings/python/tests/test_binding.py @@ -0,0 +1,11 @@ +from unittest import TestCase + +import tree_sitter, tree_sitter_poe_filter + + +class TestLanguage(TestCase): + def test_can_load_grammar(self): + try: + tree_sitter.Language(tree_sitter_poe_filter.language()) + except Exception: + self.fail("Error loading PoE item filter grammar") diff --git a/bindings/python/tree_sitter_poe_filter/__init__.py b/bindings/python/tree_sitter_poe_filter/__init__.py new file mode 100644 index 0000000..591886d --- /dev/null +++ b/bindings/python/tree_sitter_poe_filter/__init__.py @@ -0,0 +1,30 @@ +"""PoE item filter grammar for tree-sitter""" + +from importlib.resources import files as _files + +from ._binding import language + + +def _get_query(name, file): + query = _files(f"{__package__}.queries") / file + globals()[name] = query.read_text() + return globals()[name] + + +def __getattr__(name): + if name == "HIGHLIGHTS_QUERY": + return _get_query("HIGHLIGHTS_QUERY", "highlights.scm") + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") + + +__all__ = [ + "language", + "HIGHLIGHTS_QUERY", +] + + +def __dir__(): + return sorted(__all__ + [ + "__all__", "__builtins__", "__cached__", "__doc__", "__file__", + "__loader__", "__name__", "__package__", "__path__", "__spec__", + ]) diff --git a/bindings/python/tree_sitter_poe_filter/__init__.pyi b/bindings/python/tree_sitter_poe_filter/__init__.pyi new file mode 100644 index 0000000..9a5b00a --- /dev/null +++ b/bindings/python/tree_sitter_poe_filter/__init__.pyi @@ -0,0 +1,5 @@ +from typing import Final + +HIGHLIGHTS_QUERY: Final[str] + +def language() -> object: ... diff --git a/bindings/python/tree_sitter_poe_filter/binding.c b/bindings/python/tree_sitter_poe_filter/binding.c new file mode 100644 index 0000000..eaaa8bf --- /dev/null +++ b/bindings/python/tree_sitter_poe_filter/binding.c @@ -0,0 +1,27 @@ +#include + +typedef struct TSLanguage TSLanguage; + +TSLanguage *tree_sitter_poe_filter(void); + +static PyObject* _binding_language(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args)) { + return PyCapsule_New(tree_sitter_poe_filter(), "tree_sitter.Language", NULL); +} + +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_poe_filter/py.typed b/bindings/python/tree_sitter_poe_filter/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/bindings/rust/build.rs b/bindings/rust/build.rs index fbc6f86..1cf2448 100644 --- a/bindings/rust/build.rs +++ b/bindings/rust/build.rs @@ -2,12 +2,20 @@ fn main() { let src_dir = std::path::Path::new("src"); let mut c_config = cc::Build::new(); - c_config.include(src_dir); - c_config.flag_if_supported("-Wno-parentheses"); + c_config.std("c11").include(src_dir); + + #[cfg(target_env = "msvc")] + c_config.flag("-utf-8"); let parser_path = src_dir.join("parser.c"); c_config.file(&parser_path); - - c_config.compile("parser"); println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); + + let scanner_path = src_dir.join("scanner.c"); + if scanner_path.exists() { + c_config.file(&scanner_path); + println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); + } + + c_config.compile("tree-sitter-poe-filter"); } diff --git a/bindings/rust/lib.rs b/bindings/rust/lib.rs index 1c4c8bc..f854721 100644 --- a/bindings/rust/lib.rs +++ b/bindings/rust/lib.rs @@ -1,6 +1,6 @@ -//! This crate provides poe_filter language support for the [tree-sitter][] parsing library. +//! This crate provides PoE item filter language support for the [tree-sitter][] parsing library. //! -//! Typically, you will use the [language][language func] function to add this language to a +//! Typically, you will use the [LANGUAGE][] constant to add this language to a //! tree-sitter [Parser][], and then use the parser to parse some code: //! //! ``` @@ -11,28 +11,27 @@ //! Rarity Normal //! "#; //! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_poe_filter::language()).expect("Error loading poe_filter grammar"); +//! let language = tree_sitter_poe_filter::LANGUAGE; +//! parser +//! .set_language(&language.into()) +//! .expect("Error loading PoE item filter parser"); //! let tree = parser.parse(code, None).unwrap(); //! assert!(!tree.root_node().has_error()); //! ``` //! -//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html -//! [language func]: fn.language.html //! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html //! [tree-sitter]: https://tree-sitter.github.io/ -use tree_sitter::Language; +use tree_sitter_language::LanguageFn; extern "C" { - fn tree_sitter_poe_filter() -> Language; + fn tree_sitter_poe_filter() -> *const (); } -/// Get the tree-sitter [Language][] for this grammar. +/// The tree-sitter [`LanguageFn`][LanguageFn] for this grammar. /// -/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html -pub fn language() -> Language { - unsafe { tree_sitter_poe_filter() } -} +/// [LanguageFn]: https://docs.rs/tree-sitter-language/*/tree_sitter_language/struct.LanguageFn.html +pub const LANGUAGE: LanguageFn = unsafe { LanguageFn::from_raw(tree_sitter_poe_filter) }; /// The content of the [`node-types.json`][] file for this grammar. /// @@ -48,7 +47,7 @@ mod tests { fn test_can_load_grammar() { let mut parser = tree_sitter::Parser::new(); parser - .set_language(super::language()) - .expect("Error loading poe_filter language"); + .set_language(&super::LANGUAGE.into()) + .expect("Error loading PoE item filter parser"); } } diff --git a/bindings/swift/TreeSitterPoEFilter/poe_filter.h b/bindings/swift/TreeSitterPoEFilter/poe_filter.h new file mode 100644 index 0000000..2e56edd --- /dev/null +++ b/bindings/swift/TreeSitterPoEFilter/poe_filter.h @@ -0,0 +1,16 @@ +#ifndef TREE_SITTER_POE_FILTER_H_ +#define TREE_SITTER_POE_FILTER_H_ + +typedef struct TSLanguage TSLanguage; + +#ifdef __cplusplus +extern "C" { +#endif + +const TSLanguage *tree_sitter_poe_filter(void); + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_POE_FILTER_H_ diff --git a/bindings/swift/TreeSitterPoEFilterTests/TreeSitterPoEFilterTests.swift b/bindings/swift/TreeSitterPoEFilterTests/TreeSitterPoEFilterTests.swift new file mode 100644 index 0000000..7d71529 --- /dev/null +++ b/bindings/swift/TreeSitterPoEFilterTests/TreeSitterPoEFilterTests.swift @@ -0,0 +1,12 @@ +import XCTest +import SwiftTreeSitter +import TreeSitterPoEFilter + +final class TreeSitterPoEFilterTests: XCTestCase { + func testCanLoadGrammar() throws { + let parser = Parser() + let language = Language(language: tree_sitter_poe_filter()) + XCTAssertNoThrow(try parser.setLanguage(language), + "Error loading PoE item filter grammar") + } +} diff --git a/examples/NeverSink-Filter b/examples/NeverSink-Filter index 92440cf..845f335 160000 --- a/examples/NeverSink-Filter +++ b/examples/NeverSink-Filter @@ -1 +1 @@ -Subproject commit 92440cf47fe3364375704bcee3a20a1f0fe947fd +Subproject commit 845f3353c04f5b97b85d93d33912bcf6e4151ba3 diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..4aca0ba --- /dev/null +++ b/go.mod @@ -0,0 +1,7 @@ +module github.com/tree-sitter-grammars/tree-sitter-poe-filter + +go 1.22 + +require github.com/tree-sitter/go-tree-sitter v0.24.0 + +require github.com/mattn/go-pointer v0.0.1 // indirect diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..0a48bbe --- /dev/null +++ b/go.sum @@ -0,0 +1,36 @@ +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0= +github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/tree-sitter/go-tree-sitter v0.24.0 h1:kRZb6aBNfcI/u0Qh8XEt3zjNVnmxTisDBN+kXK0xRYQ= +github.com/tree-sitter/go-tree-sitter v0.24.0/go.mod h1:x681iFVoLMEwOSIHA1chaLkXlroXEN7WY+VHGFaoDbk= +github.com/tree-sitter/tree-sitter-c v0.21.5-0.20240818205408-927da1f210eb h1:A8425heRM8mylnv4H58FPUiH+aYivyitre0PzxrfmWs= +github.com/tree-sitter/tree-sitter-c v0.21.5-0.20240818205408-927da1f210eb/go.mod h1:dOF6gtQiF9UwNh995T5OphYmtIypkjsp3ap7r9AN/iA= +github.com/tree-sitter/tree-sitter-cpp v0.22.4-0.20240818224355-b1a4e2b25148 h1:AfFPZwtwGN01BW1jDdqBVqscTwetvMpydqYZz57RSlc= +github.com/tree-sitter/tree-sitter-cpp v0.22.4-0.20240818224355-b1a4e2b25148/go.mod h1:Bh6U3viD57rFXRYIQ+kmiYtr+1Bx0AceypDLJJSyi9s= +github.com/tree-sitter/tree-sitter-embedded-template v0.21.1-0.20240819044651-ffbf64942c33 h1:TwqSV3qLp3tKSqirGLRHnjFk9Tc2oy57LIl+FQ4GjI4= +github.com/tree-sitter/tree-sitter-embedded-template v0.21.1-0.20240819044651-ffbf64942c33/go.mod h1:CvCKCt3v04Ufos1zZnNCelBDeCGRpPucaN8QczoUsN4= +github.com/tree-sitter/tree-sitter-go v0.21.3-0.20240818010209-8c0f0e7a6012 h1:Xvxck3tE5FW7F7bTS97iNM2ADMyCMJztVqn5HYKdJGo= +github.com/tree-sitter/tree-sitter-go v0.21.3-0.20240818010209-8c0f0e7a6012/go.mod h1:T40D0O1cPvUU/+AmiXVXy1cncYQT6wem4Z0g4SfAYvY= +github.com/tree-sitter/tree-sitter-html v0.20.5-0.20240818004741-d11201a263d0 h1:c46K6uh5Dz00zJeU9BfjXdb8I+E4RkUdfnWJpQADXFo= +github.com/tree-sitter/tree-sitter-html v0.20.5-0.20240818004741-d11201a263d0/go.mod h1:hcNt/kOJHcIcuMvouE7LJcYdeFUFbVpBJ6d4wmOA+tU= +github.com/tree-sitter/tree-sitter-java v0.21.1-0.20240824015150-576d8097e495 h1:jrt4qbJVEFs4H93/ITxygHc6u0TGqAkkate7TQ4wFSA= +github.com/tree-sitter/tree-sitter-java v0.21.1-0.20240824015150-576d8097e495/go.mod h1:oyaR7fLnRV0hT9z6qwE9GkaeTom/hTDwK3H2idcOJFc= +github.com/tree-sitter/tree-sitter-javascript v0.21.5-0.20240818005344-15887341e5b5 h1:om4X9AVg3asL8gxNJDcz4e/Wp+VpQj1PY3uJXKr6EOg= +github.com/tree-sitter/tree-sitter-javascript v0.21.5-0.20240818005344-15887341e5b5/go.mod h1:nNqgPoV/h9uYWk6kYEFdEAhNVOacpfpRW5SFmdaP4tU= +github.com/tree-sitter/tree-sitter-json v0.21.1-0.20240818005659-bdd69eb8c8a5 h1:pfV3G3k7NCKqKk8THBmyuh2zA33lgYHS3GVrzRR8ry4= +github.com/tree-sitter/tree-sitter-json v0.21.1-0.20240818005659-bdd69eb8c8a5/go.mod h1:GbMKRjLfk0H+PI7nLi1Sx5lHf5wCpLz9al8tQYSxpEk= +github.com/tree-sitter/tree-sitter-php v0.22.9-0.20240819002312-a552625b56c1 h1:ZXZMDwE+IhUtGug4Brv6NjJWUU3rfkZBKpemf6RY8/g= +github.com/tree-sitter/tree-sitter-php v0.22.9-0.20240819002312-a552625b56c1/go.mod h1:UKCLuYnJ312Mei+3cyTmGOHzn0YAnaPRECgJmHtzrqs= +github.com/tree-sitter/tree-sitter-python v0.21.1-0.20240818005537-55a9b8a4fbfb h1:EXEM82lFM7JjJb6qiKZXkpIDaCcbV2obNn82ghwj9lw= +github.com/tree-sitter/tree-sitter-python v0.21.1-0.20240818005537-55a9b8a4fbfb/go.mod h1:lXCF1nGG5Dr4J3BTS0ObN4xJCCICiSu/b+Xe/VqMV7g= +github.com/tree-sitter/tree-sitter-ruby v0.21.1-0.20240818211811-7dbc1e2d0e2d h1:fcYCvoXdcP1uRQYXqJHRy6Hec+uKScQdKVtMwK9JeCI= +github.com/tree-sitter/tree-sitter-ruby v0.21.1-0.20240818211811-7dbc1e2d0e2d/go.mod h1:T1nShQ4v5AJtozZ8YyAS4uzUtDAJj/iv4YfwXSbUHzg= +github.com/tree-sitter/tree-sitter-rust v0.21.3-0.20240818005432-2b43eafe6447 h1:o9alBu1J/WjrcTKEthYtXmdkDc5OVXD+PqlvnEZ0Lzc= +github.com/tree-sitter/tree-sitter-rust v0.21.3-0.20240818005432-2b43eafe6447/go.mod h1:1Oh95COkkTn6Ezp0vcMbvfhRP5gLeqqljR0BYnBzWvc= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/jsconfig.json b/jsconfig.json deleted file mode 100644 index baff603..0000000 --- a/jsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "files": ["grammar.js"], - "exclude": ["node_modules"], - "compilerOptions": { - "checkJs": true, - "module": "Node16", - "types": ["tree-sitter-cli/dsl"] - } -} diff --git a/package-lock.json b/package-lock.json index 98ecc5d..a223330 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,34 +1,386 @@ { "name": "tree-sitter-poe-filter", - "version": "0.3.1", + "version": "0.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "tree-sitter-poe-filter", - "version": "0.3.1", + "version": "0.4.0", + "hasInstallScript": true, "license": "MIT", "dependencies": { - "nan": "^2.18.0" + "node-addon-api": "^8.2.1", + "node-gyp-build": "^4.8.2" }, "devDependencies": { - "tree-sitter-cli": "~0.21.0" + "prebuildify": "^6.0.1", + "tree-sitter-cli": "^0.24.4" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/ObserverOfTime" + }, + "peerDependencies": { + "tree-sitter": "^0.21.1" + }, + "peerDependenciesMeta": { + "tree-sitter": { + "optional": true + } } }, - "node_modules/nan": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==" + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/bl": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", + "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "buffer": "^5.5.0", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, + "node_modules/buffer": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", + "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.1.13" + } + }, + "node_modules/chownr": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", + "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "dev": true, + "license": "ISC" + }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, + "node_modules/fs-constants": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", + "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", + "dev": true, + "license": "MIT" + }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true, + "license": "ISC" + }, + "node_modules/minimist": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", + "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/mkdirp-classic": { + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", + "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "dev": true, + "license": "MIT" + }, + "node_modules/node-abi": { + "version": "3.71.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.71.0.tgz", + "integrity": "sha512-SZ40vRiy/+wRTf21hxkkEjPJZpARzUMVcJoQse2EF8qkUWbbO2z7vd5oA/H6bVH6SZQ5STGcu0KRDS7biNRfxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/node-addon-api": { + "version": "8.2.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.2.2.tgz", + "integrity": "sha512-9emqXAKhVoNrQ792nLI/wpzPpJ/bj/YXxW0CvAau1+RdGBcCRF1Dmz7719zgVsQNrzHl9Tzn3ImZ4qWFarWL0A==", + "license": "MIT", + "engines": { + "node": "^18 || ^20 || >= 21" + } + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "license": "MIT", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/npm-run-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz", + "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==", + "dev": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/prebuildify": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/prebuildify/-/prebuildify-6.0.1.tgz", + "integrity": "sha512-8Y2oOOateom/s8dNBsGIcnm6AxPmLH4/nanQzL5lQMU+sC0CMhzARZHizwr36pUPLdvBnOkCNQzxg4djuFSgIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "minimist": "^1.2.5", + "mkdirp-classic": "^0.5.3", + "node-abi": "^3.3.0", + "npm-run-path": "^3.1.0", + "pump": "^3.0.0", + "tar-fs": "^2.1.0" + }, + "bin": { + "prebuildify": "bin.js" + } + }, + "node_modules/pump": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz", + "integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==", + "dev": true, + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/tar-fs": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", + "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "dev": true, + "license": "MIT", + "dependencies": { + "chownr": "^1.1.1", + "mkdirp-classic": "^0.5.2", + "pump": "^3.0.0", + "tar-stream": "^2.1.4" + } + }, + "node_modules/tar-stream": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", + "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "bl": "^4.0.3", + "end-of-stream": "^1.4.1", + "fs-constants": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/tree-sitter": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.21.1.tgz", + "integrity": "sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==", + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "peer": true, + "dependencies": { + "node-addon-api": "^8.0.0", + "node-gyp-build": "^4.8.0" + } }, "node_modules/tree-sitter-cli": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.21.0.tgz", - "integrity": "sha512-wA7wT5724fNQW82XDH6zT6ZcYonjrAKLCHHuhLsPcAKULrhp3rNuMvlgBdB5FUBvmjHNhtTZF/qpHenMoRJPBw==", + "version": "0.24.4", + "resolved": "https://registry.npmjs.org/tree-sitter-cli/-/tree-sitter-cli-0.24.4.tgz", + "integrity": "sha512-I4sdtDidnujYL0tR0Re9q0UJt5KrITf2m+GMHjT4LH6IC6kpM6eLzSR7RS36Z4t5ZQBjDHvg2QUJHAWQi3P2TA==", "dev": true, "hasInstallScript": true, + "license": "MIT", "bin": { "tree-sitter": "cli.js" + }, + "engines": { + "node": ">=12.0.0" } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true, + "license": "ISC" } } } diff --git a/package.json b/package.json index 8b0668f..018499c 100644 --- a/package.json +++ b/package.json @@ -1,39 +1,55 @@ { "name": "tree-sitter-poe-filter", - "version": "0.3.1", + "version": "0.4.0", + "description": "PoE item filter grammar for tree-sitter", + "repository": "https://github.com/tree-sitter-grammars/tree-sitter-poe-filter", "license": "MIT", - "description": "PoE filter grammar for tree-sitter", - "repository": "ObserverOfTime/tree-sitter-poe-filter", "author": { "name": "ObserverOfTime", - "email": "chronobserver@disroot.org", - "url": "https://observeroftime.github.io/" + "email": "chronobserver@disroot.org" }, + "funding": { + "url": "https://github.com/sponsors/ObserverOfTime", + "type": "github" + }, + "main": "bindings/node", + "types": "bindings/node", "keywords": [ + "incremental", + "parsing", "tree-sitter", - "parser", - "lexer", "poe" ], - "scripts": { - "build": "tree-sitter generate --no-bindings", - "parse": "tree-sitter parse", - "test": "tree-sitter test" - }, - "main": "bindings/node", + "files": [ + "grammar.js", + "tree-sitter.json", + "binding.gyp", + "prebuilds/**", + "bindings/node/*", + "queries/*", + "src/**", + "*.wasm" + ], "dependencies": { - "nan": "^2.18.0" + "node-addon-api": "^8.2.1", + "node-gyp-build": "^4.8.2" }, "devDependencies": { - "tree-sitter-cli": "~0.21.0" + "prebuildify": "^6.0.1", + "tree-sitter-cli": "^0.24.4" + }, + "peerDependencies": { + "tree-sitter": "^0.21.1" }, - "tree-sitter": [ - { - "scope": "text.poe_filter", - "highlights": "queries/highlights.scm", - "file-types": [ - "filter" - ] + "peerDependenciesMeta": { + "tree-sitter": { + "optional": true } - ] + }, + "scripts": { + "install": "node-gyp-build", + "prestart": "tree-sitter build --wasm", + "start": "tree-sitter playground", + "test": "node --test bindings/node/*_test.js" + } } diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..be54632 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,29 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "tree-sitter-poe-filter" +description = "PoE item filter grammar for tree-sitter" +version = "0.4.0" +keywords = ["incremental", "parsing", "tree-sitter", "poe"] +classifiers = [ + "Intended Audience :: Developers", + "Topic :: Software Development :: Compilers", + "Topic :: Text Processing :: Linguistic", + "Typing :: Typed", +] +authors = [{ name = "ObserverOfTime", email = "chronobserver@disroot.org" }] +requires-python = ">=3.9" +license.text = "MIT" +readme = "README.md" + +[project.urls] +Homepage = "https://github.com/tree-sitter-grammars/tree-sitter-poe-filter" + +[project.optional-dependencies] +core = ["tree-sitter~=0.22"] + +[tool.cibuildwheel] +build = "cp39-*" +build-frontend = "build" diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..45d9fb4 --- /dev/null +++ b/setup.py @@ -0,0 +1,73 @@ +from os import path +from platform import system + +from setuptools import Extension, find_packages, setup +from setuptools.command.build import build +from setuptools.command.egg_info import egg_info +from wheel.bdist_wheel import bdist_wheel + +sources = [ + "bindings/python/tree_sitter_poe_filter/binding.c", + "src/parser.c", +] +if path.exists("src/scanner.c"): + sources.append("src/scanner.c") + +if system() != "Windows": + cflags = ["-std=c11", "-fvisibility=hidden"] +else: + cflags = ["/std:c11", "/utf-8"] + + +class Build(build): + def run(self): + if path.isdir("queries"): + dest = path.join(self.build_lib, "tree_sitter_poe_filter", "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 = "cp39", "abi3" + return python, abi, platform + + +class EggInfo(egg_info): + def find_sources(self): + super().find_sources() + self.filelist.recursive_include("queries", "*.scm") + self.filelist.include("src/tree_sitter/*.h") + + +setup( + packages=find_packages("bindings/python"), + package_dir={"": "bindings/python"}, + package_data={ + "tree_sitter_poe_filter": ["*.pyi", "py.typed"], + "tree_sitter_poe_filter.queries": ["*.scm"], + }, + ext_package="tree_sitter_poe_filter", + ext_modules=[ + Extension( + name="_binding", + sources=sources, + extra_compile_args=cflags, + define_macros=[ + ("Py_LIMITED_API", "0x03090000"), + ("PY_SSIZE_T_CLEAN", None), + ("TREE_SITTER_HIDE_SYMBOLS", None), + ], + include_dirs=["src"], + py_limited_api=True, + ) + ], + cmdclass={ + "build": Build, + "bdist_wheel": BdistWheel, + "egg_info": EggInfo, + }, + zip_safe=False +) diff --git a/src/grammar.json b/src/grammar.json index 3ee8f8f..49e1b8e 100644 --- a/src/grammar.json +++ b/src/grammar.json @@ -1,4 +1,5 @@ { + "$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/grammar.schema.json", "name": "poe_filter", "rules": { "filter": { diff --git a/src/node-types.json b/src/node-types.json index 067e119..1dd9e8d 100644 --- a/src/node-types.json +++ b/src/node-types.json @@ -230,6 +230,7 @@ { "type": "filter", "named": true, + "root": true, "fields": {}, "children": { "multiple": true, diff --git a/src/parser.c b/src/parser.c index 4f4df58..ffe2322 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 @@ -1498,1033 +1497,120 @@ static const TSStateId ts_primary_state_ids[STATE_COUNT] = { [187] = 138, }; -static inline bool aux_sym_string_token1_character_set_1(int32_t c) { - return (c < 6576 - ? (c < 2974 - ? (c < 2208 - ? (c < 1369 - ? (c < 748 - ? (c < 181 - ? (c < 'A' - ? (c < ',' - ? c == '\'' - : (c <= '-' || c == ':')) - : (c <= 'Z' || (c < 170 - ? (c >= 'a' && c <= 'z') - : c <= 170))) - : (c <= 181 || (c < 248 - ? (c < 192 - ? c == 186 - : (c <= 214 || (c >= 216 && c <= 246))) - : (c <= 705 || (c < 736 - ? (c >= 710 && c <= 721) - : c <= 740))))) - : (c <= 748 || (c < 904 - ? (c < 890 - ? (c < 880 - ? c == 750 - : (c <= 884 || (c >= 886 && c <= 887))) - : (c <= 893 || (c < 902 - ? c == 895 - : c <= 902))) - : (c <= 906 || (c < 1015 - ? (c < 910 - ? c == 908 - : (c <= 929 || (c >= 931 && c <= 1013))) - : (c <= 1153 || (c < 1329 - ? (c >= 1162 && c <= 1327) - : c <= 1366))))))) - : (c <= 1369 || (c < 1869 - ? (c < 1749 - ? (c < 1568 - ? (c < 1488 - ? (c >= 1376 && c <= 1416) - : (c <= 1514 || (c >= 1519 && c <= 1522))) - : (c <= 1610 || (c < 1649 - ? (c >= 1646 && c <= 1647) - : c <= 1747))) - : (c <= 1749 || (c < 1791 - ? (c < 1774 - ? (c >= 1765 && c <= 1766) - : (c <= 1775 || (c >= 1786 && c <= 1788))) - : (c <= 1791 || (c < 1810 - ? c == 1808 - : c <= 1839))))) - : (c <= 1957 || (c < 2084 - ? (c < 2042 - ? (c < 1994 - ? c == 1969 - : (c <= 2026 || (c >= 2036 && c <= 2037))) - : (c <= 2042 || (c < 2074 - ? (c >= 2048 && c <= 2069) - : c <= 2074))) - : (c <= 2084 || (c < 2144 - ? (c < 2112 - ? c == 2088 - : c <= 2136) - : (c <= 2154 || (c < 2185 - ? (c >= 2160 && c <= 2183) - : c <= 2190))))))))) - : (c <= 2249 || (c < 2674 - ? (c < 2524 - ? (c < 2447 - ? (c < 2392 - ? (c < 2365 - ? (c >= 2308 && c <= 2361) - : (c <= 2365 || c == 2384)) - : (c <= 2401 || (c < 2437 - ? (c >= 2417 && c <= 2432) - : c <= 2444))) - : (c <= 2448 || (c < 2486 - ? (c < 2474 - ? (c >= 2451 && c <= 2472) - : (c <= 2480 || c == 2482)) - : (c <= 2489 || (c < 2510 - ? c == 2493 - : c <= 2510))))) - : (c <= 2525 || (c < 2602 - ? (c < 2565 - ? (c < 2544 - ? (c >= 2527 && c <= 2529) - : (c <= 2545 || c == 2556)) - : (c <= 2570 || (c < 2579 - ? (c >= 2575 && c <= 2576) - : c <= 2600))) - : (c <= 2608 || (c < 2616 - ? (c < 2613 - ? (c >= 2610 && c <= 2611) - : c <= 2614) - : (c <= 2617 || (c < 2654 - ? (c >= 2649 && c <= 2652) - : c <= 2654))))))) - : (c <= 2676 || (c < 2858 - ? (c < 2749 - ? (c < 2730 - ? (c < 2703 - ? (c >= 2693 && c <= 2701) - : (c <= 2705 || (c >= 2707 && c <= 2728))) - : (c <= 2736 || (c < 2741 - ? (c >= 2738 && c <= 2739) - : c <= 2745))) - : (c <= 2749 || (c < 2821 - ? (c < 2784 - ? c == 2768 - : (c <= 2785 || c == 2809)) - : (c <= 2828 || (c < 2835 - ? (c >= 2831 && c <= 2832) - : c <= 2856))))) - : (c <= 2864 || (c < 2947 - ? (c < 2908 - ? (c < 2869 - ? (c >= 2866 && c <= 2867) - : (c <= 2873 || c == 2877)) - : (c <= 2909 || (c < 2929 - ? (c >= 2911 && c <= 2913) - : c <= 2929))) - : (c <= 2947 || (c < 2962 - ? (c < 2958 - ? (c >= 2949 && c <= 2954) - : c <= 2960) - : (c <= 2965 || (c < 2972 - ? (c >= 2969 && c <= 2970) - : c <= 2972))))))))))) - : (c <= 2975 || (c < 4096 - ? (c < 3406 - ? (c < 3205 - ? (c < 3090 - ? (c < 3024 - ? (c < 2984 - ? (c >= 2979 && c <= 2980) - : (c <= 2986 || (c >= 2990 && c <= 3001))) - : (c <= 3024 || (c < 3086 - ? (c >= 3077 && c <= 3084) - : c <= 3088))) - : (c <= 3112 || (c < 3165 - ? (c < 3133 - ? (c >= 3114 && c <= 3129) - : (c <= 3133 || (c >= 3160 && c <= 3162))) - : (c <= 3165 || (c < 3200 - ? (c >= 3168 && c <= 3169) - : c <= 3200))))) - : (c <= 3212 || (c < 3296 - ? (c < 3253 - ? (c < 3218 - ? (c >= 3214 && c <= 3216) - : (c <= 3240 || (c >= 3242 && c <= 3251))) - : (c <= 3257 || (c < 3293 - ? c == 3261 - : c <= 3294))) - : (c <= 3297 || (c < 3342 - ? (c < 3332 - ? (c >= 3313 && c <= 3314) - : c <= 3340) - : (c <= 3344 || (c < 3389 - ? (c >= 3346 && c <= 3386) - : c <= 3389))))))) - : (c <= 3406 || (c < 3718 - ? (c < 3517 - ? (c < 3461 - ? (c < 3423 - ? (c >= 3412 && c <= 3414) - : (c <= 3425 || (c >= 3450 && c <= 3455))) - : (c <= 3478 || (c < 3507 - ? (c >= 3482 && c <= 3505) - : c <= 3515))) - : (c <= 3517 || (c < 3648 - ? (c < 3585 - ? (c >= 3520 && c <= 3526) - : (c <= 3632 || (c >= 3634 && c <= 3635))) - : (c <= 3654 || (c < 3716 - ? (c >= 3713 && c <= 3714) - : c <= 3716))))) - : (c <= 3722 || (c < 3782 - ? (c < 3762 - ? (c < 3749 - ? (c >= 3724 && c <= 3747) - : (c <= 3749 || (c >= 3751 && c <= 3760))) - : (c <= 3763 || (c < 3776 - ? c == 3773 - : c <= 3780))) - : (c <= 3782 || (c < 3904 - ? (c < 3840 - ? (c >= 3804 && c <= 3807) - : c <= 3840) - : (c <= 3911 || (c < 3976 - ? (c >= 3913 && c <= 3948) - : c <= 3980))))))))) - : (c <= 4138 || (c < 4882 - ? (c < 4682 - ? (c < 4213 - ? (c < 4193 - ? (c < 4176 - ? c == 4159 - : (c <= 4181 || (c >= 4186 && c <= 4189))) - : (c <= 4193 || (c < 4206 - ? (c >= 4197 && c <= 4198) - : c <= 4208))) - : (c <= 4225 || (c < 4301 - ? (c < 4256 - ? c == 4238 - : (c <= 4293 || c == 4295)) - : (c <= 4301 || (c < 4348 - ? (c >= 4304 && c <= 4346) - : c <= 4680))))) - : (c <= 4685 || (c < 4786 - ? (c < 4704 - ? (c < 4696 - ? (c >= 4688 && c <= 4694) - : (c <= 4696 || (c >= 4698 && c <= 4701))) - : (c <= 4744 || (c < 4752 - ? (c >= 4746 && c <= 4749) - : c <= 4784))) - : (c <= 4789 || (c < 4802 - ? (c < 4800 - ? (c >= 4792 && c <= 4798) - : c <= 4800) - : (c <= 4805 || (c < 4824 - ? (c >= 4808 && c <= 4822) - : c <= 4880))))))) - : (c <= 4885 || (c < 5998 - ? (c < 5761 - ? (c < 5112 - ? (c < 4992 - ? (c >= 4888 && c <= 4954) - : (c <= 5007 || (c >= 5024 && c <= 5109))) - : (c <= 5117 || (c < 5743 - ? (c >= 5121 && c <= 5740) - : c <= 5759))) - : (c <= 5786 || (c < 5919 - ? (c < 5873 - ? (c >= 5792 && c <= 5866) - : (c <= 5880 || (c >= 5888 && c <= 5905))) - : (c <= 5937 || (c < 5984 - ? (c >= 5952 && c <= 5969) - : c <= 5996))))) - : (c <= 6000 || (c < 6314 - ? (c < 6176 - ? (c < 6103 - ? (c >= 6016 && c <= 6067) - : (c <= 6103 || c == 6108)) - : (c <= 6264 || (c < 6279 - ? (c >= 6272 && c <= 6276) - : c <= 6312))) - : (c <= 6314 || (c < 6480 - ? (c < 6400 - ? (c >= 6320 && c <= 6389) - : c <= 6430) - : (c <= 6509 || (c < 6528 - ? (c >= 6512 && c <= 6516) - : c <= 6571))))))))))))) - : (c <= 6601 || (c < 43259 - ? (c < 8579 - ? (c < 8031 - ? (c < 7357 - ? (c < 7086 - ? (c < 6917 - ? (c < 6688 - ? (c >= 6656 && c <= 6678) - : (c <= 6740 || c == 6823)) - : (c <= 6963 || (c < 7043 - ? (c >= 6981 && c <= 6988) - : c <= 7072))) - : (c <= 7087 || (c < 7258 - ? (c < 7168 - ? (c >= 7098 && c <= 7141) - : (c <= 7203 || (c >= 7245 && c <= 7247))) - : (c <= 7293 || (c < 7312 - ? (c >= 7296 && c <= 7304) - : c <= 7354))))) - : (c <= 7359 || (c < 7960 - ? (c < 7418 - ? (c < 7406 - ? (c >= 7401 && c <= 7404) - : (c <= 7411 || (c >= 7413 && c <= 7414))) - : (c <= 7418 || (c < 7680 - ? (c >= 7424 && c <= 7615) - : c <= 7957))) - : (c <= 7965 || (c < 8025 - ? (c < 8008 - ? (c >= 7968 && c <= 8005) - : (c <= 8013 || (c >= 8016 && c <= 8023))) - : (c <= 8025 || (c < 8029 - ? c == 8027 - : c <= 8029))))))) - : (c <= 8061 || (c < 8450 - ? (c < 8150 - ? (c < 8130 - ? (c < 8118 - ? (c >= 8064 && c <= 8116) - : (c <= 8124 || c == 8126)) - : (c <= 8132 || (c < 8144 - ? (c >= 8134 && c <= 8140) - : c <= 8147))) - : (c <= 8155 || (c < 8305 - ? (c < 8178 - ? (c >= 8160 && c <= 8172) - : (c <= 8180 || (c >= 8182 && c <= 8188))) - : (c <= 8305 || (c < 8336 - ? c == 8319 - : c <= 8348))))) - : (c <= 8450 || (c < 8488 - ? (c < 8473 - ? (c < 8458 - ? c == 8455 - : (c <= 8467 || c == 8469)) - : (c <= 8477 || (c < 8486 - ? c == 8484 - : c <= 8486))) - : (c <= 8488 || (c < 8508 - ? (c < 8495 - ? (c >= 8490 && c <= 8493) - : c <= 8505) - : (c <= 8511 || (c < 8526 - ? (c >= 8517 && c <= 8521) - : c <= 8526))))))))) - : (c <= 8580 || (c < 12593 - ? (c < 11712 - ? (c < 11568 - ? (c < 11520 - ? (c < 11499 - ? (c >= 11264 && c <= 11492) - : (c <= 11502 || (c >= 11506 && c <= 11507))) - : (c <= 11557 || (c < 11565 - ? c == 11559 - : c <= 11565))) - : (c <= 11623 || (c < 11688 - ? (c < 11648 - ? c == 11631 - : (c <= 11670 || (c >= 11680 && c <= 11686))) - : (c <= 11694 || (c < 11704 - ? (c >= 11696 && c <= 11702) - : c <= 11710))))) - : (c <= 11718 || (c < 12347 - ? (c < 11823 - ? (c < 11728 - ? (c >= 11720 && c <= 11726) - : (c <= 11734 || (c >= 11736 && c <= 11742))) - : (c <= 11823 || (c < 12337 - ? (c >= 12293 && c <= 12294) - : c <= 12341))) - : (c <= 12348 || (c < 12449 - ? (c < 12445 - ? (c >= 12353 && c <= 12438) - : c <= 12447) - : (c <= 12538 || (c < 12549 - ? (c >= 12540 && c <= 12543) - : c <= 12591))))))) - : (c <= 12686 || (c < 42775 - ? (c < 42192 - ? (c < 19903 - ? (c < 12784 - ? (c >= 12704 && c <= 12735) - : (c <= 12799 || c == 13312)) - : (c <= 19903 || (c < 40959 - ? c == 19968 - : c <= 42124))) - : (c <= 42237 || (c < 42560 - ? (c < 42512 - ? (c >= 42240 && c <= 42508) - : (c <= 42527 || (c >= 42538 && c <= 42539))) - : (c <= 42606 || (c < 42656 - ? (c >= 42623 && c <= 42653) - : c <= 42725))))) - : (c <= 42783 || (c < 43011 - ? (c < 42963 - ? (c < 42891 - ? (c >= 42786 && c <= 42888) - : (c <= 42954 || (c >= 42960 && c <= 42961))) - : (c <= 42963 || (c < 42994 - ? (c >= 42965 && c <= 42969) - : c <= 43009))) - : (c <= 43013 || (c < 43072 - ? (c < 43020 - ? (c >= 43015 && c <= 43018) - : c <= 43042) - : (c <= 43123 || (c < 43250 - ? (c >= 43138 && c <= 43187) - : c <= 43255))))))))))) - : (c <= 43259 || (c < 65313 - ? (c < 43808 - ? (c < 43642 - ? (c < 43488 - ? (c < 43360 - ? (c < 43274 - ? (c >= 43261 && c <= 43262) - : (c <= 43301 || (c >= 43312 && c <= 43334))) - : (c <= 43388 || (c < 43471 - ? (c >= 43396 && c <= 43442) - : c <= 43471))) - : (c <= 43492 || (c < 43584 - ? (c < 43514 - ? (c >= 43494 && c <= 43503) - : (c <= 43518 || (c >= 43520 && c <= 43560))) - : (c <= 43586 || (c < 43616 - ? (c >= 43588 && c <= 43595) - : c <= 43638))))) - : (c <= 43642 || (c < 43739 - ? (c < 43705 - ? (c < 43697 - ? (c >= 43646 && c <= 43695) - : (c <= 43697 || (c >= 43701 && c <= 43702))) - : (c <= 43709 || (c < 43714 - ? c == 43712 - : c <= 43714))) - : (c <= 43741 || (c < 43777 - ? (c < 43762 - ? (c >= 43744 && c <= 43754) - : c <= 43764) - : (c <= 43782 || (c < 43793 - ? (c >= 43785 && c <= 43790) - : c <= 43798))))))) - : (c <= 43814 || (c < 64287 - ? (c < 55216 - ? (c < 43888 - ? (c < 43824 - ? (c >= 43816 && c <= 43822) - : (c <= 43866 || (c >= 43868 && c <= 43881))) - : (c <= 44002 || (c < 55203 - ? c == 44032 - : c <= 55203))) - : (c <= 55238 || (c < 64256 - ? (c < 63744 - ? (c >= 55243 && c <= 55291) - : (c <= 64109 || (c >= 64112 && c <= 64217))) - : (c <= 64262 || (c < 64285 - ? (c >= 64275 && c <= 64279) - : c <= 64285))))) - : (c <= 64296 || (c < 64467 - ? (c < 64320 - ? (c < 64312 - ? (c >= 64298 && c <= 64310) - : (c <= 64316 || c == 64318)) - : (c <= 64321 || (c < 64326 - ? (c >= 64323 && c <= 64324) - : c <= 64433))) - : (c <= 64829 || (c < 65008 - ? (c < 64914 - ? (c >= 64848 && c <= 64911) - : c <= 64967) - : (c <= 65019 || (c < 65142 - ? (c >= 65136 && c <= 65140) - : c <= 65276))))))))) - : (c <= 65338 || (c < 66864 - ? (c < 66176 - ? (c < 65536 - ? (c < 65482 - ? (c < 65382 - ? (c >= 65345 && c <= 65370) - : (c <= 65470 || (c >= 65474 && c <= 65479))) - : (c <= 65487 || (c < 65498 - ? (c >= 65490 && c <= 65495) - : c <= 65500))) - : (c <= 65547 || (c < 65599 - ? (c < 65576 - ? (c >= 65549 && c <= 65574) - : (c <= 65594 || (c >= 65596 && c <= 65597))) - : (c <= 65613 || (c < 65664 - ? (c >= 65616 && c <= 65629) - : c <= 65786))))) - : (c <= 66204 || (c < 66464 - ? (c < 66370 - ? (c < 66304 - ? (c >= 66208 && c <= 66256) - : (c <= 66335 || (c >= 66349 && c <= 66368))) - : (c <= 66377 || (c < 66432 - ? (c >= 66384 && c <= 66421) - : c <= 66461))) - : (c <= 66499 || (c < 66736 - ? (c < 66560 - ? (c >= 66504 && c <= 66511) - : c <= 66717) - : (c <= 66771 || (c < 66816 - ? (c >= 66776 && c <= 66811) - : c <= 66855))))))) - : (c <= 66915 || (c < 67506 - ? (c < 66995 - ? (c < 66964 - ? (c < 66940 - ? (c >= 66928 && c <= 66938) - : (c <= 66954 || (c >= 66956 && c <= 66962))) - : (c <= 66965 || (c < 66979 - ? (c >= 66967 && c <= 66977) - : c <= 66993))) - : (c <= 67001 || (c < 67424 - ? (c < 67072 - ? (c >= 67003 && c <= 67004) - : (c <= 67382 || (c >= 67392 && c <= 67413))) - : (c <= 67431 || (c < 67463 - ? (c >= 67456 && c <= 67461) - : c <= 67504))))) - : (c <= 67514 || (c < 67680 - ? (c < 67639 - ? (c < 67592 - ? (c >= 67584 && c <= 67589) - : (c <= 67592 || (c >= 67594 && c <= 67637))) - : (c <= 67640 || (c < 67647 - ? c == 67644 - : c <= 67669))) - : (c <= 67702 || (c < 67828 - ? (c < 67808 - ? (c >= 67712 && c <= 67742) - : c <= 67826) - : (c <= 67829 || (c < 67872 - ? (c >= 67840 && c <= 67861) - : c <= 67883))))))))))))))); -} +static TSCharacterRange aux_sym_string_token1_character_set_1[] = { + {' ', ' '}, {'\'', '\''}, {',', '-'}, {':', ':'}, {'A', 'Z'}, {'a', 'z'}, {0xaa, 0xaa}, {0xb5, 0xb5}, + {0xba, 0xba}, {0xc0, 0xd6}, {0xd8, 0xf6}, {0xf8, 0x2c1}, {0x2c6, 0x2d1}, {0x2e0, 0x2e4}, {0x2ec, 0x2ec}, {0x2ee, 0x2ee}, + {0x370, 0x374}, {0x376, 0x377}, {0x37a, 0x37d}, {0x37f, 0x37f}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c}, {0x38e, 0x3a1}, + {0x3a3, 0x3f5}, {0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x559, 0x559}, {0x560, 0x588}, {0x5d0, 0x5ea}, {0x5ef, 0x5f2}, + {0x620, 0x64a}, {0x66e, 0x66f}, {0x671, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x6ee, 0x6ef}, {0x6fa, 0x6fc}, {0x6ff, 0x6ff}, + {0x710, 0x710}, {0x712, 0x72f}, {0x74d, 0x7a5}, {0x7b1, 0x7b1}, {0x7ca, 0x7ea}, {0x7f4, 0x7f5}, {0x7fa, 0x7fa}, {0x800, 0x815}, + {0x81a, 0x81a}, {0x824, 0x824}, {0x828, 0x828}, {0x840, 0x858}, {0x860, 0x86a}, {0x870, 0x887}, {0x889, 0x88e}, {0x8a0, 0x8c9}, + {0x904, 0x939}, {0x93d, 0x93d}, {0x950, 0x950}, {0x958, 0x961}, {0x971, 0x980}, {0x985, 0x98c}, {0x98f, 0x990}, {0x993, 0x9a8}, + {0x9aa, 0x9b0}, {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, {0x9bd, 0x9bd}, {0x9ce, 0x9ce}, {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, + {0x9fc, 0x9fc}, {0xa05, 0xa0a}, {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, {0xa35, 0xa36}, {0xa38, 0xa39}, + {0xa59, 0xa5c}, {0xa5e, 0xa5e}, {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, + {0xab5, 0xab9}, {0xabd, 0xabd}, {0xad0, 0xad0}, {0xae0, 0xae1}, {0xaf9, 0xaf9}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, {0xb13, 0xb28}, + {0xb2a, 0xb30}, {0xb32, 0xb33}, {0xb35, 0xb39}, {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb71, 0xb71}, {0xb83, 0xb83}, + {0xb85, 0xb8a}, {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, + {0xbae, 0xbb9}, {0xbd0, 0xbd0}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc3d, 0xc3d}, {0xc58, 0xc5a}, + {0xc5d, 0xc5d}, {0xc60, 0xc61}, {0xc80, 0xc80}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, + {0xcbd, 0xcbd}, {0xcdd, 0xcde}, {0xce0, 0xce1}, {0xcf1, 0xcf2}, {0xd04, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd3d, 0xd3d}, + {0xd4e, 0xd4e}, {0xd54, 0xd56}, {0xd5f, 0xd61}, {0xd7a, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdbd, 0xdbd}, + {0xdc0, 0xdc6}, {0xe01, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe46}, {0xe81, 0xe82}, {0xe84, 0xe84}, {0xe86, 0xe8a}, {0xe8c, 0xea3}, + {0xea5, 0xea5}, {0xea7, 0xeb0}, {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xec6, 0xec6}, {0xedc, 0xedf}, {0xf00, 0xf00}, + {0xf40, 0xf47}, {0xf49, 0xf6c}, {0xf88, 0xf8c}, {0x1000, 0x102a}, {0x103f, 0x103f}, {0x1050, 0x1055}, {0x105a, 0x105d}, {0x1061, 0x1061}, + {0x1065, 0x1066}, {0x106e, 0x1070}, {0x1075, 0x1081}, {0x108e, 0x108e}, {0x10a0, 0x10c5}, {0x10c7, 0x10c7}, {0x10cd, 0x10cd}, {0x10d0, 0x10fa}, + {0x10fc, 0x1248}, {0x124a, 0x124d}, {0x1250, 0x1256}, {0x1258, 0x1258}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, + {0x12b2, 0x12b5}, {0x12b8, 0x12be}, {0x12c0, 0x12c0}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, + {0x1380, 0x138f}, {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x16f1, 0x16f8}, + {0x1700, 0x1711}, {0x171f, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, {0x17d7, 0x17d7}, {0x17dc, 0x17dc}, + {0x1820, 0x1878}, {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18aa, 0x18aa}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, + {0x1980, 0x19ab}, {0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1aa7, 0x1aa7}, {0x1b05, 0x1b33}, {0x1b45, 0x1b4c}, {0x1b83, 0x1ba0}, + {0x1bae, 0x1baf}, {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1c90, 0x1cba}, {0x1cbd, 0x1cbf}, + {0x1ce9, 0x1cec}, {0x1cee, 0x1cf3}, {0x1cf5, 0x1cf6}, {0x1cfa, 0x1cfa}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, + {0x1f48, 0x1f4d}, {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, + {0x1fbe, 0x1fbe}, {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, + {0x2071, 0x2071}, {0x207f, 0x207f}, {0x2090, 0x209c}, {0x2102, 0x2102}, {0x2107, 0x2107}, {0x210a, 0x2113}, {0x2115, 0x2115}, {0x2119, 0x211d}, + {0x2124, 0x2124}, {0x2126, 0x2126}, {0x2128, 0x2128}, {0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, {0x214e, 0x214e}, + {0x2183, 0x2184}, {0x2c00, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2cf2, 0x2cf3}, {0x2d00, 0x2d25}, {0x2d27, 0x2d27}, {0x2d2d, 0x2d2d}, {0x2d30, 0x2d67}, + {0x2d6f, 0x2d6f}, {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, + {0x2dd0, 0x2dd6}, {0x2dd8, 0x2dde}, {0x2e2f, 0x2e2f}, {0x3005, 0x3006}, {0x3031, 0x3035}, {0x303b, 0x303c}, {0x3041, 0x3096}, {0x309d, 0x309f}, + {0x30a1, 0x30fa}, {0x30fc, 0x30ff}, {0x3105, 0x312f}, {0x3131, 0x318e}, {0x31a0, 0x31bf}, {0x31f0, 0x31ff}, {0x3400, 0x3400}, {0x4dbf, 0x4dbf}, + {0x4e00, 0x4e00}, {0x9fff, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa62a, 0xa62b}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, + {0xa6a0, 0xa6e5}, {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ca}, {0xa7d0, 0xa7d1}, {0xa7d3, 0xa7d3}, {0xa7d5, 0xa7d9}, {0xa7f2, 0xa801}, + {0xa803, 0xa805}, {0xa807, 0xa80a}, {0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, {0xa8fb, 0xa8fb}, {0xa8fd, 0xa8fe}, + {0xa90a, 0xa925}, {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, {0xa9cf, 0xa9cf}, {0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, + {0xaa00, 0xaa28}, {0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7a, 0xaa7a}, {0xaa7e, 0xaaaf}, {0xaab1, 0xaab1}, {0xaab5, 0xaab6}, + {0xaab9, 0xaabd}, {0xaac0, 0xaac0}, {0xaac2, 0xaac2}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06}, {0xab09, 0xab0e}, + {0xab11, 0xab16}, {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab69}, {0xab70, 0xabe2}, {0xac00, 0xac00}, {0xd7a3, 0xd7a3}, + {0xd7b0, 0xd7c6}, {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb1d}, {0xfb1f, 0xfb28}, + {0xfb2a, 0xfb36}, {0xfb38, 0xfb3c}, {0xfb3e, 0xfb3e}, {0xfb40, 0xfb41}, {0xfb43, 0xfb44}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, + {0xfd92, 0xfdc7}, {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7}, + {0xffca, 0xffcf}, {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003c, 0x1003d}, {0x1003f, 0x1004d}, + {0x10050, 0x1005d}, {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0}, {0x10300, 0x1031f}, {0x1032d, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375}, + {0x10380, 0x1039d}, {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563}, + {0x10570, 0x1057a}, {0x1057c, 0x1058a}, {0x1058c, 0x10592}, {0x10594, 0x10595}, {0x10597, 0x105a1}, {0x105a3, 0x105b1}, {0x105b3, 0x105b9}, {0x105bb, 0x105bc}, + {0x10600, 0x10736}, {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10780, 0x10785}, {0x10787, 0x107b0}, {0x107b2, 0x107ba}, {0x10800, 0x10805}, {0x10808, 0x10808}, + {0x1080a, 0x10835}, {0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x10855}, {0x10860, 0x10876}, {0x10880, 0x1089e}, {0x108e0, 0x108f2}, {0x108f4, 0x108f5}, + {0x10900, 0x10915}, +}; -static inline bool aux_sym_string_token1_character_set_2(int32_t c) { - return (c < 6576 - ? (c < 2972 - ? (c < 2185 - ? (c < 1329 - ? (c < 736 - ? (c < 170 - ? (c < ':' - ? (c < '\'' - ? c == ' ' - : (c <= '\'' || (c >= ',' && c <= '-'))) - : (c <= ':' || (c < 'a' - ? (c >= 'A' && c <= 'Z') - : c <= 'z'))) - : (c <= 170 || (c < 216 - ? (c < 186 - ? c == 181 - : (c <= 186 || (c >= 192 && c <= 214))) - : (c <= 246 || (c < 710 - ? (c >= 248 && c <= 705) - : c <= 721))))) - : (c <= 740 || (c < 902 - ? (c < 886 - ? (c < 750 - ? c == 748 - : (c <= 750 || (c >= 880 && c <= 884))) - : (c <= 887 || (c < 895 - ? (c >= 890 && c <= 893) - : c <= 895))) - : (c <= 902 || (c < 931 - ? (c < 908 - ? (c >= 904 && c <= 906) - : (c <= 908 || (c >= 910 && c <= 929))) - : (c <= 1013 || (c < 1162 - ? (c >= 1015 && c <= 1153) - : c <= 1327))))))) - : (c <= 1366 || (c < 1810 - ? (c < 1649 - ? (c < 1519 - ? (c < 1376 - ? c == 1369 - : (c <= 1416 || (c >= 1488 && c <= 1514))) - : (c <= 1522 || (c < 1646 - ? (c >= 1568 && c <= 1610) - : c <= 1647))) - : (c <= 1747 || (c < 1786 - ? (c < 1765 - ? c == 1749 - : (c <= 1766 || (c >= 1774 && c <= 1775))) - : (c <= 1788 || (c < 1808 - ? c == 1791 - : c <= 1808))))) - : (c <= 1839 || (c < 2074 - ? (c < 2036 - ? (c < 1969 - ? (c >= 1869 && c <= 1957) - : (c <= 1969 || (c >= 1994 && c <= 2026))) - : (c <= 2037 || (c < 2048 - ? c == 2042 - : c <= 2069))) - : (c <= 2074 || (c < 2112 - ? (c < 2088 - ? c == 2084 - : c <= 2088) - : (c <= 2136 || (c < 2160 - ? (c >= 2144 && c <= 2154) - : c <= 2183))))))))) - : (c <= 2190 || (c < 2654 - ? (c < 2510 - ? (c < 2437 - ? (c < 2384 - ? (c < 2308 - ? (c >= 2208 && c <= 2249) - : (c <= 2361 || c == 2365)) - : (c <= 2384 || (c < 2417 - ? (c >= 2392 && c <= 2401) - : c <= 2432))) - : (c <= 2444 || (c < 2482 - ? (c < 2451 - ? (c >= 2447 && c <= 2448) - : (c <= 2472 || (c >= 2474 && c <= 2480))) - : (c <= 2482 || (c < 2493 - ? (c >= 2486 && c <= 2489) - : c <= 2493))))) - : (c <= 2510 || (c < 2579 - ? (c < 2556 - ? (c < 2527 - ? (c >= 2524 && c <= 2525) - : (c <= 2529 || (c >= 2544 && c <= 2545))) - : (c <= 2556 || (c < 2575 - ? (c >= 2565 && c <= 2570) - : c <= 2576))) - : (c <= 2600 || (c < 2613 - ? (c < 2610 - ? (c >= 2602 && c <= 2608) - : c <= 2611) - : (c <= 2614 || (c < 2649 - ? (c >= 2616 && c <= 2617) - : c <= 2652))))))) - : (c <= 2654 || (c < 2835 - ? (c < 2741 - ? (c < 2707 - ? (c < 2693 - ? (c >= 2674 && c <= 2676) - : (c <= 2701 || (c >= 2703 && c <= 2705))) - : (c <= 2728 || (c < 2738 - ? (c >= 2730 && c <= 2736) - : c <= 2739))) - : (c <= 2745 || (c < 2809 - ? (c < 2768 - ? c == 2749 - : (c <= 2768 || (c >= 2784 && c <= 2785))) - : (c <= 2809 || (c < 2831 - ? (c >= 2821 && c <= 2828) - : c <= 2832))))) - : (c <= 2856 || (c < 2929 - ? (c < 2877 - ? (c < 2866 - ? (c >= 2858 && c <= 2864) - : (c <= 2867 || (c >= 2869 && c <= 2873))) - : (c <= 2877 || (c < 2911 - ? (c >= 2908 && c <= 2909) - : c <= 2913))) - : (c <= 2929 || (c < 2958 - ? (c < 2949 - ? c == 2947 - : c <= 2954) - : (c <= 2960 || (c < 2969 - ? (c >= 2962 && c <= 2965) - : c <= 2970))))))))))) - : (c <= 2972 || (c < 4096 - ? (c < 3406 - ? (c < 3200 - ? (c < 3086 - ? (c < 2990 - ? (c < 2979 - ? (c >= 2974 && c <= 2975) - : (c <= 2980 || (c >= 2984 && c <= 2986))) - : (c <= 3001 || (c < 3077 - ? c == 3024 - : c <= 3084))) - : (c <= 3088 || (c < 3160 - ? (c < 3114 - ? (c >= 3090 && c <= 3112) - : (c <= 3129 || c == 3133)) - : (c <= 3162 || (c < 3168 - ? c == 3165 - : c <= 3169))))) - : (c <= 3200 || (c < 3293 - ? (c < 3242 - ? (c < 3214 - ? (c >= 3205 && c <= 3212) - : (c <= 3216 || (c >= 3218 && c <= 3240))) - : (c <= 3251 || (c < 3261 - ? (c >= 3253 && c <= 3257) - : c <= 3261))) - : (c <= 3294 || (c < 3342 - ? (c < 3313 - ? (c >= 3296 && c <= 3297) - : (c <= 3314 || (c >= 3332 && c <= 3340))) - : (c <= 3344 || (c < 3389 - ? (c >= 3346 && c <= 3386) - : c <= 3389))))))) - : (c <= 3406 || (c < 3718 - ? (c < 3517 - ? (c < 3461 - ? (c < 3423 - ? (c >= 3412 && c <= 3414) - : (c <= 3425 || (c >= 3450 && c <= 3455))) - : (c <= 3478 || (c < 3507 - ? (c >= 3482 && c <= 3505) - : c <= 3515))) - : (c <= 3517 || (c < 3648 - ? (c < 3585 - ? (c >= 3520 && c <= 3526) - : (c <= 3632 || (c >= 3634 && c <= 3635))) - : (c <= 3654 || (c < 3716 - ? (c >= 3713 && c <= 3714) - : c <= 3716))))) - : (c <= 3722 || (c < 3782 - ? (c < 3762 - ? (c < 3749 - ? (c >= 3724 && c <= 3747) - : (c <= 3749 || (c >= 3751 && c <= 3760))) - : (c <= 3763 || (c < 3776 - ? c == 3773 - : c <= 3780))) - : (c <= 3782 || (c < 3904 - ? (c < 3840 - ? (c >= 3804 && c <= 3807) - : c <= 3840) - : (c <= 3911 || (c < 3976 - ? (c >= 3913 && c <= 3948) - : c <= 3980))))))))) - : (c <= 4138 || (c < 4882 - ? (c < 4682 - ? (c < 4213 - ? (c < 4193 - ? (c < 4176 - ? c == 4159 - : (c <= 4181 || (c >= 4186 && c <= 4189))) - : (c <= 4193 || (c < 4206 - ? (c >= 4197 && c <= 4198) - : c <= 4208))) - : (c <= 4225 || (c < 4301 - ? (c < 4256 - ? c == 4238 - : (c <= 4293 || c == 4295)) - : (c <= 4301 || (c < 4348 - ? (c >= 4304 && c <= 4346) - : c <= 4680))))) - : (c <= 4685 || (c < 4786 - ? (c < 4704 - ? (c < 4696 - ? (c >= 4688 && c <= 4694) - : (c <= 4696 || (c >= 4698 && c <= 4701))) - : (c <= 4744 || (c < 4752 - ? (c >= 4746 && c <= 4749) - : c <= 4784))) - : (c <= 4789 || (c < 4802 - ? (c < 4800 - ? (c >= 4792 && c <= 4798) - : c <= 4800) - : (c <= 4805 || (c < 4824 - ? (c >= 4808 && c <= 4822) - : c <= 4880))))))) - : (c <= 4885 || (c < 5998 - ? (c < 5761 - ? (c < 5112 - ? (c < 4992 - ? (c >= 4888 && c <= 4954) - : (c <= 5007 || (c >= 5024 && c <= 5109))) - : (c <= 5117 || (c < 5743 - ? (c >= 5121 && c <= 5740) - : c <= 5759))) - : (c <= 5786 || (c < 5919 - ? (c < 5873 - ? (c >= 5792 && c <= 5866) - : (c <= 5880 || (c >= 5888 && c <= 5905))) - : (c <= 5937 || (c < 5984 - ? (c >= 5952 && c <= 5969) - : c <= 5996))))) - : (c <= 6000 || (c < 6314 - ? (c < 6176 - ? (c < 6103 - ? (c >= 6016 && c <= 6067) - : (c <= 6103 || c == 6108)) - : (c <= 6264 || (c < 6279 - ? (c >= 6272 && c <= 6276) - : c <= 6312))) - : (c <= 6314 || (c < 6480 - ? (c < 6400 - ? (c >= 6320 && c <= 6389) - : c <= 6430) - : (c <= 6509 || (c < 6528 - ? (c >= 6512 && c <= 6516) - : c <= 6571))))))))))))) - : (c <= 6601 || (c < 43259 - ? (c < 8579 - ? (c < 8031 - ? (c < 7357 - ? (c < 7086 - ? (c < 6917 - ? (c < 6688 - ? (c >= 6656 && c <= 6678) - : (c <= 6740 || c == 6823)) - : (c <= 6963 || (c < 7043 - ? (c >= 6981 && c <= 6988) - : c <= 7072))) - : (c <= 7087 || (c < 7258 - ? (c < 7168 - ? (c >= 7098 && c <= 7141) - : (c <= 7203 || (c >= 7245 && c <= 7247))) - : (c <= 7293 || (c < 7312 - ? (c >= 7296 && c <= 7304) - : c <= 7354))))) - : (c <= 7359 || (c < 7960 - ? (c < 7418 - ? (c < 7406 - ? (c >= 7401 && c <= 7404) - : (c <= 7411 || (c >= 7413 && c <= 7414))) - : (c <= 7418 || (c < 7680 - ? (c >= 7424 && c <= 7615) - : c <= 7957))) - : (c <= 7965 || (c < 8025 - ? (c < 8008 - ? (c >= 7968 && c <= 8005) - : (c <= 8013 || (c >= 8016 && c <= 8023))) - : (c <= 8025 || (c < 8029 - ? c == 8027 - : c <= 8029))))))) - : (c <= 8061 || (c < 8450 - ? (c < 8150 - ? (c < 8130 - ? (c < 8118 - ? (c >= 8064 && c <= 8116) - : (c <= 8124 || c == 8126)) - : (c <= 8132 || (c < 8144 - ? (c >= 8134 && c <= 8140) - : c <= 8147))) - : (c <= 8155 || (c < 8305 - ? (c < 8178 - ? (c >= 8160 && c <= 8172) - : (c <= 8180 || (c >= 8182 && c <= 8188))) - : (c <= 8305 || (c < 8336 - ? c == 8319 - : c <= 8348))))) - : (c <= 8450 || (c < 8488 - ? (c < 8473 - ? (c < 8458 - ? c == 8455 - : (c <= 8467 || c == 8469)) - : (c <= 8477 || (c < 8486 - ? c == 8484 - : c <= 8486))) - : (c <= 8488 || (c < 8508 - ? (c < 8495 - ? (c >= 8490 && c <= 8493) - : c <= 8505) - : (c <= 8511 || (c < 8526 - ? (c >= 8517 && c <= 8521) - : c <= 8526))))))))) - : (c <= 8580 || (c < 12593 - ? (c < 11712 - ? (c < 11568 - ? (c < 11520 - ? (c < 11499 - ? (c >= 11264 && c <= 11492) - : (c <= 11502 || (c >= 11506 && c <= 11507))) - : (c <= 11557 || (c < 11565 - ? c == 11559 - : c <= 11565))) - : (c <= 11623 || (c < 11688 - ? (c < 11648 - ? c == 11631 - : (c <= 11670 || (c >= 11680 && c <= 11686))) - : (c <= 11694 || (c < 11704 - ? (c >= 11696 && c <= 11702) - : c <= 11710))))) - : (c <= 11718 || (c < 12347 - ? (c < 11823 - ? (c < 11728 - ? (c >= 11720 && c <= 11726) - : (c <= 11734 || (c >= 11736 && c <= 11742))) - : (c <= 11823 || (c < 12337 - ? (c >= 12293 && c <= 12294) - : c <= 12341))) - : (c <= 12348 || (c < 12449 - ? (c < 12445 - ? (c >= 12353 && c <= 12438) - : c <= 12447) - : (c <= 12538 || (c < 12549 - ? (c >= 12540 && c <= 12543) - : c <= 12591))))))) - : (c <= 12686 || (c < 42775 - ? (c < 42192 - ? (c < 19903 - ? (c < 12784 - ? (c >= 12704 && c <= 12735) - : (c <= 12799 || c == 13312)) - : (c <= 19903 || (c < 40959 - ? c == 19968 - : c <= 42124))) - : (c <= 42237 || (c < 42560 - ? (c < 42512 - ? (c >= 42240 && c <= 42508) - : (c <= 42527 || (c >= 42538 && c <= 42539))) - : (c <= 42606 || (c < 42656 - ? (c >= 42623 && c <= 42653) - : c <= 42725))))) - : (c <= 42783 || (c < 43011 - ? (c < 42963 - ? (c < 42891 - ? (c >= 42786 && c <= 42888) - : (c <= 42954 || (c >= 42960 && c <= 42961))) - : (c <= 42963 || (c < 42994 - ? (c >= 42965 && c <= 42969) - : c <= 43009))) - : (c <= 43013 || (c < 43072 - ? (c < 43020 - ? (c >= 43015 && c <= 43018) - : c <= 43042) - : (c <= 43123 || (c < 43250 - ? (c >= 43138 && c <= 43187) - : c <= 43255))))))))))) - : (c <= 43259 || (c < 65313 - ? (c < 43808 - ? (c < 43642 - ? (c < 43488 - ? (c < 43360 - ? (c < 43274 - ? (c >= 43261 && c <= 43262) - : (c <= 43301 || (c >= 43312 && c <= 43334))) - : (c <= 43388 || (c < 43471 - ? (c >= 43396 && c <= 43442) - : c <= 43471))) - : (c <= 43492 || (c < 43584 - ? (c < 43514 - ? (c >= 43494 && c <= 43503) - : (c <= 43518 || (c >= 43520 && c <= 43560))) - : (c <= 43586 || (c < 43616 - ? (c >= 43588 && c <= 43595) - : c <= 43638))))) - : (c <= 43642 || (c < 43739 - ? (c < 43705 - ? (c < 43697 - ? (c >= 43646 && c <= 43695) - : (c <= 43697 || (c >= 43701 && c <= 43702))) - : (c <= 43709 || (c < 43714 - ? c == 43712 - : c <= 43714))) - : (c <= 43741 || (c < 43777 - ? (c < 43762 - ? (c >= 43744 && c <= 43754) - : c <= 43764) - : (c <= 43782 || (c < 43793 - ? (c >= 43785 && c <= 43790) - : c <= 43798))))))) - : (c <= 43814 || (c < 64287 - ? (c < 55216 - ? (c < 43888 - ? (c < 43824 - ? (c >= 43816 && c <= 43822) - : (c <= 43866 || (c >= 43868 && c <= 43881))) - : (c <= 44002 || (c < 55203 - ? c == 44032 - : c <= 55203))) - : (c <= 55238 || (c < 64256 - ? (c < 63744 - ? (c >= 55243 && c <= 55291) - : (c <= 64109 || (c >= 64112 && c <= 64217))) - : (c <= 64262 || (c < 64285 - ? (c >= 64275 && c <= 64279) - : c <= 64285))))) - : (c <= 64296 || (c < 64467 - ? (c < 64320 - ? (c < 64312 - ? (c >= 64298 && c <= 64310) - : (c <= 64316 || c == 64318)) - : (c <= 64321 || (c < 64326 - ? (c >= 64323 && c <= 64324) - : c <= 64433))) - : (c <= 64829 || (c < 65008 - ? (c < 64914 - ? (c >= 64848 && c <= 64911) - : c <= 64967) - : (c <= 65019 || (c < 65142 - ? (c >= 65136 && c <= 65140) - : c <= 65276))))))))) - : (c <= 65338 || (c < 66864 - ? (c < 66176 - ? (c < 65536 - ? (c < 65482 - ? (c < 65382 - ? (c >= 65345 && c <= 65370) - : (c <= 65470 || (c >= 65474 && c <= 65479))) - : (c <= 65487 || (c < 65498 - ? (c >= 65490 && c <= 65495) - : c <= 65500))) - : (c <= 65547 || (c < 65599 - ? (c < 65576 - ? (c >= 65549 && c <= 65574) - : (c <= 65594 || (c >= 65596 && c <= 65597))) - : (c <= 65613 || (c < 65664 - ? (c >= 65616 && c <= 65629) - : c <= 65786))))) - : (c <= 66204 || (c < 66464 - ? (c < 66370 - ? (c < 66304 - ? (c >= 66208 && c <= 66256) - : (c <= 66335 || (c >= 66349 && c <= 66368))) - : (c <= 66377 || (c < 66432 - ? (c >= 66384 && c <= 66421) - : c <= 66461))) - : (c <= 66499 || (c < 66736 - ? (c < 66560 - ? (c >= 66504 && c <= 66511) - : c <= 66717) - : (c <= 66771 || (c < 66816 - ? (c >= 66776 && c <= 66811) - : c <= 66855))))))) - : (c <= 66915 || (c < 67506 - ? (c < 66995 - ? (c < 66964 - ? (c < 66940 - ? (c >= 66928 && c <= 66938) - : (c <= 66954 || (c >= 66956 && c <= 66962))) - : (c <= 66965 || (c < 66979 - ? (c >= 66967 && c <= 66977) - : c <= 66993))) - : (c <= 67001 || (c < 67424 - ? (c < 67072 - ? (c >= 67003 && c <= 67004) - : (c <= 67382 || (c >= 67392 && c <= 67413))) - : (c <= 67431 || (c < 67463 - ? (c >= 67456 && c <= 67461) - : c <= 67504))))) - : (c <= 67514 || (c < 67680 - ? (c < 67639 - ? (c < 67592 - ? (c >= 67584 && c <= 67589) - : (c <= 67592 || (c >= 67594 && c <= 67637))) - : (c <= 67640 || (c < 67647 - ? c == 67644 - : c <= 67669))) - : (c <= 67702 || (c < 67828 - ? (c < 67808 - ? (c >= 67712 && c <= 67742) - : c <= 67826) - : (c <= 67829 || (c < 67872 - ? (c >= 67840 && c <= 67861) - : c <= 67883))))))))))))))); -} +static TSCharacterRange aux_sym_string_token2_character_set_1[] = { + {'\'', '\''}, {',', '-'}, {':', ':'}, {'A', 'Z'}, {'a', 'z'}, {0xaa, 0xaa}, {0xb5, 0xb5}, {0xba, 0xba}, + {0xc0, 0xd6}, {0xd8, 0xf6}, {0xf8, 0x2c1}, {0x2c6, 0x2d1}, {0x2e0, 0x2e4}, {0x2ec, 0x2ec}, {0x2ee, 0x2ee}, {0x370, 0x374}, + {0x376, 0x377}, {0x37a, 0x37d}, {0x37f, 0x37f}, {0x386, 0x386}, {0x388, 0x38a}, {0x38c, 0x38c}, {0x38e, 0x3a1}, {0x3a3, 0x3f5}, + {0x3f7, 0x481}, {0x48a, 0x52f}, {0x531, 0x556}, {0x559, 0x559}, {0x560, 0x588}, {0x5d0, 0x5ea}, {0x5ef, 0x5f2}, {0x620, 0x64a}, + {0x66e, 0x66f}, {0x671, 0x6d3}, {0x6d5, 0x6d5}, {0x6e5, 0x6e6}, {0x6ee, 0x6ef}, {0x6fa, 0x6fc}, {0x6ff, 0x6ff}, {0x710, 0x710}, + {0x712, 0x72f}, {0x74d, 0x7a5}, {0x7b1, 0x7b1}, {0x7ca, 0x7ea}, {0x7f4, 0x7f5}, {0x7fa, 0x7fa}, {0x800, 0x815}, {0x81a, 0x81a}, + {0x824, 0x824}, {0x828, 0x828}, {0x840, 0x858}, {0x860, 0x86a}, {0x870, 0x887}, {0x889, 0x88e}, {0x8a0, 0x8c9}, {0x904, 0x939}, + {0x93d, 0x93d}, {0x950, 0x950}, {0x958, 0x961}, {0x971, 0x980}, {0x985, 0x98c}, {0x98f, 0x990}, {0x993, 0x9a8}, {0x9aa, 0x9b0}, + {0x9b2, 0x9b2}, {0x9b6, 0x9b9}, {0x9bd, 0x9bd}, {0x9ce, 0x9ce}, {0x9dc, 0x9dd}, {0x9df, 0x9e1}, {0x9f0, 0x9f1}, {0x9fc, 0x9fc}, + {0xa05, 0xa0a}, {0xa0f, 0xa10}, {0xa13, 0xa28}, {0xa2a, 0xa30}, {0xa32, 0xa33}, {0xa35, 0xa36}, {0xa38, 0xa39}, {0xa59, 0xa5c}, + {0xa5e, 0xa5e}, {0xa72, 0xa74}, {0xa85, 0xa8d}, {0xa8f, 0xa91}, {0xa93, 0xaa8}, {0xaaa, 0xab0}, {0xab2, 0xab3}, {0xab5, 0xab9}, + {0xabd, 0xabd}, {0xad0, 0xad0}, {0xae0, 0xae1}, {0xaf9, 0xaf9}, {0xb05, 0xb0c}, {0xb0f, 0xb10}, {0xb13, 0xb28}, {0xb2a, 0xb30}, + {0xb32, 0xb33}, {0xb35, 0xb39}, {0xb3d, 0xb3d}, {0xb5c, 0xb5d}, {0xb5f, 0xb61}, {0xb71, 0xb71}, {0xb83, 0xb83}, {0xb85, 0xb8a}, + {0xb8e, 0xb90}, {0xb92, 0xb95}, {0xb99, 0xb9a}, {0xb9c, 0xb9c}, {0xb9e, 0xb9f}, {0xba3, 0xba4}, {0xba8, 0xbaa}, {0xbae, 0xbb9}, + {0xbd0, 0xbd0}, {0xc05, 0xc0c}, {0xc0e, 0xc10}, {0xc12, 0xc28}, {0xc2a, 0xc39}, {0xc3d, 0xc3d}, {0xc58, 0xc5a}, {0xc5d, 0xc5d}, + {0xc60, 0xc61}, {0xc80, 0xc80}, {0xc85, 0xc8c}, {0xc8e, 0xc90}, {0xc92, 0xca8}, {0xcaa, 0xcb3}, {0xcb5, 0xcb9}, {0xcbd, 0xcbd}, + {0xcdd, 0xcde}, {0xce0, 0xce1}, {0xcf1, 0xcf2}, {0xd04, 0xd0c}, {0xd0e, 0xd10}, {0xd12, 0xd3a}, {0xd3d, 0xd3d}, {0xd4e, 0xd4e}, + {0xd54, 0xd56}, {0xd5f, 0xd61}, {0xd7a, 0xd7f}, {0xd85, 0xd96}, {0xd9a, 0xdb1}, {0xdb3, 0xdbb}, {0xdbd, 0xdbd}, {0xdc0, 0xdc6}, + {0xe01, 0xe30}, {0xe32, 0xe33}, {0xe40, 0xe46}, {0xe81, 0xe82}, {0xe84, 0xe84}, {0xe86, 0xe8a}, {0xe8c, 0xea3}, {0xea5, 0xea5}, + {0xea7, 0xeb0}, {0xeb2, 0xeb3}, {0xebd, 0xebd}, {0xec0, 0xec4}, {0xec6, 0xec6}, {0xedc, 0xedf}, {0xf00, 0xf00}, {0xf40, 0xf47}, + {0xf49, 0xf6c}, {0xf88, 0xf8c}, {0x1000, 0x102a}, {0x103f, 0x103f}, {0x1050, 0x1055}, {0x105a, 0x105d}, {0x1061, 0x1061}, {0x1065, 0x1066}, + {0x106e, 0x1070}, {0x1075, 0x1081}, {0x108e, 0x108e}, {0x10a0, 0x10c5}, {0x10c7, 0x10c7}, {0x10cd, 0x10cd}, {0x10d0, 0x10fa}, {0x10fc, 0x1248}, + {0x124a, 0x124d}, {0x1250, 0x1256}, {0x1258, 0x1258}, {0x125a, 0x125d}, {0x1260, 0x1288}, {0x128a, 0x128d}, {0x1290, 0x12b0}, {0x12b2, 0x12b5}, + {0x12b8, 0x12be}, {0x12c0, 0x12c0}, {0x12c2, 0x12c5}, {0x12c8, 0x12d6}, {0x12d8, 0x1310}, {0x1312, 0x1315}, {0x1318, 0x135a}, {0x1380, 0x138f}, + {0x13a0, 0x13f5}, {0x13f8, 0x13fd}, {0x1401, 0x166c}, {0x166f, 0x167f}, {0x1681, 0x169a}, {0x16a0, 0x16ea}, {0x16f1, 0x16f8}, {0x1700, 0x1711}, + {0x171f, 0x1731}, {0x1740, 0x1751}, {0x1760, 0x176c}, {0x176e, 0x1770}, {0x1780, 0x17b3}, {0x17d7, 0x17d7}, {0x17dc, 0x17dc}, {0x1820, 0x1878}, + {0x1880, 0x1884}, {0x1887, 0x18a8}, {0x18aa, 0x18aa}, {0x18b0, 0x18f5}, {0x1900, 0x191e}, {0x1950, 0x196d}, {0x1970, 0x1974}, {0x1980, 0x19ab}, + {0x19b0, 0x19c9}, {0x1a00, 0x1a16}, {0x1a20, 0x1a54}, {0x1aa7, 0x1aa7}, {0x1b05, 0x1b33}, {0x1b45, 0x1b4c}, {0x1b83, 0x1ba0}, {0x1bae, 0x1baf}, + {0x1bba, 0x1be5}, {0x1c00, 0x1c23}, {0x1c4d, 0x1c4f}, {0x1c5a, 0x1c7d}, {0x1c80, 0x1c88}, {0x1c90, 0x1cba}, {0x1cbd, 0x1cbf}, {0x1ce9, 0x1cec}, + {0x1cee, 0x1cf3}, {0x1cf5, 0x1cf6}, {0x1cfa, 0x1cfa}, {0x1d00, 0x1dbf}, {0x1e00, 0x1f15}, {0x1f18, 0x1f1d}, {0x1f20, 0x1f45}, {0x1f48, 0x1f4d}, + {0x1f50, 0x1f57}, {0x1f59, 0x1f59}, {0x1f5b, 0x1f5b}, {0x1f5d, 0x1f5d}, {0x1f5f, 0x1f7d}, {0x1f80, 0x1fb4}, {0x1fb6, 0x1fbc}, {0x1fbe, 0x1fbe}, + {0x1fc2, 0x1fc4}, {0x1fc6, 0x1fcc}, {0x1fd0, 0x1fd3}, {0x1fd6, 0x1fdb}, {0x1fe0, 0x1fec}, {0x1ff2, 0x1ff4}, {0x1ff6, 0x1ffc}, {0x2071, 0x2071}, + {0x207f, 0x207f}, {0x2090, 0x209c}, {0x2102, 0x2102}, {0x2107, 0x2107}, {0x210a, 0x2113}, {0x2115, 0x2115}, {0x2119, 0x211d}, {0x2124, 0x2124}, + {0x2126, 0x2126}, {0x2128, 0x2128}, {0x212a, 0x212d}, {0x212f, 0x2139}, {0x213c, 0x213f}, {0x2145, 0x2149}, {0x214e, 0x214e}, {0x2183, 0x2184}, + {0x2c00, 0x2ce4}, {0x2ceb, 0x2cee}, {0x2cf2, 0x2cf3}, {0x2d00, 0x2d25}, {0x2d27, 0x2d27}, {0x2d2d, 0x2d2d}, {0x2d30, 0x2d67}, {0x2d6f, 0x2d6f}, + {0x2d80, 0x2d96}, {0x2da0, 0x2da6}, {0x2da8, 0x2dae}, {0x2db0, 0x2db6}, {0x2db8, 0x2dbe}, {0x2dc0, 0x2dc6}, {0x2dc8, 0x2dce}, {0x2dd0, 0x2dd6}, + {0x2dd8, 0x2dde}, {0x2e2f, 0x2e2f}, {0x3005, 0x3006}, {0x3031, 0x3035}, {0x303b, 0x303c}, {0x3041, 0x3096}, {0x309d, 0x309f}, {0x30a1, 0x30fa}, + {0x30fc, 0x30ff}, {0x3105, 0x312f}, {0x3131, 0x318e}, {0x31a0, 0x31bf}, {0x31f0, 0x31ff}, {0x3400, 0x3400}, {0x4dbf, 0x4dbf}, {0x4e00, 0x4e00}, + {0x9fff, 0xa48c}, {0xa4d0, 0xa4fd}, {0xa500, 0xa60c}, {0xa610, 0xa61f}, {0xa62a, 0xa62b}, {0xa640, 0xa66e}, {0xa67f, 0xa69d}, {0xa6a0, 0xa6e5}, + {0xa717, 0xa71f}, {0xa722, 0xa788}, {0xa78b, 0xa7ca}, {0xa7d0, 0xa7d1}, {0xa7d3, 0xa7d3}, {0xa7d5, 0xa7d9}, {0xa7f2, 0xa801}, {0xa803, 0xa805}, + {0xa807, 0xa80a}, {0xa80c, 0xa822}, {0xa840, 0xa873}, {0xa882, 0xa8b3}, {0xa8f2, 0xa8f7}, {0xa8fb, 0xa8fb}, {0xa8fd, 0xa8fe}, {0xa90a, 0xa925}, + {0xa930, 0xa946}, {0xa960, 0xa97c}, {0xa984, 0xa9b2}, {0xa9cf, 0xa9cf}, {0xa9e0, 0xa9e4}, {0xa9e6, 0xa9ef}, {0xa9fa, 0xa9fe}, {0xaa00, 0xaa28}, + {0xaa40, 0xaa42}, {0xaa44, 0xaa4b}, {0xaa60, 0xaa76}, {0xaa7a, 0xaa7a}, {0xaa7e, 0xaaaf}, {0xaab1, 0xaab1}, {0xaab5, 0xaab6}, {0xaab9, 0xaabd}, + {0xaac0, 0xaac0}, {0xaac2, 0xaac2}, {0xaadb, 0xaadd}, {0xaae0, 0xaaea}, {0xaaf2, 0xaaf4}, {0xab01, 0xab06}, {0xab09, 0xab0e}, {0xab11, 0xab16}, + {0xab20, 0xab26}, {0xab28, 0xab2e}, {0xab30, 0xab5a}, {0xab5c, 0xab69}, {0xab70, 0xabe2}, {0xac00, 0xac00}, {0xd7a3, 0xd7a3}, {0xd7b0, 0xd7c6}, + {0xd7cb, 0xd7fb}, {0xf900, 0xfa6d}, {0xfa70, 0xfad9}, {0xfb00, 0xfb06}, {0xfb13, 0xfb17}, {0xfb1d, 0xfb1d}, {0xfb1f, 0xfb28}, {0xfb2a, 0xfb36}, + {0xfb38, 0xfb3c}, {0xfb3e, 0xfb3e}, {0xfb40, 0xfb41}, {0xfb43, 0xfb44}, {0xfb46, 0xfbb1}, {0xfbd3, 0xfd3d}, {0xfd50, 0xfd8f}, {0xfd92, 0xfdc7}, + {0xfdf0, 0xfdfb}, {0xfe70, 0xfe74}, {0xfe76, 0xfefc}, {0xff21, 0xff3a}, {0xff41, 0xff5a}, {0xff66, 0xffbe}, {0xffc2, 0xffc7}, {0xffca, 0xffcf}, + {0xffd2, 0xffd7}, {0xffda, 0xffdc}, {0x10000, 0x1000b}, {0x1000d, 0x10026}, {0x10028, 0x1003a}, {0x1003c, 0x1003d}, {0x1003f, 0x1004d}, {0x10050, 0x1005d}, + {0x10080, 0x100fa}, {0x10280, 0x1029c}, {0x102a0, 0x102d0}, {0x10300, 0x1031f}, {0x1032d, 0x10340}, {0x10342, 0x10349}, {0x10350, 0x10375}, {0x10380, 0x1039d}, + {0x103a0, 0x103c3}, {0x103c8, 0x103cf}, {0x10400, 0x1049d}, {0x104b0, 0x104d3}, {0x104d8, 0x104fb}, {0x10500, 0x10527}, {0x10530, 0x10563}, {0x10570, 0x1057a}, + {0x1057c, 0x1058a}, {0x1058c, 0x10592}, {0x10594, 0x10595}, {0x10597, 0x105a1}, {0x105a3, 0x105b1}, {0x105b3, 0x105b9}, {0x105bb, 0x105bc}, {0x10600, 0x10736}, + {0x10740, 0x10755}, {0x10760, 0x10767}, {0x10780, 0x10785}, {0x10787, 0x107b0}, {0x107b2, 0x107ba}, {0x10800, 0x10805}, {0x10808, 0x10808}, {0x1080a, 0x10835}, + {0x10837, 0x10838}, {0x1083c, 0x1083c}, {0x1083f, 0x10855}, {0x10860, 0x10876}, {0x10880, 0x1089e}, {0x108e0, 0x108f2}, {0x108f4, 0x108f5}, {0x10900, 0x10915}, +}; static bool ts_lex(TSLexer *lexer, TSStateId state) { START_LEXER(); @@ -2532,67 +1618,69 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { switch (state) { case 0: if (eof) ADVANCE(870); - if (lookahead == '\n') ADVANCE(1045); - if (lookahead == '\r') ADVANCE(3); - if (lookahead == '!') ADVANCE(944); - if (lookahead == '"') ADVANCE(949); - if (lookahead == '#') ADVANCE(1043); - if (lookahead == '-') ADVANCE(18); - if (lookahead == '0') ADVANCE(979); - if (lookahead == '1') ADVANCE(977); - if (lookahead == '2') ADVANCE(970); - if (lookahead == '3') ADVANCE(969); - if (lookahead == '4') ADVANCE(978); - if (lookahead == '<') ADVANCE(946); - if (lookahead == '=') ADVANCE(944); - if (lookahead == '>') ADVANCE(946); - if (lookahead == 'A') ADVANCE(976); - if (lookahead == 'B') ADVANCE(971); - if (lookahead == 'C') ADVANCE(375); - if (lookahead == 'D') ADVANCE(975); - if (lookahead == 'E') ADVANCE(436); - if (lookahead == 'F') ADVANCE(77); - if (lookahead == 'G') ADVANCE(974); - if (lookahead == 'H') ADVANCE(88); - if (lookahead == 'I') ADVANCE(197); - if (lookahead == 'K') ADVANCE(400); - if (lookahead == 'L') ADVANCE(381); - if (lookahead == 'M') ADVANCE(78); - if (lookahead == 'N') ADVANCE(580); - if (lookahead == 'O') ADVANCE(645); - if (lookahead == 'P') ADVANCE(257); - if (lookahead == 'Q') ADVANCE(815); - if (lookahead == 'R') ADVANCE(972); - if (lookahead == 'S') ADVANCE(152); - if (lookahead == 'T') ADVANCE(253); - if (lookahead == 'U') ADVANCE(143); - if (lookahead == 'W') ADVANCE(973); - if (lookahead == 'Y') ADVANCE(252); + ADVANCE_MAP( + '\n', 1045, + '\r', 3, + '!', 944, + '"', 949, + '#', 1043, + '-', 18, + '0', 979, + '1', 977, + '2', 970, + '3', 969, + '4', 978, + '<', 946, + '=', 944, + '>', 946, + 'A', 976, + 'B', 971, + 'C', 375, + 'D', 975, + 'E', 436, + 'F', 77, + 'G', 974, + 'H', 88, + 'I', 197, + 'K', 400, + 'L', 381, + 'M', 78, + 'N', 580, + 'O', 645, + 'P', 257, + 'Q', 815, + 'R', 972, + 'S', 152, + 'T', 253, + 'U', 143, + 'W', 973, + 'Y', 252, + ); if (lookahead == '\t' || - lookahead == ' ') SKIP(866) + lookahead == ' ') SKIP(866); if (lookahead == '5' || lookahead == '6') ADVANCE(980); if (('7' <= lookahead && lookahead <= '9')) ADVANCE(1026); END_STATE(); case 1: - if (lookahead == '\t') SKIP(16) + if (lookahead == '\t') SKIP(16); if (lookahead == ' ') ADVANCE(1020); if (lookahead == '#') ADVANCE(1021); - if (lookahead != 0 && - lookahead > 31 && + if (lookahead > ' ' && lookahead != '"' && + lookahead != '#' && lookahead != '*' && lookahead != '<' && lookahead != '>' && lookahead != '?' && lookahead != '|' && - (lookahead < 127 || 159 < lookahead)) ADVANCE(1022); + (lookahead < 0x7f || 0x9f < lookahead)) ADVANCE(1022); END_STATE(); case 2: - if (lookahead == '\t') SKIP(16) + if (lookahead == '\t') SKIP(16); if (lookahead == ' ') ADVANCE(1017); if (lookahead == '#') ADVANCE(1043); - if (aux_sym_string_token1_character_set_1(lookahead)) ADVANCE(1018); + if (set_contains(aux_sym_string_token2_character_set_1, 432, lookahead)) ADVANCE(1018); END_STATE(); case 3: if (lookahead == '\n') ADVANCE(1045); @@ -2606,9 +1694,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '=') ADVANCE(944); if (lookahead == '>') ADVANCE(946); if (lookahead == '\t' || - lookahead == ' ') SKIP(6) + lookahead == ' ') SKIP(6); if (('1' <= lookahead && lookahead <= '9')) ADVANCE(1026); - if (aux_sym_string_token1_character_set_1(lookahead)) ADVANCE(1019); + if (set_contains(aux_sym_string_token2_character_set_1, 432, lookahead)) ADVANCE(1019); END_STATE(); case 5: if (lookahead == '!') ADVANCE(944); @@ -2618,7 +1706,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '=') ADVANCE(944); if (lookahead == '>') ADVANCE(946); if (lookahead == '\t' || - lookahead == ' ') SKIP(7) + lookahead == ' ') SKIP(7); if (lookahead == 'A' || lookahead == 'B' || lookahead == 'D' || @@ -2635,9 +1723,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '=') ADVANCE(944); if (lookahead == '>') ADVANCE(946); if (lookahead == '\t' || - lookahead == ' ') SKIP(6) + lookahead == ' ') SKIP(6); if (('1' <= lookahead && lookahead <= '9')) ADVANCE(1026); - if (aux_sym_string_token1_character_set_1(lookahead)) ADVANCE(1019); + if (set_contains(aux_sym_string_token2_character_set_1, 432, lookahead)) ADVANCE(1019); END_STATE(); case 7: if (lookahead == '!') ADVANCE(944); @@ -2646,7 +1734,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '=') ADVANCE(944); if (lookahead == '>') ADVANCE(946); if (lookahead == '\t' || - lookahead == ' ') SKIP(7) + lookahead == ' ') SKIP(7); if (lookahead == 'A' || lookahead == 'B' || lookahead == 'D' || @@ -2659,44 +1747,48 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '"') ADVANCE(927); END_STATE(); case 9: - if (lookahead == '"') ADVANCE(948); - if (lookahead == '#') ADVANCE(1043); - if (lookahead == '1') ADVANCE(1028); - if (lookahead == 'A') ADVANCE(553); - if (lookahead == 'C') ADVANCE(717); - if (lookahead == 'D') ADVANCE(409); - if (lookahead == 'E') ADVANCE(479); - if (lookahead == 'H') ADVANCE(814); - if (lookahead == 'M') ADVANCE(100); - if (lookahead == 'N') ADVANCE(632); - if (lookahead == 'P') ADVANCE(373); - if (lookahead == 'R') ADVANCE(126); - if (lookahead == 'S') ADVANCE(365); - if (lookahead == 'U') ADVANCE(571); - if (lookahead == 'W') ADVANCE(89); + ADVANCE_MAP( + '"', 948, + '#', 1043, + '1', 1028, + 'A', 553, + 'C', 717, + 'D', 409, + 'E', 479, + 'H', 814, + 'M', 100, + 'N', 632, + 'P', 373, + 'R', 126, + 'S', 365, + 'U', 571, + 'W', 89, + ); if (lookahead == '\t' || - lookahead == ' ') SKIP(14) + lookahead == ' ') SKIP(14); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(1027); END_STATE(); case 10: - if (lookahead == '#') ADVANCE(1043); - if (lookahead == '-') ADVANCE(18); - if (lookahead == 'C') ADVANCE(728); - if (lookahead == 'E') ADVANCE(480); - if (lookahead == 'H') ADVANCE(841); - if (lookahead == 'N') ADVANCE(622); - if (lookahead == 'R') ADVANCE(329); - if (lookahead == 'S') ADVANCE(370); - if (lookahead == 'W') ADVANCE(138); + ADVANCE_MAP( + '#', 1043, + '-', 18, + 'C', 728, + 'E', 480, + 'H', 841, + 'N', 622, + 'R', 329, + 'S', 370, + 'W', 138, + ); if (lookahead == '\t' || - lookahead == ' ') SKIP(11) + lookahead == ' ') SKIP(11); if (('0' <= lookahead && lookahead <= '2')) ADVANCE(1039); END_STATE(); case 11: if (lookahead == '#') ADVANCE(1043); if (lookahead == '-') ADVANCE(18); if (lookahead == '\t' || - lookahead == ' ') SKIP(11) + lookahead == ' ') SKIP(11); if (('0' <= lookahead && lookahead <= '2')) ADVANCE(1039); END_STATE(); case 12: @@ -2705,7 +1797,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '1') ADVANCE(1038); if (lookahead == '2') ADVANCE(1035); if (lookahead == '\t' || - lookahead == ' ') SKIP(12) + lookahead == ' ') SKIP(12); if (('3' <= lookahead && lookahead <= '9')) ADVANCE(1037); END_STATE(); case 13: @@ -2713,42 +1805,44 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '0') ADVANCE(1029); if (lookahead == '3') ADVANCE(1031); if (lookahead == '\t' || - lookahead == ' ') SKIP(13) + lookahead == ' ') SKIP(13); if (lookahead == '1' || lookahead == '2') ADVANCE(1033); if (('4' <= lookahead && lookahead <= '9')) ADVANCE(1032); END_STATE(); case 14: - if (lookahead == '#') ADVANCE(1043); - if (lookahead == '1') ADVANCE(1028); - if (lookahead == 'C') ADVANCE(717); - if (lookahead == 'E') ADVANCE(479); - if (lookahead == 'H') ADVANCE(814); - if (lookahead == 'N') ADVANCE(618); - if (lookahead == 'R') ADVANCE(311); - if (lookahead == 'S') ADVANCE(364); - if (lookahead == 'W') ADVANCE(89); + ADVANCE_MAP( + '#', 1043, + '1', 1028, + 'C', 717, + 'E', 479, + 'H', 814, + 'N', 618, + 'R', 311, + 'S', 364, + 'W', 89, + ); if (lookahead == '\t' || - lookahead == ' ') SKIP(14) + lookahead == ' ') SKIP(14); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(1027); END_STATE(); case 15: if (lookahead == '#') ADVANCE(1043); if (lookahead == '4') ADVANCE(1041); if (lookahead == '\t' || - lookahead == ' ') SKIP(15) + lookahead == ' ') SKIP(15); if (('1' <= lookahead && lookahead <= '3')) ADVANCE(1042); if (('0' <= lookahead && lookahead <= '9')) ADVANCE(1040); END_STATE(); case 16: if (lookahead == '#') ADVANCE(1043); if (lookahead == '\t' || - lookahead == ' ') SKIP(16) + lookahead == ' ') SKIP(16); END_STATE(); case 17: if (lookahead == '#') ADVANCE(1043); if (lookahead == '\t' || - lookahead == ' ') SKIP(16) + lookahead == ' ') SKIP(16); if (lookahead == 'A' || lookahead == 'B' || lookahead == 'D' || @@ -3200,24 +2294,28 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == 'c') ADVANCE(431); END_STATE(); case 152: - if (lookahead == 'c') ADVANCE(578); - if (lookahead == 'e') ADVANCE(759); - if (lookahead == 'h') ADVANCE(118); - if (lookahead == 'o') ADVANCE(162); - if (lookahead == 'q') ADVANCE(819); - if (lookahead == 't') ADVANCE(82); - if (lookahead == 'u') ADVANCE(653); - if (lookahead == 'y') ADVANCE(535); + ADVANCE_MAP( + 'c', 578, + 'e', 759, + 'h', 118, + 'o', 162, + 'q', 819, + 't', 82, + 'u', 653, + 'y', 535, + ); END_STATE(); case 153: - if (lookahead == 'c') ADVANCE(578); - if (lookahead == 'e') ADVANCE(759); - if (lookahead == 'h') ADVANCE(125); - if (lookahead == 'o') ADVANCE(162); - if (lookahead == 'q') ADVANCE(819); - if (lookahead == 't') ADVANCE(82); - if (lookahead == 'u') ADVANCE(653); - if (lookahead == 'y') ADVANCE(535); + ADVANCE_MAP( + 'c', 578, + 'e', 759, + 'h', 125, + 'o', 162, + 'q', 819, + 't', 82, + 'u', 653, + 'y', 535, + ); END_STATE(); case 154: if (lookahead == 'c') ADVANCE(454); @@ -5403,132 +4501,140 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 866: if (eof) ADVANCE(870); - if (lookahead == '\n') ADVANCE(1045); - if (lookahead == '\r') ADVANCE(3); - if (lookahead == '!') ADVANCE(944); - if (lookahead == '"') ADVANCE(55); - if (lookahead == '#') ADVANCE(1043); - if (lookahead == '-') ADVANCE(18); - if (lookahead == '0') ADVANCE(991); - if (lookahead == '1') ADVANCE(989); - if (lookahead == '2') ADVANCE(982); - if (lookahead == '3') ADVANCE(981); - if (lookahead == '4') ADVANCE(990); - if (lookahead == '<') ADVANCE(946); - if (lookahead == '=') ADVANCE(944); - if (lookahead == '>') ADVANCE(946); - if (lookahead == 'A') ADVANCE(988); - if (lookahead == 'B') ADVANCE(983); - if (lookahead == 'C') ADVANCE(375); - if (lookahead == 'D') ADVANCE(987); - if (lookahead == 'E') ADVANCE(436); - if (lookahead == 'F') ADVANCE(77); - if (lookahead == 'G') ADVANCE(986); - if (lookahead == 'H') ADVANCE(88); - if (lookahead == 'I') ADVANCE(197); - if (lookahead == 'K') ADVANCE(400); - if (lookahead == 'L') ADVANCE(381); - if (lookahead == 'M') ADVANCE(78); - if (lookahead == 'N') ADVANCE(580); - if (lookahead == 'O') ADVANCE(645); - if (lookahead == 'P') ADVANCE(257); - if (lookahead == 'Q') ADVANCE(815); - if (lookahead == 'R') ADVANCE(984); - if (lookahead == 'S') ADVANCE(152); - if (lookahead == 'T') ADVANCE(253); - if (lookahead == 'U') ADVANCE(143); - if (lookahead == 'W') ADVANCE(985); - if (lookahead == 'Y') ADVANCE(252); + ADVANCE_MAP( + '\n', 1045, + '\r', 3, + '!', 944, + '"', 55, + '#', 1043, + '-', 18, + '0', 991, + '1', 989, + '2', 982, + '3', 981, + '4', 990, + '<', 946, + '=', 944, + '>', 946, + 'A', 988, + 'B', 983, + 'C', 375, + 'D', 987, + 'E', 436, + 'F', 77, + 'G', 986, + 'H', 88, + 'I', 197, + 'K', 400, + 'L', 381, + 'M', 78, + 'N', 580, + 'O', 645, + 'P', 257, + 'Q', 815, + 'R', 984, + 'S', 152, + 'T', 253, + 'U', 143, + 'W', 985, + 'Y', 252, + ); if (lookahead == '\t' || - lookahead == ' ') SKIP(866) + lookahead == ' ') SKIP(866); if (lookahead == '5' || lookahead == '6') ADVANCE(992); if (('7' <= lookahead && lookahead <= '9')) ADVANCE(1026); END_STATE(); case 867: if (eof) ADVANCE(870); - if (lookahead == '\n') ADVANCE(1045); - if (lookahead == '\r') ADVANCE(3); - if (lookahead == '!') ADVANCE(944); - if (lookahead == '"') ADVANCE(948); - if (lookahead == '#') ADVANCE(1043); - if (lookahead == '0') ADVANCE(1023); - if (lookahead == '<') ADVANCE(946); - if (lookahead == '=') ADVANCE(944); - if (lookahead == '>') ADVANCE(946); - if (lookahead == 'A') ADVANCE(435); - if (lookahead == 'B') ADVANCE(76); - if (lookahead == 'C') ADVANCE(376); - if (lookahead == 'D') ADVANCE(377); - if (lookahead == 'E') ADVANCE(478); - if (lookahead == 'F') ADVANCE(687); - if (lookahead == 'G') ADVANCE(217); - if (lookahead == 'H') ADVANCE(87); - if (lookahead == 'I') ADVANCE(197); - if (lookahead == 'K') ADVANCE(400); - if (lookahead == 'L') ADVANCE(381); - if (lookahead == 'M') ADVANCE(78); - if (lookahead == 'N') ADVANCE(580); - if (lookahead == 'O') ADVANCE(714); - if (lookahead == 'P') ADVANCE(257); - if (lookahead == 'Q') ADVANCE(815); - if (lookahead == 'R') ADVANCE(79); - if (lookahead == 'S') ADVANCE(153); - if (lookahead == 'T') ADVANCE(679); - if (lookahead == 'U') ADVANCE(143); - if (lookahead == 'W') ADVANCE(367); - if (lookahead == 'Y') ADVANCE(252); + ADVANCE_MAP( + '\n', 1045, + '\r', 3, + '!', 944, + '"', 948, + '#', 1043, + '0', 1023, + '<', 946, + '=', 944, + '>', 946, + 'A', 435, + 'B', 76, + 'C', 376, + 'D', 377, + 'E', 478, + 'F', 687, + 'G', 217, + 'H', 87, + 'I', 197, + 'K', 400, + 'L', 381, + 'M', 78, + 'N', 580, + 'O', 714, + 'P', 257, + 'Q', 815, + 'R', 79, + 'S', 153, + 'T', 679, + 'U', 143, + 'W', 367, + 'Y', 252, + ); if (lookahead == '\t' || - lookahead == ' ') SKIP(868) + lookahead == ' ') SKIP(868); if (('1' <= lookahead && lookahead <= '9')) ADVANCE(1026); END_STATE(); case 868: if (eof) ADVANCE(870); - if (lookahead == '\n') ADVANCE(1045); - if (lookahead == '\r') ADVANCE(3); - if (lookahead == '!') ADVANCE(944); - if (lookahead == '#') ADVANCE(1043); - if (lookahead == '0') ADVANCE(1023); - if (lookahead == '<') ADVANCE(946); - if (lookahead == '=') ADVANCE(944); - if (lookahead == '>') ADVANCE(946); - if (lookahead == 'A') ADVANCE(435); - if (lookahead == 'B') ADVANCE(76); - if (lookahead == 'C') ADVANCE(376); - if (lookahead == 'D') ADVANCE(377); - if (lookahead == 'E') ADVANCE(478); - if (lookahead == 'F') ADVANCE(687); - if (lookahead == 'G') ADVANCE(217); - if (lookahead == 'H') ADVANCE(87); - if (lookahead == 'I') ADVANCE(197); - if (lookahead == 'K') ADVANCE(400); - if (lookahead == 'L') ADVANCE(381); - if (lookahead == 'M') ADVANCE(78); - if (lookahead == 'N') ADVANCE(580); - if (lookahead == 'O') ADVANCE(714); - if (lookahead == 'P') ADVANCE(257); - if (lookahead == 'Q') ADVANCE(815); - if (lookahead == 'R') ADVANCE(79); - if (lookahead == 'S') ADVANCE(153); - if (lookahead == 'T') ADVANCE(679); - if (lookahead == 'U') ADVANCE(143); - if (lookahead == 'W') ADVANCE(367); - if (lookahead == 'Y') ADVANCE(252); + ADVANCE_MAP( + '\n', 1045, + '\r', 3, + '!', 944, + '#', 1043, + '0', 1023, + '<', 946, + '=', 944, + '>', 946, + 'A', 435, + 'B', 76, + 'C', 376, + 'D', 377, + 'E', 478, + 'F', 687, + 'G', 217, + 'H', 87, + 'I', 197, + 'K', 400, + 'L', 381, + 'M', 78, + 'N', 580, + 'O', 714, + 'P', 257, + 'Q', 815, + 'R', 79, + 'S', 153, + 'T', 679, + 'U', 143, + 'W', 367, + 'Y', 252, + ); if (lookahead == '\t' || - lookahead == ' ') SKIP(868) + lookahead == ' ') SKIP(868); if (('1' <= lookahead && lookahead <= '9')) ADVANCE(1026); END_STATE(); case 869: if (eof) ADVANCE(870); - if (lookahead == '\n') ADVANCE(1045); - if (lookahead == '\r') ADVANCE(3); - if (lookahead == '#') ADVANCE(1043); - if (lookahead == 'H') ADVANCE(401); - if (lookahead == 'I') ADVANCE(486); - if (lookahead == 'M') ADVANCE(399); - if (lookahead == 'S') ADVANCE(362); - if (lookahead == '\t' || - lookahead == ' ') ADVANCE(1044); + ADVANCE_MAP( + '\n', 1045, + '\r', 3, + '#', 1043, + 'H', 401, + 'I', 486, + 'M', 399, + 'S', 362, + '\t', 1044, + ' ', 1044, + ); END_STATE(); case 870: ACCEPT_TOKEN(ts_builtin_sym_end); @@ -5863,15 +4969,17 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 971: ACCEPT_TOKEN(aux_sym_sockets_token1); - if (lookahead == 'a') ADVANCE(740); - if (lookahead == 'l') ADVANCE(378); - if (lookahead == 'r') ADVANCE(577); - if (lookahead == 'A' || - lookahead == 'B' || - lookahead == 'D' || - lookahead == 'G' || - lookahead == 'R' || - lookahead == 'W') ADVANCE(979); + ADVANCE_MAP( + 'a', 740, + 'l', 378, + 'r', 577, + 'A', 979, + 'B', 979, + 'D', 979, + 'G', 979, + 'R', 979, + 'W', 979, + ); END_STATE(); case 972: ACCEPT_TOKEN(aux_sym_sockets_token1); @@ -5886,15 +4994,17 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 973: ACCEPT_TOKEN(aux_sym_sockets_token1); - if (lookahead == 'a') ADVANCE(691); - if (lookahead == 'h') ADVANCE(406); - if (lookahead == 'i') ADVANCE(199); - if (lookahead == 'A' || - lookahead == 'B' || - lookahead == 'D' || - lookahead == 'G' || - lookahead == 'R' || - lookahead == 'W') ADVANCE(979); + ADVANCE_MAP( + 'a', 691, + 'h', 406, + 'i', 199, + 'A', 979, + 'B', 979, + 'D', 979, + 'G', 979, + 'R', 979, + 'W', 979, + ); END_STATE(); case 974: ACCEPT_TOKEN(aux_sym_sockets_token1); @@ -5920,15 +5030,17 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 976: ACCEPT_TOKEN(aux_sym_sockets_token1); - if (lookahead == 'l') ADVANCE(794); - if (lookahead == 'n') ADVANCE(581); - if (lookahead == 'r') ADVANCE(147); - if (lookahead == 'A' || - lookahead == 'B' || - lookahead == 'D' || - lookahead == 'G' || - lookahead == 'R' || - lookahead == 'W') ADVANCE(979); + ADVANCE_MAP( + 'l', 794, + 'n', 581, + 'r', 147, + 'A', 979, + 'B', 979, + 'D', 979, + 'G', 979, + 'R', 979, + 'W', 979, + ); END_STATE(); case 977: ACCEPT_TOKEN(aux_sym_sockets_token1); @@ -5996,15 +5108,17 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 983: ACCEPT_TOKEN(aux_sym_sockets_token2); - if (lookahead == 'a') ADVANCE(740); - if (lookahead == 'l') ADVANCE(378); - if (lookahead == 'r') ADVANCE(577); - if (lookahead == 'A' || - lookahead == 'B' || - lookahead == 'D' || - lookahead == 'G' || - lookahead == 'R' || - lookahead == 'W') ADVANCE(991); + ADVANCE_MAP( + 'a', 740, + 'l', 378, + 'r', 577, + 'A', 991, + 'B', 991, + 'D', 991, + 'G', 991, + 'R', 991, + 'W', 991, + ); END_STATE(); case 984: ACCEPT_TOKEN(aux_sym_sockets_token2); @@ -6019,15 +5133,17 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 985: ACCEPT_TOKEN(aux_sym_sockets_token2); - if (lookahead == 'a') ADVANCE(691); - if (lookahead == 'h') ADVANCE(406); - if (lookahead == 'i') ADVANCE(199); - if (lookahead == 'A' || - lookahead == 'B' || - lookahead == 'D' || - lookahead == 'G' || - lookahead == 'R' || - lookahead == 'W') ADVANCE(991); + ADVANCE_MAP( + 'a', 691, + 'h', 406, + 'i', 199, + 'A', 991, + 'B', 991, + 'D', 991, + 'G', 991, + 'R', 991, + 'W', 991, + ); END_STATE(); case 986: ACCEPT_TOKEN(aux_sym_sockets_token2); @@ -6053,15 +5169,17 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { END_STATE(); case 988: ACCEPT_TOKEN(aux_sym_sockets_token2); - if (lookahead == 'l') ADVANCE(794); - if (lookahead == 'n') ADVANCE(581); - if (lookahead == 'r') ADVANCE(147); - if (lookahead == 'A' || - lookahead == 'B' || - lookahead == 'D' || - lookahead == 'G' || - lookahead == 'R' || - lookahead == 'W') ADVANCE(991); + ADVANCE_MAP( + 'l', 794, + 'n', 581, + 'r', 147, + 'A', 991, + 'B', 991, + 'D', 991, + 'G', 991, + 'R', 991, + 'W', 991, + ); END_STATE(); case 989: ACCEPT_TOKEN(aux_sym_sockets_token2); @@ -6180,55 +5298,53 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { case 1017: ACCEPT_TOKEN(aux_sym_string_token1); if (lookahead == ' ') ADVANCE(1017); - if (aux_sym_string_token1_character_set_1(lookahead)) ADVANCE(1018); + if (set_contains(aux_sym_string_token2_character_set_1, 432, lookahead)) ADVANCE(1018); END_STATE(); case 1018: ACCEPT_TOKEN(aux_sym_string_token1); - if (aux_sym_string_token1_character_set_2(lookahead)) ADVANCE(1018); + if (set_contains(aux_sym_string_token1_character_set_1, 433, lookahead)) ADVANCE(1018); END_STATE(); case 1019: ACCEPT_TOKEN(aux_sym_string_token2); - if (aux_sym_string_token1_character_set_1(lookahead)) ADVANCE(1019); + if (set_contains(aux_sym_string_token2_character_set_1, 432, lookahead)) ADVANCE(1019); END_STATE(); case 1020: ACCEPT_TOKEN(aux_sym_file_token1); if (lookahead == ' ') ADVANCE(1020); if (lookahead == '#') ADVANCE(1021); - if (lookahead != 0 && - lookahead > 31 && + if (lookahead > ' ' && lookahead != '"' && + lookahead != '#' && lookahead != '*' && lookahead != '<' && lookahead != '>' && lookahead != '?' && lookahead != '|' && - (lookahead < 127 || 159 < lookahead)) ADVANCE(1022); + (lookahead < 0x7f || 0x9f < lookahead)) ADVANCE(1022); END_STATE(); case 1021: ACCEPT_TOKEN(aux_sym_file_token1); - if (!eof && (0 <= lookahead && lookahead <= '\t') || - (11 <= lookahead && lookahead <= 31) || + if ((!eof && lookahead <= '\t') || + (0x0b <= lookahead && lookahead <= 0x1f) || lookahead == '"' || lookahead == '*' || lookahead == '<' || lookahead == '>' || lookahead == '?' || lookahead == '|' || - (127 <= lookahead && lookahead <= 159)) ADVANCE(1043); - if (lookahead != 0 && - lookahead != '\n') ADVANCE(1021); + (0x7f <= lookahead && lookahead <= 0x9f)) ADVANCE(1043); + if (lookahead > 0x1f) ADVANCE(1021); END_STATE(); case 1022: ACCEPT_TOKEN(aux_sym_file_token1); - if (lookahead != 0 && - lookahead > 31 && + if (lookahead > 0x1f && lookahead != '"' && lookahead != '*' && lookahead != '<' && lookahead != '>' && lookahead != '?' && lookahead != '|' && - (lookahead < 127 || 159 < lookahead)) ADVANCE(1022); + (lookahead < 0x7f || 0x9f < lookahead)) ADVANCE(1022); END_STATE(); case 1023: ACCEPT_TOKEN(sym_number); @@ -10211,11 +9327,11 @@ static const TSParseActionEntry ts_parse_actions[] = { [0] = {.entry = {.count = 0, .reusable = false}}, [1] = {.entry = {.count = 1, .reusable = false}}, RECOVER(), [3] = {.entry = {.count = 1, .reusable = true}}, SHIFT_EXTRA(), - [5] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_filter, 0), + [5] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_filter, 0, 0, 0), [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(181), [9] = {.entry = {.count = 1, .reusable = true}}, SHIFT(185), [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(41), - [13] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 3), + [13] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_block, 3, 0, 0), [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(180), [17] = {.entry = {.count = 1, .reusable = true}}, SHIFT(100), [19] = {.entry = {.count = 1, .reusable = true}}, SHIFT(173), @@ -10241,84 +9357,84 @@ static const TSParseActionEntry ts_parse_actions[] = { [59] = {.entry = {.count = 1, .reusable = true}}, SHIFT(155), [61] = {.entry = {.count = 1, .reusable = true}}, SHIFT(156), [63] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [65] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), - [67] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(180), - [70] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(100), - [73] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(173), - [76] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(104), - [79] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(106), - [82] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(180), - [85] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(115), - [88] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(116), - [91] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(117), - [94] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(121), - [97] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(125), - [100] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(126), - [103] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(152), - [106] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(152), - [109] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(151), - [112] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(149), - [115] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(129), - [118] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(129), - [121] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(144), - [124] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(143), - [127] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(141), - [130] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(139), - [133] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(155), - [136] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(156), - [139] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2), SHIFT_REPEAT(3), - [142] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 4, .production_id = 14), - [144] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 4, .production_id = 14), - [146] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 4, .production_id = 16), - [148] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 4, .production_id = 16), - [150] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 8, .production_id = 24), - [152] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 8, .production_id = 24), - [154] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 8, .production_id = 14), - [156] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 8, .production_id = 14), - [158] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, .production_id = 11), - [160] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, .production_id = 11), - [162] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6), - [164] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6), - [166] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, .production_id = 14), - [168] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, .production_id = 14), - [170] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, .production_id = 8), - [172] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, .production_id = 8), - [174] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 2), - [176] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 2), - [178] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, .production_id = 23), - [180] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, .production_id = 23), - [182] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, .production_id = 22), - [184] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, .production_id = 22), - [186] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, .production_id = 21), - [188] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, .production_id = 21), - [190] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5), - [192] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5), - [194] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, .production_id = 20), - [196] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, .production_id = 20), - [198] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, .production_id = 19), - [200] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, .production_id = 19), - [202] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, .production_id = 18), - [204] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, .production_id = 18), - [206] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, .production_id = 17), - [208] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, .production_id = 17), - [210] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3), - [212] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3), - [214] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, .production_id = 5), - [216] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, .production_id = 5), - [218] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 8, .production_id = 16), - [220] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 8, .production_id = 16), - [222] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 4), - [224] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 4), - [226] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 4, .production_id = 15), - [228] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 4, .production_id = 15), - [230] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_continue, 2), - [232] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_continue, 2), - [234] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 4), - [236] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 4), - [238] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, .production_id = 2), - [240] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, .production_id = 2), - [242] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 10, .production_id = 25), - [244] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 10, .production_id = 25), + [65] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), + [67] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(180), + [70] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(100), + [73] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(173), + [76] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(104), + [79] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(106), + [82] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(180), + [85] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(115), + [88] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(116), + [91] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(117), + [94] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(121), + [97] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(125), + [100] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(126), + [103] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(152), + [106] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(152), + [109] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(151), + [112] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(149), + [115] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(129), + [118] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(129), + [121] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(144), + [124] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(143), + [127] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(141), + [130] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(139), + [133] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(155), + [136] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(156), + [139] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_block_repeat1, 2, 0, 0), SHIFT_REPEAT(3), + [142] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 4, 0, 14), + [144] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 4, 0, 14), + [146] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 4, 0, 16), + [148] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 4, 0, 16), + [150] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 8, 0, 24), + [152] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 8, 0, 24), + [154] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 8, 0, 14), + [156] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 8, 0, 14), + [158] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, 0, 11), + [160] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, 0, 11), + [162] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, 0, 0), + [164] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, 0, 0), + [166] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, 0, 14), + [168] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, 0, 14), + [170] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, 0, 8), + [172] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, 0, 8), + [174] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 2, 0, 0), + [176] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 2, 0, 0), + [178] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, 0, 23), + [180] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, 0, 23), + [182] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, 0, 22), + [184] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, 0, 22), + [186] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 6, 0, 21), + [188] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 6, 0, 21), + [190] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, 0, 0), + [192] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, 0, 0), + [194] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, 0, 20), + [196] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, 0, 20), + [198] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, 0, 19), + [200] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, 0, 19), + [202] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, 0, 18), + [204] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, 0, 18), + [206] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 5, 0, 17), + [208] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 5, 0, 17), + [210] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, 0, 0), + [212] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, 0, 0), + [214] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, 0, 5), + [216] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, 0, 5), + [218] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 8, 0, 16), + [220] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 8, 0, 16), + [222] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 4, 0, 0), + [224] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 4, 0, 0), + [226] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 4, 0, 15), + [228] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 4, 0, 15), + [230] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_continue, 2, 0, 0), + [232] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_continue, 2, 0, 0), + [234] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 4, 0, 0), + [236] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 4, 0, 0), + [238] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_condition, 3, 0, 2), + [240] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_condition, 3, 0, 2), + [242] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_action, 10, 0, 25), + [244] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_action, 10, 0, 25), [246] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), [248] = {.entry = {.count = 1, .reusable = true}}, SHIFT(176), [250] = {.entry = {.count = 1, .reusable = true}}, SHIFT(118), @@ -10332,22 +9448,22 @@ static const TSParseActionEntry ts_parse_actions[] = { [266] = {.entry = {.count = 1, .reusable = true}}, SHIFT(110), [268] = {.entry = {.count = 1, .reusable = true}}, SHIFT(97), [270] = {.entry = {.count = 1, .reusable = true}}, SHIFT(179), - [272] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_filter_repeat1, 2), - [274] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_filter_repeat1, 2), SHIFT_REPEAT(181), - [277] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_filter_repeat1, 2), SHIFT_REPEAT(185), - [280] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_filter_repeat1, 2), SHIFT_REPEAT(40), - [283] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_filter, 1), + [272] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_filter_repeat1, 2, 0, 0), + [274] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_filter_repeat1, 2, 0, 0), SHIFT_REPEAT(181), + [277] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_filter_repeat1, 2, 0, 0), SHIFT_REPEAT(185), + [280] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_filter_repeat1, 2, 0, 0), SHIFT_REPEAT(40), + [283] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_filter, 1, 0, 0), [285] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), - [287] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_file, 3), - [289] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_file, 3), + [287] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_file, 3, 0, 0), + [289] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_file, 3, 0, 0), [291] = {.entry = {.count = 1, .reusable = false}}, SHIFT_EXTRA(), - [293] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import, 3), - [295] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_import, 3), + [293] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import, 3, 0, 0), + [295] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_import, 3, 0, 0), [297] = {.entry = {.count = 1, .reusable = true}}, SHIFT(148), [299] = {.entry = {.count = 1, .reusable = true}}, SHIFT(108), [301] = {.entry = {.count = 1, .reusable = true}}, SHIFT(172), [303] = {.entry = {.count = 1, .reusable = true}}, SHIFT(107), - [305] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import, 5), + [305] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_import, 5, 0, 0), [307] = {.entry = {.count = 1, .reusable = true}}, SHIFT(182), [309] = {.entry = {.count = 1, .reusable = true}}, SHIFT(94), [311] = {.entry = {.count = 1, .reusable = true}}, SHIFT(138), @@ -10357,8 +9473,8 @@ static const TSParseActionEntry ts_parse_actions[] = { [319] = {.entry = {.count = 1, .reusable = true}}, SHIFT(87), [321] = {.entry = {.count = 1, .reusable = true}}, SHIFT(76), [323] = {.entry = {.count = 1, .reusable = false}}, SHIFT(30), - [325] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat4, 2, .production_id = 12), SHIFT_REPEAT(83), - [328] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat4, 2, .production_id = 12), + [325] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat4, 2, 0, 12), SHIFT_REPEAT(83), + [328] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat4, 2, 0, 12), [330] = {.entry = {.count = 1, .reusable = true}}, SHIFT(81), [332] = {.entry = {.count = 1, .reusable = false}}, SHIFT(22), [334] = {.entry = {.count = 1, .reusable = true}}, SHIFT(75), @@ -10381,51 +9497,51 @@ static const TSParseActionEntry ts_parse_actions[] = { [368] = {.entry = {.count = 1, .reusable = false}}, SHIFT(19), [370] = {.entry = {.count = 1, .reusable = false}}, SHIFT(20), [372] = {.entry = {.count = 1, .reusable = false}}, SHIFT(28), - [374] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat8, 2), SHIFT_REPEAT(73), - [377] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat8, 2), - [379] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat7, 2), SHIFT_REPEAT(47), - [382] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat7, 2), - [384] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat1, 2, .production_id = 3), SHIFT_REPEAT(76), - [387] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat1, 2, .production_id = 3), - [389] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat3, 2, .production_id = 9), SHIFT_REPEAT(75), - [392] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat3, 2, .production_id = 9), - [394] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat6, 2), SHIFT_REPEAT(39), - [397] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat6, 2), - [399] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat5, 2), SHIFT_REPEAT(46), - [402] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat5, 2), - [404] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat2, 2, .production_id = 6), SHIFT_REPEAT(81), - [407] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat2, 2, .production_id = 6), + [374] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat8, 2, 0, 0), SHIFT_REPEAT(73), + [377] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat8, 2, 0, 0), + [379] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat7, 2, 0, 0), SHIFT_REPEAT(47), + [382] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat7, 2, 0, 0), + [384] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat1, 2, 0, 3), SHIFT_REPEAT(76), + [387] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat1, 2, 0, 3), + [389] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat3, 2, 0, 9), SHIFT_REPEAT(75), + [392] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat3, 2, 0, 9), + [394] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat6, 2, 0, 0), SHIFT_REPEAT(39), + [397] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat6, 2, 0, 0), + [399] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat5, 2, 0, 0), SHIFT_REPEAT(46), + [402] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat5, 2, 0, 0), + [404] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_condition_repeat2, 2, 0, 6), SHIFT_REPEAT(81), + [407] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat2, 2, 0, 6), [409] = {.entry = {.count = 1, .reusable = true}}, SHIFT(147), [411] = {.entry = {.count = 1, .reusable = false}}, SHIFT(24), [413] = {.entry = {.count = 1, .reusable = true}}, SHIFT(159), [415] = {.entry = {.count = 1, .reusable = true}}, SHIFT(184), - [417] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat2, 2, .production_id = 4), - [419] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat2, 2, .production_id = 4), - [421] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat3, 2, .production_id = 7), - [423] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat3, 2, .production_id = 7), - [425] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat4, 2, .production_id = 10), - [427] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat4, 2, .production_id = 10), + [417] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat2, 2, 0, 4), + [419] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat2, 2, 0, 4), + [421] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat3, 2, 0, 7), + [423] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat3, 2, 0, 7), + [425] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat4, 2, 0, 10), + [427] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat4, 2, 0, 10), [429] = {.entry = {.count = 1, .reusable = true}}, SHIFT(157), - [431] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_quality, 1), - [433] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_quality, 1), - [435] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat5, 2), + [431] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_quality, 1, 0, 0), + [433] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_quality, 1, 0, 0), + [435] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat5, 2, 0, 0), [437] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86), [439] = {.entry = {.count = 1, .reusable = false}}, SHIFT(6), - [441] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_influence, 1), - [443] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_influence, 1), + [441] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_influence, 1, 0, 0), + [443] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_influence, 1, 0, 0), [445] = {.entry = {.count = 1, .reusable = true}}, SHIFT(96), - [447] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat6, 2), + [447] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat6, 2, 0, 0), [449] = {.entry = {.count = 1, .reusable = true}}, SHIFT(51), - [451] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_rarity, 1), - [453] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_rarity, 1), - [455] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat7, 2), + [451] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_rarity, 1, 0, 0), + [453] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_rarity, 1, 0, 0), + [455] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat7, 2, 0, 0), [457] = {.entry = {.count = 1, .reusable = true}}, SHIFT(52), [459] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49), - [461] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sockets, 1, .production_id = 13), - [463] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sockets, 1, .production_id = 13), - [465] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat8, 2), - [467] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 1), - [469] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 1), + [461] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sockets, 1, 0, 13), + [463] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sockets, 1, 0, 13), + [465] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat8, 2, 0, 0), + [467] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 1, 0, 0), + [469] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 1, 0, 0), [471] = {.entry = {.count = 1, .reusable = true}}, SHIFT(133), [473] = {.entry = {.count = 1, .reusable = false}}, SHIFT(4), [475] = {.entry = {.count = 1, .reusable = true}}, SHIFT(132), @@ -10434,20 +9550,20 @@ static const TSParseActionEntry ts_parse_actions[] = { [481] = {.entry = {.count = 1, .reusable = true}}, SHIFT(50), [483] = {.entry = {.count = 1, .reusable = true}}, SHIFT(38), [485] = {.entry = {.count = 1, .reusable = true}}, SHIFT(146), - [487] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_colour, 1), - [489] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_colour, 1), - [491] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sockets, 3), - [493] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sockets, 3), - [495] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_rarity, 3), - [497] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_rarity, 3), - [499] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_influence, 3), - [501] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_influence, 3), - [503] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_quality, 3), - [505] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_quality, 3), + [487] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_colour, 1, 0, 0), + [489] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_colour, 1, 0, 0), + [491] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_sockets, 3, 0, 0), + [493] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_sockets, 3, 0, 0), + [495] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_rarity, 3, 0, 0), + [497] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_rarity, 3, 0, 0), + [499] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_influence, 3, 0, 0), + [501] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_influence, 3, 0, 0), + [503] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_quality, 3, 0, 0), + [505] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_quality, 3, 0, 0), [507] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), [509] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), - [511] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3), - [513] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 3), + [511] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_string, 3, 0, 0), + [513] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_string, 3, 0, 0), [515] = {.entry = {.count = 1, .reusable = true}}, SHIFT(167), [517] = {.entry = {.count = 1, .reusable = true}}, SHIFT(137), [519] = {.entry = {.count = 1, .reusable = false}}, SHIFT(12), @@ -10455,8 +9571,8 @@ static const TSParseActionEntry ts_parse_actions[] = { [523] = {.entry = {.count = 1, .reusable = true}}, SHIFT(158), [525] = {.entry = {.count = 1, .reusable = true}}, SHIFT(161), [527] = {.entry = {.count = 1, .reusable = true}}, SHIFT(160), - [529] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat1, 2, .production_id = 1), - [531] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat1, 2, .production_id = 1), + [529] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_condition_repeat1, 2, 0, 1), + [531] = {.entry = {.count = 1, .reusable = false}}, REDUCE(aux_sym_condition_repeat1, 2, 0, 1), [533] = {.entry = {.count = 1, .reusable = true}}, SHIFT(122), [535] = {.entry = {.count = 1, .reusable = true}}, SHIFT(13), [537] = {.entry = {.count = 1, .reusable = true}}, SHIFT(171), @@ -10472,7 +9588,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [557] = {.entry = {.count = 1, .reusable = true}}, SHIFT(166), [559] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), [561] = {.entry = {.count = 1, .reusable = true}}, SHIFT(105), - [563] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__quantity, 2), + [563] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym__quantity, 2, 0, 0), [565] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), [567] = {.entry = {.count = 1, .reusable = true}}, SHIFT(62), [569] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), @@ -10496,7 +9612,7 @@ static const TSParseActionEntry ts_parse_actions[] = { [605] = {.entry = {.count = 1, .reusable = true}}, SHIFT(162), [607] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), [609] = {.entry = {.count = 1, .reusable = true}}, SHIFT(135), - [611] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_shape, 1), + [611] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_shape, 1, 0, 0), [613] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), [615] = {.entry = {.count = 1, .reusable = true}}, SHIFT(23), [617] = {.entry = {.count = 1, .reusable = true}}, SHIFT(140), @@ -10512,11 +9628,15 @@ static const TSParseActionEntry ts_parse_actions[] = { #ifdef __cplusplus extern "C" { #endif -#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_poe_filter(void) { +TS_PUBLIC const TSLanguage *tree_sitter_poe_filter(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..1abdd12 --- /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 size); +extern void *(*ts_current_calloc)(size_t count, size_t size); +extern void *(*ts_current_realloc)(void *ptr, size_t size); +extern void (*ts_current_free)(void *ptr); + +#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..799f599 100644 --- a/src/tree_sitter/parser.h +++ b/src/tree_sitter/parser.h @@ -47,6 +47,7 @@ struct TSLexer { uint32_t (*get_column)(TSLexer *); bool (*is_at_included_range_start)(const TSLexer *); bool (*eof)(const TSLexer *); + void (*log)(const TSLexer *, const char *, ...); }; typedef enum { @@ -86,6 +87,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 +131,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 +178,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 +238,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() \ diff --git a/tree-sitter.json b/tree-sitter.json new file mode 100644 index 0000000..291eb31 --- /dev/null +++ b/tree-sitter.json @@ -0,0 +1,29 @@ +{ + "$schema": "https://tree-sitter.github.io/tree-sitter/assets/schemas/config.schema.json", + "grammars": [ + { + "name": "poe_filter", + "camelcase": "PoEFilter", + "scope": "text.poe_filter", + "path": ".", + "file-types": [ + "filter" + ], + "highlights": "queries/highlights.scm" + } + ], + "metadata": { + "version": "0.4.0", + "license": "MIT", + "description": "PoE item filter grammar for tree-sitter", + "authors": [ + { + "name": "ObserverOfTime", + "email": "chronobserver@disroot.org" + } + ], + "links": { + "repository": "https://github.com/tree-sitter-grammars/tree-sitter-poe-filter" + } + } +}