diff --git a/CHANGELOG.md b/CHANGELOG.md index e5301c59d..ea03e1df6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ with YAML. Improved language detection when one argument is a named pipe. Updated to the latest tree-sitter parser for Bash, C, C++, C#, Go, -Haskell, Java, JavaScript, JSON, Julia, Objective-C, OCaml, PHP, +Haskell, HTML, Java, JavaScript, JSON, Julia, Objective-C, OCaml, PHP, Python, Ruby, Scala and TypeScript. ### Syntax Highlighting diff --git a/Cargo.lock b/Cargo.lock index 9ecff2d5e..a16f9a200 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -255,6 +255,7 @@ dependencies = [ "tree-sitter-cpp", "tree-sitter-go", "tree-sitter-haskell", + "tree-sitter-html", "tree-sitter-java", "tree-sitter-javascript", "tree-sitter-json", @@ -1078,6 +1079,16 @@ dependencies = [ "tree-sitter-language", ] +[[package]] +name = "tree-sitter-html" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261b708e5d92061ede329babaaa427b819329a9d427a1d710abb0f67bbef63ee" +dependencies = [ + "cc", + "tree-sitter-language", +] + [[package]] name = "tree-sitter-java" version = "0.23.4" diff --git a/Cargo.toml b/Cargo.toml index a7c471870..a3ecd08f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,6 +95,7 @@ tree-sitter-go = "0.23.4" tree-sitter-bash = "0.23.3" tree-sitter-php = "0.23.11" tree-sitter-json = "0.24.8" +tree-sitter-html = "0.23.2" [dev-dependencies] # assert_cmd 2.0.10 requires predicates 3. diff --git a/build.rs b/build.rs index 311502cee..8a7c73728 100644 --- a/build.rs +++ b/build.rs @@ -41,8 +41,6 @@ impl TreeSitterParser { .flag_if_supported("-Wno-implicit-fallthrough") .flag_if_supported("-Wno-unused-parameter") .flag_if_supported("-Wno-ignored-qualifiers") - // Ignore warning from tree-sitter-html. - .flag_if_supported("-Wno-sign-compare") .link_lib_modifier("+whole-archive"); for file in cpp_files { @@ -154,11 +152,6 @@ fn main() { src_dir: "vendored_parsers/tree-sitter-hcl-src", extra_files: vec!["scanner.cc"], }, - TreeSitterParser { - name: "tree-sitter-html", - src_dir: "vendored_parsers/tree-sitter-html-src", - extra_files: vec!["scanner.cc"], - }, TreeSitterParser { name: "tree-sitter-janet-simple", src_dir: "vendored_parsers/tree-sitter-janet-simple-src", diff --git a/src/parse/tree_sitter_parser.rs b/src/parse/tree_sitter_parser.rs index f29b8182b..729b540bf 100644 --- a/src/parse/tree_sitter_parser.rs +++ b/src/parse/tree_sitter_parser.rs @@ -79,7 +79,6 @@ extern "C" { fn tree_sitter_hare() -> ts::Language; fn tree_sitter_hack() -> ts::Language; fn tree_sitter_hcl() -> ts::Language; - fn tree_sitter_html() -> ts::Language; fn tree_sitter_janet_simple() -> ts::Language; fn tree_sitter_kotlin() -> ts::Language; fn tree_sitter_latex() -> ts::Language; @@ -507,7 +506,9 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig { } } Html => { - let language = unsafe { tree_sitter_html() }; + let language_fn = tree_sitter_html::LANGUAGE; + let language = tree_sitter::Language::new(language_fn); + TreeSitterConfig { language: language.clone(), atom_nodes: vec![ @@ -522,11 +523,8 @@ pub(crate) fn from_language(language: guess::Language) -> TreeSitterConfig { delimiter_tokens: vec![("<", ">"), (""), ("")] .into_iter() .collect(), - highlight_query: ts::Query::new( - &language, - include_str!("../../vendored_parsers/highlights/html.scm"), - ) - .unwrap(), + highlight_query: ts::Query::new(&language, tree_sitter_html::HIGHLIGHTS_QUERY) + .unwrap(), sub_languages: vec![ TreeSitterSubLanguage { query: ts::Query::new(&language, "(style_element (raw_text) @contents)") diff --git a/vendored_parsers/tree-sitter-html-src b/vendored_parsers/tree-sitter-html-src deleted file mode 120000 index 72f2053cf..000000000 --- a/vendored_parsers/tree-sitter-html-src +++ /dev/null @@ -1 +0,0 @@ -tree-sitter-html/src \ No newline at end of file diff --git a/vendored_parsers/tree-sitter-html/.appveyor.yml b/vendored_parsers/tree-sitter-html/.appveyor.yml deleted file mode 100644 index 3e438d380..000000000 --- a/vendored_parsers/tree-sitter-html/.appveyor.yml +++ /dev/null @@ -1,22 +0,0 @@ -image: Visual Studio 2015 - -environment: - nodejs_version: "10" - -platform: - - x64 - -install: - - ps: Install-Product node $env:nodejs_version - - node --version - - npm --version - - npm install - -test_script: - - npm run test-windows - -build: off - -branches: - only: - - master diff --git a/vendored_parsers/tree-sitter-html/.gitattributes b/vendored_parsers/tree-sitter-html/.gitattributes deleted file mode 100644 index 1d9225c44..000000000 --- a/vendored_parsers/tree-sitter-html/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -/src/parser.c linguist-vendored diff --git a/vendored_parsers/tree-sitter-html/.gitignore b/vendored_parsers/tree-sitter-html/.gitignore deleted file mode 100644 index 4decba2a6..000000000 --- a/vendored_parsers/tree-sitter-html/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -node_modules -build -*.log -package-lock.json -target -Cargo.lock -*.a -*.dylib -*.so -*.o -bindings/c/*.h -bindings/c/*.pc \ No newline at end of file diff --git a/vendored_parsers/tree-sitter-html/.npmignore b/vendored_parsers/tree-sitter-html/.npmignore deleted file mode 100644 index e9c0f7e1d..000000000 --- a/vendored_parsers/tree-sitter-html/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -corpus -examples -build -script -target -Cargo.lock diff --git a/vendored_parsers/tree-sitter-html/.travis.yml b/vendored_parsers/tree-sitter-html/.travis.yml deleted file mode 100644 index 38d6538b7..000000000 --- a/vendored_parsers/tree-sitter-html/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: node_js - -node_js: 10 - -env: - - CXX=clang++ - -branches: - only: - - master diff --git a/vendored_parsers/tree-sitter-html/Cargo.toml b/vendored_parsers/tree-sitter-html/Cargo.toml deleted file mode 100644 index e65e95461..000000000 --- a/vendored_parsers/tree-sitter-html/Cargo.toml +++ /dev/null @@ -1,25 +0,0 @@ -[package] -name = "tree-sitter-html" -description = "html grammar for the tree-sitter parsing library" -version = "0.19.0" -keywords = ["incremental", "parsing", "html"] -categories = ["parsing", "text-editors"] -repository = "https://github.com/tree-sitter/tree-sitter-html" -edition = "2018" - -build = "bindings/rust/build.rs" -include = [ - "bindings/rust/*", - "grammar.js", - "queries/*", - "src/*", -] - -[lib] -path = "bindings/rust/lib.rs" - -[dependencies] -tree-sitter = "0.19" - -[build-dependencies] -cc = "1.0" diff --git a/vendored_parsers/tree-sitter-html/LICENSE b/vendored_parsers/tree-sitter-html/LICENSE deleted file mode 100644 index 4b52d191c..000000000 --- a/vendored_parsers/tree-sitter-html/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Max Brunsfeld - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendored_parsers/tree-sitter-html/Makefile b/vendored_parsers/tree-sitter-html/Makefile deleted file mode 100644 index c4d127ae2..000000000 --- a/vendored_parsers/tree-sitter-html/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -VERSION := 0.19.0 - -# Repository -SRC_DIR := src - -PARSER_REPO_URL ?= $(shell git -C $(SRC_DIR) remote get-url origin ) -# the # in the sed pattern has to be escaped or it will be interpreted as a comment -PARSER_NAME ?= $(shell basename $(PARSER_REPO_URL) | cut -d '-' -f3 | sed 's\#.git\#\#') -UPPER_PARSER_NAME := $(shell echo $(PARSER_NAME) | tr a-z A-Z ) - -# install directory layout -PREFIX ?= /usr/local -INCLUDEDIR ?= $(PREFIX)/include -LIBDIR ?= $(PREFIX)/lib -PCLIBDIR ?= $(LIBDIR)/pkgconfig - -# collect C++ sources, and link if necessary -CPPSRC := $(wildcard $(SRC_DIR)/*.cc) - -ifeq (, $(CPPSRC)) - ADDITIONALLIBS := -else - ADDITIONALLIBS := -lc++ -endif - -# collect sources -SRC := $(wildcard $(SRC_DIR)/*.c) -SRC += $(CPPSRC) -OBJ := $(addsuffix .o,$(basename $(SRC))) - -# ABI versioning -SONAME_MAJOR := 0 -SONAME_MINOR := 0 - -CFLAGS ?= -O3 -Wall -Wextra -I$(SRC_DIR) -CXXFLAGS ?= -O3 -Wall -Wextra -I$(SRC_DIR) -override CFLAGS += -std=gnu99 -fPIC -override CXXFLAGS += -fPIC - -# OS-specific bits -ifeq ($(shell uname),Darwin) - SOEXT = dylib - SOEXTVER_MAJOR = $(SONAME_MAJOR).dylib - SOEXTVER = $(SONAME_MAJOR).$(SONAME_MINOR).dylib - LINKSHARED := $(LINKSHARED)-dynamiclib -Wl, - ifneq ($(ADDITIONALLIBS),) - LINKSHARED := $(LINKSHARED)$(ADDITIONALLIBS), - endif - LINKSHARED := $(LINKSHARED)-install_name,$(LIBDIR)/libtree-sitter-$(PARSER_NAME).$(SONAME_MAJOR).dylib,-rpath,@executable_path/../Frameworks -else - SOEXT = so - SOEXTVER_MAJOR = so.$(SONAME_MAJOR) - SOEXTVER = so.$(SONAME_MAJOR).$(SONAME_MINOR) - LINKSHARED := $(LINKSHARED)-shared -Wl, - ifneq ($(ADDITIONALLIBS),) - LINKSHARED := $(LINKSHARED)$(ADDITIONALLIBS) - endif - LINKSHARED := $(LINKSHARED)-soname,libtree-sitter-$(PARSER_NAME).so.$(SONAME_MAJOR) -endif -ifneq (,$(filter $(shell uname),FreeBSD NetBSD DragonFly)) - PCLIBDIR := $(PREFIX)/libdata/pkgconfig -endif - -all: libtree-sitter-$(PARSER_NAME).a libtree-sitter-$(PARSER_NAME).$(SOEXTVER) bindings/c/$(PARSER_NAME).h - -libtree-sitter-$(PARSER_NAME).a: $(OBJ) - $(AR) rcs $@ $^ - -libtree-sitter-$(PARSER_NAME).$(SOEXTVER): $(OBJ) - $(CC) $(LDFLAGS) $(LINKSHARED) $^ $(LDLIBS) -o $@ - ln -sf $@ libtree-sitter-$(PARSER_NAME).$(SOEXT) - ln -sf $@ libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR) - -bindings/c/$(PARSER_NAME).h: - sed -e 's|@UPPER_PARSERNAME@|$(UPPER_PARSER_NAME)|' \ - -e 's|@PARSERNAME@|$(PARSER_NAME)|' \ - bindings/c/tree-sitter.h.in > $@ - -install: all - install -d '$(DESTDIR)$(LIBDIR)' - install -m755 libtree-sitter-$(PARSER_NAME).a '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).a - install -m755 libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXTVER) - ln -sf libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR) - ln -sf libtree-sitter-$(PARSER_NAME).$(SOEXTVER) '$(DESTDIR)$(LIBDIR)'/libtree-sitter-$(PARSER_NAME).$(SOEXT) - install -d '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter - install -m644 bindings/c/$(PARSER_NAME).h '$(DESTDIR)$(INCLUDEDIR)'/tree_sitter/ - install -d '$(DESTDIR)$(PCLIBDIR)' - sed -e 's|@LIBDIR@|$(LIBDIR)|;s|@INCLUDEDIR@|$(INCLUDEDIR)|;s|@VERSION@|$(VERSION)|' \ - -e 's|=$(PREFIX)|=$${prefix}|' \ - -e 's|@PREFIX@|$(PREFIX)|' \ - -e 's|@ADDITIONALLIBS@|$(ADDITIONALLIBS)|' \ - -e 's|@PARSERNAME@|$(PARSER_NAME)|' \ - -e 's|@PARSERREPOURL@|$(PARSER_REPO_URL)|' \ - bindings/c/tree-sitter.pc.in > '$(DESTDIR)$(PCLIBDIR)'/tree-sitter-$(PARSER_NAME).pc - -clean: - rm -f $(OBJ) libtree-sitter-$(PARSER_NAME).a libtree-sitter-$(PARSER_NAME).$(SOEXT) libtree-sitter-$(PARSER_NAME).$(SOEXTVER_MAJOR) libtree-sitter-$(PARSER_NAME).$(SOEXTVER) bindings/c/$(PARSER_NAME).h - -.PHONY: all install clean diff --git a/vendored_parsers/tree-sitter-html/README.md b/vendored_parsers/tree-sitter-html/README.md deleted file mode 100644 index d06f73a33..000000000 --- a/vendored_parsers/tree-sitter-html/README.md +++ /dev/null @@ -1,13 +0,0 @@ -tree-sitter-html -================ - -[![Build Status](https://travis-ci.org/tree-sitter/tree-sitter-html.svg?branch=master)](https://travis-ci.org/tree-sitter/tree-sitter-html) -[![Build status](https://ci.appveyor.com/api/projects/status/bv1i8f3yi2aoyonx/branch/master?svg=true)](https://ci.appveyor.com/project/maxbrunsfeld/tree-sitter-html/branch/master) - -HTML grammar for [tree-sitter][]. - -[tree-sitter]: https://github.com/tree-sitter/tree-sitter - -References - -* [The HTML5 Spec](https://www.w3.org/TR/html5/syntax.html) diff --git a/vendored_parsers/tree-sitter-html/binding.gyp b/vendored_parsers/tree-sitter-html/binding.gyp deleted file mode 100644 index 9837a8975..000000000 --- a/vendored_parsers/tree-sitter-html/binding.gyp +++ /dev/null @@ -1,19 +0,0 @@ -{ - "targets": [ - { - "target_name": "tree_sitter_html_binding", - "include_dirs": [ - " - -#ifdef __cplusplus -extern "C" { -#endif - -extern TSLanguage *tree_sitter_@PARSERNAME@(); - -#ifdef __cplusplus -} -#endif - -#endif // TREE_SITTER_@UPPER_PARSERNAME@_H_ diff --git a/vendored_parsers/tree-sitter-html/bindings/c/tree-sitter.pc.in b/vendored_parsers/tree-sitter-html/bindings/c/tree-sitter.pc.in deleted file mode 100644 index 8c2baa401..000000000 --- a/vendored_parsers/tree-sitter-html/bindings/c/tree-sitter.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@PREFIX@ -libdir=@LIBDIR@ -includedir=@INCLUDEDIR@ -additionallibs=@ADDITIONALLIBS@ - -Name: tree-sitter-@PARSERNAME@ -Description: A tree-sitter grammar for the @PARSERNAME@ programming language. -URL: @PARSERREPOURL@ -Version: @VERSION@ -Libs: -L${libdir} ${additionallibs} -ltree-sitter-@PARSERNAME@ -Cflags: -I${includedir} diff --git a/vendored_parsers/tree-sitter-html/bindings/node/binding.cc b/vendored_parsers/tree-sitter-html/bindings/node/binding.cc deleted file mode 100644 index c578559d6..000000000 --- a/vendored_parsers/tree-sitter-html/bindings/node/binding.cc +++ /dev/null @@ -1,28 +0,0 @@ -#include "tree_sitter/parser.h" -#include -#include "nan.h" - -using namespace v8; - -extern "C" TSLanguage * tree_sitter_html(); - -namespace { - -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_html()); - - Nan::Set(instance, Nan::New("name").ToLocalChecked(), Nan::New("html").ToLocalChecked()); - Nan::Set(module, Nan::New("exports").ToLocalChecked(), instance); -} - -NODE_MODULE(tree_sitter_html_binding, Init) - -} // namespace diff --git a/vendored_parsers/tree-sitter-html/bindings/node/index.js b/vendored_parsers/tree-sitter-html/bindings/node/index.js deleted file mode 100644 index 801b0d031..000000000 --- a/vendored_parsers/tree-sitter-html/bindings/node/index.js +++ /dev/null @@ -1,19 +0,0 @@ -try { - module.exports = require("../../build/Release/tree_sitter_html_binding"); -} catch (error1) { - if (error1.code !== 'MODULE_NOT_FOUND') { - throw error1; - } - try { - module.exports = require("../../build/Debug/tree_sitter_html_binding"); - } catch (error2) { - if (error2.code !== 'MODULE_NOT_FOUND') { - throw error2; - } - throw error1 - } -} - -try { - module.exports.nodeTypeInfo = require("../../src/node-types.json"); -} catch (_) {} diff --git a/vendored_parsers/tree-sitter-html/bindings/rust/build.rs b/vendored_parsers/tree-sitter-html/bindings/rust/build.rs deleted file mode 100644 index 65350f14d..000000000 --- a/vendored_parsers/tree-sitter-html/bindings/rust/build.rs +++ /dev/null @@ -1,25 +0,0 @@ -fn main() { - let src_dir = std::path::Path::new("src"); - - let mut c_config = cc::Build::new(); - c_config.include(&src_dir); - c_config - .flag_if_supported("-Wno-unused-parameter") - .flag_if_supported("-Wno-unused-but-set-variable") - .flag_if_supported("-Wno-trigraphs"); - let parser_path = src_dir.join("parser.c"); - c_config.file(&parser_path); - println!("cargo:rerun-if-changed={}", parser_path.to_str().unwrap()); - c_config.compile("parser"); - - let mut cpp_config = cc::Build::new(); - cpp_config.cpp(true); - cpp_config.include(&src_dir); - cpp_config - .flag_if_supported("-Wno-unused-parameter") - .flag_if_supported("-Wno-unused-but-set-variable"); - let scanner_path = src_dir.join("scanner.cc"); - cpp_config.file(&scanner_path); - println!("cargo:rerun-if-changed={}", scanner_path.to_str().unwrap()); - cpp_config.compile("scanner"); -} diff --git a/vendored_parsers/tree-sitter-html/bindings/rust/lib.rs b/vendored_parsers/tree-sitter-html/bindings/rust/lib.rs deleted file mode 100644 index 88b6abd20..000000000 --- a/vendored_parsers/tree-sitter-html/bindings/rust/lib.rs +++ /dev/null @@ -1,52 +0,0 @@ -//! This crate provides html language support for the [tree-sitter][] parsing library. -//! -//! Typically, you will use the [language][language func] function to add this language to a -//! tree-sitter [Parser][], and then use the parser to parse some code: -//! -//! ``` -//! let code = ""; -//! let mut parser = tree_sitter::Parser::new(); -//! parser.set_language(tree_sitter_html::language()).expect("Error loading html grammar"); -//! let tree = parser.parse(code, None).unwrap(); -//! ``` -//! -//! [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html -//! [language func]: fn.language.html -//! [Parser]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Parser.html -//! [tree-sitter]: https://tree-sitter.github.io/ - -use tree_sitter::Language; - -extern "C" { - fn tree_sitter_html() -> Language; -} - -/// Get the tree-sitter [Language][] for this grammar. -/// -/// [Language]: https://docs.rs/tree-sitter/*/tree_sitter/struct.Language.html -pub fn language() -> Language { - unsafe { tree_sitter_html() } -} - -/// The content of the [`node-types.json`][] file for this grammar. -/// -/// [`node-types.json`]: https://tree-sitter.github.io/tree-sitter/using-parsers#static-node-types -pub const NODE_TYPES: &'static str = include_str!("../../src/node-types.json"); - -// Uncomment these to include any queries that this grammar contains - -// pub const HIGHLIGHTS_QUERY: &'static str = include_str!("../../queries/highlights.scm"); -// pub const INJECTIONS_QUERY: &'static str = include_str!("../../queries/injections.scm"); -// pub const LOCALS_QUERY: &'static str = include_str!("../../queries/locals.scm"); -// pub const TAGS_QUERY: &'static str = include_str!("../../queries/tags.scm"); - -#[cfg(test)] -mod tests { - #[test] - fn test_can_load_grammar() { - let mut parser = tree_sitter::Parser::new(); - parser - .set_language(super::language()) - .expect("Error loading html language"); - } -} diff --git a/vendored_parsers/tree-sitter-html/corpus/main.txt b/vendored_parsers/tree-sitter-html/corpus/main.txt deleted file mode 100644 index 917a7e910..000000000 --- a/vendored_parsers/tree-sitter-html/corpus/main.txt +++ /dev/null @@ -1,312 +0,0 @@ -=================================== -Tags -=================================== -Hello ---- - -(fragment - (element - (start_tag (tag_name)) - (text) - (end_tag (tag_name)))) - -=================================== -Tags with attributes -=================================== - ---- - -(fragment - (element - (start_tag - (tag_name) - (attribute - (attribute_name) - (attribute_value)) - (attribute - (attribute_name) - (quoted_attribute_value (attribute_value))) - (attribute - (attribute_name))) - (end_tag (tag_name)))) - -=================================== -Nested tags -=================================== -
- a - b - c - Multi-line - text -
---- - -(fragment - (element - (start_tag (tag_name)) - (element - (start_tag (tag_name)) - (text) - (end_tag (tag_name))) - (text) - (element - (start_tag (tag_name)) - (text) - (end_tag (tag_name))) - (text) - (end_tag (tag_name)))) - -================================== -Void tags -================================== -

