From aca3a5f3b08d754c3ee946cb331172a4f5e11745 Mon Sep 17 00:00:00 2001 From: Kamil Jakubus Date: Mon, 18 Nov 2024 05:05:38 +0100 Subject: [PATCH] parser: add return tuning Fixes #96 --- grammar.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grammar.js b/grammar.js index e8757fe..0c14338 100644 --- a/grammar.js +++ b/grammar.js @@ -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)), @@ -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 @@ -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")))),