Add ':=' to 'operator'
This commit is contained in:
parent
82bbebeeb5
commit
0b17386cad
|
@ -193,7 +193,7 @@ module.exports = grammar({
|
||||||
PREC.assign,
|
PREC.assign,
|
||||||
seq(
|
seq(
|
||||||
field("left", $._lvalue),
|
field("left", $._lvalue),
|
||||||
":=",
|
alias(":=", $.operator),
|
||||||
field("right", $._expr),
|
field("right", $._expr),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -223,7 +223,7 @@ module.exports = grammar({
|
||||||
for_expression: ($) => seq(
|
for_expression: ($) => seq(
|
||||||
"for",
|
"for",
|
||||||
field("index", $.identifier),
|
field("index", $.identifier),
|
||||||
":=",
|
alias(":=", $.operator),
|
||||||
field("start", $._expr),
|
field("start", $._expr),
|
||||||
"to",
|
"to",
|
||||||
field("end", $._expr),
|
field("end", $._expr),
|
||||||
|
@ -325,7 +325,7 @@ module.exports = grammar({
|
||||||
"var",
|
"var",
|
||||||
field("name", $.identifier),
|
field("name", $.identifier),
|
||||||
optional(seq(":", field("type", $._type_identifier))),
|
optional(seq(":", field("type", $._type_identifier))),
|
||||||
":=",
|
alias(":=", $.operator),
|
||||||
field("value", $._expr),
|
field("value", $._expr),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
|
@ -822,8 +822,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "ALIAS",
|
||||||
"value": ":="
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ":="
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "operator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
|
@ -939,8 +944,13 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "ALIAS",
|
||||||
"value": ":="
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ":="
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "operator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
|
@ -1469,8 +1479,13 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "STRING",
|
"type": "ALIAS",
|
||||||
"value": ":="
|
"content": {
|
||||||
|
"type": "STRING",
|
||||||
|
"value": ":="
|
||||||
|
},
|
||||||
|
"named": true,
|
||||||
|
"value": "operator"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "FIELD",
|
"type": "FIELD",
|
||||||
|
|
|
@ -389,6 +389,16 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "operator",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -811,6 +821,16 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "operator",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2067,6 +2087,16 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"children": {
|
||||||
|
"multiple": false,
|
||||||
|
"required": true,
|
||||||
|
"types": [
|
||||||
|
{
|
||||||
|
"type": "operator",
|
||||||
|
"named": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -2255,10 +2285,6 @@
|
||||||
"type": ":",
|
"type": ":",
|
||||||
"named": false
|
"named": false
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": ":=",
|
|
||||||
"named": false
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": ";",
|
"type": ";",
|
||||||
"named": false
|
"named": false
|
||||||
|
|
|
@ -136,7 +136,7 @@ static const char * const ts_symbol_names[] = {
|
||||||
[anon_sym_of] = "of",
|
[anon_sym_of] = "of",
|
||||||
[anon_sym_LBRACE] = "{",
|
[anon_sym_LBRACE] = "{",
|
||||||
[anon_sym_RBRACE] = "}",
|
[anon_sym_RBRACE] = "}",
|
||||||
[anon_sym_COLON_EQ] = ":=",
|
[anon_sym_COLON_EQ] = "operator",
|
||||||
[anon_sym_if] = "if",
|
[anon_sym_if] = "if",
|
||||||
[anon_sym_then] = "then",
|
[anon_sym_then] = "then",
|
||||||
[anon_sym_else] = "else",
|
[anon_sym_else] = "else",
|
||||||
|
@ -227,7 +227,7 @@ static const TSSymbol ts_symbol_map[] = {
|
||||||
[anon_sym_of] = anon_sym_of,
|
[anon_sym_of] = anon_sym_of,
|
||||||
[anon_sym_LBRACE] = anon_sym_LBRACE,
|
[anon_sym_LBRACE] = anon_sym_LBRACE,
|
||||||
[anon_sym_RBRACE] = anon_sym_RBRACE,
|
[anon_sym_RBRACE] = anon_sym_RBRACE,
|
||||||
[anon_sym_COLON_EQ] = anon_sym_COLON_EQ,
|
[anon_sym_COLON_EQ] = anon_sym_DASH,
|
||||||
[anon_sym_if] = anon_sym_if,
|
[anon_sym_if] = anon_sym_if,
|
||||||
[anon_sym_then] = anon_sym_then,
|
[anon_sym_then] = anon_sym_then,
|
||||||
[anon_sym_else] = anon_sym_else,
|
[anon_sym_else] = anon_sym_else,
|
||||||
|
@ -407,7 +407,7 @@ static const TSSymbolMetadata ts_symbol_metadata[] = {
|
||||||
},
|
},
|
||||||
[anon_sym_COLON_EQ] = {
|
[anon_sym_COLON_EQ] = {
|
||||||
.visible = true,
|
.visible = true,
|
||||||
.named = false,
|
.named = true,
|
||||||
},
|
},
|
||||||
[anon_sym_if] = {
|
[anon_sym_if] = {
|
||||||
.visible = true,
|
.visible = true,
|
||||||
|
|
|
@ -112,10 +112,12 @@ end
|
||||||
(comment)
|
(comment)
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
(identifier)
|
(identifier)
|
||||||
|
(operator)
|
||||||
(integer_literal))
|
(integer_literal))
|
||||||
(comment)
|
(comment)
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
(identifier)
|
(identifier)
|
||||||
|
(operator)
|
||||||
(integer_literal))
|
(integer_literal))
|
||||||
(comment)
|
(comment)
|
||||||
(comment)
|
(comment)
|
||||||
|
|
|
@ -65,6 +65,7 @@ for i := 12 to nil do "42"
|
||||||
(source_file
|
(source_file
|
||||||
(for_expression
|
(for_expression
|
||||||
index: (identifier)
|
index: (identifier)
|
||||||
|
(operator)
|
||||||
start: (integer_literal)
|
start: (integer_literal)
|
||||||
end: (nil_literal)
|
end: (nil_literal)
|
||||||
body: (string_literal)))
|
body: (string_literal)))
|
||||||
|
@ -134,6 +135,7 @@ for i := break to break do while break do break
|
||||||
(source_file
|
(source_file
|
||||||
(for_expression
|
(for_expression
|
||||||
(identifier)
|
(identifier)
|
||||||
|
(operator)
|
||||||
(break_expression)
|
(break_expression)
|
||||||
(break_expression)
|
(break_expression)
|
||||||
(while_expression
|
(while_expression
|
||||||
|
|
|
@ -217,6 +217,7 @@ var a := 12
|
||||||
(source_file
|
(source_file
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
name: (identifier)
|
name: (identifier)
|
||||||
|
(operator)
|
||||||
value: (integer_literal)))
|
value: (integer_literal)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -231,6 +232,7 @@ var a : int := 27
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
name: (identifier)
|
name: (identifier)
|
||||||
type: (type_identifier)
|
type: (type_identifier)
|
||||||
|
(operator)
|
||||||
value: (integer_literal)))
|
value: (integer_literal)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
@ -245,9 +247,11 @@ var b := 27
|
||||||
(source_file
|
(source_file
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
name: (identifier)
|
name: (identifier)
|
||||||
|
(operator)
|
||||||
value: (integer_literal))
|
value: (integer_literal))
|
||||||
(variable_declaration
|
(variable_declaration
|
||||||
name: (identifier)
|
name: (identifier)
|
||||||
|
(operator)
|
||||||
value: (integer_literal)))
|
value: (integer_literal)))
|
||||||
|
|
||||||
================================================================================
|
================================================================================
|
||||||
|
|
|
@ -150,10 +150,12 @@ a := array[12] := record.field
|
||||||
(source_file
|
(source_file
|
||||||
(assignment_expression
|
(assignment_expression
|
||||||
left: (identifier)
|
left: (identifier)
|
||||||
|
(operator)
|
||||||
right: (assignment_expression
|
right: (assignment_expression
|
||||||
left: (array_value
|
left: (array_value
|
||||||
array: (identifier)
|
array: (identifier)
|
||||||
index: (integer_literal))
|
index: (integer_literal))
|
||||||
|
(operator)
|
||||||
right: (record_value
|
right: (record_value
|
||||||
record: (identifier)
|
record: (identifier)
|
||||||
field: (field_identifier)))))
|
field: (field_identifier)))))
|
||||||
|
|
Loading…
Reference in a new issue