@reteps/tree-sitter-htmlmustache 0.0.38 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cli/out/main.js CHANGED
@@ -1739,29 +1739,33 @@ var ERROR_NODE_TYPES = /* @__PURE__ */ new Set([
1739
1739
  function collectErrors(tree, file) {
1740
1740
  const errors = [];
1741
1741
  const cursor = tree.walk();
1742
- function visit() {
1742
+ function visit(insideMustacheSection) {
1743
1743
  const node = cursor.currentNode;
1744
1744
  const nodeType = cursor.nodeType;
1745
1745
  if (ERROR_NODE_TYPES.has(nodeType) || cursor.nodeIsMissing) {
1746
- errors.push({
1747
- file,
1748
- line: node.startPosition.row + 1,
1749
- column: node.startPosition.column + 1,
1750
- endLine: node.endPosition.row + 1,
1751
- endColumn: node.endPosition.column + 1,
1752
- message: errorMessageForNode(nodeType, node),
1753
- nodeText: node.text
1754
- });
1746
+ const skip = insideMustacheSection && nodeType === "html_erroneous_end_tag";
1747
+ if (!skip) {
1748
+ errors.push({
1749
+ file,
1750
+ line: node.startPosition.row + 1,
1751
+ column: node.startPosition.column + 1,
1752
+ endLine: node.endPosition.row + 1,
1753
+ endColumn: node.endPosition.column + 1,
1754
+ message: errorMessageForNode(nodeType, node),
1755
+ nodeText: node.text
1756
+ });
1757
+ }
1755
1758
  if (nodeType === "ERROR") return;
1756
1759
  }
1760
+ const enteringMustacheSection = nodeType === "mustache_section" || nodeType === "mustache_inverted_section";
1757
1761
  if (cursor.gotoFirstChild()) {
1758
1762
  do {
1759
- visit();
1763
+ visit(insideMustacheSection || enteringMustacheSection);
1760
1764
  } while (cursor.gotoNextSibling());
1761
1765
  cursor.gotoParent();
1762
1766
  }
1763
1767
  }
1764
- visit();
1768
+ visit(false);
1765
1769
  return errors;
1766
1770
  }
1767
1771
  function formatError(error, source) {
package/grammar.js CHANGED
@@ -281,12 +281,12 @@ module.exports = grammar({
281
281
  _attribute_value_no_double_quote: ($) =>
282
282
  choice(
283
283
  $._mustache_node,
284
- alias($._html_attribute_value_no_single_quote, $.text),
284
+ alias($._html_attribute_value_no_double_quote, $.text),
285
285
  ),
286
286
  _attribute_value_no_single_quote: ($) =>
287
287
  choice(
288
288
  $._mustache_node,
289
- alias($._html_attribute_value_no_double_quote, $.text),
289
+ alias($._html_attribute_value_no_single_quote, $.text),
290
290
  ),
291
291
  _mustache_section_no_single_quote: ($) =>
292
292
  seq(
@@ -370,6 +370,7 @@ module.exports = grammar({
370
370
  ),
371
371
  _mustache_node_no_single_quote: ($) =>
372
372
  choice(
373
+ $.mustache_triple,
373
374
  $.mustache_interpolation,
374
375
  alias($._mustache_comment_no_single_quote, $.mustache_comment),
375
376
  alias($._mustache_partial_no_single_quote, $.mustache_partial),
@@ -381,6 +382,7 @@ module.exports = grammar({
381
382
  ),
382
383
  _mustache_node_no_double_quote: ($) =>
383
384
  choice(
385
+ $.mustache_triple,
384
386
  $.mustache_interpolation,
385
387
  alias($._mustache_comment_no_double_quote, $.mustache_comment),
386
388
  alias($._mustache_partial_no_double_quote, $.mustache_partial),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reteps/tree-sitter-htmlmustache",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "description": "HTML with Mustache/Handlebars template syntax grammar for tree-sitter",
5
5
  "repository": {
6
6
  "type": "git",
package/src/grammar.json CHANGED
@@ -942,7 +942,7 @@
942
942
  "type": "ALIAS",
943
943
  "content": {
944
944
  "type": "SYMBOL",
945
- "name": "_html_attribute_value_no_single_quote"
945
+ "name": "_html_attribute_value_no_double_quote"
946
946
  },
947
947
  "named": true,
948
948
  "value": "text"
@@ -960,7 +960,7 @@
960
960
  "type": "ALIAS",
961
961
  "content": {
962
962
  "type": "SYMBOL",
963
- "name": "_html_attribute_value_no_double_quote"
963
+ "name": "_html_attribute_value_no_single_quote"
964
964
  },
965
965
  "named": true,
966
966
  "value": "text"
@@ -1158,6 +1158,10 @@
1158
1158
  "_mustache_node_no_single_quote": {
1159
1159
  "type": "CHOICE",
1160
1160
  "members": [
1161
+ {
1162
+ "type": "SYMBOL",
1163
+ "name": "mustache_triple"
1164
+ },
1161
1165
  {
1162
1166
  "type": "SYMBOL",
1163
1167
  "name": "mustache_interpolation"
@@ -1203,6 +1207,10 @@
1203
1207
  "_mustache_node_no_double_quote": {
1204
1208
  "type": "CHOICE",
1205
1209
  "members": [
1210
+ {
1211
+ "type": "SYMBOL",
1212
+ "name": "mustache_triple"
1213
+ },
1206
1214
  {
1207
1215
  "type": "SYMBOL",
1208
1216
  "name": "mustache_interpolation"
@@ -326,6 +326,10 @@
326
326
  {
327
327
  "type": "mustache_section",
328
328
  "named": true
329
+ },
330
+ {
331
+ "type": "mustache_triple",
332
+ "named": true
329
333
  }
330
334
  ]
331
335
  }