Skip to content

Commit c2036b3

Browse files
committed
Add submodule and apply syntax highlighting theme
1 parent a23c755 commit c2036b3

File tree

7 files changed

+212
-123
lines changed

7 files changed

+212
-123
lines changed

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "tree-sitter-cognate"]
2+
path = tree-sitter-cognate
3+
url = https://github.com/hedyhli/tree-sitter-cognate

highlights.scm

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
(number) @number
2+
(string) @string
3+
(escape_sequence) @string.escape
4+
(symbol) @constant
5+
(boolean) @boolean
6+
7+
[(line_comment) (multiline_comment)] @comment
8+
(inline_comment) @comment.inline
9+
10+
";" @punctuation.special
11+
12+
["(" ")"] @punctuation.bracket
13+
14+
(identifier) @variable
15+
16+
(statement
17+
(identifier) @keyword (#eq? @keyword "Def")
18+
.
19+
(identifier) @function)
20+
21+
;; TODO: Update once neovim supports this.
22+
; ((identifier) @function (#is-not? local))
23+
24+
((identifier) @keyword.special (#any-of? @keyword.special "Def" "Let" "Set"))
25+
26+
((identifier) @keyword (#any-of? @keyword "For" "While" "When" "If"
27+
"Case" "When" "Unless" "Do" "With" "Take-while"
28+
"Until"))
29+
30+
((identifier) @function.builtin (#any-of? @function.builtin
31+
"Empty" "Match" "Print" "Put" "Random" "Modulo" "Sqrt" "Integer?" "Zero?" "First" "Rest" "Head" "Tail" "Push" "Empty?" "Join" "String-length" "Substring" "Regex" "Regex-match" "Ordinal" "Character" "Split" "Uppercase" "Lowercase" "Floor" "Round" "Ceiling" "Abs" "Error" "Wait" "Stop" "Show" "Stack" "Clear" "Unbox" "Debug" "Begin" "Sind" "Cosd" "Tand" "Sin" "Cos" "Tan" "Exp" "Log" "Ln" "Asind" "Acosd" "Atand" "Asin" "Acos" "Atan" "Sinhd" "Coshd" "Tanhd" "Sinh" "Cosh" "Tanh" "Table" "Insert" "Remove" "." "Has" "Values" "Keys" "Parameters" "Input" "Open" "Read-file" "Read-line" "Close" "Path" "Seek" "Drop" "Prepend" "Index" "All" "Discard" "None" "Append" "Swap" "Fold" "Prints" "Times" "Range" "Twin" "Take" "Triplet" "Min" "Reverse" "Filter" "Max" "Map" "Puts" "Sort" "Assert" "Length" "Of"
32+
))
33+
((identifier) @operator (#any-of? @operator "+" "-" "*" "/" ">" "<" "<=" ">=" "^"
34+
"==" "!=" "Not" "And" "Or" "Xor"))
35+
((identifier) @type.builtin (#any-of? @type.builtin "List" "Box" "Number" "Number!" "String!" "List!" "Block!" "Symbol!" "Boolean!" "Box!" "Io!" "Any!" "Number?" "String?" "List?" "Block?" "Symbol?" "Boolean?" "Box?" "Io?" "Any?"))
36+
37+
(statement (
38+
(identifier) @function.builtin (#eq? @function.builtin ".")
39+
.
40+
(identifier) @variable.member))

public/index.html

Lines changed: 36 additions & 36 deletions
Large diffs are not rendered by default.

public/learn/index.html

Lines changed: 86 additions & 86 deletions
Large diffs are not rendered by default.

scripts/highlight

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
22

3-
tree-sitter highlight --scope source.cog -H /dev/stdin | sed -z '
3+
tree-sitter highlight --query-paths $PWD/highlights.scm --config-path tree-sitter.json --scope source.cog -H /dev/stdin | sed -z '
44
s/.*<table>\n\(.*\)\n<\/table>.*/\1/
55
s/<tr><td class=line-number>[0-9]\+<\/td><td class=line>\([^\n]*\)\n<\/td><\/tr>/\1/g'

tree-sitter-cognate

Submodule tree-sitter-cognate added at 7a9ed6f

tree-sitter.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"parser-directories": [
3+
"."
4+
],
5+
"theme": {
6+
"function": "#795da3",
7+
"function.builtin": "#183691",
8+
"attribute": {
9+
"italic": true,
10+
"color": 124
11+
},
12+
"keyword": "#a71d5d",
13+
"number": "#0086b3",
14+
"punctuation.delimiter": 239,
15+
"variable.parameter": {
16+
"underline": true
17+
},
18+
"operator": {
19+
"bold": true,
20+
"color": 239
21+
},
22+
"tag": 18,
23+
"constructor": 136,
24+
"string": "#183691",
25+
"variable": "#795da3",
26+
"comment": {
27+
"color": "#969896",
28+
"italic": true
29+
},
30+
"comment.inline": {
31+
"color": "#333333",
32+
"italic": false
33+
},
34+
"module": 136,
35+
"string.special": "#183691",
36+
"variable.builtin": {
37+
"bold": true
38+
},
39+
"type": "#794da3",
40+
"property": 124,
41+
"keyword.special": "#0086b3",
42+
"embedded": null,
43+
"punctuation.bracket": 239
44+
}
45+
}

0 commit comments

Comments
 (0)