Skip to content

Commit 1a6ec35

Browse files
authored
feat: Add Tcl support (#269)
1 parent 24f107a commit 1a6ec35

File tree

5 files changed

+152
-0
lines changed

5 files changed

+152
-0
lines changed

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -484,3 +484,9 @@
484484
branch = main
485485
update = none
486486
ignore = dirty
487+
[submodule "repos/tcl"]
488+
path = repos/tcl
489+
url = https://github.com/lewis6991/tree-sitter-tcl
490+
branch = main
491+
update = none
492+
ignore = dirty

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Changelog
22

33
## Unreleased
4+
- Add `Tcl` support
45

56
## 0.12.68 - 2023-10-12
67
- Add `HEEx` support

queries/tcl/highlights.scm

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
2+
(comment) @comment @spell
3+
4+
(command name: (simple_word) @function)
5+
6+
"proc" @keyword.function
7+
8+
((simple_word) @variable.builtin
9+
(#any-of? @variable.builtin
10+
"argc"
11+
"argv"
12+
"argv0"
13+
"auto_path"
14+
"env"
15+
"errorCode"
16+
"errorInfo"
17+
"tcl_interactive"
18+
"tcl_library"
19+
"tcl_nonwordchars"
20+
"tcl_patchLevel"
21+
"tcl_pkgPath"
22+
"tcl_platform"
23+
"tcl_precision"
24+
"tcl_rcFileName"
25+
"tcl_traceCompile"
26+
"tcl_traceExec"
27+
"tcl_wordchars"
28+
"tcl_version"))
29+
30+
31+
"expr" @function.builtin
32+
33+
(command
34+
name: (simple_word) @function.builtin
35+
(#any-of? @function.builtin
36+
"cd"
37+
"exec"
38+
"exit"
39+
"incr"
40+
"info"
41+
"join"
42+
"puts"
43+
"regexp"
44+
"regsub"
45+
"split"
46+
"subst"
47+
"trace"
48+
"source"))
49+
50+
(command name: (simple_word) @keyword
51+
(#any-of? @keyword
52+
"append"
53+
"break"
54+
"catch"
55+
"continue"
56+
"default"
57+
"dict"
58+
"error"
59+
"eval"
60+
"global"
61+
"lappend"
62+
"lassign"
63+
"lindex"
64+
"linsert"
65+
"list"
66+
"llength"
67+
"lmap"
68+
"lrange"
69+
"lrepeat"
70+
"lreplace"
71+
"lreverse"
72+
"lsearch"
73+
"lset"
74+
"lsort"
75+
"package"
76+
"return"
77+
"switch"
78+
"throw"
79+
"unset"
80+
"variable"))
81+
82+
[
83+
"error"
84+
"namespace"
85+
"on"
86+
"set"
87+
"try"
88+
] @keyword
89+
90+
(unpack) @operator
91+
92+
[
93+
"while"
94+
"foreach"
95+
; "for"
96+
] @repeat
97+
98+
[
99+
"if"
100+
"else"
101+
"elseif"
102+
] @conditional
103+
104+
[
105+
"**"
106+
"/" "*" "%" "+" "-"
107+
"<<" ">>"
108+
">" "<" ">=" "<="
109+
"==" "!="
110+
"eq" "ne"
111+
"in" "ni"
112+
"&"
113+
"^"
114+
"|"
115+
"&&"
116+
"||"
117+
] @operator
118+
119+
(variable_substitution) @parameter
120+
(quoted_word) @string
121+
(escaped_character) @string.escape
122+
123+
[
124+
"{" "}"
125+
"[" "]"
126+
";"
127+
] @punctuation.delimiter
128+
129+
((simple_word) @number
130+
(#lua-match? @number "^[0-9]+$"))
131+
132+
((simple_word) @boolean
133+
(#any-of? @boolean "true" "false"))
134+
135+
; after apply array auto_execok auto_import auto_load auto_mkindex auto_qualify
136+
; auto_reset bgerror binary chan clock close coroutine dde encoding eof fblocked
137+
; fconfigure fcopy file fileevent filename flush format gets glob history http
138+
; interp load mathfunc mathop memory msgcat my next nextto open parray pid
139+
; pkg::create pkg_mkIndex platform platform::shell pwd re_syntax read refchan
140+
; registry rename safe scan seek self socket source string tailcall tcl::prefix
141+
; tcl_endOfWord tcl_findLibrary tcl_startOfNextWord tcl_startOfPreviousWord
142+
; tcl_wordBreakAfter tcl_wordBreakBefore tcltest tell time timerate tm
143+
; transchan unknown unload update uplevel upvar vwait yield yieldto zlib

repos/tcl

Submodule tcl added at ac8b94b

tree-sitter-langs.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ See `tree-sitter-langs-repos'."
188188
(swift-mode . swift)
189189
(toml-mode . toml)
190190
(conf-toml-mode . toml)
191+
(tcl-mode . tcl)
191192
(tuareg-mode . ocaml)
192193
(typescript-mode . typescript)
193194
(verilog-mode . verilog)

0 commit comments

Comments
 (0)