Skip to content

Commit 2dddace

Browse files
authored
Add support for the SlightLisp language (#14236)
1 parent 66737c6 commit 2dddace

File tree

4 files changed

+95
-1
lines changed

4 files changed

+95
-1
lines changed

book/src/generated/lang-support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232
| shellcheckrc ||| | | | |
233233
| slang |||| | | `slangd` |
234234
| slint |||| | | `slint-lsp` |
235+
| slisp || | || | |
235236
| smali || || | | |
236237
| smithy || | | | | `cs` |
237238
| sml || | | | | |

languages.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4751,7 +4751,6 @@ file-types = [{glob = "Cross.toml"}]
47514751
language-servers = [ "taplo", "tombi" ]
47524752
indent = { tab-width = 2, unit = " " }
47534753

4754-
# https://git-cliff.org/docs/configuration/
47554754
[[language]]
47564755
name = "git-cliff-config"
47574756
scope = "source.git-cliff-config"
@@ -4832,3 +4831,15 @@ language-servers = ["wikitext-lsp"]
48324831
indent = { tab-width = 2, unit = " " }
48334832
block-comment-tokens = { start = "<!--", end = "-->" }
48344833
word-completion.trigger-length = 4
4834+
4835+
[[language]]
4836+
name = "slisp"
4837+
scope = "source.sl"
4838+
injection-regex = "sl"
4839+
file-types = ["sl"]
4840+
comment-token = ";"
4841+
indent = { tab-width = 2, unit = " " }
4842+
4843+
[[grammar]]
4844+
name = "slisp"
4845+
source = { git = "https://github.com/xenogenics/tree-sitter-slisp", rev = "29f9c6707ce9dfc2fc915d175ec720b207f179f3" }
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
;; Keywords
2+
[ "if" "prog" ] @keyword
3+
4+
;; Let binding
5+
[ "let" ] @keyword
6+
7+
(let_bindings name: (symbol) @variable)
8+
9+
;; Apply
10+
(apply_stmt . (symbol) @function)
11+
12+
;; Use module
13+
[ "use" ] @keyword
14+
15+
(use_module_global (quote) . (symbol) @namespace)
16+
(use_module_select (quote) . (symbol) @namespace)
17+
18+
;; Val definition
19+
[ "val" ] @keyword
20+
21+
(val_definition name: (symbol) @constant)
22+
23+
;; External definitions
24+
[ "ext" ] @keyword
25+
26+
(external_definition name: (symbol) @function)
27+
(external_definition signature: (signature (symbol) @variable.parameter (dot) (external_type) @type.builtin))
28+
(external_definition docstring: (string) @comment)
29+
(external_definition return_type: (external_type) @type.builtin)
30+
31+
;; Function definitions
32+
[ "def" ] @keyword
33+
34+
(function_definition name: (symbol) @function)
35+
(function_definition parameters: (parameters (symbol) @variable.parameter))
36+
(function_definition docstring: (string) @comment)
37+
38+
;; Macro definitions
39+
[ "mac" ] @keyword
40+
41+
(macro_definition name: (symbol) @function)
42+
(macro_definition parameters: (parameters (symbol) @variable.parameter))
43+
(macro_definition docstring: (string) @comment)
44+
45+
;; Lambda
46+
[ "\\" ] @keyword
47+
48+
(lambda_stmt parameters: (parameters (symbol) @variable.parameter))
49+
50+
;; Atoms
51+
(char) @constant.character
52+
(comment) @comment
53+
(number) @constant.numeric
54+
(string) @string
55+
56+
;; Punctuation
57+
[ "(" ")" ] @punctuation.bracket
58+
59+
;; Operators
60+
(dot) @operator
61+
(tilde) @operator
62+
(backquote) @operator
63+
(quote) @operator
64+
(unquote) @operator
65+
(unquote_splice) @operator
66+
67+
;; Highlight nil t as constant
68+
[ "nil" ] @constant.builtin
69+
70+
;; Highlight as t as boolean constant
71+
[ "T" ] @constant.builtin.boolean
72+
73+
;; Highlight variable names used in anamorphic macros.
74+
[ "it" ] @variable.builtin

runtime/queries/slisp/tags.scm

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
;; def
2+
(function_definition name: (symbol) @name) @definition.function
3+
4+
;; ext
5+
(external_definition name: (symbol) @name) @definition.function
6+
7+
;; mac
8+
(macro_definition name: (symbol) @name) @definition.function

0 commit comments

Comments
 (0)