1
0

Update grammar and highlight queries

This commit is contained in:
Jeff 2024-02-19 15:24:44 -05:00
parent ca72fe04f1
commit 69347ad435
7 changed files with 25155 additions and 24879 deletions

View File

@ -9,7 +9,7 @@ secret_number = int:random_range(0..=100);
loop {
output("Please input your guess.")
input = io::stdin():expect("Failed to read line.")
input = io:stdin():expect("Failed to read line.")
guess = int:parse(input);
output("You guessed: " + guess)
@ -22,7 +22,5 @@ loop {
break;
}
}
}
}

View File

@ -10,7 +10,7 @@ Simple As
(statement
(statement_kind
(expression
(as
(as_node
(expression
(value
(integer)))
@ -28,7 +28,7 @@ foo as (int) -> int
(statement
(statement_kind
(expression
(as
(as_node
(expression
(identifier))
(type
@ -49,7 +49,7 @@ for i in foobar as [string] {}
(for
(identifier)
(expression
(as
(as_node
(expression
(identifier))
(type

View File

@ -31,7 +31,7 @@ module.exports = grammar({
$.for,
$.if_else,
$.index_assignment,
$.break_loop,
$.loop_node,
$.match,
$.pipe,
$.while,
@ -52,7 +52,7 @@ module.exports = grammar({
_expression_kind: $ =>
prec.right(
choice(
$.as,
$.as_node,
$.function_call,
$.identifier,
$.index,
@ -73,7 +73,7 @@ module.exports = grammar({
),
),
as: $ =>
as_node: $ =>
seq($.expression, 'as', $.type),
pipe: $ =>
@ -328,7 +328,7 @@ module.exports = grammar({
),
),
break_loop: $ =>
loop_node: $ =>
seq(
'loop',
$.block,

View File

@ -46,27 +46,26 @@
(logic_operator) @operator.logic
(math_operator) @operator.math
[
"as"
"async"
"break"
"else"
"else if"
"enum"
"false"
"for"
"if"
"in"
"loop"
"match"
"return"
"struct"
"true"
"while"
"->"
":"
"::"
"^"
] @keyword
"as" @keyword
"async" @keyword
"break" @keyword
"else" @keyword
"else if" @keyword
"enum" @keyword
"false" @keyword
"for" @keyword
"if" @keyword
"in" @keyword
"match" @keyword
"return" @keyword
"struct" @keyword
"true" @keyword
"while" @keyword
"->" @keyword
":" @keyword
"::" @keyword
"^" @keyword
"loop" @keyword
(function_call) @function.call

View File

@ -93,6 +93,10 @@
"type": "SYMBOL",
"name": "index_assignment"
},
{
"type": "SYMBOL",
"name": "loop_node"
},
{
"type": "SYMBOL",
"name": "match"
@ -146,7 +150,7 @@
"members": [
{
"type": "SYMBOL",
"name": "as"
"name": "as_node"
},
{
"type": "SYMBOL",
@ -207,7 +211,7 @@
}
}
},
"as": {
"as_node": {
"type": "SEQ",
"members": [
{
@ -978,6 +982,19 @@
]
}
},
"loop_node": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "loop"
},
{
"type": "SYMBOL",
"name": "block"
}
]
},
"while": {
"type": "SEQ",
"members": [

View File

@ -1,6 +1,6 @@
[
{
"type": "as",
"type": "as_node",
"named": true,
"fields": {},
"children": {
@ -190,7 +190,7 @@
"required": true,
"types": [
{
"type": "as",
"type": "as_node",
"named": true
},
{
@ -471,6 +471,21 @@
"named": true,
"fields": {}
},
{
"type": "loop_node",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "block",
"named": true
}
]
}
},
{
"type": "map",
"named": true,
@ -645,6 +660,10 @@
"type": "index_assignment",
"named": true
},
{
"type": "loop_node",
"named": true
},
{
"type": "match",
"named": true
@ -1049,6 +1068,10 @@
"type": "list",
"named": false
},
{
"type": "loop",
"named": false
},
{
"type": "map",
"named": false

File diff suppressed because it is too large Load Diff