Skip to content

Commit

Permalink
parser: add return tuning
Browse files Browse the repository at this point in the history
Fixes #96
  • Loading branch information
jkbz64 committed Nov 18, 2024
1 parent 08943fe commit aca3a5f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ module.exports = grammar({
$._terminator
),

return_tuning: ($) => seq(kw("EXTENT"), $.number_literal),
return_type: ($) =>
seq(choice(kw("RETURNS"), kw("RETURN")), field("type", $._type)),

Expand Down Expand Up @@ -549,6 +550,7 @@ module.exports = grammar({
kw("FUNCTION"),
field("name", $.identifier),
$.return_type,
optional($.return_tuning),
optional(alias($.function_parameters, $.parameters)),
optional(alias($.dot_body, $.body)),
$._function_terminator
Expand Down Expand Up @@ -652,6 +654,7 @@ module.exports = grammar({
kw("METHOD"),
repeat(choice($.access_tuning, $.scope_tuning, $.method_tuning)),
alias($._type, $.return_type),
optional($.return_tuning),
field("name", $.identifier),
alias($.function_parameters, $.parameters),
optional(seq($.body, kw("END"), optional(kw("METHOD")))),
Expand Down

0 comments on commit aca3a5f

Please sign in to comment.