1
0

Move return syntax node to option for statements

This commit is contained in:
Jeff 2024-02-16 10:38:51 -05:00
parent 172a6fa860
commit 1ce2178af5
5 changed files with 24500 additions and 23987 deletions

View File

@ -40,11 +40,9 @@ Block with Return
(value
(integer))))
(statement
(return
(statement
(expression
(value
(integer))))))
(expression
(value
(integer))))
(statement
(expression
(value

View File

@ -14,6 +14,7 @@ module.exports = grammar({
statement: $ =>
prec.left(
seq(
optional('return'),
choice(
$.assignment,
$.block,
@ -22,7 +23,6 @@ module.exports = grammar({
$.if_else,
$.index_assignment,
$.match,
$.return,
$.pipe,
$.while,
$.type_definition,
@ -336,11 +336,6 @@ module.exports = grammar({
$.block,
),
return: $ =>
prec.right(
seq('return', $.statement),
),
type_specification: $ =>
seq('<', $.type, '>'),

View File

@ -23,6 +23,18 @@
"content": {
"type": "SEQ",
"members": [
{
"type": "CHOICE",
"members": [
{
"type": "STRING",
"value": "return"
},
{
"type": "BLANK"
}
]
},
{
"type": "CHOICE",
"members": [
@ -54,10 +66,6 @@
"type": "SYMBOL",
"name": "match"
},
{
"type": "SYMBOL",
"name": "return"
},
{
"type": "SYMBOL",
"name": "pipe"
@ -1004,23 +1012,6 @@
}
]
},
"return": {
"type": "PREC_RIGHT",
"value": 0,
"content": {
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "return"
},
{
"type": "SYMBOL",
"name": "statement"
}
]
}
},
"type_specification": {
"type": "SEQ",
"members": [
@ -1199,27 +1190,6 @@
]
}
]
},
{
"type": "SEQ",
"members": [
{
"type": "STRING",
"value": "option"
},
{
"type": "STRING",
"value": "("
},
{
"type": "SYMBOL",
"name": "type"
},
{
"type": "STRING",
"value": ")"
}
]
}
]
}

View File

@ -587,21 +587,6 @@
]
}
},
{
"type": "return",
"named": true,
"fields": {},
"children": {
"multiple": false,
"required": true,
"types": [
{
"type": "statement",
"named": true
}
]
}
},
{
"type": "root",
"named": true,
@ -657,10 +642,6 @@
"type": "pipe",
"named": true
},
{
"type": "return",
"named": true
},
{
"type": "type_definition",
"named": true
@ -1054,10 +1035,6 @@
"type": "num",
"named": false
},
{
"type": "option",
"named": false
},
{
"type": "range",
"named": true

File diff suppressed because it is too large Load Diff