@sshadows/tree-sitter-al 2.1.0

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/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@sshadows/tree-sitter-al",
3
+ "version": "2.1.0",
4
+ "description": "AL for Business Central",
5
+ "repository": "github:SShadowS/tree-sitter-al",
6
+ "license": "MIT",
7
+ "author": {
8
+ "name": "Torben Leth",
9
+ "email": "sshadows@sshadows.dk"
10
+ },
11
+ "main": "bindings/node",
12
+ "types": "bindings/node",
13
+ "keywords": [
14
+ "incremental",
15
+ "parsing",
16
+ "tree-sitter",
17
+ "al"
18
+ ],
19
+ "files": [
20
+ "grammar.js",
21
+ "binding.gyp",
22
+ "prebuilds/**",
23
+ "bindings/node/*",
24
+ "queries/*",
25
+ "src/**",
26
+ "*.wasm"
27
+ ],
28
+ "dependencies": {
29
+ "node-addon-api": "^8.6.0",
30
+ "node-gyp-build": "^4.8.4",
31
+ "ts-check": "^0.2.4"
32
+ },
33
+ "devDependencies": {
34
+ "@types/jquery": "^4.0.0",
35
+ "prebuildify": "^6.0.1",
36
+ "tree-sitter-cli": "^0.26.7"
37
+ },
38
+ "peerDependencies": {
39
+ "tree-sitter": "latest"
40
+ },
41
+ "peerDependenciesMeta": {
42
+ "tree-sitter": {
43
+ "optional": true
44
+ }
45
+ },
46
+ "scripts": {
47
+ "install": "node-gyp-build",
48
+ "prestart": "tree-sitter build --wasm",
49
+ "start": "tree-sitter playground",
50
+ "test": "node --test bindings/node/*_test.js"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "tree-sitter": [
56
+ {
57
+ "scope": "source.al",
58
+ "injection-regex": "^al$"
59
+ }
60
+ ]
61
+ }
@@ -0,0 +1,30 @@
1
+ ; ── "OnBeforeDeleteEvent subscribers missing IsTemporary guard" ─────────────────────────────
2
+ (
3
+ ; The attribute_item and procedure must be adjacent siblings (Rust-style attributes)
4
+ (attribute_item
5
+ attribute: (attribute_content
6
+ name: (identifier) @attr_name
7
+ arguments: (attribute_arguments
8
+ arguments: (expression_list
9
+ (qualified_enum_value) ; ObjectType::Table
10
+ [(integer) (database_reference)] ; Table ID or Database::"Table Name"
11
+ [(string_literal) (identifier)] @event_name ; Event name (with or without quotes)
12
+ (string_literal) ; Publisher object
13
+ (boolean) ; Publisher function
14
+ (boolean))))) ; Skip on missing
15
+ . ; Adjacent sibling operator
16
+ (procedure
17
+ name: (name) @proc_name
18
+ (parameter_list
19
+ (parameter
20
+ parameter_name: (name) @rec_param) ; var Rec: Record
21
+ (parameter
22
+ parameter_name: (name))) ; RunTrigger: Boolean
23
+ (var_section)? ; Optional var section
24
+ (code_block ; BEGIN … END;
25
+ (_) @first_statement ; Capture first statement (any type)
26
+ .)) ; Ensure it's the first
27
+ (#eq? @attr_name "EventSubscriber") ; Match EventSubscriber attribute
28
+ (#match? @event_name "OnBeforeDeleteEvent") ; Match OnBeforeDeleteEvent (with or without quotes)
29
+ (#not-match? @first_statement "IsTemporary"); First statement does NOT contain IsTemporary
30
+ )
@@ -0,0 +1,221 @@
1
+ ; AL Language (v2) - Tree-sitter Code Folding Queries
2
+ ; Defines regions that can be collapsed in editors supporting tree-sitter folding
3
+
4
+ ; =============================================================================
5
+ ; Object Declarations
6
+ ; =============================================================================
7
+
8
+ [
9
+ (table_declaration)
10
+ (tableextension_declaration)
11
+ (page_declaration)
12
+ (pageextension_declaration)
13
+ (pagecustomization_declaration)
14
+ (codeunit_declaration)
15
+ (report_declaration)
16
+ (reportextension_declaration)
17
+ (query_declaration)
18
+ (xmlport_declaration)
19
+ (enum_declaration)
20
+ (enumextension_declaration)
21
+ (interface_declaration)
22
+ (controladdin_declaration)
23
+ (dotnet_declaration)
24
+ (profile_declaration)
25
+ (profileextension_declaration)
26
+ (permissionset_declaration)
27
+ (permissionsetextension_declaration)
28
+ (entitlement_declaration)
29
+ ] @fold
30
+
31
+ ; =============================================================================
32
+ ; Procedures and Triggers
33
+ ; =============================================================================
34
+
35
+ (procedure) @fold
36
+ (trigger_declaration) @fold
37
+ (event_declaration) @fold
38
+ (interface_procedure) @fold
39
+ (preproc_split_procedure) @fold
40
+
41
+ ; =============================================================================
42
+ ; Code Blocks (begin ... end)
43
+ ; =============================================================================
44
+
45
+ (code_block) @fold
46
+
47
+ ; =============================================================================
48
+ ; Sections
49
+ ; =============================================================================
50
+
51
+ [
52
+ (fields_section)
53
+ (keys_section)
54
+ (fieldgroups_section)
55
+ (layout_section)
56
+ (actions_section)
57
+ (dataset_section)
58
+ (elements_section)
59
+ (labels_section)
60
+ (rendering_section)
61
+ (requestpage_section)
62
+ (views_section)
63
+ (schema_section)
64
+ ] @fold
65
+
66
+ ; =============================================================================
67
+ ; Layout Elements
68
+ ; =============================================================================
69
+
70
+ [
71
+ (area_section)
72
+ (group_section)
73
+ (repeater_section)
74
+ (cuegroup_section)
75
+ (fixed_section)
76
+ (grid_section)
77
+ (part_section)
78
+ (systempart_section)
79
+ (usercontrol_section)
80
+ ] @fold
81
+
82
+ ; =============================================================================
83
+ ; Action Sections
84
+ ; =============================================================================
85
+
86
+ [
87
+ (action_area_section)
88
+ (action_group_section)
89
+ (action_declaration)
90
+ (customaction_declaration)
91
+ (systemaction_declaration)
92
+ (fileuploadaction_declaration)
93
+ ] @fold
94
+
95
+ ; =============================================================================
96
+ ; Report Elements
97
+ ; =============================================================================
98
+
99
+ [
100
+ (report_dataitem)
101
+ (report_column)
102
+ (rendering_layout)
103
+ (label_section)
104
+ ] @fold
105
+
106
+ ; =============================================================================
107
+ ; Query Elements
108
+ ; =============================================================================
109
+
110
+ [
111
+ (query_dataitem)
112
+ (query_column)
113
+ (query_filter)
114
+ ] @fold
115
+
116
+ ; =============================================================================
117
+ ; XMLport Elements
118
+ ; =============================================================================
119
+
120
+ [
121
+ (xmlport_element)
122
+ (xmlport_attribute)
123
+ ] @fold
124
+
125
+ ; =============================================================================
126
+ ; Declarations with Bodies
127
+ ; =============================================================================
128
+
129
+ [
130
+ (field_declaration)
131
+ (enum_value_declaration)
132
+ (key_declaration)
133
+ (view_definition)
134
+ (assembly_declaration)
135
+ ] @fold
136
+
137
+ ; =============================================================================
138
+ ; Var Sections
139
+ ; =============================================================================
140
+
141
+ (var_section) @fold
142
+
143
+ ; =============================================================================
144
+ ; Control Flow
145
+ ; =============================================================================
146
+
147
+ [
148
+ (if_statement)
149
+ (case_statement)
150
+ (case_branch)
151
+ (case_else_branch)
152
+ (for_statement)
153
+ (foreach_statement)
154
+ (while_statement)
155
+ (repeat_statement)
156
+ (with_statement)
157
+ ] @fold
158
+
159
+ ; =============================================================================
160
+ ; Modification Blocks
161
+ ; =============================================================================
162
+
163
+ [
164
+ (addafter_modification)
165
+ (addbefore_modification)
166
+ (addfirst_modification)
167
+ (addlast_modification)
168
+ (modify_modification)
169
+ (moveafter_modification)
170
+ (movebefore_modification)
171
+ (movefirst_modification)
172
+ (movelast_modification)
173
+ (addafter_action_modification)
174
+ (addbefore_action_modification)
175
+ (addfirst_action_modification)
176
+ (addlast_action_modification)
177
+ (modify_action_modification)
178
+ (addafter_dataset_modification)
179
+ (addbefore_dataset_modification)
180
+ (addfirst_dataset_modification)
181
+ (addlast_dataset_modification)
182
+ (add_dataset_modification)
183
+ (addfirst_fieldgroup_modification)
184
+ (addlast_fieldgroup_modification)
185
+ (addafter_views_modification)
186
+ (addbefore_views_modification)
187
+ (addfirst_views_modification)
188
+ (addlast_views_modification)
189
+ ] @fold
190
+
191
+ ; =============================================================================
192
+ ; Comments
193
+ ; =============================================================================
194
+
195
+ (multiline_comment) @fold
196
+
197
+ ; =============================================================================
198
+ ; Preprocessor Regions
199
+ ; =============================================================================
200
+
201
+ (preproc_region) @fold
202
+
203
+ ; Preprocessor conditionals
204
+ [
205
+ (preproc_conditional)
206
+ (preproc_conditional_actions)
207
+ (preproc_conditional_case)
208
+ (preproc_conditional_controladdin)
209
+ (preproc_conditional_dataset)
210
+ (preproc_conditional_fieldgroups)
211
+ (preproc_conditional_fields)
212
+ (preproc_conditional_keys)
213
+ (preproc_conditional_layout)
214
+ (preproc_conditional_object)
215
+ (preproc_conditional_query)
216
+ (preproc_conditional_report)
217
+ (preproc_conditional_statement)
218
+ (preproc_conditional_var)
219
+ (preproc_conditional_var_block)
220
+ (preproc_conditional_xmlport)
221
+ ] @fold