tree-sitter-aspx 0.0.0-stage → 0.1.3

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.
@@ -0,0 +1,70 @@
1
+ ; Embedded C# and VB.NET.
2
+ ;
3
+ ; The scanner records the page Language attribute and emits c_sharp_code or
4
+ ; vb_code for each nugget, so a host does not have to walk back to the
5
+ ; directive. Statement blocks are combined: `<% if (x) { %>` markup `<% } %>`
6
+ ; is one C# or VB document with the markup left out of the injected ranges.
7
+ ; Output, encoded, and binding nuggets are separate expressions and are not
8
+ ; combined with statement blocks or with each other.
9
+ ;
10
+ ; A <script> body uses the same code node. Without runat="server" the body
11
+ ; is client script, so the query below replaces the page language with
12
+ ; JavaScript. With runat="server" the page language stands.
13
+ ; Expression builders (`<%$ ... %>`) are not C# or VB and are not injected.
14
+ ; <style> bodies inject as CSS.
15
+
16
+ ((statement_block
17
+ (c_sharp_code) @injection.content)
18
+ (#set! injection.language "c_sharp")
19
+ (#set! injection.combined))
20
+
21
+ ((statement_block
22
+ (vb_code) @injection.content)
23
+ (#set! injection.language "vb")
24
+ (#set! injection.combined))
25
+
26
+ ((output_expression
27
+ (c_sharp_code) @injection.content)
28
+ (#set! injection.language "c_sharp"))
29
+
30
+ ((output_expression
31
+ (vb_code) @injection.content)
32
+ (#set! injection.language "vb"))
33
+
34
+ ((encoded_expression
35
+ (c_sharp_code) @injection.content)
36
+ (#set! injection.language "c_sharp"))
37
+
38
+ ((encoded_expression
39
+ (vb_code) @injection.content)
40
+ (#set! injection.language "vb"))
41
+
42
+ ((binding_expression
43
+ (c_sharp_code) @injection.content)
44
+ (#set! injection.language "c_sharp"))
45
+
46
+ ((binding_expression
47
+ (vb_code) @injection.content)
48
+ (#set! injection.language "vb"))
49
+
50
+ ((script_element
51
+ (start_tag) @_tag
52
+ (c_sharp_code) @injection.content)
53
+ (#match? @_tag "[Rr][Uu][Nn][Aa][Tt]\\s*=\\s*[\"'][Ss]erver")
54
+ (#set! injection.language "c_sharp"))
55
+
56
+ ((script_element
57
+ (start_tag) @_tag
58
+ (vb_code) @injection.content)
59
+ (#match? @_tag "[Rr][Uu][Nn][Aa][Tt]\\s*=\\s*[\"'][Ss]erver")
60
+ (#set! injection.language "vb"))
61
+
62
+ ((script_element
63
+ (start_tag) @_tag
64
+ [(c_sharp_code) (vb_code)] @injection.content)
65
+ (#not-match? @_tag "[Rr][Uu][Nn][Aa][Tt]\\s*=\\s*[\"'][Ss]erver")
66
+ (#set! injection.language "javascript"))
67
+
68
+ ((style_element
69
+ (style_text) @injection.content)
70
+ (#set! injection.language "css"))