From 70d58fe4839dbb1835f41a949d66736369bb589e Mon Sep 17 00:00:00 2001 From: ilevyor Date: Mon, 25 Mar 2024 11:49:25 -0400 Subject: [PATCH 1/3] update html submodule --- resources/language-submodules/tree-sitter-html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/language-submodules/tree-sitter-html b/resources/language-submodules/tree-sitter-html index 949b78051..cc53b6878 160000 --- a/resources/language-submodules/tree-sitter-html +++ b/resources/language-submodules/tree-sitter-html @@ -1 +1 @@ -Subproject commit 949b78051835564bca937565241e5e337d838502 +Subproject commit cc53b6878a003cf26d213025af49c78388cebe21 From 7328821b9a5f82f440d7273aea496afabfe1025d Mon Sep 17 00:00:00 2001 From: ilevyor Date: Mon, 25 Mar 2024 15:26:57 -0400 Subject: [PATCH 2/3] figure out why rust bindings are working differently than the cli --- Cargo.lock | 2 +- crates/core/src/test.rs | 40 + crates/language/src/html.rs | 36 + .../wasm_parsers/tree-sitter-html.wasm | Bin 18346 -> 19160 bytes resources/edit_grammars.mjs | 4 - .../tree-sitter-html/.appveyor.yml | 22 - .../tree-sitter-html/.travis.yml | 10 - .../tree-sitter-html/Cargo.toml | 2 +- .../tree-sitter-html/Makefile | 2 +- .../tree-sitter-html/README.md | 14 +- .../tree-sitter-html/bindings/rust/README.md | 2 +- .../tree-sitter-html/grammar.js | 4 +- .../tree-sitter-html/package.json | 7 +- .../tree-sitter-html/src/grammar.json | 4 +- .../tree-sitter-html/src/node-types.json | 78 +- .../tree-sitter-html/src/parser.c | 575 +- .../tree-sitter-html/src/scanner.c | 272 +- .../tree-sitter-html/src/tag.h | 78 +- .../tree-sitter-html/src/tree_sitter/alloc.h | 54 + .../tree-sitter-html/src/tree_sitter/array.h | 290 + .../tree_sitter_typescript_binding.node | Bin 4868832 -> 4868832 bytes .../tree_sitter_typescript_binding.target.mk | 14 +- .../common/define-grammar.js | 6 + .../tree-sitter-javascript/build/Makefile | 2 +- .../src/parser.o | Bin 796072 -> 732592 bytes .../src/scanner.o | Bin 16352 -> 16352 bytes .../tree_sitter_javascript_binding.node | Bin 769808 -> 720368 bytes .../src/node-types.json | 2174 +- .../tree-sitter-javascript/src/parser.c | 218673 +++++++-------- .../src/tree_sitter/parser.h | 16 +- .../tree-sitter-vue/build/Makefile | 2 +- .../Release/tree_sitter_vue_binding.node | Bin 94960 -> 94960 bytes .../node_modules/.yarn-integrity | 2 +- .../tree-sitter-html/.appveyor.yml | 22 - .../node_modules/tree-sitter-html/.travis.yml | 10 - .../node_modules/tree-sitter-html/Cargo.toml | 2 +- .../node_modules/tree-sitter-html/Makefile | 2 +- .../node_modules/tree-sitter-html/README.md | 14 +- .../tree-sitter-html/bindings/rust/README.md | 2 +- .../tree-sitter-html/build/Makefile | 2 +- .../tree_sitter_html_binding/src/scanner.o.d | 5 +- .../tree_sitter_html_binding/src/parser.o | Bin 26440 -> 31224 bytes .../tree_sitter_html_binding/src/scanner.o | Bin 33416 -> 34760 bytes .../Release/tree_sitter_html_binding.node | Bin 75424 -> 75104 bytes .../build/tree_sitter_html_binding.target.mk | 14 +- .../node_modules/tree-sitter-html/grammar.js | 259 +- .../tree-sitter-html/package.json | 7 +- .../tree-sitter-html/src/grammar.json | 491 +- .../tree-sitter-html/src/node-types.json | 506 +- .../tree-sitter-html/src/parser.c | 2446 +- .../tree-sitter-html/src/scanner.c | 272 +- .../node_modules/tree-sitter-html/src/tag.h | 78 +- .../tree-sitter-html/src/tree_sitter/alloc.h | 54 + .../tree-sitter-html/src/tree_sitter/array.h | 290 + .../tree-sitter-vue/yarn.lock | 2 +- .../html-metavariable-grammar.js | 148 + resources/node-types/html-node-types.json | 78 +- 57 files changed, 108449 insertions(+), 118640 deletions(-) delete mode 100644 resources/language-metavariables/tree-sitter-html/.appveyor.yml delete mode 100644 resources/language-metavariables/tree-sitter-html/.travis.yml create mode 100644 resources/language-metavariables/tree-sitter-html/src/tree_sitter/alloc.h create mode 100644 resources/language-metavariables/tree-sitter-html/src/tree_sitter/array.h delete mode 100644 resources/language-metavariables/tree-sitter-vue/node_modules/tree-sitter-html/.appveyor.yml delete mode 100644 resources/language-metavariables/tree-sitter-vue/node_modules/tree-sitter-html/.travis.yml create mode 100644 resources/language-metavariables/tree-sitter-vue/node_modules/tree-sitter-html/src/tree_sitter/alloc.h create mode 100644 resources/language-metavariables/tree-sitter-vue/node_modules/tree-sitter-html/src/tree_sitter/array.h create mode 100644 resources/metavariable-grammars/html-metavariable-grammar.js diff --git a/Cargo.lock b/Cargo.lock index 6e6071b2d..0573f2b85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3852,7 +3852,7 @@ dependencies = [ [[package]] name = "tree-sitter-html" -version = "0.20.0" +version = "0.20.2" dependencies = [ "cc", "tree-sitter", diff --git a/crates/core/src/test.rs b/crates/core/src/test.rs index 16068ae56..be58522e7 100644 --- a/crates/core/src/test.rs +++ b/crates/core/src/test.rs @@ -12815,3 +12815,43 @@ fn css_property_value() { }) .unwrap(); } + +#[test] +fn html_match_element() { + run_test_match(TestArg { + pattern: r#" + |language html + | + |contains `` + |"# + .trim_margin() + .unwrap(), + source: r#""# + .to_owned(), + }) + .unwrap(); +} + +#[test] +fn html_prefer_self_closing_tags() { + run_test_expected(TestArgExpected { + pattern: r#" + |language html + | + |`<$name $props>$body` => `<$name $props />` where $body <: . + |"# + .trim_margin() + .unwrap(), + source: r#" + | + |"# + .trim_margin() + .unwrap(), + expected: r#" + | + |"# + .trim_margin() + .unwrap(), + }) + .unwrap(); +} diff --git a/crates/language/src/html.rs b/crates/language/src/html.rs index 69fe09020..e649909f7 100644 --- a/crates/language/src/html.rs +++ b/crates/language/src/html.rs @@ -61,3 +61,39 @@ impl Language for Html { self.metavariable_sort } } + + + + +#[cfg(test)] +mod tests { + use marzano_util::print_node::print_node; + + use crate::language::nodes_from_indices; + + use super::*; + + #[test] + fn import_variable() { + let snippet = r#""#; + let lang = Html::new(None); + let mut parser = tree_sitter::Parser::new().unwrap(); + parser.set_language(lang.get_ts_language()).unwrap(); + let snippets = lang.parse_snippet_contexts(snippet); + let nodes = nodes_from_indices(&snippets); + assert!(!nodes.is_empty()); + print_node(&nodes[0].node); + } + + #[test] + fn print_sexp() { + let code = r#""#; + let mut parser = tree_sitter::Parser::new().unwrap(); + let lang = Html::new(None); + parser.set_language(lang.get_ts_language()).unwrap(); + let tree = parser.parse(code, None).unwrap().unwrap(); + let root = tree.root_node(); + let sexp = root.to_sexp(); + println!("{sexp}"); + } +} \ No newline at end of file diff --git a/crates/wasm-bindings/wasm_parsers/tree-sitter-html.wasm b/crates/wasm-bindings/wasm_parsers/tree-sitter-html.wasm index 2d2835ca4c38ccd28385614934ec2effc9f72f48..1c88c0c465ce6d830a9edfa7b4ab3cebfde4bf87 100755 GIT binary patch literal 19160 zcmcgz36LaLas5@*=T!Af?`rSW?pF6+v)cRC-t%XsXSOv*&(5J+YK>-F(%iE%y%H-d z&w_=K9oSwQ0u)Ae$PR@qEEC4~z%md>2q6iCk&OtXuxyJE4r9Q92*5_zAivCCzw4OZ zSrLwK&1Til%%Ax)^XJd{Rn;qo=Ozt-Bbz#VVPbS@eAgZ${#Y?)2xCwB4r5;2Vb0@Z z%p3F6!r7YVix77RU@>6e6H%Cd5?f(artVFQ3{Olp^3Tb>_lbCLnbSeBa<^CMjc~!%~mQxP%~3556{h2W~=49hDRqvl4!})V%v?}<5~NfkDU3cmF?D`Y4cJsJ&sB#<#>+F)qf^z&tTk_V<3VV8_Cop2 z;kk-6&qg@qa&`F5iHfGBI!lAQ?m9m;(p-h1<+;%+6qN6&PEM37??Q8Gc%nQvGCVZ} z>IjUjLXlAu+ID53vlaL;eIY2d<;qetWKd-LI}oYNjt)=auDPU_g=rN3llO zOu=DXT`rGKogJO6j9}srsOsqSl!~D-gC33@k0)Yiq(s6>{(+fVQZC6C&qAj>EPHQQ=svPhp+VTM-~3mb`O6{;TI2k z_~Rb_yco+1rQ&ZC=@YxWE}!x6-5&mw!r!~c!@r>L2Q~h@!Y^t3MZ!&``xTG3-;;e! z;csgEb;2#x_g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8E+L4`RIJ6uk(6;^fg|`z4g@h z?-s#VH?qFjLnt!ZJ>LePxReT=Rv*DK`3Mdh4>jW*34cI%S(YU@@^Y6m_5k4LfL8!G z=!dRLF#eoOU5G9axde;ml?J>YqMu!WG~m6!9XwNjHb4X5GH7=JuE5z2;M6X8&lf=Z uI&d8x1ilOKWAI)CybK__-v=}TUIU)SbD0J%+P#1dz&ijVfJXGO7Vtl~x?gYr diff --git a/resources/edit_grammars.mjs b/resources/edit_grammars.mjs index daba18f5e..244b36033 100644 --- a/resources/edit_grammars.mjs +++ b/resources/edit_grammars.mjs @@ -121,10 +121,6 @@ async function rsyncGrammars(language) { ? `${LANGUAGE_METAVARIABLES}/${treeSitterLang}` : LANGUAGE_METAVARIABLES; - if (languagesWithoutMetaVariables.includes(language)) { - return; - } - await fs.rmdir(mvDir, { recursive: true }); await fs.mkdir(mvDir, { recursive: true }); diff --git a/resources/language-metavariables/tree-sitter-html/.appveyor.yml b/resources/language-metavariables/tree-sitter-html/.appveyor.yml deleted file mode 100644 index 3e438d380..000000000 --- a/resources/language-metavariables/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/resources/language-metavariables/tree-sitter-html/.travis.yml b/resources/language-metavariables/tree-sitter-html/.travis.yml deleted file mode 100644 index 38d6538b7..000000000 --- a/resources/language-metavariables/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/resources/language-metavariables/tree-sitter-html/Cargo.toml b/resources/language-metavariables/tree-sitter-html/Cargo.toml index 556323cb1..7b78055ca 100644 --- a/resources/language-metavariables/tree-sitter-html/Cargo.toml +++ b/resources/language-metavariables/tree-sitter-html/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "tree-sitter-html" description = "HTML grammar for tree-sitter" -version = "0.20.0" +version = "0.20.2" authors = [ "Max Brunsfeld ", "Amaan Qureshi ", diff --git a/resources/language-metavariables/tree-sitter-html/Makefile b/resources/language-metavariables/tree-sitter-html/Makefile index 071e95018..c24aed7a1 100644 --- a/resources/language-metavariables/tree-sitter-html/Makefile +++ b/resources/language-metavariables/tree-sitter-html/Makefile @@ -1,4 +1,4 @@ -VERSION := 0.20.0 +VERSION := 0.20.2 # Repository SRC_DIR := src diff --git a/resources/language-metavariables/tree-sitter-html/README.md b/resources/language-metavariables/tree-sitter-html/README.md index c2981f4ba..58bd3e364 100644 --- a/resources/language-metavariables/tree-sitter-html/README.md +++ b/resources/language-metavariables/tree-sitter-html/README.md @@ -1,9 +1,19 @@ # tree-sitter-html -[![build](https://github.com/tree-sitter/tree-sitter-html/actions/workflows/ci.yml/badge.svg)](https://github.com/tree-sitter/tree-sitter-html/actions/workflows/ci.yml) +[![CI][ci]](https://github.com/tree-sitter/tree-sitter-html/actions/workflows/ci.yml) +[![discord][discord]](https://discord.gg/w7nTvsVJhm) +[![matrix][matrix]](https://matrix.to/#/#tree-sitter-chat:matrix.org) +[![crates][crates]](https://crates.io/crates/tree-sitter-html) +[![npm][npm]](https://www.npmjs.com/package/tree-sitter-html) HTML grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter). References -* [The HTML5 Spec](https://www.w3.org/TR/html5/syntax.html) +- [The HTML5 Spec](https://www.w3.org/TR/html5/syntax.html) + +[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/tree-sitter-html/ci.yml?logo=github&label=CI +[discord]: https://img.shields.io/discord/1063097320771698699?logo=discord&label=discord +[matrix]: https://img.shields.io/matrix/tree-sitter-chat%3Amatrix.org?logo=matrix&label=matrix +[npm]: https://img.shields.io/npm/v/tree-sitter-html?logo=npm +[crates]: https://img.shields.io/crates/v/tree-sitter-html?logo=rust diff --git a/resources/language-metavariables/tree-sitter-html/bindings/rust/README.md b/resources/language-metavariables/tree-sitter-html/bindings/rust/README.md index e7de0dee7..6d0ae3698 100644 --- a/resources/language-metavariables/tree-sitter-html/bindings/rust/README.md +++ b/resources/language-metavariables/tree-sitter-html/bindings/rust/README.md @@ -9,7 +9,7 @@ way.) ```toml [dependencies] tree-sitter = "0.20.10" -tree-sitter-html = "0.20.0" +tree-sitter-html = "0.20" ``` Typically, you will use the [language][language func] function to add this diff --git a/resources/language-metavariables/tree-sitter-html/grammar.js b/resources/language-metavariables/tree-sitter-html/grammar.js index 3f76f1eb7..de4c1e571 100644 --- a/resources/language-metavariables/tree-sitter-html/grammar.js +++ b/resources/language-metavariables/tree-sitter-html/grammar.js @@ -31,7 +31,7 @@ module.exports = grammar({ ], rules: { - fragment: $ => repeat($._node), + document: $ => repeat($._node), doctype: $ => seq( ' /&(#([xX][0-9a-fA-F]{1,6}|[0-9]{1,5})|[A-Za-z]{1,30});/, + entity: _ => /&(#([xX][0-9a-fA-F]{1,6}|[0-9]{1,5})|[A-Za-z]{1,30});?/, quoted_attribute_value: $ => choice( seq('\'', optional(alias(/[^']+/, $.attribute_value)), '\''), diff --git a/resources/language-metavariables/tree-sitter-html/package.json b/resources/language-metavariables/tree-sitter-html/package.json index bc332c88a..bbb08e580 100644 --- a/resources/language-metavariables/tree-sitter-html/package.json +++ b/resources/language-metavariables/tree-sitter-html/package.json @@ -1,6 +1,6 @@ { "name": "tree-sitter-html", - "version": "0.20.0", + "version": "0.20.2", "description": "HTML grammar for tree-sitter", "main": "bindings/node", "keywords": [ @@ -37,7 +37,7 @@ }, "tree-sitter": [ { - "scope": "text.html.basic", + "scope": "source.html", "file-types": [ "html" ], @@ -47,6 +47,9 @@ ], "injections": [ "queries/injections.scm" + ], + "external-files": [ + "src/tag.h" ] } ] diff --git a/resources/language-metavariables/tree-sitter-html/src/grammar.json b/resources/language-metavariables/tree-sitter-html/src/grammar.json index 63283e131..2f3a9932b 100644 --- a/resources/language-metavariables/tree-sitter-html/src/grammar.json +++ b/resources/language-metavariables/tree-sitter-html/src/grammar.json @@ -1,7 +1,7 @@ { "name": "html", "rules": { - "fragment": { + "document": { "type": "REPEAT", "content": { "type": "SYMBOL", @@ -373,7 +373,7 @@ }, "entity": { "type": "PATTERN", - "value": "&(#([xX][0-9a-fA-F]{1,6}|[0-9]{1,5})|[A-Za-z]{1,30});" + "value": "&(#([xX][0-9a-fA-F]{1,6}|[0-9]{1,5})|[A-Za-z]{1,30});?" }, "quoted_attribute_value": { "type": "CHOICE", diff --git a/resources/language-metavariables/tree-sitter-html/src/node-types.json b/resources/language-metavariables/tree-sitter-html/src/node-types.json index 17626fccc..07fc3750a 100644 --- a/resources/language-metavariables/tree-sitter-html/src/node-types.json +++ b/resources/language-metavariables/tree-sitter-html/src/node-types.json @@ -27,6 +27,45 @@ "named": true, "fields": {} }, + { + "type": "document", + "named": true, + "fields": {}, + "children": { + "multiple": true, + "required": false, + "types": [ + { + "type": "doctype", + "named": true + }, + { + "type": "element", + "named": true + }, + { + "type": "entity", + "named": true + }, + { + "type": "erroneous_end_tag", + "named": true + }, + { + "type": "script_element", + "named": true + }, + { + "type": "style_element", + "named": true + }, + { + "type": "text", + "named": true + } + ] + } + }, { "type": "element", "named": true, @@ -108,45 +147,6 @@ ] } }, - { - "type": "fragment", - "named": true, - "fields": {}, - "children": { - "multiple": true, - "required": false, - "types": [ - { - "type": "doctype", - "named": true - }, - { - "type": "element", - "named": true - }, - { - "type": "entity", - "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, diff --git a/resources/language-metavariables/tree-sitter-html/src/parser.c b/resources/language-metavariables/tree-sitter-html/src/parser.c index 788fb404e..adb20eece 100644 --- a/resources/language-metavariables/tree-sitter-html/src/parser.c +++ b/resources/language-metavariables/tree-sitter-html/src/parser.c @@ -41,7 +41,7 @@ enum { sym__implicit_end_tag = 22, sym_raw_text = 23, sym_comment = 24, - sym_fragment = 25, + sym_document = 25, sym_doctype = 26, sym__node = 27, sym_element = 28, @@ -55,7 +55,7 @@ enum { sym_erroneous_end_tag = 36, sym_attribute = 37, sym_quoted_attribute_value = 38, - aux_sym_fragment_repeat1 = 39, + aux_sym_document_repeat1 = 39, aux_sym_start_tag_repeat1 = 40, }; @@ -85,7 +85,7 @@ static const char * const ts_symbol_names[] = { [sym__implicit_end_tag] = "_implicit_end_tag", [sym_raw_text] = "raw_text", [sym_comment] = "comment", - [sym_fragment] = "fragment", + [sym_document] = "document", [sym_doctype] = "doctype", [sym__node] = "_node", [sym_element] = "element", @@ -99,7 +99,7 @@ static const char * const ts_symbol_names[] = { [sym_erroneous_end_tag] = "erroneous_end_tag", [sym_attribute] = "attribute", [sym_quoted_attribute_value] = "quoted_attribute_value", - [aux_sym_fragment_repeat1] = "fragment_repeat1", + [aux_sym_document_repeat1] = "document_repeat1", [aux_sym_start_tag_repeat1] = "start_tag_repeat1", }; @@ -129,7 +129,7 @@ static const TSSymbol ts_symbol_map[] = { [sym__implicit_end_tag] = sym__implicit_end_tag, [sym_raw_text] = sym_raw_text, [sym_comment] = sym_comment, - [sym_fragment] = sym_fragment, + [sym_document] = sym_document, [sym_doctype] = sym_doctype, [sym__node] = sym__node, [sym_element] = sym_element, @@ -143,7 +143,7 @@ static const TSSymbol ts_symbol_map[] = { [sym_erroneous_end_tag] = sym_erroneous_end_tag, [sym_attribute] = sym_attribute, [sym_quoted_attribute_value] = sym_quoted_attribute_value, - [aux_sym_fragment_repeat1] = aux_sym_fragment_repeat1, + [aux_sym_document_repeat1] = aux_sym_document_repeat1, [aux_sym_start_tag_repeat1] = aux_sym_start_tag_repeat1, }; @@ -248,7 +248,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, - [sym_fragment] = { + [sym_document] = { .visible = true, .named = true, }, @@ -304,7 +304,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = { .visible = true, .named = true, }, - [aux_sym_fragment_repeat1] = { + [aux_sym_document_repeat1] = { .visible = false, .named = false, }, @@ -424,16 +424,16 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { eof = lexer->eof(lexer); switch (state) { case 0: - if (eof) ADVANCE(57); + if (eof) ADVANCE(18); if (lookahead == '"') ADVANCE(73); if (lookahead == '&') ADVANCE(3); if (lookahead == '\'') ADVANCE(70); - if (lookahead == '/') ADVANCE(45); - if (lookahead == '<') ADVANCE(63); - if (lookahead == '=') ADVANCE(66); - if (lookahead == '>') ADVANCE(61); + if (lookahead == '/') ADVANCE(6); + if (lookahead == '<') ADVANCE(24); + if (lookahead == '=') ADVANCE(27); + if (lookahead == '>') ADVANCE(22); if (lookahead == 'D' || - lookahead == 'd') ADVANCE(48); + lookahead == 'd') ADVANCE(9); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || @@ -447,7 +447,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { lookahead == '\r' || lookahead == ' ') SKIP(1) if (lookahead != 0 && - (lookahead < '<' || '>' < lookahead)) ADVANCE(68); + (lookahead < '<' || '>' < lookahead)) ADVANCE(29); END_STATE(); case 2: if (lookahead == '"') ADVANCE(73); @@ -458,9 +458,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead != 0) ADVANCE(75); END_STATE(); case 3: - if (lookahead == '#') ADVANCE(51); + if (lookahead == '#') ADVANCE(12); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(44); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(69); END_STATE(); case 4: if (lookahead == '\'') ADVANCE(70); @@ -471,9 +471,9 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead != 0) ADVANCE(72); END_STATE(); case 5: - if (lookahead == '/') ADVANCE(45); - if (lookahead == '=') ADVANCE(66); - if (lookahead == '>') ADVANCE(61); + if (lookahead == '/') ADVANCE(6); + if (lookahead == '=') ADVANCE(27); + if (lookahead == '>') ADVANCE(22); if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || @@ -481,333 +481,372 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead != 0 && lookahead != '"' && lookahead != '\'' && - lookahead != '<') ADVANCE(67); + lookahead != '<') ADVANCE(28); END_STATE(); case 6: - if (lookahead == ';') ADVANCE(69); + if (lookahead == '>') ADVANCE(25); END_STATE(); case 7: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(6); + if (lookahead == 'C' || + lookahead == 'c') ADVANCE(11); END_STATE(); case 8: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(7); + if (lookahead == 'E' || + lookahead == 'e') ADVANCE(23); END_STATE(); case 9: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(8); + if (lookahead == 'O' || + lookahead == 'o') ADVANCE(7); END_STATE(); case 10: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(9); + if (lookahead == 'P' || + lookahead == 'p') ADVANCE(8); END_STATE(); case 11: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(6); + if (lookahead == 'T' || + lookahead == 't') ADVANCE(13); END_STATE(); case 12: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(11); + if (lookahead == 'X' || + lookahead == 'x') ADVANCE(16); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(35); END_STATE(); case 13: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(12); + if (lookahead == 'Y' || + lookahead == 'y') ADVANCE(10); END_STATE(); case 14: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(13); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(14); + if (lookahead != 0 && + lookahead != '&' && + lookahead != '<' && + lookahead != '>') ADVANCE(76); END_STATE(); case 15: - if (lookahead == ';') ADVANCE(69); - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(14); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(20); + if (lookahead != 0 && + lookahead != '>') ADVANCE(21); END_STATE(); case 16: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(6); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(40); END_STATE(); case 17: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(16); + if (eof) ADVANCE(18); + if (lookahead == '&') ADVANCE(3); + if (lookahead == '<') ADVANCE(24); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') SKIP(17) + if (lookahead != 0 && + lookahead != '>') ADVANCE(76); END_STATE(); case 18: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(17); + ACCEPT_TOKEN(ts_builtin_sym_end); END_STATE(); case 19: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(18); + ACCEPT_TOKEN(anon_sym_LT_BANG); END_STATE(); case 20: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(19); + ACCEPT_TOKEN(aux_sym_doctype_token1); + if (lookahead == '\t' || + lookahead == '\n' || + lookahead == '\r' || + lookahead == ' ') ADVANCE(20); + if (lookahead != 0 && + lookahead != '>') ADVANCE(21); END_STATE(); case 21: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(20); + ACCEPT_TOKEN(aux_sym_doctype_token1); + if (lookahead != 0 && + lookahead != '>') ADVANCE(21); END_STATE(); case 22: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(21); + ACCEPT_TOKEN(anon_sym_GT); END_STATE(); case 23: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(22); + ACCEPT_TOKEN(sym__doctype); END_STATE(); case 24: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(23); + ACCEPT_TOKEN(anon_sym_LT); + if (lookahead == '!') ADVANCE(19); + if (lookahead == '/') ADVANCE(26); END_STATE(); case 25: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(24); + ACCEPT_TOKEN(anon_sym_SLASH_GT); END_STATE(); case 26: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(25); + ACCEPT_TOKEN(anon_sym_LT_SLASH); END_STATE(); case 27: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(26); + ACCEPT_TOKEN(anon_sym_EQ); END_STATE(); case 28: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(27); + ACCEPT_TOKEN(sym_attribute_name); + if (lookahead != 0 && + lookahead != '\t' && + lookahead != '\n' && + lookahead != '\r' && + lookahead != ' ' && + lookahead != '"' && + lookahead != '\'' && + lookahead != '/' && + (lookahead < '<' || '>' < lookahead)) ADVANCE(28); END_STATE(); case 29: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(28); + ACCEPT_TOKEN(sym_attribute_value); + if (lookahead != 0 && + lookahead != '\t' && + lookahead != '\n' && + lookahead != '\r' && + lookahead != ' ' && + lookahead != '"' && + lookahead != '\'' && + (lookahead < '<' || '>' < lookahead)) ADVANCE(29); END_STATE(); case 30: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(29); + ACCEPT_TOKEN(sym_entity); END_STATE(); case 31: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(30); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); END_STATE(); case 32: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(31); END_STATE(); case 33: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(32); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(32); END_STATE(); case 34: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(33); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(33); END_STATE(); case 35: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(34); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9')) ADVANCE(34); END_STATE(); case 36: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(35); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(31); END_STATE(); case 37: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(36); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(36); END_STATE(); case 38: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(37); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(37); END_STATE(); case 39: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(38); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(38); END_STATE(); case 40: - if (lookahead == ';') ADVANCE(69); - if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(39); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('0' <= lookahead && lookahead <= '9') || + ('A' <= lookahead && lookahead <= 'F') || + ('a' <= lookahead && lookahead <= 'f')) ADVANCE(39); END_STATE(); case 41: - if (lookahead == ';') ADVANCE(69); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); if (('A' <= lookahead && lookahead <= 'Z') || - ('a' <= lookahead && lookahead <= 'z')) ADVANCE(40); + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(31); END_STATE(); case 42: - if (lookahead == ';') ADVANCE(69); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); if (('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(41); END_STATE(); case 43: - if (lookahead == ';') ADVANCE(69); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); if (('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(42); END_STATE(); case 44: - if (lookahead == ';') ADVANCE(69); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); if (('A' <= lookahead && lookahead <= 'Z') || ('a' <= lookahead && lookahead <= 'z')) ADVANCE(43); END_STATE(); case 45: - if (lookahead == '>') ADVANCE(64); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(44); END_STATE(); case 46: - if (lookahead == 'C' || - lookahead == 'c') ADVANCE(50); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(45); END_STATE(); case 47: - if (lookahead == 'E' || - lookahead == 'e') ADVANCE(62); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(46); END_STATE(); case 48: - if (lookahead == 'O' || - lookahead == 'o') ADVANCE(46); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(47); END_STATE(); case 49: - if (lookahead == 'P' || - lookahead == 'p') ADVANCE(47); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(48); END_STATE(); case 50: - if (lookahead == 'T' || - lookahead == 't') ADVANCE(52); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(49); END_STATE(); case 51: - if (lookahead == 'X' || - lookahead == 'x') ADVANCE(55); - if (('0' <= lookahead && lookahead <= '9')) ADVANCE(10); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(50); END_STATE(); case 52: - if (lookahead == 'Y' || - lookahead == 'y') ADVANCE(49); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(51); END_STATE(); case 53: - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(53); - if (lookahead != 0 && - lookahead != '&' && - lookahead != '<' && - lookahead != '>') ADVANCE(76); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(52); END_STATE(); case 54: - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(59); - if (lookahead != 0 && - lookahead != '>') ADVANCE(60); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(53); END_STATE(); case 55: - if (('0' <= lookahead && lookahead <= '9') || - ('A' <= lookahead && lookahead <= 'F') || - ('a' <= lookahead && lookahead <= 'f')) ADVANCE(15); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(54); END_STATE(); case 56: - if (eof) ADVANCE(57); - if (lookahead == '&') ADVANCE(3); - if (lookahead == '<') ADVANCE(63); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') SKIP(56) - if (lookahead != 0 && - lookahead != '>') ADVANCE(76); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(55); END_STATE(); case 57: - ACCEPT_TOKEN(ts_builtin_sym_end); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(56); END_STATE(); case 58: - ACCEPT_TOKEN(anon_sym_LT_BANG); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(57); END_STATE(); case 59: - ACCEPT_TOKEN(aux_sym_doctype_token1); - if (lookahead == '\t' || - lookahead == '\n' || - lookahead == '\r' || - lookahead == ' ') ADVANCE(59); - if (lookahead != 0 && - lookahead != '>') ADVANCE(60); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(58); END_STATE(); case 60: - ACCEPT_TOKEN(aux_sym_doctype_token1); - if (lookahead != 0 && - lookahead != '>') ADVANCE(60); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(59); END_STATE(); case 61: - ACCEPT_TOKEN(anon_sym_GT); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(60); END_STATE(); case 62: - ACCEPT_TOKEN(sym__doctype); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(61); END_STATE(); case 63: - ACCEPT_TOKEN(anon_sym_LT); - if (lookahead == '!') ADVANCE(58); - if (lookahead == '/') ADVANCE(65); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(62); END_STATE(); case 64: - ACCEPT_TOKEN(anon_sym_SLASH_GT); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(63); END_STATE(); case 65: - ACCEPT_TOKEN(anon_sym_LT_SLASH); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(64); END_STATE(); case 66: - ACCEPT_TOKEN(anon_sym_EQ); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(65); END_STATE(); case 67: - ACCEPT_TOKEN(sym_attribute_name); - if (lookahead != 0 && - lookahead != '\t' && - lookahead != '\n' && - lookahead != '\r' && - lookahead != ' ' && - lookahead != '"' && - lookahead != '\'' && - lookahead != '/' && - (lookahead < '<' || '>' < lookahead)) ADVANCE(67); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(66); END_STATE(); case 68: - ACCEPT_TOKEN(sym_attribute_value); - if (lookahead != 0 && - lookahead != '\t' && - lookahead != '\n' && - lookahead != '\r' && - lookahead != ' ' && - lookahead != '"' && - lookahead != '\'' && - (lookahead < '<' || '>' < lookahead)) ADVANCE(68); + ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(67); END_STATE(); case 69: ACCEPT_TOKEN(sym_entity); + if (lookahead == ';') ADVANCE(30); + if (('A' <= lookahead && lookahead <= 'Z') || + ('a' <= lookahead && lookahead <= 'z')) ADVANCE(68); END_STATE(); case 70: ACCEPT_TOKEN(anon_sym_SQUOTE); @@ -848,7 +887,7 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { if (lookahead == '\t' || lookahead == '\n' || lookahead == '\r' || - lookahead == ' ') ADVANCE(53); + lookahead == ' ') ADVANCE(14); if (lookahead != 0 && lookahead != '&' && lookahead != '<' && @@ -861,40 +900,40 @@ static bool ts_lex(TSLexer *lexer, TSStateId state) { static const TSLexMode ts_lex_modes[STATE_COUNT] = { [0] = {.lex_state = 0, .external_lex_state = 1}, - [1] = {.lex_state = 56, .external_lex_state = 2}, - [2] = {.lex_state = 56, .external_lex_state = 3}, - [3] = {.lex_state = 56, .external_lex_state = 3}, - [4] = {.lex_state = 56, .external_lex_state = 3}, - [5] = {.lex_state = 56, .external_lex_state = 3}, - [6] = {.lex_state = 56, .external_lex_state = 3}, - [7] = {.lex_state = 56, .external_lex_state = 2}, - [8] = {.lex_state = 56, .external_lex_state = 2}, - [9] = {.lex_state = 56, .external_lex_state = 2}, - [10] = {.lex_state = 56, .external_lex_state = 2}, - [11] = {.lex_state = 56, .external_lex_state = 2}, - [12] = {.lex_state = 56, .external_lex_state = 3}, - [13] = {.lex_state = 56, .external_lex_state = 3}, - [14] = {.lex_state = 56, .external_lex_state = 2}, - [15] = {.lex_state = 56, .external_lex_state = 2}, - [16] = {.lex_state = 56, .external_lex_state = 3}, - [17] = {.lex_state = 56, .external_lex_state = 2}, - [18] = {.lex_state = 56, .external_lex_state = 3}, - [19] = {.lex_state = 56, .external_lex_state = 3}, - [20] = {.lex_state = 56, .external_lex_state = 3}, - [21] = {.lex_state = 56, .external_lex_state = 2}, - [22] = {.lex_state = 56, .external_lex_state = 3}, - [23] = {.lex_state = 56, .external_lex_state = 2}, - [24] = {.lex_state = 56, .external_lex_state = 3}, - [25] = {.lex_state = 56, .external_lex_state = 3}, - [26] = {.lex_state = 56, .external_lex_state = 3}, - [27] = {.lex_state = 56, .external_lex_state = 2}, - [28] = {.lex_state = 56, .external_lex_state = 2}, - [29] = {.lex_state = 56, .external_lex_state = 2}, - [30] = {.lex_state = 56, .external_lex_state = 3}, - [31] = {.lex_state = 56, .external_lex_state = 3}, - [32] = {.lex_state = 56, .external_lex_state = 3}, - [33] = {.lex_state = 56, .external_lex_state = 3}, - [34] = {.lex_state = 56, .external_lex_state = 2}, + [1] = {.lex_state = 17, .external_lex_state = 2}, + [2] = {.lex_state = 17, .external_lex_state = 3}, + [3] = {.lex_state = 17, .external_lex_state = 3}, + [4] = {.lex_state = 17, .external_lex_state = 3}, + [5] = {.lex_state = 17, .external_lex_state = 3}, + [6] = {.lex_state = 17, .external_lex_state = 3}, + [7] = {.lex_state = 17, .external_lex_state = 2}, + [8] = {.lex_state = 17, .external_lex_state = 2}, + [9] = {.lex_state = 17, .external_lex_state = 2}, + [10] = {.lex_state = 17, .external_lex_state = 2}, + [11] = {.lex_state = 17, .external_lex_state = 2}, + [12] = {.lex_state = 17, .external_lex_state = 3}, + [13] = {.lex_state = 17, .external_lex_state = 3}, + [14] = {.lex_state = 17, .external_lex_state = 2}, + [15] = {.lex_state = 17, .external_lex_state = 2}, + [16] = {.lex_state = 17, .external_lex_state = 3}, + [17] = {.lex_state = 17, .external_lex_state = 2}, + [18] = {.lex_state = 17, .external_lex_state = 3}, + [19] = {.lex_state = 17, .external_lex_state = 3}, + [20] = {.lex_state = 17, .external_lex_state = 3}, + [21] = {.lex_state = 17, .external_lex_state = 2}, + [22] = {.lex_state = 17, .external_lex_state = 3}, + [23] = {.lex_state = 17, .external_lex_state = 2}, + [24] = {.lex_state = 17, .external_lex_state = 3}, + [25] = {.lex_state = 17, .external_lex_state = 3}, + [26] = {.lex_state = 17, .external_lex_state = 3}, + [27] = {.lex_state = 17, .external_lex_state = 2}, + [28] = {.lex_state = 17, .external_lex_state = 2}, + [29] = {.lex_state = 17, .external_lex_state = 2}, + [30] = {.lex_state = 17, .external_lex_state = 3}, + [31] = {.lex_state = 17, .external_lex_state = 3}, + [32] = {.lex_state = 17, .external_lex_state = 3}, + [33] = {.lex_state = 17, .external_lex_state = 3}, + [34] = {.lex_state = 17, .external_lex_state = 2}, [35] = {.lex_state = 5, .external_lex_state = 4}, [36] = {.lex_state = 5, .external_lex_state = 4}, [37] = {.lex_state = 5, .external_lex_state = 4}, @@ -939,7 +978,7 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [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 = 54, .external_lex_state = 2}, + [79] = {.lex_state = 15, .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}, @@ -950,7 +989,7 @@ static const TSLexMode ts_lex_modes[STATE_COUNT] = { [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 = 54, .external_lex_state = 2}, + [90] = {.lex_state = 15, .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}, @@ -1051,7 +1090,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_comment] = ACTIONS(3), }, [1] = { - [sym_fragment] = STATE(77), + [sym_document] = STATE(77), [sym_doctype] = STATE(8), [sym__node] = STATE(8), [sym_element] = STATE(8), @@ -1062,7 +1101,7 @@ static const uint16_t ts_parse_table[LARGE_STATE_COUNT][SYMBOL_COUNT] = { [sym_style_start_tag] = STATE(57), [sym_self_closing_tag] = STATE(11), [sym_erroneous_end_tag] = STATE(8), - [aux_sym_fragment_repeat1] = STATE(8), + [aux_sym_document_repeat1] = STATE(8), [ts_builtin_sym_end] = ACTIONS(5), [anon_sym_LT_BANG] = ACTIONS(7), [anon_sym_LT] = ACTIONS(9), @@ -1105,7 +1144,7 @@ static const uint16_t ts_small_parse_table[] = { sym_script_element, sym_style_element, sym_erroneous_end_tag, - aux_sym_fragment_repeat1, + aux_sym_document_repeat1, [44] = 12, ACTIONS(3), 1, sym_comment, @@ -1137,7 +1176,7 @@ static const uint16_t ts_small_parse_table[] = { sym_script_element, sym_style_element, sym_erroneous_end_tag, - aux_sym_fragment_repeat1, + aux_sym_document_repeat1, [88] = 12, ACTIONS(3), 1, sym_comment, @@ -1169,7 +1208,7 @@ static const uint16_t ts_small_parse_table[] = { sym_script_element, sym_style_element, sym_erroneous_end_tag, - aux_sym_fragment_repeat1, + aux_sym_document_repeat1, [132] = 12, ACTIONS(3), 1, sym_comment, @@ -1201,7 +1240,7 @@ static const uint16_t ts_small_parse_table[] = { sym_script_element, sym_style_element, sym_erroneous_end_tag, - aux_sym_fragment_repeat1, + aux_sym_document_repeat1, [176] = 11, ACTIONS(3), 1, sym_comment, @@ -1231,7 +1270,7 @@ static const uint16_t ts_small_parse_table[] = { sym_script_element, sym_style_element, sym_erroneous_end_tag, - aux_sym_fragment_repeat1, + aux_sym_document_repeat1, [217] = 11, ACTIONS(3), 1, sym_comment, @@ -1261,7 +1300,7 @@ static const uint16_t ts_small_parse_table[] = { sym_script_element, sym_style_element, sym_erroneous_end_tag, - aux_sym_fragment_repeat1, + aux_sym_document_repeat1, [258] = 11, ACTIONS(3), 1, sym_comment, @@ -1291,7 +1330,7 @@ static const uint16_t ts_small_parse_table[] = { sym_script_element, sym_style_element, sym_erroneous_end_tag, - aux_sym_fragment_repeat1, + aux_sym_document_repeat1, [299] = 3, ACTIONS(3), 1, sym_comment, @@ -2109,7 +2148,7 @@ 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), + [5] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 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), @@ -2125,16 +2164,16 @@ static const TSParseActionEntry ts_parse_actions[] = { [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), + [37] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(93), + [40] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(51), + [43] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(89), + [46] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(6), + [49] = {.entry = {.count = 1, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), + [51] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(75), + [54] = {.entry = {.count = 2, .reusable = false}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(52), + [57] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(81), + [60] = {.entry = {.count = 2, .reusable = true}}, REDUCE(aux_sym_document_repeat1, 2), SHIFT_REPEAT(7), + [63] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_document, 1), [65] = {.entry = {.count = 1, .reusable = true}}, SHIFT(7), [67] = {.entry = {.count = 1, .reusable = true}}, REDUCE(sym_element, 3), [69] = {.entry = {.count = 1, .reusable = false}}, REDUCE(sym_element, 3), diff --git a/resources/language-metavariables/tree-sitter-html/src/scanner.c b/resources/language-metavariables/tree-sitter-html/src/scanner.c index 9ec2915a1..078315351 100644 --- a/resources/language-metavariables/tree-sitter-html/src/scanner.c +++ b/resources/language-metavariables/tree-sitter-html/src/scanner.c @@ -1,5 +1,5 @@ #include "tag.h" - +#include "tree_sitter/array.h" #include enum TokenType { @@ -11,107 +11,24 @@ enum TokenType { SELF_CLOSING_TAG_DELIMITER, IMPLICIT_END_TAG, RAW_TEXT, - COMMENT + COMMENT, + OMITTED_HTML_END_TAG, + OMITTED_HEAD_END_TAG, + OMITTED_BODY_END_TAG, }; typedef struct { - uint32_t len; - uint32_t cap; - Tag *data; -} tags_vec; - -typedef struct { - tags_vec tags; + Array(Tag) tags; } Scanner; #define MAX(a, b) ((a) > (b) ? (a) : (b)) -#define VEC_RESIZE(vec, _cap) \ - if ((_cap) > (vec).cap && (_cap) > 0) { \ - void *tmp = realloc((vec).data, (_cap) * sizeof((vec).data[0])); \ - assert(tmp != NULL); \ - (vec).data = tmp; \ - (vec).cap = (_cap); \ - } - -#define VEC_GROW(vec, _cap) \ - if ((vec).cap < (_cap)) { \ - VEC_RESIZE((vec), (_cap)); \ - } - -#define VEC_PUSH(vec, el) \ - if ((vec).cap == (vec).len) { \ - VEC_RESIZE((vec), MAX(16, (vec).len * 2)); \ - } \ - (vec).data[(vec).len++] = (el); - -#define VEC_POP(vec) \ - { \ - if (VEC_BACK(vec).type == CUSTOM) { \ - tag_free(&VEC_BACK(vec)); \ - } \ - (vec).len--; \ - } - -#define VEC_BACK(vec) ((vec).data[(vec).len - 1]) - -#define VEC_FREE(vec) \ - { \ - if ((vec).data != NULL) \ - free((vec).data); \ - (vec).data = NULL; \ - } - -#define VEC_CLEAR(vec) \ - { \ - for (int i = 0; i < (vec).len; i++) { \ - tag_free(&(vec).data[i]); \ - } \ - (vec).len = 0; \ - } - -#define STRING_RESIZE(vec, _cap) \ - void *tmp = realloc((vec).data, ((_cap) + 1) * sizeof((vec).data[0])); \ - assert(tmp != NULL); \ - (vec).data = tmp; \ - memset((vec).data + (vec).len, 0, \ - (((_cap) + 1) - (vec).len) * sizeof((vec).data[0])); \ - (vec).cap = (_cap); - -#define STRING_GROW(vec, _cap) \ - if ((vec).cap < (_cap)) { \ - STRING_RESIZE((vec), (_cap)); \ - } - -#define STRING_PUSH(vec, el) \ - if ((vec).cap == (vec).len) { \ - STRING_RESIZE((vec), MAX(16, (vec).len * 2)); \ - } \ - (vec).data[(vec).len++] = (el); - -#define STRING_INIT(vec) \ - { \ - (vec).data = calloc(1, sizeof(char) * 17); \ - (vec).len = 0; \ - (vec).cap = 16; \ - } +static inline void advance(TSLexer *lexer) { lexer->advance(lexer, false); } -#define STRING_FREE(vec) \ - { \ - if ((vec).data != NULL) \ - free((vec).data); \ - (vec).data = NULL; \ - } - -#define STRING_CLEAR(vec) \ - { \ - (vec).len = 0; \ - memset((vec).data, 0, (vec).cap * sizeof(char)); \ - } +static inline void skip(TSLexer *lexer) { lexer->advance(lexer, true); } static unsigned serialize(Scanner *scanner, char *buffer) { - uint16_t tag_count = - scanner->tags.len > UINT16_MAX ? UINT16_MAX : scanner->tags.len; + uint16_t tag_count = scanner->tags.size > UINT16_MAX ? UINT16_MAX : scanner->tags.size; uint16_t serialized_tag_count = 0; unsigned size = sizeof(tag_count); @@ -119,19 +36,18 @@ static unsigned serialize(Scanner *scanner, char *buffer) { size += sizeof(tag_count); for (; serialized_tag_count < tag_count; serialized_tag_count++) { - Tag tag = scanner->tags.data[serialized_tag_count]; + Tag tag = scanner->tags.contents[serialized_tag_count]; if (tag.type == CUSTOM) { - unsigned name_length = tag.custom_tag_name.len; + unsigned name_length = tag.custom_tag_name.size; if (name_length > UINT8_MAX) { name_length = UINT8_MAX; } - if (size + 2 + name_length >= - TREE_SITTER_SERIALIZATION_BUFFER_SIZE) { + if (size + 2 + name_length >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) { break; } buffer[size++] = (char)tag.type; buffer[size++] = (char)name_length; - strncpy(&buffer[size], tag.custom_tag_name.data, name_length); + strncpy(&buffer[size], tag.custom_tag_name.contents, name_length); size += name_length; } else { if (size + 1 >= TREE_SITTER_SERIALIZATION_BUFFER_SIZE) { @@ -146,54 +62,51 @@ static unsigned serialize(Scanner *scanner, char *buffer) { } static void deserialize(Scanner *scanner, const char *buffer, unsigned length) { - VEC_CLEAR(scanner->tags); + for (unsigned i = 0; i < scanner->tags.size; i++) { + tag_free(&scanner->tags.contents[i]); + } + array_clear(&scanner->tags); + if (length > 0) { unsigned size = 0; uint16_t tag_count = 0; uint16_t serialized_tag_count = 0; - memcpy(&serialized_tag_count, &buffer[size], - sizeof(serialized_tag_count)); + memcpy(&serialized_tag_count, &buffer[size], sizeof(serialized_tag_count)); size += sizeof(serialized_tag_count); memcpy(&tag_count, &buffer[size], sizeof(tag_count)); size += sizeof(tag_count); - VEC_RESIZE(scanner->tags, tag_count); + array_reserve(&scanner->tags, tag_count); if (tag_count > 0) { unsigned iter = 0; for (iter = 0; iter < serialized_tag_count; iter++) { - Tag tag = scanner->tags.data[iter]; + Tag tag = tag_new(); tag.type = (TagType)buffer[size++]; if (tag.type == CUSTOM) { uint16_t name_length = (uint8_t)buffer[size++]; - tag.custom_tag_name.len = name_length; - tag.custom_tag_name.cap = name_length; - tag.custom_tag_name.data = - (char *)calloc(1, sizeof(char) * (name_length + 1)); - strncpy(tag.custom_tag_name.data, &buffer[size], - name_length); + array_reserve(&tag.custom_tag_name, name_length); + tag.custom_tag_name.size = name_length; + memcpy(tag.custom_tag_name.contents, &buffer[size], name_length); size += name_length; } - VEC_PUSH(scanner->tags, tag); + array_push(&scanner->tags, tag); } // add zero tags if we didn't read enough, this is because the // buffer had no more room but we held more tags. for (; iter < tag_count; iter++) { - Tag tag = new_tag(); - VEC_PUSH(scanner->tags, tag); + array_push(&scanner->tags, tag_new()); } } } } static String scan_tag_name(TSLexer *lexer) { - String tag_name; - STRING_INIT(tag_name); - while (iswalnum(lexer->lookahead) || lexer->lookahead == '-' || - lexer->lookahead == ':') { - STRING_PUSH(tag_name, towupper(lexer->lookahead)); - lexer->advance(lexer, false); + String tag_name = array_new(); + while (iswalnum(lexer->lookahead) || lexer->lookahead == '-' || lexer->lookahead == ':') { + array_push(&tag_name, towupper(lexer->lookahead)); + advance(lexer); } return tag_name; } @@ -202,11 +115,11 @@ static bool scan_comment(TSLexer *lexer) { if (lexer->lookahead != '-') { return false; } - lexer->advance(lexer, false); + advance(lexer); if (lexer->lookahead != '-') { return false; } - lexer->advance(lexer, false); + advance(lexer); unsigned dashes = 0; while (lexer->lookahead) { @@ -217,27 +130,26 @@ static bool scan_comment(TSLexer *lexer) { case '>': if (dashes >= 2) { lexer->result_symbol = COMMENT; - lexer->advance(lexer, false); + advance(lexer); lexer->mark_end(lexer); return true; } default: dashes = 0; } - lexer->advance(lexer, false); + advance(lexer); } return false; } static bool scan_raw_text(Scanner *scanner, TSLexer *lexer) { - if (scanner->tags.len == 0) { + if (scanner->tags.size == 0) { return false; } lexer->mark_end(lexer); - const char *end_delimiter = - VEC_BACK(scanner->tags).type == SCRIPT ? "tags)->type == SCRIPT ? "lookahead) { @@ -246,10 +158,10 @@ static bool scan_raw_text(Scanner *scanner, TSLexer *lexer) { if (delimiter_index == strlen(end_delimiter)) { break; } - lexer->advance(lexer, false); + advance(lexer); } else { delimiter_index = 0; - lexer->advance(lexer, false); + advance(lexer); lexer->mark_end(lexer); } } @@ -258,70 +170,77 @@ static bool scan_raw_text(Scanner *scanner, TSLexer *lexer) { return true; } +static void pop_tag(Scanner *scanner) { + Tag popped_tag = array_pop(&scanner->tags); + tag_free(&popped_tag); +} + static bool scan_implicit_end_tag(Scanner *scanner, TSLexer *lexer) { - Tag *parent = scanner->tags.len == 0 ? NULL : &VEC_BACK(scanner->tags); + Tag *parent = scanner->tags.size == 0 ? NULL : array_back(&scanner->tags); bool is_closing_tag = false; if (lexer->lookahead == '/') { is_closing_tag = true; - lexer->advance(lexer, false); + advance(lexer); } else { - if (parent && is_void(parent)) { - VEC_POP(scanner->tags); + if (parent && tag_is_void(parent)) { + pop_tag(scanner); lexer->result_symbol = IMPLICIT_END_TAG; return true; } } String tag_name = scan_tag_name(lexer); - if (tag_name.len == 0) { - STRING_FREE(tag_name); + if (tag_name.size == 0 && !lexer->eof(lexer)) { + array_delete(&tag_name); return false; } - Tag next_tag = for_name(tag_name.data); + Tag next_tag = tag_for_name(tag_name); if (is_closing_tag) { // The tag correctly closes the topmost element on the stack - if (scanner->tags.len > 0 && - tagcmp(&VEC_BACK(scanner->tags), &next_tag)) { - STRING_FREE(tag_name); + if (scanner->tags.size > 0 && tag_eq(array_back(&scanner->tags), &next_tag)) { tag_free(&next_tag); return false; } // Otherwise, dig deeper and queue implicit end tags (to be nice in // the case of malformed HTML) - for (unsigned i = scanner->tags.len; i > 0; i--) { - if (scanner->tags.data[i - 1].type == next_tag.type) { - VEC_POP(scanner->tags); + for (unsigned i = scanner->tags.size; i > 0; i--) { + if (scanner->tags.contents[i - 1].type == next_tag.type) { + pop_tag(scanner); lexer->result_symbol = IMPLICIT_END_TAG; - STRING_FREE(tag_name); tag_free(&next_tag); return true; } } - } else if (parent && !can_contain(parent, &next_tag)) { - VEC_POP(scanner->tags); + } else if ( + parent && + ( + !tag_can_contain(parent, &next_tag) || + ((parent->type == HTML || parent->type == HEAD || parent->type == BODY) && lexer->eof(lexer)) + ) + ) { + pop_tag(scanner); lexer->result_symbol = IMPLICIT_END_TAG; - STRING_FREE(tag_name); tag_free(&next_tag); return true; } - STRING_FREE(tag_name); tag_free(&next_tag); return false; } static bool scan_start_tag_name(Scanner *scanner, TSLexer *lexer) { String tag_name = scan_tag_name(lexer); - if (tag_name.len == 0) { - STRING_FREE(tag_name); + if (tag_name.size == 0) { + array_delete(&tag_name); return false; } - Tag tag = for_name(tag_name.data); - VEC_PUSH(scanner->tags, tag); + + Tag tag = tag_for_name(tag_name); + array_push(&scanner->tags, tag); switch (tag.type) { case SCRIPT: lexer->result_symbol = SCRIPT_START_TAG_NAME; @@ -333,34 +252,35 @@ static bool scan_start_tag_name(Scanner *scanner, TSLexer *lexer) { lexer->result_symbol = START_TAG_NAME; break; } - STRING_FREE(tag_name); return true; } static bool scan_end_tag_name(Scanner *scanner, TSLexer *lexer) { String tag_name = scan_tag_name(lexer); - if (tag_name.len == 0) { - STRING_FREE(tag_name); + + if (tag_name.size == 0) { + array_delete(&tag_name); return false; } - Tag tag = for_name(tag_name.data); - if (scanner->tags.len > 0 && tagcmp(&VEC_BACK(scanner->tags), &tag)) { - VEC_POP(scanner->tags); + + Tag tag = tag_for_name(tag_name); + if (scanner->tags.size > 0 && tag_eq(array_back(&scanner->tags), &tag)) { + pop_tag(scanner); lexer->result_symbol = END_TAG_NAME; } else { lexer->result_symbol = ERRONEOUS_END_TAG_NAME; } + tag_free(&tag); - STRING_FREE(tag_name); return true; } static bool scan_self_closing_tag_delimiter(Scanner *scanner, TSLexer *lexer) { - lexer->advance(lexer, false); + advance(lexer); if (lexer->lookahead == '>') { - lexer->advance(lexer, false); - if (scanner->tags.len > 0) { - VEC_POP(scanner->tags); + advance(lexer); + if (scanner->tags.size > 0) { + pop_tag(scanner); lexer->result_symbol = SELF_CLOSING_TAG_DELIMITER; } return true; @@ -369,22 +289,21 @@ static bool scan_self_closing_tag_delimiter(Scanner *scanner, TSLexer *lexer) { } static bool scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) { - if (valid_symbols[RAW_TEXT] && !valid_symbols[START_TAG_NAME] && - !valid_symbols[END_TAG_NAME]) { + if (valid_symbols[RAW_TEXT] && !valid_symbols[START_TAG_NAME] && !valid_symbols[END_TAG_NAME]) { return scan_raw_text(scanner, lexer); } while (iswspace(lexer->lookahead)) { - lexer->advance(lexer, true); + skip(lexer); } switch (lexer->lookahead) { case '<': lexer->mark_end(lexer); - lexer->advance(lexer, false); + advance(lexer); if (lexer->lookahead == '!') { - lexer->advance(lexer, false); + advance(lexer); return scan_comment(lexer); } @@ -406,12 +325,9 @@ static bool scan(Scanner *scanner, TSLexer *lexer, const bool *valid_symbols) { 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(scanner, lexer) - : scan_end_tag_name(scanner, lexer); + 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(scanner, lexer) + : scan_end_tag_name(scanner, lexer); } } @@ -423,30 +339,26 @@ void *tree_sitter_html_external_scanner_create() { return scanner; } -bool tree_sitter_html_external_scanner_scan(void *payload, TSLexer *lexer, - const bool *valid_symbols) { +bool tree_sitter_html_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) { Scanner *scanner = (Scanner *)payload; return scan(scanner, lexer, valid_symbols); } -unsigned tree_sitter_html_external_scanner_serialize(void *payload, - char *buffer) { +unsigned tree_sitter_html_external_scanner_serialize(void *payload, char *buffer) { Scanner *scanner = (Scanner *)payload; return serialize(scanner, buffer); } -void tree_sitter_html_external_scanner_deserialize(void *payload, - const char *buffer, - unsigned length) { +void tree_sitter_html_external_scanner_deserialize(void *payload, const char *buffer, unsigned length) { Scanner *scanner = (Scanner *)payload; deserialize(scanner, buffer, length); } void tree_sitter_html_external_scanner_destroy(void *payload) { Scanner *scanner = (Scanner *)payload; - for (unsigned i = 0; i < scanner->tags.len; i++) { - STRING_FREE(scanner->tags.data[i].custom_tag_name); + for (unsigned i = 0; i < scanner->tags.size; i++) { + tag_free(&scanner->tags.contents[i]); } - VEC_FREE(scanner->tags); + array_delete(&scanner->tags); free(scanner); } diff --git a/resources/language-metavariables/tree-sitter-html/src/tag.h b/resources/language-metavariables/tree-sitter-html/src/tag.h index 2e21c9393..6884fbdd5 100644 --- a/resources/language-metavariables/tree-sitter-html/src/tag.h +++ b/resources/language-metavariables/tree-sitter-html/src/tag.h @@ -1,5 +1,5 @@ #include "tree_sitter/parser.h" - +#include "tree_sitter/array.h" #include #include @@ -137,23 +137,19 @@ typedef enum { END_, } TagType; -typedef struct { - uint32_t len; - uint32_t cap; - char *data; -} String; +typedef Array(char) String; typedef struct { char tag_name[16]; - TagType tag_value; -} TagMap; + TagType tag_type; +} TagMapEntry; typedef struct { TagType type; String custom_tag_name; } Tag; -const TagMap TAG_TYPES_BY_TAG_NAME[126] = { +static const TagMapEntry TAG_TYPES_BY_TAG_NAME[126] = { {"AREA", AREA }, {"BASE", BASE }, {"BASEFONT", BASEFONT }, @@ -289,59 +285,65 @@ static const TagType TAG_TYPES_NOT_ALLOWED_IN_PARAGRAPHS[] = { NAV, OL, P, PRE, SECTION, }; -static TagType get_tag_from_string(const char *tag_name) { +static TagType tag_type_for_name(const String *tag_name) { for (int i = 0; i < 126; i++) { - if (strcmp(TAG_TYPES_BY_TAG_NAME[i].tag_name, tag_name) == 0) { - return TAG_TYPES_BY_TAG_NAME[i].tag_value; + const TagMapEntry *entry = &TAG_TYPES_BY_TAG_NAME[i]; + if ( + strlen(entry->tag_name) == tag_name->size && + memcmp(tag_name->contents, entry->tag_name, tag_name->size) == 0 + ) { + return entry->tag_type; } } return CUSTOM; } -static inline Tag new_tag() { +static inline Tag tag_new() { Tag tag; tag.type = END_; - tag.custom_tag_name.data = NULL; - tag.custom_tag_name.len = 0; - tag.custom_tag_name.cap = 0; + tag.custom_tag_name = (String) array_new(); return tag; } -static Tag make_tag(TagType type, const char *name) { - Tag tag = new_tag(); - tag.type = type; - if (type == CUSTOM) { - tag.custom_tag_name.len = (uint32_t)strlen(name); - tag.custom_tag_name.data = - (char *)calloc(1, sizeof(char) * (tag.custom_tag_name.len + 1)); - strncpy(tag.custom_tag_name.data, name, tag.custom_tag_name.len); +static inline Tag tag_for_name(String name) { + Tag tag = tag_new(); + tag.type = tag_type_for_name(&name); + if (tag.type == CUSTOM) { + tag.custom_tag_name = name; + } else { + array_delete(&name); } return tag; } static inline void tag_free(Tag *tag) { if (tag->type == CUSTOM) { - free(tag->custom_tag_name.data); + array_delete(&tag->custom_tag_name); } - tag->custom_tag_name.data = NULL; -} - -static inline bool is_void(const Tag *tag) { - return tag->type < END_OF_VOID_TAGS; } -static inline Tag for_name(const char *name) { - return make_tag(get_tag_from_string(name), name); +static inline bool tag_is_void(const Tag *self) { + return self->type < END_OF_VOID_TAGS; } -static inline bool tagcmp(const Tag *_tag1, const Tag *_tag2) { - return _tag1->type == _tag2->type && - (_tag1->type == CUSTOM ? strcmp(_tag1->custom_tag_name.data, - _tag2->custom_tag_name.data) == 0 - : true); +static inline bool tag_eq(const Tag *self, const Tag *other) { + if (self->type != other->type) return false; + if (self->type == CUSTOM) { + if (self->custom_tag_name.size != other->custom_tag_name.size) { + return false; + } + if (memcmp( + self->custom_tag_name.contents, + other->custom_tag_name.contents, + self->custom_tag_name.size + ) != 0) { + return false; + } + } + return true; } -static bool can_contain(Tag *self, const Tag *other) { +static bool tag_can_contain(Tag *self, const Tag *other) { TagType child = other->type; switch (self->type) { diff --git a/resources/language-metavariables/tree-sitter-html/src/tree_sitter/alloc.h b/resources/language-metavariables/tree-sitter-html/src/tree_sitter/alloc.h new file mode 100644 index 000000000..1f4466d75 --- /dev/null +++ b/resources/language-metavariables/tree-sitter-html/src/tree_sitter/alloc.h @@ -0,0 +1,54 @@ +#ifndef TREE_SITTER_ALLOC_H_ +#define TREE_SITTER_ALLOC_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +// Allow clients to override allocation functions +#ifdef TREE_SITTER_REUSE_ALLOCATOR + +extern void *(*ts_current_malloc)(size_t); +extern void *(*ts_current_calloc)(size_t, size_t); +extern void *(*ts_current_realloc)(void *, size_t); +extern void (*ts_current_free)(void *); + +#ifndef ts_malloc +#define ts_malloc ts_current_malloc +#endif +#ifndef ts_calloc +#define ts_calloc ts_current_calloc +#endif +#ifndef ts_realloc +#define ts_realloc ts_current_realloc +#endif +#ifndef ts_free +#define ts_free ts_current_free +#endif + +#else + +#ifndef ts_malloc +#define ts_malloc malloc +#endif +#ifndef ts_calloc +#define ts_calloc calloc +#endif +#ifndef ts_realloc +#define ts_realloc realloc +#endif +#ifndef ts_free +#define ts_free free +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ALLOC_H_ diff --git a/resources/language-metavariables/tree-sitter-html/src/tree_sitter/array.h b/resources/language-metavariables/tree-sitter-html/src/tree_sitter/array.h new file mode 100644 index 000000000..15a3b233b --- /dev/null +++ b/resources/language-metavariables/tree-sitter-html/src/tree_sitter/array.h @@ -0,0 +1,290 @@ +#ifndef TREE_SITTER_ARRAY_H_ +#define TREE_SITTER_ARRAY_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "./alloc.h" + +#include +#include +#include +#include +#include + +#ifdef _MSC_VER +#pragma warning(disable : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-variable" +#endif + +#define Array(T) \ + struct { \ + T *contents; \ + uint32_t size; \ + uint32_t capacity; \ + } + +/// Initialize an array. +#define array_init(self) \ + ((self)->size = 0, (self)->capacity = 0, (self)->contents = NULL) + +/// Create an empty array. +#define array_new() \ + { NULL, 0, 0 } + +/// Get a pointer to the element at a given `index` in the array. +#define array_get(self, _index) \ + (assert((uint32_t)(_index) < (self)->size), &(self)->contents[_index]) + +/// Get a pointer to the first element in the array. +#define array_front(self) array_get(self, 0) + +/// Get a pointer to the last element in the array. +#define array_back(self) array_get(self, (self)->size - 1) + +/// Clear the array, setting its size to zero. Note that this does not free any +/// memory allocated for the array's contents. +#define array_clear(self) ((self)->size = 0) + +/// Reserve `new_capacity` elements of space in the array. If `new_capacity` is +/// less than the array's current capacity, this function has no effect. +#define array_reserve(self, new_capacity) \ + _array__reserve((Array *)(self), array_elem_size(self), new_capacity) + +/// Free any memory allocated for this array. Note that this does not free any +/// memory allocated for the array's contents. +#define array_delete(self) _array__delete((Array *)(self)) + +/// Push a new `element` onto the end of the array. +#define array_push(self, element) \ + (_array__grow((Array *)(self), 1, array_elem_size(self)), \ + (self)->contents[(self)->size++] = (element)) + +/// Increase the array's size by `count` elements. +/// New elements are zero-initialized. +#define array_grow_by(self, count) \ + do { \ + if ((count) == 0) break; \ + _array__grow((Array *)(self), count, array_elem_size(self)); \ + memset((self)->contents + (self)->size, 0, (count) * array_elem_size(self)); \ + (self)->size += (count); \ + } while (0) + +/// Append all elements from one array to the end of another. +#define array_push_all(self, other) \ + array_extend((self), (other)->size, (other)->contents) + +/// Append `count` elements to the end of the array, reading their values from the +/// `contents` pointer. +#define array_extend(self, count, contents) \ + _array__splice( \ + (Array *)(self), array_elem_size(self), (self)->size, \ + 0, count, contents \ + ) + +/// Remove `old_count` elements from the array starting at the given `index`. At +/// the same index, insert `new_count` new elements, reading their values from the +/// `new_contents` pointer. +#define array_splice(self, _index, old_count, new_count, new_contents) \ + _array__splice( \ + (Array *)(self), array_elem_size(self), _index, \ + old_count, new_count, new_contents \ + ) + +/// Insert one `element` into the array at the given `index`. +#define array_insert(self, _index, element) \ + _array__splice((Array *)(self), array_elem_size(self), _index, 0, 1, &(element)) + +/// Remove one element from the array at the given `index`. +#define array_erase(self, _index) \ + _array__erase((Array *)(self), array_elem_size(self), _index) + +/// Pop the last element off the array, returning the element by value. +#define array_pop(self) ((self)->contents[--(self)->size]) + +/// Assign the contents of one array to another, reallocating if necessary. +#define array_assign(self, other) \ + _array__assign((Array *)(self), (const Array *)(other), array_elem_size(self)) + +/// Swap one array with another +#define array_swap(self, other) \ + _array__swap((Array *)(self), (Array *)(other)) + +/// Get the size of the array contents +#define array_elem_size(self) (sizeof *(self)->contents) + +/// Search a sorted array for a given `needle` value, using the given `compare` +/// callback to determine the order. +/// +/// If an existing element is found to be equal to `needle`, then the `index` +/// out-parameter is set to the existing value's index, and the `exists` +/// out-parameter is set to true. Otherwise, `index` is set to an index where +/// `needle` should be inserted in order to preserve the sorting, and `exists` +/// is set to false. +#define array_search_sorted_with(self, compare, needle, _index, _exists) \ + _array__search_sorted(self, 0, compare, , needle, _index, _exists) + +/// Search a sorted array for a given `needle` value, using integer comparisons +/// of a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_with`. +#define array_search_sorted_by(self, field, needle, _index, _exists) \ + _array__search_sorted(self, 0, _compare_int, field, needle, _index, _exists) + +/// Insert a given `value` into a sorted array, using the given `compare` +/// callback to determine the order. +#define array_insert_sorted_with(self, compare, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_with(self, compare, &(value), &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +/// Insert a given `value` into a sorted array, using integer comparisons of +/// a given struct field (specified with a leading dot) to determine the order. +/// +/// See also `array_search_sorted_by`. +#define array_insert_sorted_by(self, field, value) \ + do { \ + unsigned _index, _exists; \ + array_search_sorted_by(self, field, (value) field, &_index, &_exists); \ + if (!_exists) array_insert(self, _index, value); \ + } while (0) + +// Private + +typedef Array(void) Array; + +/// This is not what you're looking for, see `array_delete`. +static inline void _array__delete(Array *self) { + if (self->contents) { + ts_free(self->contents); + self->contents = NULL; + self->size = 0; + self->capacity = 0; + } +} + +/// This is not what you're looking for, see `array_erase`. +static inline void _array__erase(Array *self, size_t element_size, + uint32_t index) { + assert(index < self->size); + char *contents = (char *)self->contents; + memmove(contents + index * element_size, contents + (index + 1) * element_size, + (self->size - index - 1) * element_size); + self->size--; +} + +/// This is not what you're looking for, see `array_reserve`. +static inline void _array__reserve(Array *self, size_t element_size, uint32_t new_capacity) { + if (new_capacity > self->capacity) { + if (self->contents) { + self->contents = ts_realloc(self->contents, new_capacity * element_size); + } else { + self->contents = ts_malloc(new_capacity * element_size); + } + self->capacity = new_capacity; + } +} + +/// This is not what you're looking for, see `array_assign`. +static inline void _array__assign(Array *self, const Array *other, size_t element_size) { + _array__reserve(self, element_size, other->size); + self->size = other->size; + memcpy(self->contents, other->contents, self->size * element_size); +} + +/// This is not what you're looking for, see `array_swap`. +static inline void _array__swap(Array *self, Array *other) { + Array swap = *other; + *other = *self; + *self = swap; +} + +/// This is not what you're looking for, see `array_push` or `array_grow_by`. +static inline void _array__grow(Array *self, uint32_t count, size_t element_size) { + uint32_t new_size = self->size + count; + if (new_size > self->capacity) { + uint32_t new_capacity = self->capacity * 2; + if (new_capacity < 8) new_capacity = 8; + if (new_capacity < new_size) new_capacity = new_size; + _array__reserve(self, element_size, new_capacity); + } +} + +/// This is not what you're looking for, see `array_splice`. +static inline void _array__splice(Array *self, size_t element_size, + uint32_t index, uint32_t old_count, + uint32_t new_count, const void *elements) { + uint32_t new_size = self->size + new_count - old_count; + uint32_t old_end = index + old_count; + uint32_t new_end = index + new_count; + assert(old_end <= self->size); + + _array__reserve(self, element_size, new_size); + + char *contents = (char *)self->contents; + if (self->size > old_end) { + memmove( + contents + new_end * element_size, + contents + old_end * element_size, + (self->size - old_end) * element_size + ); + } + if (new_count > 0) { + if (elements) { + memcpy( + (contents + index * element_size), + elements, + new_count * element_size + ); + } else { + memset( + (contents + index * element_size), + 0, + new_count * element_size + ); + } + } + self->size += new_count - old_count; +} + +/// A binary search routine, based on Rust's `std::slice::binary_search_by`. +/// This is not what you're looking for, see `array_search_sorted_with` or `array_search_sorted_by`. +#define _array__search_sorted(self, start, compare, suffix, needle, _index, _exists) \ + do { \ + *(_index) = start; \ + *(_exists) = false; \ + uint32_t size = (self)->size - *(_index); \ + if (size == 0) break; \ + int comparison; \ + while (size > 1) { \ + uint32_t half_size = size / 2; \ + uint32_t mid_index = *(_index) + half_size; \ + comparison = compare(&((self)->contents[mid_index] suffix), (needle)); \ + if (comparison <= 0) *(_index) = mid_index; \ + size -= half_size; \ + } \ + comparison = compare(&((self)->contents[*(_index)] suffix), (needle)); \ + if (comparison == 0) *(_exists) = true; \ + else if (comparison < 0) *(_index) += 1; \ + } while (0) + +/// Helper macro for the `_sorted_by` routines below. This takes the left (existing) +/// parameter by reference in order to work with the generic sorting function above. +#define _compare_int(a, b) ((int)*(a) - (int)(b)) + +#ifdef _MSC_VER +#pragma warning(default : 4101) +#elif defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif + +#ifdef __cplusplus +} +#endif + +#endif // TREE_SITTER_ARRAY_H_ diff --git a/resources/language-metavariables/tree-sitter-typescript/build/Release/tree_sitter_typescript_binding.node b/resources/language-metavariables/tree-sitter-typescript/build/Release/tree_sitter_typescript_binding.node index 62af9d3a896e65d617e3893827e3aa9aea78c3b9..71f99cdb2ac8ba3027a0498ae063f0701c49e6d8 100755 GIT binary patch delta 479 zcmWm2ODKZ@0KoC~*@t<*hRti9^EU4{^BSKVyyBuPCo7b4LM+ls^A36BapOR8`8aTp zU3XBsYB^vv^j@il7R{o~EGi(t4@&r+ zKLQX46@n0q5QHKO;fO#aq7aQ3s1b`e#6tru5|D@_BqIenq#_OJ$Ur8tphq@xkc&Lz zqX2~{f&s-SK`F{mjtW$w3e~7VE$UE@1~kHmCN!f3t!RS@?dXurqGYuR>U;UcE;*IH zxZaR{6@rG?l2%1uH1GM2mN<}-6LsS&55u$GP3PtK+q?YYYC7HZDo6d-rrW!|j*=|e z6WJE{21WQc4~n|CPh9{`~_h9z_7&9zkO(eAizMHyv$0f3}*x+};_x;Is=NP#_da z1Ya0bP$L`>h(r{k5rbH05QlgqAQ4Frp+z!Mkcu?ukPbaEU_d6akc}MVA`kf}Kp~1y zj1rWh4CSamC8|)38q~swI+#$81~kHqCN!f37PP{OHngJyo#;ZhY!{>{r{Z=}zIRFI z%3%1Gq~8$59pRQ1gkV_L{*QG-((4S45v3-se?R=Nx^H-I=e74B;-cUq{mNhS<9Cz} z?M};6vJ_ahn9e3n2EON4h4E9-RDP-*^@wxFE46C3{P?Dt9Wy>$i#~^W(f8u(-Y|8! Z486vl%fa seq( // repeat(field('decorator', $.decorator)), // optional(choice( @@ -441,6 +444,9 @@ module.exports = function defineGrammar(dialect) { '}', ), + // TODO use the below version of the rule as it is up to date with the upstream typescript grammar + // unfortunatly using it breaks the react class componenets to functional componenets pattern + // class_body: ($) => seq( // '{', // repeat(choice( diff --git a/resources/language-metavariables/tree-sitter-typescript/node_modules/tree-sitter-javascript/build/Makefile b/resources/language-metavariables/tree-sitter-typescript/node_modules/tree-sitter-javascript/build/Makefile index 8bcd78b9a..5b9825949 100644 --- a/resources/language-metavariables/tree-sitter-typescript/node_modules/tree-sitter-javascript/build/Makefile +++ b/resources/language-metavariables/tree-sitter-typescript/node_modules/tree-sitter-javascript/build/Makefile @@ -327,7 +327,7 @@ endif quiet_cmd_regen_makefile = ACTION Regenerating $@ cmd_regen_makefile = cd $(srcdir); /Users/itamarlevy-or/.nvm/versions/node/v18.5.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/itamarlevy-or/Library/Caches/node-gyp/18.5.0" "-Dnode_gyp_dir=/Users/itamarlevy-or/.nvm/versions/node/v18.5.0/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/itamarlevy-or/Library/Caches/node-gyp/18.5.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/itamarlevy-or/dev/gritql/resources/language-metavariables/tree-sitter-typescript/node_modules/tree-sitter-javascript" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/Users/itamarlevy-or/dev/gritql/resources/language-metavariables/tree-sitter-typescript/node_modules/tree-sitter-javascript/build/config.gypi -I/Users/itamarlevy-or/.nvm/versions/node/v18.5.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/itamarlevy-or/Library/Caches/node-gyp/18.5.0/include/node/common.gypi "--toplevel-dir=." binding.gyp -Makefile: $(srcdir)/../../../../../../../Library/Caches/node-gyp/18.5.0/include/node/common.gypi $(srcdir)/../../../../../../../.nvm/versions/node/v18.5.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp +Makefile: $(srcdir)/binding.gyp $(srcdir)/../../../../../../../.nvm/versions/node/v18.5.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/../../../../../../../Library/Caches/node-gyp/18.5.0/include/node/common.gypi $(srcdir)/build/config.gypi $(call do_cmd,regen_makefile) # "all" is a concatenation of the "all" targets from all the included diff --git a/resources/language-metavariables/tree-sitter-typescript/node_modules/tree-sitter-javascript/build/Release/obj.target/tree_sitter_javascript_binding/src/parser.o b/resources/language-metavariables/tree-sitter-typescript/node_modules/tree-sitter-javascript/build/Release/obj.target/tree_sitter_javascript_binding/src/parser.o index 65bf7499e69b4958f5d6325b0733a772f3900415..d211ec065b6b59fad967835abcbd74bdcfabefeb 100644 GIT binary patch literal 732592 zcmeFa3!IeW|Nno_9%{C;l+tNCY&BaV(RQxwJX=Yn^FilKsk9X35K&AKg^-WPA*Ki+ z3L!a6k#l{74pPiU5kg46>z?cNS~KtNYj$U+{qp_)za9@;J@bzsgva%ToW@KT_2HpV~iatN+!1r>p-5+y6HFcj5k0;otm*82-DYqW1q~(Qf3( z>EmZk$3N5`BS-e{I=KJe|K{Ju1;bJ-yT2p_2OlV9{b>I(#k$V^ga3^jIrfsNm;K$L z?2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