1
0
Fork 0
mirror of https://github.com/pnx/tree-sitter-dotenv synced 2026-08-15 12:58:12 +02:00
tree-sitter-dotenv/test/corpus/export.txt
Henrik Hautakoski 0cc23a517e feat: make export keyword anonymous.
"export" was a named node despite always having fixed spelling, with
no variation to expose to queries. Anonymous string literals are
already fully queryable ("export" @keyword), so the named production
added a redundant node in the tree for no benefit.

Keeps the alias("export", $.identifier) in the key field, since that
usage is a genuine reclassification (export as an identifier, not the
keyword) and still needs to be named.

Updated corpus tests to use :cst format where "export" and "="
presence needs to be asserted explicitly.
2026-07-16 10:47:32 +02:00

64 lines
1.8 KiB
Text

================================================================================
Export keyword
:cst
================================================================================
export VAR=one
export VAR = one
export TAB=two
export export=var
--------------------------------------------------------------------------------
1:0 - 5:0 document
1:0 - 1:14 assignment
1:0 - 1:6 "export"
1:7 - 1:10 key: identifier `VAR`
1:10 - 1:11 "="
1:11 - 1:14 value: value `one`
2:0 - 2:18 assignment
2:0 - 2:6 "export"
2:8 - 2:11 key: identifier `VAR`
2:13 - 2:14 "="
2:15 - 2:18 value: value `one`
3:0 - 3:14 assignment
3:0 - 3:6 "export"
3:7 - 3:10 key: identifier `TAB`
3:10 - 3:11 "="
3:11 - 3:14 value: value `two`
4:0 - 4:17 assignment
4:0 - 4:6 "export"
4:7 - 4:13 key: identifier `export`
4:13 - 4:14 "="
4:14 - 4:17 value: value `var`
================================================================================
Export-like identifiers
:cst
================================================================================
export=one
export = one
exportVAR=two
exportVAR = two
--------------------------------------------------------------------------------
1:0 - 6:0 document
1:0 - 1:10 assignment
1:0 - 1:6 key: identifier `export`
1:6 - 1:7 "="
1:7 - 1:10 value: value `one`
2:0 - 2:12 assignment
2:0 - 2:6 key: identifier `export`
2:7 - 2:8 "="
2:9 - 2:12 value: value `one`
3:0 - 3:13 assignment
3:0 - 3:9 key: identifier `exportVAR`
3:9 - 3:10 "="
3:10 - 3:13 value: value `two`
4:0 - 4:15 assignment
4:0 - 4:9 key: identifier `exportVAR`
4:10 - 4:11 "="
4:12 - 4:15 value: value `two`