function type added

This commit is contained in:
ProgramSnail 2023-08-14 10:07:35 +03:00
parent 6b093311df
commit 754d207af5
3 changed files with 133 additions and 63 deletions

View file

@ -53,11 +53,7 @@ module.exports = grammar({
)),
optional(seq(
':',
repeat1(seq(
optional($.annotation_identifier),
optional($._reference),
$._scoped_type,
)),
choice($.function_type, $._annotated_type),
)),
choice(seq('=', choice(prec(2, choice($.block, $.array)), seq($._super_expression, ';'))), ';'),
),
@ -226,6 +222,11 @@ module.exports = grammar({
repeat1(seq('&', $._annotated_type)),
),
function_type: $ => seq(
$._annotated_type,
repeat1($._annotated_type),
),
// add annotations to in all types ??
_annotated_type: $ => seq(optional($.annotation_identifier), $._scoped_type),
@ -249,6 +250,7 @@ module.exports = grammar({
$.array_type,
$.variant_type,
$.tuple_type,
$.function_type,
),
_scoped_type: $ => choice(
@ -259,7 +261,9 @@ module.exports = grammar({
seq('(', choice(
$.variant_type,
$.tuple_type,
//$.function_type,
), ')'),
seq('((', $.function_type, '))'),
),
// --- comments