mirror of
https://codeberg.org/ProgramSnail/tree-sitter-lang.git
synced 2025-12-15 11:08:50 +00:00
function type added
This commit is contained in:
parent
6b093311df
commit
754d207af5
3 changed files with 133 additions and 63 deletions
14
grammar.js
14
grammar.js
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue