@@ 160,7 160,7 @@ module.exports = grammar({
"fn",
field("name", $._identifier),
"(",
- optional(field("parameter_list", $.parameter_list)),
+ optional(field("parameters", $.parameter_list)),
")",
field("result", $._type),
optional(seq("=", $._expression)),
@@ 526,7 526,7 @@ module.exports = grammar({
)),
error_propagation: ($) =>
- prec.left(PREC.ERROR, seq($._expression, choice("?", "!"))),
+ prec.left(PREC.ERROR, seq($._expression, field("operator", choice("?", "!")))),
variadic_expression: ($) =>
choice(
@@ 1,24 1,18 @@
[
"as"
"break"
- "case"
"continue"
"const"
"def"
"defer"
- "else"
"export"
"fn"
- "if"
"is"
"let"
- "match"
"nullable"
"offset"
- "return"
"static"
"struct"
- "switch"
"type"
"union"
"yield"
@@ 27,6 21,7 @@
"use" @include
"for" @repeat
+"return" @keyword.return
[
"if"
@@ 49,10 44,10 @@
] @function.builtin
[
- "@test"
- "@init"
- "@fini"
- ] @special
+ (decl_attr)
+ (fndec_attr)
+ (fntype_attr)
+ ] @attribute
[
(alias_type)
@@ 100,18 95,22 @@
(floating_literal) @float
(rune_literal) @number
-"." @punctuation.delimiter
-"," @punctuation.delimiter
-":" @punctuation.delimiter
-";" @punctuation.delimiter
-"::" @punctuation.delimiter
+[
+"."
+","
+":"
+";"
+"::"
+ ] @punctuation.delimiter
-"(" @punctuation.bracket
-")" @punctuation.bracket
-"{" @punctuation.bracket
-"}" @punctuation.bracket
-"[" @punctuation.bracket
-"]" @punctuation.bracket
+[
+ "("
+ ")"
+ "{"
+ "}"
+ "["
+ "]"
+ ] @punctuation.bracket
(string_literal) @string
@@ 138,3 137,11 @@
(identifier) @type)
(struct_union_field) @field
+
+(parameter
+ name: (identifier) @parameter)
+
+(error_propagation
+ operator: "!" @punctuation.special)
+(error_propagation
+ operator: "?" @punctuation.special)