---- - -(fragment - (element - (start_tag (tag_name)) - (element - (start_tag - (tag_name) - (attribute (attribute_name) (quoted_attribute_value (attribute_value))))) - (element (start_tag (tag_name))) - (element - (self_closing_tag - (tag_name) - (attribute (attribute_name) (attribute_value)) - (attribute (attribute_name) (attribute_value)))) - (end_tag (tag_name)))) - -================================== -Void tags at EOF -================================== - ---- - -(fragment - (element - (start_tag - (tag_name) - (attribute (attribute_name) (quoted_attribute_value (attribute_value)))))) - -================================== -Custom tags -================================== - - - Hello - - ---- - -(fragment - (element - (start_tag (tag_name)) - (element - (start_tag (tag_name) (attribute (attribute_name))) - (text) - (end_tag (tag_name))) - (end_tag (tag_name)))) - -================================== -Comments -================================== - - -
- -
---- - -(fragment - (comment) - (comment) - (element - (start_tag (tag_name)) - (comment) - (end_tag (tag_name)))) - -================================== -Raw text elements -================================== - - - - - - ---- - -(fragment - (script_element - (start_tag (tag_name)) - (raw_text) - (end_tag (tag_name))) - (style_element - (start_tag (tag_name)) - (raw_text) - (end_tag (tag_name))) - (script_element - (start_tag (tag_name)) - (raw_text) - (end_tag (tag_name)))) - -================================== -All-caps doctype -================================== - ---- - -(fragment - (doctype)) - -================================== -Lowercase doctype -================================== - ---- - -(fragment - (doctype)) - -================================== -LI elements without close tags -================================== -
    -
  • One -
  • Two -
---- - -(fragment - (element - (start_tag (tag_name)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text)) - (end_tag (tag_name)))) - -====================================== -DT and DL elements without close tags -====================================== -
-
Coffee -
Café -
Black hot drink -
Milk -
White cold drink -
---- - -(fragment - (element - (start_tag (tag_name)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text)) - (end_tag (tag_name)))) - -====================================== -P elements without close tags -====================================== -

One -

Two
-

Three -

Four -

Five

