syntax highlightinggit status
This commit is contained in:
@@ -1,7 +1,43 @@
|
|||||||
type t List = 'EOL | 'Cons {head: t, tail: t List}
|
def tricky =
|
||||||
|
let ab = funct(1)
|
||||||
|
let cd = 3
|
||||||
|
ab + cd
|
||||||
|
|
||||||
type List2 = with t: 'EOL | 'Cons {head: t, tail: t List}
|
|
||||||
|
|
||||||
type List3 = with t: &a 'EOL | 'Cons {head: t, tail: a}
|
## doc comment
|
||||||
|
type [a,b] list = [a,b] List option
|
||||||
|
|
||||||
type List4 = with t: &a 'EOL Unit | 'Cons {head: t, tail: a}
|
# comment
|
||||||
|
|
||||||
|
def xa =
|
||||||
|
let data = 2
|
||||||
|
if data then
|
||||||
|
data and other and more
|
||||||
|
else 'MyTag myList ++ [4 + 2 * -(4) - 1] = 2^2
|
||||||
|
|
||||||
|
## adds two numbers
|
||||||
|
## together
|
||||||
|
def add : int -> int -> int =
|
||||||
|
a -> b : int -> a + b
|
||||||
|
|
||||||
|
def lol =
|
||||||
|
let data = 2
|
||||||
|
match x with
|
||||||
|
a | b -> (match c with y -> 3 | z ->5)
|
||||||
|
| c -> 3
|
||||||
|
|
||||||
|
def main =
|
||||||
|
let x = 2 ( 5 )
|
||||||
|
[6 :: int,7,8,"helo world"]
|
||||||
|
|
||||||
|
|
||||||
|
def example = a -> b -> 1:x => y
|
||||||
|
|
||||||
|
extensible union io.Plan
|
||||||
|
extend io.Plan with 'WriteFile Unit
|
||||||
|
|
||||||
|
type a b = {a:Int,b: (Array Of Integ), c: a3}
|
||||||
|
|
||||||
|
type ?lol.FullPartial = {}
|
||||||
|
|
||||||
|
type t List = with lol: &t2 with cursed: 'Tag [t,t2] List option | 'Case2 | 'Case3 | ...?rem -> int -> float
|
||||||
|
@@ -12,12 +12,13 @@ module.exports = grammar({
|
|||||||
|
|
||||||
reserved: {
|
reserved: {
|
||||||
toplevel_kw: $ =>
|
toplevel_kw: $ =>
|
||||||
['type', 'with', 'extensible', 'extend', 'union', 'def', 'await', 'if', 'then', 'else', 'in', 'match'],
|
['type', 'with', 'extensible', 'extend', 'union', 'def', 'await', 'let', 'if', 'then', 'else', 'in', 'match'],
|
||||||
},
|
},
|
||||||
|
|
||||||
extras: ($) => [
|
extras: ($) => [
|
||||||
/\s/, // whitespace
|
/\s/, // whitespace
|
||||||
$.comment,
|
$.comment,
|
||||||
|
$.section_comment,
|
||||||
],
|
],
|
||||||
|
|
||||||
word: $ => $._identifier_tok,
|
word: $ => $._identifier_tok,
|
||||||
@@ -55,6 +56,9 @@ module.exports = grammar({
|
|||||||
comment: $ =>
|
comment: $ =>
|
||||||
token(seq("# ", /.*/)),
|
token(seq("# ", /.*/)),
|
||||||
|
|
||||||
|
section_comment: $ =>
|
||||||
|
token(seq("###", /.*/)),
|
||||||
|
|
||||||
doc_comment: $ =>
|
doc_comment: $ =>
|
||||||
repeat1(seq('## ', token.immediate(/.*/))),
|
repeat1(seq('## ', token.immediate(/.*/))),
|
||||||
|
|
||||||
|
57
tree-sitter/queries/highlights.scm
Normal file
57
tree-sitter/queries/highlights.scm
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
; megic
|
||||||
|
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
(tag) @label ; @constructor
|
||||||
|
|
||||||
|
[
|
||||||
|
"(" ")"
|
||||||
|
"{" "}"
|
||||||
|
"[" "]"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
[
|
||||||
|
"."
|
||||||
|
","
|
||||||
|
"|"
|
||||||
|
"->"
|
||||||
|
":"
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
(comment)
|
||||||
|
(doc_comment)
|
||||||
|
(section_comment)
|
||||||
|
] @comment
|
||||||
|
|
||||||
|
(num_literal) @constant.builtin
|
||||||
|
|
||||||
|
[(char_literal)
|
||||||
|
(string_literal)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(escape_sequence) @escape
|
||||||
|
|
||||||
|
["+" "-"
|
||||||
|
"*" "/"
|
||||||
|
"=>" "++"
|
||||||
|
"::"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"def"
|
||||||
|
"type"
|
||||||
|
"with"
|
||||||
|
"extensible"
|
||||||
|
"extend"
|
||||||
|
"union"
|
||||||
|
"def"
|
||||||
|
"await"
|
||||||
|
"let"
|
||||||
|
"if"
|
||||||
|
"then"
|
||||||
|
"else"
|
||||||
|
"in"
|
||||||
|
"match"
|
||||||
|
"and"
|
||||||
|
] @keyword
|
24
tree-sitter/src/grammar.json
generated
24
tree-sitter/src/grammar.json
generated
@@ -70,6 +70,22 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"section_comment": {
|
||||||
|
"type": "TOKEN",
|
||||||
|
"content": {
|
||||||
|
"type": "SEQ",
|
||||||
|
"members": [
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "###"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "PATTERN",
|
||||||
|
"value": ".*"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"doc_comment": {
|
"doc_comment": {
|
||||||
"type": "REPEAT1",
|
"type": "REPEAT1",
|
||||||
"content": {
|
"content": {
|
||||||
@@ -2027,6 +2043,10 @@
|
|||||||
{
|
{
|
||||||
"type": "SYMBOL",
|
"type": "SYMBOL",
|
||||||
"name": "comment"
|
"name": "comment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "SYMBOL",
|
||||||
|
"name": "section_comment"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"conflicts": [],
|
"conflicts": [],
|
||||||
@@ -2135,6 +2155,10 @@
|
|||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "await"
|
"value": "await"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "STRING",
|
||||||
|
"value": "let"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "STRING",
|
||||||
"value": "if"
|
"value": "if"
|
||||||
|
5
tree-sitter/src/node-types.json
generated
5
tree-sitter/src/node-types.json
generated
@@ -6300,6 +6300,11 @@
|
|||||||
"type": "match",
|
"type": "match",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "section_comment",
|
||||||
|
"named": true,
|
||||||
|
"extra": true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "string_middle",
|
"type": "string_middle",
|
||||||
"named": true
|
"named": true
|
||||||
|
7467
tree-sitter/src/parser.c
generated
7467
tree-sitter/src/parser.c
generated
File diff suppressed because it is too large
Load Diff
@@ -10,7 +10,8 @@
|
|||||||
"crr"
|
"crr"
|
||||||
],
|
],
|
||||||
"injection-regex": "^crepuscular$",
|
"injection-regex": "^crepuscular$",
|
||||||
"class-name": "TreeSitterCrepuscular"
|
"class-name": "TreeSitterCrepuscular",
|
||||||
|
"highlights": "queries/highlights.scm"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
Reference in New Issue
Block a user