Skip to content

Commit 634cfc5

Browse files
authored
fix(#52): Fix raw text sequences (#54)
1 parent be53f25 commit 634cfc5

File tree

8 files changed

+124
-6
lines changed

8 files changed

+124
-6
lines changed

.github/workflows/publish.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ jobs:
1212
uses: tree-sitter/workflows/.github/workflows/package-npm.yml@main
1313
secrets:
1414
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
15+
with:
16+
generate: true
1517
crates:
1618
uses: tree-sitter/workflows/.github/workflows/package-crates.yml@main
1719
secrets:
1820
CARGO_REGISTRY_TOKEN: ${{secrets.CARGO_TOKEN}}
21+
with:
22+
generate: true

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "tree-sitter-angular"
33
description = "Angular grammar for tree-sitter"
4-
version = "0.5.2"
4+
version = "0.5.3"
55
keywords = ["incremental", "parsing", "angular"]
66
categories = ["parsing", "text-editors"]
77
repository = "https://github.com/tree-sitter/tree-sitter-angular"

grammar.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ module.exports = grammar(HTML, {
3636

3737
// ---------- Overrides ----------
3838
attribute_name: (_) => /[^<>\*.\[\]\(\)"'=\s]+/,
39-
text: (_) => /[^<>{}&\s]([^<>{}&]*[^<>{}&\s])?/,
39+
text: (_) => /[^<>@{}&\s]([^<>@{}&]*[^<>@{}&\s])?/,
4040

4141
// ----------- Statement block --------
4242
statement_block: ($) => prec.right(seq('{', repeat($._node), '}')),

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tree-sitter-angular",
3-
"version": "0.5.2",
3+
"version": "0.5.3",
44
"description": "Tree-sitter grammar for the Angular framework",
55
"main": "bindings/node",
66
"types": "bindings/node",

src/grammar.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/parser.c

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/corpus/html.txt

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
============
2+
Regular HTML
3+
============
4+
5+
<div>
6+
<h1>Title</h1>
7+
<span>Some subtext</span>
8+
</div>
9+
10+
---
11+
12+
(document
13+
(element
14+
(start_tag
15+
(tag_name))
16+
(element
17+
(start_tag
18+
(tag_name))
19+
(text)
20+
(end_tag
21+
(tag_name)))
22+
(element
23+
(start_tag
24+
(tag_name))
25+
(text)
26+
(end_tag
27+
(tag_name)))
28+
(end_tag
29+
(tag_name))))
30+
31+
32+
=======================
33+
Text without tag - HTML
34+
=======================
35+
36+
<div>
37+
Random Text
38+
<span>Some subtext</span>
39+
</div>
40+
41+
---
42+
43+
(document
44+
(element
45+
(start_tag
46+
(tag_name))
47+
(text)
48+
(element
49+
(start_tag
50+
(tag_name))
51+
(text)
52+
(end_tag
53+
(tag_name)))
54+
(end_tag
55+
(tag_name))))
56+
57+
===============================
58+
Text without tag - Control Flow
59+
===============================
60+
61+
<div>
62+
Random Text
63+
@if (condition) {
64+
<span>Conditional text</span>
65+
}
66+
</div>
67+
68+
---
69+
70+
(document
71+
(element
72+
(start_tag
73+
(tag_name))
74+
(text)
75+
(if_statement
76+
(control_keyword)
77+
condition: (if_condition
78+
(expression
79+
(identifier)))
80+
consequence: (statement_block
81+
(element
82+
(start_tag
83+
(tag_name))
84+
(text)
85+
(end_tag
86+
(tag_name)))))
87+
(end_tag
88+
(tag_name))))
89+
90+
================================
91+
Text without tag - Interpolation
92+
================================
93+
94+
<div>
95+
Random Text
96+
{{ property }}
97+
</div>
98+
99+
---
100+
101+
(document
102+
(element
103+
(start_tag
104+
(tag_name))
105+
(text)
106+
(interpolation
107+
(expression
108+
(identifier)))
109+
(end_tag
110+
(tag_name))))
111+

tree-sitter.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010
],
1111
"metadata": {
12-
"version": "0.5.2",
12+
"version": "0.5.3",
1313
"license": "MIT",
1414
"description": "Tree-sitter grammar for the Angular framework",
1515
"authors": [

0 commit comments

Comments
 (0)