---- - -(fragment - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text) (end_tag (tag_name))) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text) (end_tag (tag_name)))) - -====================================== -Ruby annotation elements without close tags -====================================== -とうきょう ---- - -(fragment - (element - (start_tag (tag_name)) - (text) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text)) - (end_tag (tag_name)))) - -======================================= -COLGROUP elements without end tags -======================================= - - - - - - - - - -
LimeLemonOrange
---- - -(fragment - (element - (start_tag (tag_name)) - (element - (start_tag (tag_name)) - (element (start_tag - (tag_name) - (attribute (attribute_name) (quoted_attribute_value (attribute_value))))) - (element (start_tag - (tag_name) - (attribute (attribute_name) (quoted_attribute_value (attribute_value)))))) - (element - (start_tag (tag_name)) - (element (start_tag (tag_name)) (text) (end_tag (tag_name))) - (element (start_tag (tag_name)) (text) (end_tag (tag_name))) - (element (start_tag (tag_name)) (text) (end_tag (tag_name))) - (end_tag (tag_name))) - (end_tag (tag_name)))) - -========================================= -TR, TD, and TH elements without end tags -========================================= - - - -
One - Two -
Three - Four -
---- - -(fragment - (element - (start_tag (tag_name)) - (element - (start_tag (tag_name)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text))) - (element - (start_tag (tag_name)) - (element (start_tag (tag_name)) (text)) - (element (start_tag (tag_name)) (text))) - (end_tag (tag_name)))) diff --git a/vendored_parsers/tree-sitter-html/examples/deeply-nested-custom.html b/vendored_parsers/tree-sitter-html/examples/deeply-nested-custom.html deleted file mode 100644 index c7efc9432..000000000 --- a/vendored_parsers/tree-sitter-html/examples/deeply-nested-custom.html +++ /dev/null @@ -1,62 +0,0 @@ -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
diff --git a/vendored_parsers/tree-sitter-html/examples/deeply-nested.html b/vendored_parsers/tree-sitter-html/examples/deeply-nested.html deleted file mode 100644 index c9dcb8b3a..000000000 --- a/vendored_parsers/tree-sitter-html/examples/deeply-nested.html +++ /dev/null @@ -1,62 +0,0 @@ - diff --git a/vendored_parsers/tree-sitter-html/grammar.js b/vendored_parsers/tree-sitter-html/grammar.js deleted file mode 100644 index d2d5affdb..000000000 --- a/vendored_parsers/tree-sitter-html/grammar.js +++ /dev/null @@ -1,125 +0,0 @@ -module.exports = grammar({ - name: 'html', - - extras: $ => [ - $.comment, - /\s+/, - ], - - externals: $ => [ - $._start_tag_name, - $._script_start_tag_name, - $._style_start_tag_name, - $._end_tag_name, - $.erroneous_end_tag_name, - '/>', - $._implicit_end_tag, - $.raw_text, - $.comment, - ], - - rules: { - fragment: $ => repeat($._node), - - doctype: $ => seq( - ']+/, - '>' - ), - - _doctype: $ => /[Dd][Oo][Cc][Tt][Yy][Pp][Ee]/, - - _node: $ => choice( - $.doctype, - $.text, - $.element, - $.script_element, - $.style_element, - $.erroneous_end_tag - ), - - element: $ => choice( - seq( - $.start_tag, - repeat($._node), - choice($.end_tag, $._implicit_end_tag) - ), - $.self_closing_tag - ), - - script_element: $ => seq( - alias($.script_start_tag, $.start_tag), - optional($.raw_text), - $.end_tag - ), - - style_element: $ => seq( - alias($.style_start_tag, $.start_tag), - optional($.raw_text), - $.end_tag - ), - - start_tag: $ => seq( - '<', - alias($._start_tag_name, $.tag_name), - repeat($.attribute), - '>' - ), - - script_start_tag: $ => seq( - '<', - alias($._script_start_tag_name, $.tag_name), - repeat($.attribute), - '>' - ), - - style_start_tag: $ => seq( - '<', - alias($._style_start_tag_name, $.tag_name), - repeat($.attribute), - '>' - ), - - self_closing_tag: $ => seq( - '<', - alias($._start_tag_name, $.tag_name), - repeat($.attribute), - '/>' - ), - - end_tag: $ => seq( - '' - ), - - erroneous_end_tag: $ => seq( - '' - ), - - attribute: $ => seq( - $.attribute_name, - optional(seq( - '=', - choice( - $.attribute_value, - $.quoted_attribute_value - ) - )) - ), - - attribute_name: $ => /[^<>"'/=\s]+/, - - attribute_value: $ => /[^<>"'=\s]+/, - - quoted_attribute_value: $ => choice( - seq("'", optional(alias(/[^']+/, $.attribute_value)), "'"), - seq('"', optional(alias(/[^"]+/, $.attribute_value)), '"') - ), - - text: $ => /[^<>\s]([^<>]*[^<>\s])?/ - } -}); diff --git a/vendored_parsers/tree-sitter-html/package.json b/vendored_parsers/tree-sitter-html/package.json deleted file mode 100644 index 6f5dd2895..000000000 --- a/vendored_parsers/tree-sitter-html/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "tree-sitter-html", - "version": "0.19.0", - "description": "HTML grammar for tree-sitter", - "main": "bindings/node", - "keywords": [ - "parser", - "lexer" - ], - "repository": { - "type": "git", - "url": "https://github.com/tree-sitter/tree-sitter-html.git" - }, - "authors": [ - "Max Brunsfeld ", - "Ashi Krishnan " - ], - "license": "MIT", - "dependencies": { - "nan": "^2.14.0" - }, - "devDependencies": { - "tree-sitter-cli": "^0.19.1" - }, - "scripts": { - "test": "tree-sitter test && tree-sitter parse examples/*.html --quiet --time", - "test-windows": "tree-sitter test" - }, - "tree-sitter": [ - { - "scope": "text.html.basic", - "file-types": [ - "html" - ], - "injection-regex": "html" - } - ] -} diff --git a/vendored_parsers/tree-sitter-html/queries/highlights.scm b/vendored_parsers/tree-sitter-html/queries/highlights.scm deleted file mode 100644 index 2c70a9c3e..000000000 --- a/vendored_parsers/tree-sitter-html/queries/highlights.scm +++ /dev/null @@ -1,12 +0,0 @@ -(tag_name) @tag -(erroneous_end_tag_name) @tag.error -(doctype) @constant -(attribute_name) @attribute -(attribute_value) @string -(comment) @comment - -[ - "<" - ">" - "]+" - }, - { - "type": "STRING", - "value": ">" - } - ] - }, - "_doctype": { - "type": "PATTERN", - "value": "[Dd][Oo][Cc][Tt][Yy][Pp][Ee]" - }, - "_node": { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "doctype" - }, - { - "type": "SYMBOL", - "name": "text" - }, - { - "type": "SYMBOL", - "name": "element" - }, - { - "type": "SYMBOL", - "name": "script_element" - }, - { - "type": "SYMBOL", - "name": "style_element" - }, - { - "type": "SYMBOL", - "name": "erroneous_end_tag" - } - ] - }, - "element": { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "start_tag" - }, - { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "_node" - } - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "end_tag" - }, - { - "type": "SYMBOL", - "name": "_implicit_end_tag" - } - ] - } - ] - }, - { - "type": "SYMBOL", - "name": "self_closing_tag" - } - ] - }, - "script_element": { - "type": "SEQ", - "members": [ - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "script_start_tag" - }, - "named": true, - "value": "start_tag" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "raw_text" - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "SYMBOL", - "name": "end_tag" - } - ] - }, - "style_element": { - "type": "SEQ", - "members": [ - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "style_start_tag" - }, - "named": true, - "value": "start_tag" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "raw_text" - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "SYMBOL", - "name": "end_tag" - } - ] - }, - "start_tag": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "<" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_start_tag_name" - }, - "named": true, - "value": "tag_name" - }, - { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "attribute" - } - }, - { - "type": "STRING", - "value": ">" - } - ] - }, - "script_start_tag": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "<" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_script_start_tag_name" - }, - "named": true, - "value": "tag_name" - }, - { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "attribute" - } - }, - { - "type": "STRING", - "value": ">" - } - ] - }, - "style_start_tag": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "<" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_style_start_tag_name" - }, - "named": true, - "value": "tag_name" - }, - { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "attribute" - } - }, - { - "type": "STRING", - "value": ">" - } - ] - }, - "self_closing_tag": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "<" - }, - { - "type": "ALIAS", - "content": { - "type": "SYMBOL", - "name": "_start_tag_name" - }, - "named": true, - "value": "tag_name" - }, - { - "type": "REPEAT", - "content": { - "type": "SYMBOL", - "name": "attribute" - } - }, - { - "type": "STRING", - "value": "/>" - } - ] - }, - "end_tag": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "" - } - ] - }, - "erroneous_end_tag": { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "" - } - ] - }, - "attribute": { - "type": "SEQ", - "members": [ - { - "type": "SYMBOL", - "name": "attribute_name" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "=" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "SYMBOL", - "name": "attribute_value" - }, - { - "type": "SYMBOL", - "name": "quoted_attribute_value" - } - ] - } - ] - }, - { - "type": "BLANK" - } - ] - } - ] - }, - "attribute_name": { - "type": "PATTERN", - "value": "[^<>\"'/=\\s]+" - }, - "attribute_value": { - "type": "PATTERN", - "value": "[^<>\"'=\\s]+" - }, - "quoted_attribute_value": { - "type": "CHOICE", - "members": [ - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "'" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "ALIAS", - "content": { - "type": "PATTERN", - "value": "[^']+" - }, - "named": true, - "value": "attribute_value" - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "STRING", - "value": "'" - } - ] - }, - { - "type": "SEQ", - "members": [ - { - "type": "STRING", - "value": "\"" - }, - { - "type": "CHOICE", - "members": [ - { - "type": "ALIAS", - "content": { - "type": "PATTERN", - "value": "[^\"]+" - }, - "named": true, - "value": "attribute_value" - }, - { - "type": "BLANK" - } - ] - }, - { - "type": "STRING", - "value": "\"" - } - ] - } - ] - }, - "text": { - "type": "PATTERN", - "value": "[^<>\\s]([^<>]*[^<>\\s])?" - } - }, - "extras": [ - { - "type": "SYMBOL", - "name": "comment" - }, - { - "type": "PATTERN", - "value": "\\s+" - } - ], - "conflicts": [], - "precedences": [], - "externals": [ - { - "type": "SYMBOL", - "name": "_start_tag_name" - }, - { - "type": "SYMBOL", - "name": "_script_start_tag_name" - }, - { - "type": "SYMBOL", - "name": "_style_start_tag_name" - }, - { - "type": "SYMBOL", - "name": "_end_tag_name" - }, - { - "type": "SYMBOL", - "name": "erroneous_end_tag_name" - }, - { - "type": "STRING", - "value": "/>" - }, - { - "type": "SYMBOL", - "name": "_implicit_end_tag" - }, - { - "type": "SYMBOL", - "name": "raw_text" - }, - { - "type": "SYMBOL", - "name": "comment" - } - ], - "inline": [], - "supertypes": [] -} - diff --git a/vendored_parsers/tree-sitter-html/src/node-types.json b/vendored_parsers/tree-sitter-html/src/node-types.json deleted file mode 100644 index 5d975ea6f..000000000 --- a/vendored_parsers/tree-sitter-html/src/node-types.json +++ /dev/null @@ -1,305 +0,0 @@ -[ - { - "type": "attribute", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "attribute_name", - "named": true - }, - { - "type": "attribute_value", - "named": true - }, - { - "type": "quoted_attribute_value", - "named": true - } - ] - } - }, - { - "type": "doctype", - "named": true, - "fields": {} - }, - { - "type": "element", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "doctype", - "named": true - }, - { - "type": "element", - "named": true - }, - { - "type": "end_tag", - "named": true - }, - { - "type": "erroneous_end_tag", - "named": true - }, - { - "type": "script_element", - "named": true - }, - { - "type": "self_closing_tag", - "named": true - }, - { - "type": "start_tag", - "named": true - }, - { - "type": "style_element", - "named": true - }, - { - "type": "text", - "named": true - } - ] - } - }, - { - "type": "end_tag", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "tag_name", - "named": true - } - ] - } - }, - { - "type": "erroneous_end_tag", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": true, - "types": [ - { - "type": "erroneous_end_tag_name", - "named": true - } - ] - } - }, - { - "type": "fragment", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": false, - "types": [ - { - "type": "doctype", - "named": true - }, - { - "type": "element", - "named": true - }, - { - "type": "erroneous_end_tag", - "named": true - }, - { - "type": "script_element", - "named": true - }, - { - "type": "style_element", - "named": true - }, - { - "type": "text", - "named": true - } - ] - } - }, - { - "type": "quoted_attribute_value", - "named": true, - "fields": {}, - "children": { - "multiple": false, - "required": false, - "types": [ - { - "type": "attribute_value", - "named": true - } - ] - } - }, - { - "type": "script_element", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "end_tag", - "named": true - }, - { - "type": "raw_text", - "named": true - }, - { - "type": "start_tag", - "named": true - } - ] - } - }, - { - "type": "self_closing_tag", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "attribute", - "named": true - }, - { - "type": "tag_name", - "named": true - } - ] - } - }, - { - "type": "start_tag", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "attribute", - "named": true - }, - { - "type": "tag_name", - "named": true - } - ] - } - }, - { - "type": "style_element", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": true, - "types": [ - { - "type": "end_tag", - "named": true - }, - { - "type": "raw_text", - "named": true - }, - { - "type": "start_tag", - "named": true - } - ] - } - }, - { - "type": "\"", - "named": false - }, - { - "type": "'", - "named": false - }, - { - "type": "/>", - "named": false - }, - { - "type": "<", - "named": false - }, - { - "type": "", - "named": false - }, - { - "type": "attribute_name", - "named": true - }, - { - "type": "attribute_value", - "named": true - }, - { - "type": "comment", - "named": true - }, - { - "type": "doctype", - "named": false - }, - { - "type": "erroneous_end_tag_name", - "named": true - }, - { - "type": "raw_text", - "named": true - }, - { - "type": "tag_name", - "named": true - }, - { - "type": "text", - "named": true - } -] \ No newline at end of file diff --git a/vendored_parsers/tree-sitter-html/src/parser.c b/vendored_parsers/tree-sitter-html/src/parser.c deleted file mode 100644 index f0061aaab..000000000 --- a/vendored_parsers/tree-sitter-html/src/parser.c +++ /dev/null @@ -1,1928 +0,0 @@ -#include - -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#endif - -#define LANGUAGE_VERSION 13 -#define STATE_COUNT 94 -#define LARGE_STATE_COUNT 2 -#define SYMBOL_COUNT 40 -#define ALIAS_COUNT 0 -#define TOKEN_COUNT 24 -#define EXTERNAL_TOKEN_COUNT 9 -#define FIELD_COUNT 0 -#define MAX_ALIAS_SEQUENCE_LENGTH 4 -#define PRODUCTION_ID_COUNT 1 - -enum { - anon_sym_LT_BANG = 1, - aux_sym_doctype_token1 = 2, - anon_sym_GT = 3, - sym__doctype = 4, - anon_sym_LT = 5, - anon_sym_SLASH_GT = 6, - anon_sym_LT_SLASH = 7, - anon_sym_EQ = 8, - sym_attribute_name = 9, - sym_attribute_value = 10, - anon_sym_SQUOTE = 11, - aux_sym_quoted_attribute_value_token1 = 12, - anon_sym_DQUOTE = 13, - aux_sym_quoted_attribute_value_token2 = 14, - sym_text = 15, - sym__start_tag_name = 16, - sym__script_start_tag_name = 17, - sym__style_start_tag_name = 18, - sym__end_tag_name = 19, - sym_erroneous_end_tag_name = 20, - sym__implicit_end_tag = 21, - sym_raw_text = 22, - sym_comment = 23, - sym_fragment = 24, - sym_doctype = 25, - sym__node = 26, - sym_element = 27, - sym_script_element = 28, - sym_style_element = 29, - sym_start_tag = 30, - sym_script_start_tag = 31, - sym_style_start_tag = 32, - sym_self_closing_tag = 33, - sym_end_tag = 34, - sym_erroneous_end_tag = 35, - sym_attribute = 36, - sym_quoted_attribute_value = 37, - aux_sym_fragment_repeat1 = 38, - aux_sym_start_tag_repeat1 = 39, -}; - -static const char * const ts_symbol_names[] = { - [ts_builtin_sym_end] = "end", - [anon_sym_LT_BANG] = "", - [sym__doctype] = "doctype", - [anon_sym_LT] = "<", - [anon_sym_SLASH_GT] = "/>", - [anon_sym_LT_SLASH] = "eof(lexer); - switch (state) { - case 0: - if (eof) ADVANCE(15); - if (lookahead == '"') ADVANCE(30); - if (lookahead == '\'') ADVANCE(27); - if (lookahead == '/') ADVANCE(5); - if (lookahead == '<') ADVANCE(21); - if (lookahead == '=') ADVANCE(24); - if (lookahead == '>') ADVANCE(19); - if (lookahead == 'D' || - lookahead == 'd') ADVANCE(8); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(0) - END_STATE(); - case 1: - if (lookahead == '"') ADVANCE(30); - if (lookahead == '\'') ADVANCE(27); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(1) - if (lookahead != 0 && - (lookahead < '<' || '>' < lookahead)) ADVANCE(26); - END_STATE(); - case 2: - if (lookahead == '"') ADVANCE(30); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(31); - if (lookahead != 0) ADVANCE(32); - END_STATE(); - case 3: - if (lookahead == '\'') ADVANCE(27); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(28); - if (lookahead != 0) ADVANCE(29); - END_STATE(); - case 4: - if (lookahead == '/') ADVANCE(5); - if (lookahead == '=') ADVANCE(24); - if (lookahead == '>') ADVANCE(19); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(4) - if (lookahead != 0 && - lookahead != '"' && - lookahead != '\'' && - lookahead != '<') ADVANCE(25); - END_STATE(); - case 5: - if (lookahead == '>') ADVANCE(22); - END_STATE(); - case 6: - if (lookahead == 'C' || - lookahead == 'c') ADVANCE(10); - END_STATE(); - case 7: - if (lookahead == 'E' || - lookahead == 'e') ADVANCE(20); - END_STATE(); - case 8: - if (lookahead == 'O' || - lookahead == 'o') ADVANCE(6); - END_STATE(); - case 9: - if (lookahead == 'P' || - lookahead == 'p') ADVANCE(7); - END_STATE(); - case 10: - if (lookahead == 'T' || - lookahead == 't') ADVANCE(11); - END_STATE(); - case 11: - if (lookahead == 'Y' || - lookahead == 'y') ADVANCE(9); - END_STATE(); - case 12: - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(12); - if (lookahead != 0 && - lookahead != '<' && - lookahead != '>') ADVANCE(33); - END_STATE(); - case 13: - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(17); - if (lookahead != 0 && - lookahead != '>') ADVANCE(18); - END_STATE(); - case 14: - if (eof) ADVANCE(15); - if (lookahead == '<') ADVANCE(21); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(14) - if (lookahead != 0 && - lookahead != '>') ADVANCE(33); - END_STATE(); - case 15: - ACCEPT_TOKEN(ts_builtin_sym_end); - END_STATE(); - case 16: - ACCEPT_TOKEN(anon_sym_LT_BANG); - END_STATE(); - case 17: - ACCEPT_TOKEN(aux_sym_doctype_token1); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(17); - if (lookahead != 0 && - lookahead != '>') ADVANCE(18); - END_STATE(); - case 18: - ACCEPT_TOKEN(aux_sym_doctype_token1); - if (lookahead != 0 && - lookahead != '>') ADVANCE(18); - END_STATE(); - case 19: - ACCEPT_TOKEN(anon_sym_GT); - END_STATE(); - case 20: - ACCEPT_TOKEN(sym__doctype); - END_STATE(); - case 21: - ACCEPT_TOKEN(anon_sym_LT); - if (lookahead == '!') ADVANCE(16); - if (lookahead == '/') ADVANCE(23); - END_STATE(); - case 22: - ACCEPT_TOKEN(anon_sym_SLASH_GT); - END_STATE(); - case 23: - ACCEPT_TOKEN(anon_sym_LT_SLASH); - END_STATE(); - case 24: - ACCEPT_TOKEN(anon_sym_EQ); - END_STATE(); - case 25: - ACCEPT_TOKEN(sym_attribute_name); - if (lookahead != 0 && - lookahead != '\t' && - lookahead != '\n' && - lookahead != '\r' && - lookahead != ' ' && - lookahead != '"' && - lookahead != '\'' && - lookahead != '/' && - (lookahead < '<' || '>' < lookahead)) ADVANCE(25); - END_STATE(); - case 26: - ACCEPT_TOKEN(sym_attribute_value); - if (lookahead != 0 && - lookahead != '\t' && - lookahead != '\n' && - lookahead != '\r' && - lookahead != ' ' && - lookahead != '"' && - lookahead != '\'' && - (lookahead < '<' || '>' < lookahead)) ADVANCE(26); - END_STATE(); - case 27: - ACCEPT_TOKEN(anon_sym_SQUOTE); - END_STATE(); - case 28: - ACCEPT_TOKEN(aux_sym_quoted_attribute_value_token1); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(28); - if (lookahead != 0 && - lookahead != '\'') ADVANCE(29); - END_STATE(); - case 29: - ACCEPT_TOKEN(aux_sym_quoted_attribute_value_token1); - if (lookahead != 0 && - lookahead != '\'') ADVANCE(29); - END_STATE(); - case 30: - ACCEPT_TOKEN(anon_sym_DQUOTE); - END_STATE(); - case 31: - ACCEPT_TOKEN(aux_sym_quoted_attribute_value_token2); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(31); - if (lookahead != 0 && - lookahead != '"') ADVANCE(32); - END_STATE(); - case 32: - ACCEPT_TOKEN(aux_sym_quoted_attribute_value_token2); - if (lookahead != 0 && - lookahead != '"') ADVANCE(32); - END_STATE(); - case 33: - ACCEPT_TOKEN(sym_text); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(12); - if (lookahead != 0 && - lookahead != '<' && - lookahead != '>') ADVANCE(33); - END_STATE(); - default: - return false; - } -} - -static const TSLexMode ts_lex_modes[STATE_COUNT] = { - [0] = {.lex_state = 0, .external_lex_state = 1}, - [1] = {.lex_state = 14, .external_lex_state = 2}, - [2] = {.lex_state = 14, .external_lex_state = 3}, - [3] = {.lex_state = 14, .external_lex_state = 3}, - [4] = {.lex_state = 14, .external_lex_state = 3}, - [5] = {.lex_state = 14, .external_lex_state = 3}, - [6] = {.lex_state = 14, .external_lex_state = 3}, - [7] = {.lex_state = 14, .external_lex_state = 2}, - [8] = {.lex_state = 14, .external_lex_state = 2}, - [9] = {.lex_state = 4, .external_lex_state = 4}, - [10] = {.lex_state = 14, .external_lex_state = 2}, - [11] = {.lex_state = 14, .external_lex_state = 2}, - [12] = {.lex_state = 14, .external_lex_state = 3}, - [13] = {.lex_state = 14, .external_lex_state = 3}, - [14] = {.lex_state = 14, .external_lex_state = 3}, - [15] = {.lex_state = 4, .external_lex_state = 4}, - [16] = {.lex_state = 14, .external_lex_state = 3}, - [17] = {.lex_state = 14, .external_lex_state = 2}, - [18] = {.lex_state = 14, .external_lex_state = 3}, - [19] = {.lex_state = 14, .external_lex_state = 3}, - [20] = {.lex_state = 14, .external_lex_state = 3}, - [21] = {.lex_state = 14, .external_lex_state = 2}, - [22] = {.lex_state = 14, .external_lex_state = 3}, - [23] = {.lex_state = 14, .external_lex_state = 2}, - [24] = {.lex_state = 14, .external_lex_state = 2}, - [25] = {.lex_state = 14, .external_lex_state = 3}, - [26] = {.lex_state = 14, .external_lex_state = 3}, - [27] = {.lex_state = 14, .external_lex_state = 2}, - [28] = {.lex_state = 4, .external_lex_state = 4}, - [29] = {.lex_state = 4, .external_lex_state = 4}, - [30] = {.lex_state = 14, .external_lex_state = 3}, - [31] = {.lex_state = 14, .external_lex_state = 2}, - [32] = {.lex_state = 4, .external_lex_state = 4}, - [33] = {.lex_state = 14, .external_lex_state = 3}, - [34] = {.lex_state = 14, .external_lex_state = 2}, - [35] = {.lex_state = 14, .external_lex_state = 3}, - [36] = {.lex_state = 14, .external_lex_state = 2}, - [37] = {.lex_state = 14, .external_lex_state = 3}, - [38] = {.lex_state = 14, .external_lex_state = 2}, - [39] = {.lex_state = 14, .external_lex_state = 2}, - [40] = {.lex_state = 1, .external_lex_state = 2}, - [41] = {.lex_state = 4, .external_lex_state = 2}, - [42] = {.lex_state = 4, .external_lex_state = 2}, - [43] = {.lex_state = 4, .external_lex_state = 4}, - [44] = {.lex_state = 1, .external_lex_state = 2}, - [45] = {.lex_state = 4, .external_lex_state = 2}, - [46] = {.lex_state = 4, .external_lex_state = 2}, - [47] = {.lex_state = 4, .external_lex_state = 2}, - [48] = {.lex_state = 4, .external_lex_state = 4}, - [49] = {.lex_state = 4, .external_lex_state = 2}, - [50] = {.lex_state = 4, .external_lex_state = 4}, - [51] = {.lex_state = 0, .external_lex_state = 5}, - [52] = {.lex_state = 0, .external_lex_state = 5}, - [53] = {.lex_state = 4, .external_lex_state = 4}, - [54] = {.lex_state = 0, .external_lex_state = 6}, - [55] = {.lex_state = 0, .external_lex_state = 6}, - [56] = {.lex_state = 0, .external_lex_state = 6}, - [57] = {.lex_state = 0, .external_lex_state = 6}, - [58] = {.lex_state = 4, .external_lex_state = 2}, - [59] = {.lex_state = 0, .external_lex_state = 6}, - [60] = {.lex_state = 0, .external_lex_state = 6}, - [61] = {.lex_state = 0, .external_lex_state = 6}, - [62] = {.lex_state = 0, .external_lex_state = 7}, - [63] = {.lex_state = 0, .external_lex_state = 2}, - [64] = {.lex_state = 2, .external_lex_state = 2}, - [65] = {.lex_state = 0, .external_lex_state = 2}, - [66] = {.lex_state = 0, .external_lex_state = 7}, - [67] = {.lex_state = 3, .external_lex_state = 2}, - [68] = {.lex_state = 0, .external_lex_state = 2}, - [69] = {.lex_state = 4, .external_lex_state = 2}, - [70] = {.lex_state = 4, .external_lex_state = 2}, - [71] = {.lex_state = 2, .external_lex_state = 2}, - [72] = {.lex_state = 0, .external_lex_state = 2}, - [73] = {.lex_state = 0, .external_lex_state = 6}, - [74] = {.lex_state = 3, .external_lex_state = 2}, - [75] = {.lex_state = 0, .external_lex_state = 2}, - [76] = {.lex_state = 0, .external_lex_state = 2}, - [77] = {.lex_state = 0, .external_lex_state = 2}, - [78] = {.lex_state = 0, .external_lex_state = 2}, - [79] = {.lex_state = 13, .external_lex_state = 2}, - [80] = {.lex_state = 0, .external_lex_state = 2}, - [81] = {.lex_state = 0, .external_lex_state = 8}, - [82] = {.lex_state = 0, .external_lex_state = 2}, - [83] = {.lex_state = 0, .external_lex_state = 2}, - [84] = {.lex_state = 0, .external_lex_state = 2}, - [85] = {.lex_state = 0, .external_lex_state = 9}, - [86] = {.lex_state = 0, .external_lex_state = 2}, - [87] = {.lex_state = 0, .external_lex_state = 2}, - [88] = {.lex_state = 0, .external_lex_state = 2}, - [89] = {.lex_state = 0, .external_lex_state = 8}, - [90] = {.lex_state = 13, .external_lex_state = 2}, - [91] = {.lex_state = 0, .external_lex_state = 2}, - [92] = {.lex_state = 0, .external_lex_state = 9}, - [93] = {.lex_state = 0, .external_lex_state = 2}, -}; - -enum { - ts_external_token__start_tag_name = 0, - ts_external_token__script_start_tag_name = 1, - ts_external_token__style_start_tag_name = 2, - ts_external_token__end_tag_name = 3, - ts_external_token_erroneous_end_tag_name = 4, - ts_external_token_SLASH_GT = 5, - ts_external_token__implicit_end_tag = 6, - ts_external_token_raw_text = 7, - ts_external_token_comment = 8, -}; - -static const TSSymbol ts_external_scanner_symbol_map[EXTERNAL_TOKEN_COUNT] = { - [ts_external_token__start_tag_name] = sym__start_tag_name, - [ts_external_token__script_start_tag_name] = sym__script_start_tag_name, - [ts_external_token__style_start_tag_name] = sym__style_start_tag_name, - [ts_external_token__end_tag_name] = sym__end_tag_name, - [ts_external_token_erroneous_end_tag_name] = sym_erroneous_end_tag_name, - [ts_external_token_SLASH_GT] = anon_sym_SLASH_GT, - [ts_external_token__implicit_end_tag] = sym__implicit_end_tag, - [ts_external_token_raw_text] = sym_raw_text, - [ts_external_token_comment] = sym_comment, -}; - -static const bool ts_external_scanner_states[10][EXTERNAL_TOKEN_COUNT] = { - [1] = { - [ts_external_token__start_tag_name] = true, - [ts_external_token__script_start_tag_name] = true, - [ts_external_token__style_start_tag_name] = true, - [ts_external_token__end_tag_name] = true, - [ts_external_token_erroneous_end_tag_name] = true, - [ts_external_token_SLASH_GT] = true, - [ts_external_token__implicit_end_tag] = true, - [ts_external_token_raw_text] = true, - [ts_external_token_comment] = true, - }, - [2] = { - [ts_external_token_comment] = true, - }, - [3] = { - [ts_external_token__implicit_end_tag] = true, - [ts_external_token_comment] = true, - }, - [4] = { - [ts_external_token_SLASH_GT] = true, - [ts_external_token_comment] = true, - }, - [5] = { - [ts_external_token__start_tag_name] = true, - [ts_external_token__script_start_tag_name] = true, - [ts_external_token__style_start_tag_name] = true, - [ts_external_token_comment] = true, - }, - [6] = { - [ts_external_token_raw_text] = true, - [ts_external_token_comment] = true, - }, - [7] = { - [ts_external_token__end_tag_name] = true, - [ts_external_token_erroneous_end_tag_name] = true, - [ts_external_token_comment] = true, - }, - [8] = { - [ts_external_token_erroneous_end_tag_name] = true, - [ts_external_token_comment] = true, - }, - [9] = { - [ts_external_token__end_tag_name] = true, - [ts_external_token_comment] = true, - }, -}; - -static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { - [0] = { - [ts_builtin_sym_end] = ACTIONS(1), - [anon_sym_LT_BANG] = ACTIONS(1), - [anon_sym_GT] = ACTIONS(1), - [sym__doctype] = ACTIONS(1), - [anon_sym_LT] = ACTIONS(1), - [anon_sym_SLASH_GT] = ACTIONS(1), - [anon_sym_LT_SLASH] = ACTIONS(1), - [anon_sym_EQ] = ACTIONS(1), - [anon_sym_SQUOTE] = ACTIONS(1), - [anon_sym_DQUOTE] = ACTIONS(1), - [sym__start_tag_name] = ACTIONS(1), - [sym__script_start_tag_name] = ACTIONS(1), - [sym__style_start_tag_name] = ACTIONS(1), - [sym__end_tag_name] = ACTIONS(1), - [sym_erroneous_end_tag_name] = ACTIONS(1), - [sym__implicit_end_tag] = ACTIONS(1), - [sym_raw_text] = ACTIONS(1), - [sym_comment] = ACTIONS(3), - }, - [1] = { - [sym_fragment] = STATE(77), - [sym_doctype] = STATE(8), - [sym__node] = STATE(8), - [sym_element] = STATE(8), - [sym_script_element] = STATE(8), - [sym_style_element] = STATE(8), - [sym_start_tag] = STATE(4), - [sym_script_start_tag] = STATE(54), - [sym_style_start_tag] = STATE(57), - [sym_self_closing_tag] = STATE(11), - [sym_erroneous_end_tag] = STATE(8), - [aux_sym_fragment_repeat1] = STATE(8), - [ts_builtin_sym_end] = ACTIONS(5), - [anon_sym_LT_BANG] = ACTIONS(7), - [anon_sym_LT] = ACTIONS(9), - [anon_sym_LT_SLASH] = ACTIONS(11), - [sym_text] = ACTIONS(13), - [sym_comment] = ACTIONS(3), - }, -}; - -static const uint16_t ts_small_parse_table[] = { - [0] = 12, - ACTIONS(3), 1, - sym_comment, - ACTIONS(15), 1, - anon_sym_LT_BANG, - ACTIONS(17), 1, - anon_sym_LT, - ACTIONS(19), 1, - anon_sym_LT_SLASH, - ACTIONS(21), 1, - sym_text, - ACTIONS(23), 1, - sym__implicit_end_tag, - STATE(5), 1, - sym_start_tag, - STATE(14), 1, - sym_self_closing_tag, - STATE(36), 1, - sym_end_tag, - STATE(55), 1, - sym_style_start_tag, - STATE(56), 1, - sym_script_start_tag, - STATE(6), 7, - sym_doctype, - sym__node, - sym_element, - sym_script_element, - sym_style_element, - sym_erroneous_end_tag, - aux_sym_fragment_repeat1, - [43] = 12, - ACTIONS(3), 1, - sym_comment, - ACTIONS(15), 1, - anon_sym_LT_BANG, - ACTIONS(17), 1, - anon_sym_LT, - ACTIONS(21), 1, - sym_text, - ACTIONS(25), 1, - anon_sym_LT_SLASH, - ACTIONS(27), 1, - sym__implicit_end_tag, - STATE(5), 1, - sym_start_tag, - STATE(14), 1, - sym_self_closing_tag, - STATE(22), 1, - sym_end_tag, - STATE(55), 1, - sym_style_start_tag, - STATE(56), 1, - sym_script_start_tag, - STATE(6), 7, - sym_doctype, - sym__node, - sym_element, - sym_script_element, - sym_style_element, - sym_erroneous_end_tag, - aux_sym_fragment_repeat1, - [86] = 12, - ACTIONS(3), 1, - sym_comment, - ACTIONS(15), 1, - anon_sym_LT_BANG, - ACTIONS(17), 1, - anon_sym_LT, - ACTIONS(19), 1, - anon_sym_LT_SLASH, - ACTIONS(29), 1, - sym_text, - ACTIONS(31), 1, - sym__implicit_end_tag, - STATE(5), 1, - sym_start_tag, - STATE(14), 1, - sym_self_closing_tag, - STATE(17), 1, - sym_end_tag, - STATE(55), 1, - sym_style_start_tag, - STATE(56), 1, - sym_script_start_tag, - STATE(2), 7, - sym_doctype, - sym__node, - sym_element, - sym_script_element, - sym_style_element, - sym_erroneous_end_tag, - aux_sym_fragment_repeat1, - [129] = 12, - ACTIONS(3), 1, - sym_comment, - ACTIONS(15), 1, - anon_sym_LT_BANG, - ACTIONS(17), 1, - anon_sym_LT, - ACTIONS(25), 1, - anon_sym_LT_SLASH, - ACTIONS(33), 1, - sym_text, - ACTIONS(35), 1, - sym__implicit_end_tag, - STATE(5), 1, - sym_start_tag, - STATE(12), 1, - sym_end_tag, - STATE(14), 1, - sym_self_closing_tag, - STATE(55), 1, - sym_style_start_tag, - STATE(56), 1, - sym_script_start_tag, - STATE(3), 7, - sym_doctype, - sym__node, - sym_element, - sym_script_element, - sym_style_element, - sym_erroneous_end_tag, - aux_sym_fragment_repeat1, - [172] = 11, - ACTIONS(3), 1, - sym_comment, - ACTIONS(37), 1, - anon_sym_LT_BANG, - ACTIONS(40), 1, - anon_sym_LT, - ACTIONS(43), 1, - anon_sym_LT_SLASH, - ACTIONS(46), 1, - sym_text, - ACTIONS(49), 1, - sym__implicit_end_tag, - STATE(5), 1, - sym_start_tag, - STATE(14), 1, - sym_self_closing_tag, - STATE(55), 1, - sym_style_start_tag, - STATE(56), 1, - sym_script_start_tag, - STATE(6), 7, - sym_doctype, - sym__node, - sym_element, - sym_script_element, - sym_style_element, - sym_erroneous_end_tag, - aux_sym_fragment_repeat1, - [212] = 11, - ACTIONS(3), 1, - sym_comment, - ACTIONS(49), 1, - ts_builtin_sym_end, - ACTIONS(51), 1, - anon_sym_LT_BANG, - ACTIONS(54), 1, - anon_sym_LT, - ACTIONS(57), 1, - anon_sym_LT_SLASH, - ACTIONS(60), 1, - sym_text, - STATE(4), 1, - sym_start_tag, - STATE(11), 1, - sym_self_closing_tag, - STATE(54), 1, - sym_script_start_tag, - STATE(57), 1, - sym_style_start_tag, - STATE(7), 7, - sym_doctype, - sym__node, - sym_element, - sym_script_element, - sym_style_element, - sym_erroneous_end_tag, - aux_sym_fragment_repeat1, - [252] = 11, - ACTIONS(3), 1, - sym_comment, - ACTIONS(7), 1, - anon_sym_LT_BANG, - ACTIONS(9), 1, - anon_sym_LT, - ACTIONS(11), 1, - anon_sym_LT_SLASH, - ACTIONS(63), 1, - ts_builtin_sym_end, - ACTIONS(65), 1, - sym_text, - STATE(4), 1, - sym_start_tag, - STATE(11), 1, - sym_self_closing_tag, - STATE(54), 1, - sym_script_start_tag, - STATE(57), 1, - sym_style_start_tag, - STATE(7), 7, - sym_doctype, - sym__node, - sym_element, - sym_script_element, - sym_style_element, - sym_erroneous_end_tag, - aux_sym_fragment_repeat1, - [292] = 5, - ACTIONS(3), 1, - sym_comment, - ACTIONS(67), 1, - anon_sym_GT, - ACTIONS(69), 1, - anon_sym_SLASH_GT, - ACTIONS(71), 1, - sym_attribute_name, - STATE(29), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [309] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(75), 1, - anon_sym_LT, - ACTIONS(73), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [322] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(79), 1, - anon_sym_LT, - ACTIONS(77), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [335] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(83), 1, - anon_sym_LT, - ACTIONS(81), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [348] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(87), 1, - anon_sym_LT, - ACTIONS(85), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [361] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(79), 1, - anon_sym_LT, - ACTIONS(77), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [374] = 5, - ACTIONS(3), 1, - sym_comment, - ACTIONS(71), 1, - sym_attribute_name, - ACTIONS(89), 1, - anon_sym_GT, - ACTIONS(91), 1, - anon_sym_SLASH_GT, - STATE(28), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [391] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(95), 1, - anon_sym_LT, - ACTIONS(93), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [404] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(83), 1, - anon_sym_LT, - ACTIONS(81), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [417] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(99), 1, - anon_sym_LT, - ACTIONS(97), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [430] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(103), 1, - anon_sym_LT, - ACTIONS(101), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [443] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(75), 1, - anon_sym_LT, - ACTIONS(73), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [456] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(87), 1, - anon_sym_LT, - ACTIONS(85), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [469] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(107), 1, - anon_sym_LT, - ACTIONS(105), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [482] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(111), 1, - anon_sym_LT, - ACTIONS(109), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [495] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(115), 1, - anon_sym_LT, - ACTIONS(113), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [508] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(119), 1, - anon_sym_LT, - ACTIONS(117), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [521] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(123), 1, - anon_sym_LT, - ACTIONS(121), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [534] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(127), 1, - anon_sym_LT, - ACTIONS(125), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [547] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(131), 1, - sym_attribute_name, - ACTIONS(129), 2, - anon_sym_GT, - anon_sym_SLASH_GT, - STATE(28), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [562] = 5, - ACTIONS(3), 1, - sym_comment, - ACTIONS(71), 1, - sym_attribute_name, - ACTIONS(89), 1, - anon_sym_GT, - ACTIONS(134), 1, - anon_sym_SLASH_GT, - STATE(28), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [579] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(127), 1, - anon_sym_LT, - ACTIONS(125), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [592] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(95), 1, - anon_sym_LT, - ACTIONS(93), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [605] = 5, - ACTIONS(3), 1, - sym_comment, - ACTIONS(67), 1, - anon_sym_GT, - ACTIONS(71), 1, - sym_attribute_name, - ACTIONS(136), 1, - anon_sym_SLASH_GT, - STATE(15), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [622] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(140), 1, - anon_sym_LT, - ACTIONS(138), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [635] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(119), 1, - anon_sym_LT, - ACTIONS(117), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [648] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(111), 1, - anon_sym_LT, - ACTIONS(109), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [661] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(107), 1, - anon_sym_LT, - ACTIONS(105), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [674] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(115), 1, - anon_sym_LT, - ACTIONS(113), 4, - sym__implicit_end_tag, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [687] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(103), 1, - anon_sym_LT, - ACTIONS(101), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [700] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(99), 1, - anon_sym_LT, - ACTIONS(97), 4, - ts_builtin_sym_end, - anon_sym_LT_BANG, - anon_sym_LT_SLASH, - sym_text, - [713] = 5, - ACTIONS(3), 1, - sym_comment, - ACTIONS(142), 1, - sym_attribute_value, - ACTIONS(144), 1, - anon_sym_SQUOTE, - ACTIONS(146), 1, - anon_sym_DQUOTE, - STATE(48), 1, - sym_quoted_attribute_value, - [729] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(148), 1, - anon_sym_GT, - ACTIONS(150), 1, - sym_attribute_name, - STATE(47), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [743] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(150), 1, - sym_attribute_name, - ACTIONS(152), 1, - anon_sym_GT, - STATE(47), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [757] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(156), 1, - anon_sym_EQ, - ACTIONS(154), 3, - anon_sym_GT, - anon_sym_SLASH_GT, - sym_attribute_name, - [769] = 5, - ACTIONS(3), 1, - sym_comment, - ACTIONS(158), 1, - sym_attribute_value, - ACTIONS(160), 1, - anon_sym_SQUOTE, - ACTIONS(162), 1, - anon_sym_DQUOTE, - STATE(69), 1, - sym_quoted_attribute_value, - [785] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(150), 1, - sym_attribute_name, - ACTIONS(164), 1, - anon_sym_GT, - STATE(41), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [799] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(150), 1, - sym_attribute_name, - ACTIONS(166), 1, - anon_sym_GT, - STATE(42), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [813] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(129), 1, - anon_sym_GT, - ACTIONS(168), 1, - sym_attribute_name, - STATE(47), 2, - sym_attribute, - aux_sym_start_tag_repeat1, - [827] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(171), 3, - anon_sym_GT, - anon_sym_SLASH_GT, - sym_attribute_name, - [836] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(173), 1, - anon_sym_EQ, - ACTIONS(154), 2, - anon_sym_GT, - sym_attribute_name, - [847] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(175), 3, - anon_sym_GT, - anon_sym_SLASH_GT, - sym_attribute_name, - [856] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(177), 1, - sym__start_tag_name, - ACTIONS(179), 1, - sym__script_start_tag_name, - ACTIONS(181), 1, - sym__style_start_tag_name, - [869] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(179), 1, - sym__script_start_tag_name, - ACTIONS(181), 1, - sym__style_start_tag_name, - ACTIONS(183), 1, - sym__start_tag_name, - [882] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(185), 3, - anon_sym_GT, - anon_sym_SLASH_GT, - sym_attribute_name, - [891] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(187), 1, - anon_sym_LT_SLASH, - ACTIONS(189), 1, - sym_raw_text, - STATE(21), 1, - sym_end_tag, - [904] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(191), 1, - anon_sym_LT_SLASH, - ACTIONS(193), 1, - sym_raw_text, - STATE(35), 1, - sym_end_tag, - [917] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(191), 1, - anon_sym_LT_SLASH, - ACTIONS(195), 1, - sym_raw_text, - STATE(13), 1, - sym_end_tag, - [930] = 4, - ACTIONS(3), 1, - sym_comment, - ACTIONS(187), 1, - anon_sym_LT_SLASH, - ACTIONS(197), 1, - sym_raw_text, - STATE(23), 1, - sym_end_tag, - [943] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(185), 2, - anon_sym_GT, - sym_attribute_name, - [951] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(199), 2, - sym_raw_text, - anon_sym_LT_SLASH, - [959] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(201), 2, - sym_raw_text, - anon_sym_LT_SLASH, - [967] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(203), 2, - sym_raw_text, - anon_sym_LT_SLASH, - [975] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(205), 1, - sym__end_tag_name, - ACTIONS(207), 1, - sym_erroneous_end_tag_name, - [985] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(187), 1, - anon_sym_LT_SLASH, - STATE(38), 1, - sym_end_tag, - [995] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(209), 1, - anon_sym_DQUOTE, - ACTIONS(211), 1, - aux_sym_quoted_attribute_value_token2, - [1005] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(187), 1, - anon_sym_LT_SLASH, - STATE(10), 1, - sym_end_tag, - [1015] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(207), 1, - sym_erroneous_end_tag_name, - ACTIONS(213), 1, - sym__end_tag_name, - [1025] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(209), 1, - anon_sym_SQUOTE, - ACTIONS(215), 1, - aux_sym_quoted_attribute_value_token1, - [1035] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(191), 1, - anon_sym_LT_SLASH, - STATE(19), 1, - sym_end_tag, - [1045] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(171), 2, - anon_sym_GT, - sym_attribute_name, - [1053] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(175), 2, - anon_sym_GT, - sym_attribute_name, - [1061] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(217), 1, - anon_sym_DQUOTE, - ACTIONS(219), 1, - aux_sym_quoted_attribute_value_token2, - [1071] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(191), 1, - anon_sym_LT_SLASH, - STATE(20), 1, - sym_end_tag, - [1081] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(221), 2, - sym_raw_text, - anon_sym_LT_SLASH, - [1089] = 3, - ACTIONS(3), 1, - sym_comment, - ACTIONS(217), 1, - anon_sym_SQUOTE, - ACTIONS(223), 1, - aux_sym_quoted_attribute_value_token1, - [1099] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(225), 1, - sym__doctype, - [1106] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(227), 1, - anon_sym_GT, - [1113] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(229), 1, - ts_builtin_sym_end, - [1120] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(231), 1, - anon_sym_SQUOTE, - [1127] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(233), 1, - aux_sym_doctype_token1, - [1134] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(235), 1, - anon_sym_GT, - [1141] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(237), 1, - sym_erroneous_end_tag_name, - [1148] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(239), 1, - anon_sym_GT, - [1155] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(241), 1, - anon_sym_GT, - [1162] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(243), 1, - anon_sym_GT, - [1169] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(213), 1, - sym__end_tag_name, - [1176] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(245), 1, - anon_sym_SQUOTE, - [1183] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(245), 1, - anon_sym_DQUOTE, - [1190] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(231), 1, - anon_sym_DQUOTE, - [1197] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(207), 1, - sym_erroneous_end_tag_name, - [1204] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(247), 1, - aux_sym_doctype_token1, - [1211] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(249), 1, - anon_sym_GT, - [1218] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(205), 1, - sym__end_tag_name, - [1225] = 2, - ACTIONS(3), 1, - sym_comment, - ACTIONS(251), 1, - sym__doctype, -}; - -static const uint32_t ts_small_parse_table_map[] = { - [SMALL_STATE(2)] = 0, - [SMALL_STATE(3)] = 43, - [SMALL_STATE(4)] = 86, - [SMALL_STATE(5)] = 129, - [SMALL_STATE(6)] = 172, - [SMALL_STATE(7)] = 212, - [SMALL_STATE(8)] = 252, - [SMALL_STATE(9)] = 292, - [SMALL_STATE(10)] = 309, - [SMALL_STATE(11)] = 322, - [SMALL_STATE(12)] = 335, - [SMALL_STATE(13)] = 348, - [SMALL_STATE(14)] = 361, - [SMALL_STATE(15)] = 374, - [SMALL_STATE(16)] = 391, - [SMALL_STATE(17)] = 404, - [SMALL_STATE(18)] = 417, - [SMALL_STATE(19)] = 430, - [SMALL_STATE(20)] = 443, - [SMALL_STATE(21)] = 456, - [SMALL_STATE(22)] = 469, - [SMALL_STATE(23)] = 482, - [SMALL_STATE(24)] = 495, - [SMALL_STATE(25)] = 508, - [SMALL_STATE(26)] = 521, - [SMALL_STATE(27)] = 534, - [SMALL_STATE(28)] = 547, - [SMALL_STATE(29)] = 562, - [SMALL_STATE(30)] = 579, - [SMALL_STATE(31)] = 592, - [SMALL_STATE(32)] = 605, - [SMALL_STATE(33)] = 622, - [SMALL_STATE(34)] = 635, - [SMALL_STATE(35)] = 648, - [SMALL_STATE(36)] = 661, - [SMALL_STATE(37)] = 674, - [SMALL_STATE(38)] = 687, - [SMALL_STATE(39)] = 700, - [SMALL_STATE(40)] = 713, - [SMALL_STATE(41)] = 729, - [SMALL_STATE(42)] = 743, - [SMALL_STATE(43)] = 757, - [SMALL_STATE(44)] = 769, - [SMALL_STATE(45)] = 785, - [SMALL_STATE(46)] = 799, - [SMALL_STATE(47)] = 813, - [SMALL_STATE(48)] = 827, - [SMALL_STATE(49)] = 836, - [SMALL_STATE(50)] = 847, - [SMALL_STATE(51)] = 856, - [SMALL_STATE(52)] = 869, - [SMALL_STATE(53)] = 882, - [SMALL_STATE(54)] = 891, - [SMALL_STATE(55)] = 904, - [SMALL_STATE(56)] = 917, - [SMALL_STATE(57)] = 930, - [SMALL_STATE(58)] = 943, - [SMALL_STATE(59)] = 951, - [SMALL_STATE(60)] = 959, - [SMALL_STATE(61)] = 967, - [SMALL_STATE(62)] = 975, - [SMALL_STATE(63)] = 985, - [SMALL_STATE(64)] = 995, - [SMALL_STATE(65)] = 1005, - [SMALL_STATE(66)] = 1015, - [SMALL_STATE(67)] = 1025, - [SMALL_STATE(68)] = 1035, - [SMALL_STATE(69)] = 1045, - [SMALL_STATE(70)] = 1053, - [SMALL_STATE(71)] = 1061, - [SMALL_STATE(72)] = 1071, - [SMALL_STATE(73)] = 1081, - [SMALL_STATE(74)] = 1089, - [SMALL_STATE(75)] = 1099, - [SMALL_STATE(76)] = 1106, - [SMALL_STATE(77)] = 1113, - [SMALL_STATE(78)] = 1120, - [SMALL_STATE(79)] = 1127, - [SMALL_STATE(80)] = 1134, - [SMALL_STATE(81)] = 1141, - [SMALL_STATE(82)] = 1148, - [SMALL_STATE(83)] = 1155, - [SMALL_STATE(84)] = 1162, - [SMALL_STATE(85)] = 1169, - [SMALL_STATE(86)] = 1176, - [SMALL_STATE(87)] = 1183, - [SMALL_STATE(88)] = 1190, - [SMALL_STATE(89)] = 1197, - [SMALL_STATE(90)] = 1204, - [SMALL_STATE(91)] = 1211, - [SMALL_STATE(92)] = 1218, - [SMALL_STATE(93)] = 1225, -}; - -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_fragment, 0), - [7] = {.entry = {.count = 1, .reusable = true}}, SHIFT(75), - [9] = {.entry = {.count = 1, .reusable = false}}, SHIFT(52), - [11] = {.entry = {.count = 1, .reusable = true}}, SHIFT(81), - [13] = {.entry = {.count = 1, .reusable = true}}, SHIFT(8), - [15] = {.entry = {.count = 1, .reusable = true}}, SHIFT(93), - [17] = {.entry = {.count = 1, .reusable = false}}, SHIFT(51), - [19] = {.entry = {.count = 1, .reusable = true}}, SHIFT(66), - [21] = {.entry = {.count = 1, .reusable = true}}, SHIFT(6), - [23] = {.entry = {.count = 1, .reusable = true}}, SHIFT(36), - [25] = {.entry = {.count = 1, .reusable = true}}, SHIFT(62), - [27] = {.entry = {.count = 1, .reusable = true}}, SHIFT(22), - [29] = {.entry = {.count = 1, .reusable = true}}, SHIFT(2), - [31] = {.entry = {.count = 1, .reusable = true}}, SHIFT(17), - [33] = {.entry = {.count = 1, .reusable = true}}, SHIFT(3), - [35] = {.entry = {.count = 1, .reusable = true}}, SHIFT(12), - [37] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(93), - [40] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(51), - [43] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(89), - [46] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(6), - [49] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_fragment_repeat1, 2), - [51] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(75), - [54] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(52), - [57] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(81), - [60] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_fragment_repeat1, 2), SHIFT_REPEAT(7), - [63] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_fragment, 1), - [65] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), - [67] = {.entry = {.count = 1, .reusable = true}}, SHIFT(26), - [69] = {.entry = {.count = 1, .reusable = true}}, SHIFT(27), - [71] = {.entry = {.count = 1, .reusable = true}}, SHIFT(43), - [73] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_script_element, 3), - [75] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_script_element, 3), - [77] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 1), - [79] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_element, 1), - [81] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 2), - [83] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_element, 2), - [85] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_script_element, 2), - [87] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_script_element, 2), - [89] = {.entry = {.count = 1, .reusable = true}}, SHIFT(33), - [91] = {.entry = {.count = 1, .reusable = true}}, SHIFT(16), - [93] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_self_closing_tag, 4), - [95] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_self_closing_tag, 4), - [97] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_doctype, 4), - [99] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_doctype, 4), - [101] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_style_element, 3), - [103] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_style_element, 3), - [105] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3), - [107] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_element, 3), - [109] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_style_element, 2), - [111] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_style_element, 2), - [113] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_end_tag, 3), - [115] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_end_tag, 3), - [117] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_erroneous_end_tag, 3), - [119] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_erroneous_end_tag, 3), - [121] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_start_tag, 3), - [123] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_start_tag, 3), - [125] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_self_closing_tag, 3), - [127] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_self_closing_tag, 3), - [129] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_start_tag_repeat1, 2), - [131] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_start_tag_repeat1, 2), SHIFT_REPEAT(43), - [134] = {.entry = {.count = 1, .reusable = true}}, SHIFT(31), - [136] = {.entry = {.count = 1, .reusable = true}}, SHIFT(30), - [138] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_start_tag, 4), - [140] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_start_tag, 4), - [142] = {.entry = {.count = 1, .reusable = true}}, SHIFT(48), - [144] = {.entry = {.count = 1, .reusable = true}}, SHIFT(74), - [146] = {.entry = {.count = 1, .reusable = true}}, SHIFT(71), - [148] = {.entry = {.count = 1, .reusable = true}}, SHIFT(73), - [150] = {.entry = {.count = 1, .reusable = true}}, SHIFT(49), - [152] = {.entry = {.count = 1, .reusable = true}}, SHIFT(59), - [154] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute, 1), - [156] = {.entry = {.count = 1, .reusable = true}}, SHIFT(40), - [158] = {.entry = {.count = 1, .reusable = true}}, SHIFT(69), - [160] = {.entry = {.count = 1, .reusable = true}}, SHIFT(67), - [162] = {.entry = {.count = 1, .reusable = true}}, SHIFT(64), - [164] = {.entry = {.count = 1, .reusable = true}}, SHIFT(60), - [166] = {.entry = {.count = 1, .reusable = true}}, SHIFT(61), - [168] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_start_tag_repeat1, 2), SHIFT_REPEAT(49), - [171] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_attribute, 3), - [173] = {.entry = {.count = 1, .reusable = true}}, SHIFT(44), - [175] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_quoted_attribute_value, 2), - [177] = {.entry = {.count = 1, .reusable = true}}, SHIFT(32), - [179] = {.entry = {.count = 1, .reusable = true}}, SHIFT(46), - [181] = {.entry = {.count = 1, .reusable = true}}, SHIFT(45), - [183] = {.entry = {.count = 1, .reusable = true}}, SHIFT(9), - [185] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_quoted_attribute_value, 3), - [187] = {.entry = {.count = 1, .reusable = true}}, SHIFT(85), - [189] = {.entry = {.count = 1, .reusable = true}}, SHIFT(65), - [191] = {.entry = {.count = 1, .reusable = true}}, SHIFT(92), - [193] = {.entry = {.count = 1, .reusable = true}}, SHIFT(68), - [195] = {.entry = {.count = 1, .reusable = true}}, SHIFT(72), - [197] = {.entry = {.count = 1, .reusable = true}}, SHIFT(63), - [199] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_script_start_tag, 4), - [201] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_style_start_tag, 3), - [203] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_script_start_tag, 3), - [205] = {.entry = {.count = 1, .reusable = true}}, SHIFT(82), - [207] = {.entry = {.count = 1, .reusable = true}}, SHIFT(76), - [209] = {.entry = {.count = 1, .reusable = false}}, SHIFT(70), - [211] = {.entry = {.count = 1, .reusable = true}}, SHIFT(87), - [213] = {.entry = {.count = 1, .reusable = true}}, SHIFT(83), - [215] = {.entry = {.count = 1, .reusable = true}}, SHIFT(86), - [217] = {.entry = {.count = 1, .reusable = false}}, SHIFT(50), - [219] = {.entry = {.count = 1, .reusable = true}}, SHIFT(88), - [221] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_style_start_tag, 4), - [223] = {.entry = {.count = 1, .reusable = true}}, SHIFT(78), - [225] = {.entry = {.count = 1, .reusable = true}}, SHIFT(79), - [227] = {.entry = {.count = 1, .reusable = true}}, SHIFT(25), - [229] = {.entry = {.count = 1, .reusable = true}}, ACCEPT_INPUT(), - [231] = {.entry = {.count = 1, .reusable = true}}, SHIFT(53), - [233] = {.entry = {.count = 1, .reusable = true}}, SHIFT(91), - [235] = {.entry = {.count = 1, .reusable = true}}, SHIFT(18), - [237] = {.entry = {.count = 1, .reusable = true}}, SHIFT(84), - [239] = {.entry = {.count = 1, .reusable = true}}, SHIFT(37), - [241] = {.entry = {.count = 1, .reusable = true}}, SHIFT(24), - [243] = {.entry = {.count = 1, .reusable = true}}, SHIFT(34), - [245] = {.entry = {.count = 1, .reusable = true}}, SHIFT(58), - [247] = {.entry = {.count = 1, .reusable = true}}, SHIFT(80), - [249] = {.entry = {.count = 1, .reusable = true}}, SHIFT(39), - [251] = {.entry = {.count = 1, .reusable = true}}, SHIFT(90), -}; - -#ifdef __cplusplus -extern "C" { -#endif -void *tree_sitter_html_external_scanner_create(void); -void tree_sitter_html_external_scanner_destroy(void *); -bool tree_sitter_html_external_scanner_scan(void *, TSLexer *, const bool *); -unsigned tree_sitter_html_external_scanner_serialize(void *, char *); -void tree_sitter_html_external_scanner_deserialize(void *, const char *, unsigned); - -#ifdef _WIN32 -#define extern __declspec(dllexport) -#endif - -extern const TSLanguage *tree_sitter_html(void) { - static const TSLanguage language = { - .version = LANGUAGE_VERSION, - .symbol_count = SYMBOL_COUNT, - .alias_count = ALIAS_COUNT, - .token_count = TOKEN_COUNT, - .external_token_count = EXTERNAL_TOKEN_COUNT, - .state_count = STATE_COUNT, - .large_state_count = LARGE_STATE_COUNT, - .production_id_count = PRODUCTION_ID_COUNT, - .field_count = FIELD_COUNT, - .max_alias_sequence_length = MAX_ALIAS_SEQUENCE_LENGTH, - .parse_table = &ts_parse_table[0][0], - .small_parse_table = ts_small_parse_table, - .small_parse_table_map = ts_small_parse_table_map, - .parse_actions = ts_parse_actions, - .symbol_names = ts_symbol_names, - .symbol_metadata = ts_symbol_metadata, - .public_symbol_map = ts_symbol_map, - .alias_map = ts_non_terminal_alias_map, - .alias_sequences = &ts_alias_sequences[0][0], - .lex_modes = ts_lex_modes, - .lex_fn = ts_lex, - .external_scanner = { - &ts_external_scanner_states[0][0], - ts_external_scanner_symbol_map, - tree_sitter_html_external_scanner_create, - tree_sitter_html_external_scanner_destroy, - tree_sitter_html_external_scanner_scan, - tree_sitter_html_external_scanner_serialize, - tree_sitter_html_external_scanner_deserialize, - }, - }; - return &language; -} -#ifdef __cplusplus -} -#endif diff --git a/vendored_parsers/tree-sitter-html/src/scanner.cc b/vendored_parsers/tree-sitter-html/src/scanner.cc deleted file mode 100644 index 515f86ea6..000000000 --- a/vendored_parsers/tree-sitter-html/src/scanner.cc +++ /dev/null @@ -1,310 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "tag.h" - -namespace { - -using std::vector; -using std::string; - -enum TokenType { - START_TAG_NAME, - SCRIPT_START_TAG_NAME, - STYLE_START_TAG_NAME, - END_TAG_NAME, - ERRONEOUS_END_TAG_NAME, - SELF_CLOSING_TAG_DELIMITER, - IMPLICIT_END_TAG, - RAW_TEXT, - COMMENT -}; - -struct Scanner { - Scanner() {} - - unsigned serialize(char *buffer) { - uint16_t tag_count = tags.size() > UINT16_MAX ? UINT16_MAX : tags.size(); - uint16_t serialized_tag_count = 0; - - unsigned i = sizeof(tag_count); - std::memcpy(&buffer[i], &tag_count, sizeof(tag_count)); - i += sizeof(tag_count); - - for (; serialized_tag_count < tag_count; serialized_tag_count++) { - Tag &tag = tags[serialized_tag_count]; - if (tag.type == CUSTOM) { - unsigned name_length = tag.custom_tag_name.size(); - if (name_length > UINT8_MAX) name_length = UINT8_MAX; - if (i + 2 + name_length >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) break; - buffer[i++] = static_cast(tag.type); - buffer[i++] = name_length; - tag.custom_tag_name.copy(&buffer[i], name_length); - i += name_length; - } else { - if (i + 1 >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) break; - buffer[i++] = static_cast(tag.type); - } - } - - std::memcpy(&buffer[0], &serialized_tag_count, sizeof(serialized_tag_count)); - return i; - } - - void deserialize(const char *buffer, unsigned length) { - tags.clear(); - if (length > 0) { - unsigned i = 0; - uint16_t tag_count, serialized_tag_count; - - std::memcpy(&serialized_tag_count, &buffer[i], sizeof(serialized_tag_count)); - i += sizeof(serialized_tag_count); - - std::memcpy(&tag_count, &buffer[i], sizeof(tag_count)); - i += sizeof(tag_count); - - tags.resize(tag_count); - for (unsigned j = 0; j < serialized_tag_count; j++) { - Tag &tag = tags[j]; - tag.type = static_cast(buffer[i++]); - if (tag.type == CUSTOM) { - uint16_t name_length = static_cast(buffer[i++]); - tag.custom_tag_name.assign(&buffer[i], &buffer[i + name_length]); - i += name_length; - } - } - } - } - - string scan_tag_name(TSLexer *lexer) { - string tag_name; - while (iswalnum(lexer->lookahead) || - lexer->lookahead == '-' || - lexer->lookahead == ':') { - tag_name += towupper(lexer->lookahead); - lexer->advance(lexer, false); - } - return tag_name; - } - - bool scan_comment(TSLexer *lexer) { - if (lexer->lookahead != '-') return false; - lexer->advance(lexer, false); - if (lexer->lookahead != '-') return false; - lexer->advance(lexer, false); - - unsigned dashes = 0; - while (lexer->lookahead) { - switch (lexer->lookahead) { - case '-': - ++dashes; - break; - case '>': - if (dashes >= 2) { - lexer->result_symbol = COMMENT; - lexer->advance(lexer, false); - lexer->mark_end(lexer); - return true; - } - default: - dashes = 0; - } - lexer->advance(lexer, false); - } - return false; - } - - bool scan_raw_text(TSLexer *lexer) { - if (!tags.size()) return false; - - lexer->mark_end(lexer); - - const string &end_delimiter = tags.back().type == SCRIPT - ? "lookahead) { - if (towupper(lexer->lookahead) == end_delimiter[delimiter_index]) { - delimiter_index++; - if (delimiter_index == end_delimiter.size()) break; - lexer->advance(lexer, false); - } else { - delimiter_index = 0; - lexer->advance(lexer, false); - lexer->mark_end(lexer); - } - } - - lexer->result_symbol = RAW_TEXT; - return true; - } - - bool scan_implicit_end_tag(TSLexer *lexer) { - Tag *parent = tags.empty() ? NULL : &tags.back(); - - bool is_closing_tag = false; - if (lexer->lookahead == '/') { - is_closing_tag = true; - lexer->advance(lexer, false); - } else { - if (parent && parent->is_void()) { - tags.pop_back(); - lexer->result_symbol = IMPLICIT_END_TAG; - return true; - } - } - - string tag_name = scan_tag_name(lexer); - if (tag_name.empty()) return false; - - Tag next_tag = Tag::for_name(tag_name); - - if (is_closing_tag) { - // The tag correctly closes the topmost element on the stack - if (!tags.empty() && tags.back() == next_tag) return false; - - // Otherwise, dig deeper and queue implicit end tags (to be nice in - // the case of malformed HTML) - if (std::find(tags.begin(), tags.end(), next_tag) != tags.end()) { - tags.pop_back(); - lexer->result_symbol = IMPLICIT_END_TAG; - return true; - } - } else if (parent && !parent->can_contain(next_tag)) { - tags.pop_back(); - lexer->result_symbol = IMPLICIT_END_TAG; - return true; - } - - return false; - } - - bool scan_start_tag_name(TSLexer *lexer) { - string tag_name = scan_tag_name(lexer); - if (tag_name.empty()) return false; - Tag tag = Tag::for_name(tag_name); - tags.push_back(tag); - switch (tag.type) { - case SCRIPT: - lexer->result_symbol = SCRIPT_START_TAG_NAME; - break; - case STYLE: - lexer->result_symbol = STYLE_START_TAG_NAME; - break; - default: - lexer->result_symbol = START_TAG_NAME; - break; - } - return true; - } - - bool scan_end_tag_name(TSLexer *lexer) { - string tag_name = scan_tag_name(lexer); - if (tag_name.empty()) return false; - Tag tag = Tag::for_name(tag_name); - if (!tags.empty() && tags.back() == tag) { - tags.pop_back(); - lexer->result_symbol = END_TAG_NAME; - } else { - lexer->result_symbol = ERRONEOUS_END_TAG_NAME; - } - return true; - } - - bool scan_self_closing_tag_delimiter(TSLexer *lexer) { - lexer->advance(lexer, false); - if (lexer->lookahead == '>') { - lexer->advance(lexer, false); - if (!tags.empty()) { - tags.pop_back(); - lexer->result_symbol = SELF_CLOSING_TAG_DELIMITER; - } - return true; - } - return false; - } - - bool scan(TSLexer *lexer, const bool *valid_symbols) { - while (iswspace(lexer->lookahead)) { - lexer->advance(lexer, true); - } - - if (valid_symbols[RAW_TEXT] && !valid_symbols[START_TAG_NAME] && !valid_symbols[END_TAG_NAME]) { - return scan_raw_text(lexer); - } - - switch (lexer->lookahead) { - case '<': - lexer->mark_end(lexer); - lexer->advance(lexer, false); - - if (lexer->lookahead == '!') { - lexer->advance(lexer, false); - return scan_comment(lexer); - } - - if (valid_symbols[IMPLICIT_END_TAG]) { - return scan_implicit_end_tag(lexer); - } - break; - - case '\0': - if (valid_symbols[IMPLICIT_END_TAG]) { - return scan_implicit_end_tag(lexer); - } - break; - - case '/': - if (valid_symbols[SELF_CLOSING_TAG_DELIMITER]) { - return scan_self_closing_tag_delimiter(lexer); - } - break; - - default: - if ((valid_symbols[START_TAG_NAME] || valid_symbols[END_TAG_NAME]) && !valid_symbols[RAW_TEXT]) { - return valid_symbols[START_TAG_NAME] - ? scan_start_tag_name(lexer) - : scan_end_tag_name(lexer); - } - } - - return false; - } - - vector tags; -}; - -} - -extern "C" { - -void *tree_sitter_html_external_scanner_create() { - return new Scanner(); -} - -bool tree_sitter_html_external_scanner_scan(void *payload, TSLexer *lexer, - const bool *valid_symbols) { - Scanner *scanner = static_cast(payload); - return scanner->scan(lexer, valid_symbols); -} - -unsigned tree_sitter_html_external_scanner_serialize(void *payload, char *buffer) { - Scanner *scanner = static_cast(payload); - return scanner->serialize(buffer); -} - -void tree_sitter_html_external_scanner_deserialize(void *payload, const char *buffer, unsigned length) { - Scanner *scanner = static_cast(payload); - scanner->deserialize(buffer, length); -} - -void tree_sitter_html_external_scanner_destroy(void *payload) { - Scanner *scanner = static_cast(payload); - delete scanner; -} - -} diff --git a/vendored_parsers/tree-sitter-html/src/tag.h b/vendored_parsers/tree-sitter-html/src/tag.h deleted file mode 100644 index b068eca0f..000000000 --- a/vendored_parsers/tree-sitter-html/src/tag.h +++ /dev/null @@ -1,380 +0,0 @@ -#include -#include - -using std::string; -using std::map; - -enum TagType { - AREA, - BASE, - BASEFONT, - BGSOUND, - BR, - COL, - COMMAND, - EMBED, - FRAME, - HR, - IMAGE, - IMG, - INPUT, - ISINDEX, - KEYGEN, - LINK, - MENUITEM, - META, - NEXTID, - PARAM, - SOURCE, - TRACK, - WBR, - END_OF_VOID_TAGS, - - A, - ABBR, - ADDRESS, - ARTICLE, - ASIDE, - AUDIO, - B, - BDI, - BDO, - BLOCKQUOTE, - BODY, - BUTTON, - CANVAS, - CAPTION, - CITE, - CODE, - COLGROUP, - DATA, - DATALIST, - DD, - DEL, - DETAILS, - DFN, - DIALOG, - DIV, - DL, - DT, - EM, - FIELDSET, - FIGCAPTION, - FIGURE, - FOOTER, - FORM, - H1, - H2, - H3, - H4, - H5, - H6, - HEAD, - HEADER, - HGROUP, - HTML, - I, - IFRAME, - INS, - KBD, - LABEL, - LEGEND, - LI, - MAIN, - MAP, - MARK, - MATH, - MENU, - METER, - NAV, - NOSCRIPT, - OBJECT, - OL, - OPTGROUP, - OPTION, - OUTPUT, - P, - PICTURE, - PRE, - PROGRESS, - Q, - RB, - RP, - RT, - RTC, - RUBY, - S, - SAMP, - SCRIPT, - SECTION, - SELECT, - SLOT, - SMALL, - SPAN, - STRONG, - STYLE, - SUB, - SUMMARY, - SUP, - SVG, - TABLE, - TBODY, - TD, - TEMPLATE, - TEXTAREA, - TFOOT, - TH, - THEAD, - TIME, - TITLE, - TR, - U, - UL, - VAR, - VIDEO, - - CUSTOM, -}; - - -static const map get_tag_map() { - map result; -#define TAG(name) result[#name] = name - TAG(AREA); - TAG(BASE); - TAG(BASEFONT); - TAG(BGSOUND); - TAG(BR); - TAG(COL); - TAG(COMMAND); - TAG(EMBED); - TAG(FRAME); - TAG(HR); - TAG(IMAGE); - TAG(IMG); - TAG(INPUT); - TAG(ISINDEX); - TAG(KEYGEN); - TAG(LINK); - TAG(MENUITEM); - TAG(META); - TAG(NEXTID); - TAG(PARAM); - TAG(SOURCE); - TAG(TRACK); - TAG(WBR); - TAG(A); - TAG(ABBR); - TAG(ADDRESS); - TAG(ARTICLE); - TAG(ASIDE); - TAG(AUDIO); - TAG(B); - TAG(BDI); - TAG(BDO); - TAG(BLOCKQUOTE); - TAG(BODY); - TAG(BUTTON); - TAG(CANVAS); - TAG(CAPTION); - TAG(CITE); - TAG(CODE); - TAG(COLGROUP); - TAG(DATA); - TAG(DATALIST); - TAG(DD); - TAG(DEL); - TAG(DETAILS); - TAG(DFN); - TAG(DIALOG); - TAG(DIV); - TAG(DL); - TAG(DT); - TAG(EM); - TAG(FIELDSET); - TAG(FIGCAPTION); - TAG(FIGURE); - TAG(FOOTER); - TAG(FORM); - TAG(H1); - TAG(H2); - TAG(H3); - TAG(H4); - TAG(H5); - TAG(H6); - TAG(HEAD); - TAG(HEADER); - TAG(HGROUP); - TAG(HTML); - TAG(I); - TAG(IFRAME); - TAG(INS); - TAG(KBD); - TAG(LABEL); - TAG(LEGEND); - TAG(LI); - TAG(MAIN); - TAG(MAP); - TAG(MARK); - TAG(MATH); - TAG(MENU); - TAG(METER); - TAG(NAV); - TAG(NOSCRIPT); - TAG(OBJECT); - TAG(OL); - TAG(OPTGROUP); - TAG(OPTION); - TAG(OUTPUT); - TAG(P); - TAG(PICTURE); - TAG(PRE); - TAG(PROGRESS); - TAG(Q); - TAG(RB); - TAG(RP); - TAG(RT); - TAG(RTC); - TAG(RUBY); - TAG(S); - TAG(SAMP); - TAG(SCRIPT); - TAG(SECTION); - TAG(SELECT); - TAG(SLOT); - TAG(SMALL); - TAG(SPAN); - TAG(STRONG); - TAG(STYLE); - TAG(SUB); - TAG(SUMMARY); - TAG(SUP); - TAG(SVG); - TAG(TABLE); - TAG(TBODY); - TAG(TD); - TAG(TEMPLATE); - TAG(TEXTAREA); - TAG(TFOOT); - TAG(TH); - TAG(THEAD); - TAG(TIME); - TAG(TITLE); - TAG(TR); - TAG(U); - TAG(UL); - TAG(VAR); - TAG(VIDEO); -#undef TAG - return result; -} - -static const map TAG_TYPES_BY_TAG_NAME = get_tag_map(); - -static const TagType TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS[] = { - ADDRESS, - ARTICLE, - ASIDE, - BLOCKQUOTE, - DETAILS, - DIV, - DL, - FIELDSET, - FIGCAPTION, - FIGURE, - FOOTER, - FORM, - H1, - H2, - H3, - H4, - H5, - H6, - HEADER, - HR, - MAIN, - NAV, - OL, - P, - PRE, - SECTION, -}; - -static const TagType *TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS_END = ( - TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS + - sizeof(TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS) / - sizeof(TagType) -); - -struct Tag { - TagType type; - string custom_tag_name; - - // This default constructor is used in the case where there is not enough space - // in the serialization buffer to store all of the tags. In that case, tags - // that cannot be serialized will be treated as having an unknown type. These - // tags will be closed via implicit end tags regardless of the next closing - // tag is encountered. - Tag() : type(END_OF_VOID_TAGS) {} - - Tag(TagType type, const string &name) : type(type), custom_tag_name(name) {} - - bool operator==(const Tag &other) const { - if (type != other.type) return false; - if (type == CUSTOM && custom_tag_name != other.custom_tag_name) return false; - return true; - } - - inline bool is_void() const { - return type < END_OF_VOID_TAGS; - } - - inline bool can_contain(const Tag &tag) { - TagType child = tag.type; - - switch (type) { - case LI: return child != LI; - - case DT: - case DD: - return child != DT && child != DD; - - case P: - return std::find( - TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS, - TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS_END, - tag.type - ) == TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS_END; - - case COLGROUP: - return child == COL; - - case RB: - case RT: - case RP: - return child != RB && child != RT && child != RP; - - case OPTGROUP: - return child != OPTGROUP; - - case TR: - return child != TR; - - case TD: - case TH: - return child != TD && child != TH && child != TR; - - default: - return true; - } - } - - static inline Tag for_name(const string &name) { - map::const_iterator type = TAG_TYPES_BY_TAG_NAME.find(name); - if (type != TAG_TYPES_BY_TAG_NAME.end()) { - return Tag(type->second, string()); - } else { - return Tag(CUSTOM, name); - } - } -}; diff --git a/vendored_parsers/tree-sitter-html/src/tree_sitter/parser.h b/vendored_parsers/tree-sitter-html/src/tree_sitter/parser.h deleted file mode 100644 index cbbc7b4ee..000000000 --- a/vendored_parsers/tree-sitter-html/src/tree_sitter/parser.h +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef TREE_SITTER_PARSER_H_ -#define TREE_SITTER_PARSER_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#define ts_builtin_sym_error ((TSSymbol)-1) -#define ts_builtin_sym_end 0 -#define TREE_SITTER_SERIALIZATION_BUFFER_SIZE 1024 - -typedef uint16_t TSStateId; - -#ifndef TREE_SITTER_API_H_ -typedef uint16_t TSSymbol; -typedef uint16_t TSFieldId; -typedef struct TSLanguage TSLanguage; -#endif - -typedef struct { - TSFieldId field_id; - uint8_t child_index; - bool inherited; -} TSFieldMapEntry; - -typedef struct { - uint16_t index; - uint16_t length; -} TSFieldMapSlice; - -typedef struct { - bool visible; - bool named; - bool supertype; -} TSSymbolMetadata; - -typedef struct TSLexer TSLexer; - -struct TSLexer { - int32_t lookahead; - TSSymbol result_symbol; - void (*advance)(TSLexer *, bool); - void (*mark_end)(TSLexer *); - uint32_t (*get_column)(TSLexer *); - bool (*is_at_included_range_start)(const TSLexer *); - bool (*eof)(const TSLexer *); -}; - -typedef enum { - TSParseActionTypeShift, - TSParseActionTypeReduce, - TSParseActionTypeAccept, - TSParseActionTypeRecover, -} TSParseActionType; - -typedef union { - struct { - uint8_t type; - TSStateId state; - bool extra; - bool repetition; - } shift; - struct { - uint8_t type; - uint8_t child_count; - TSSymbol symbol; - int16_t dynamic_precedence; - uint16_t production_id; - } reduce; - uint8_t type; -} TSParseAction; - -typedef struct { - uint16_t lex_state; - uint16_t external_lex_state; -} TSLexMode; - -typedef union { - TSParseAction action; - struct { - uint8_t count; - bool reusable; - } entry; -} TSParseActionEntry; - -struct TSLanguage { - uint32_t version; - uint32_t symbol_count; - uint32_t alias_count; - uint32_t token_count; - uint32_t external_token_count; - uint32_t state_count; - uint32_t large_state_count; - uint32_t production_id_count; - uint32_t field_count; - uint16_t max_alias_sequence_length; - const uint16_t *parse_table; - const uint16_t *small_parse_table; - const uint32_t *small_parse_table_map; - const TSParseActionEntry *parse_actions; - const char * const *symbol_names; - const char * const *field_names; - const TSFieldMapSlice *field_map_slices; - const TSFieldMapEntry *field_map_entries; - const TSSymbolMetadata *symbol_metadata; - const TSSymbol *public_symbol_map; - const uint16_t *alias_map; - const TSSymbol *alias_sequences; - const TSLexMode *lex_modes; - bool (*lex_fn)(TSLexer *, TSStateId); - bool (*keyword_lex_fn)(TSLexer *, TSStateId); - TSSymbol keyword_capture_token; - struct { - const bool *states; - const TSSymbol *symbol_map; - void *(*create)(void); - void (*destroy)(void *); - bool (*scan)(void *, TSLexer *, const bool *symbol_whitelist); - unsigned (*serialize)(void *, char *); - void (*deserialize)(void *, const char *, unsigned); - } external_scanner; -}; - -/* - * Lexer Macros - */ - -#define START_LEXER() \ - bool result = false; \ - bool skip = false; \ - bool eof = false; \ - int32_t lookahead; \ - goto start; \ - next_state: \ - lexer->advance(lexer, skip); \ - start: \ - skip = false; \ - lookahead = lexer->lookahead; - -#define ADVANCE(state_value) \ - { \ - state = state_value; \ - goto next_state; \ - } - -#define SKIP(state_value) \ - { \ - skip = true; \ - state = state_value; \ - goto next_state; \ - } - -#define ACCEPT_TOKEN(symbol_value) \ - result = true; \ - lexer->result_symbol = symbol_value; \ - lexer->mark_end(lexer); - -#define END_STATE() return result; - -/* - * Parse Table Macros - */ - -#define SMALL_STATE(id) id - LARGE_STATE_COUNT - -#define STATE(id) id - -#define ACTIONS(id) id - -#define SHIFT(state_value) \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .state = state_value \ - } \ - }} - -#define SHIFT_REPEAT(state_value) \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .state = state_value, \ - .repetition = true \ - } \ - }} - -#define SHIFT_EXTRA() \ - {{ \ - .shift = { \ - .type = TSParseActionTypeShift, \ - .extra = true \ - } \ - }} - -#define REDUCE(symbol_val, child_count_val, ...) \ - {{ \ - .reduce = { \ - .type = TSParseActionTypeReduce, \ - .symbol = symbol_val, \ - .child_count = child_count_val, \ - __VA_ARGS__ \ - }, \ - }} - -#define RECOVER() \ - {{ \ - .type = TSParseActionTypeRecover \ - }} - -#define ACCEPT_INPUT() \ - {{ \ - .type = TSParseActionTypeAccept \ - }} - -#ifdef __cplusplus -} -#endif - -#endif // TREE_SITTER_PARSER_H_