mirror of
https://codeberg.org/ProgramSnail/tree-sitter-lang.git
synced 2025-12-08 15:48:49 +00:00
block and array without = in function definition, Array and Function type shortcuts removed
This commit is contained in:
parent
154fbfb4d4
commit
cbd923d0f1
4 changed files with 109 additions and 46 deletions
12
grammar.js
12
grammar.js
|
|
@ -55,7 +55,7 @@ module.exports = grammar({
|
|||
':',
|
||||
repeat1($._annotated_type),
|
||||
)),
|
||||
choice(seq('=', choice(prec(2, choice($.block, $.array)), seq($._super_expression, ';'))), ';'),
|
||||
choice(choice(prec(2, choice($.block, $.array)), seq('=', $._super_expression, ';')), ';'),
|
||||
),
|
||||
|
||||
// datatype or typeclass definition
|
||||
|
|
@ -222,13 +222,12 @@ module.exports = grammar({
|
|||
repeat1(seq('&', $._annotated_type)),
|
||||
),
|
||||
|
||||
function_type: $ => seq('((', repeat1($._annotated_type), '))'),
|
||||
// for function type Function[...] or F[...] is used
|
||||
|
||||
// add annotations to in all types ??
|
||||
_annotated_type: $ => seq(optional($.annotation_identifier), $._scoped_type),
|
||||
|
||||
// same to Array[...]
|
||||
array_type: $ => seq('[[', $._type, ']]'),
|
||||
// for array type Array[...] or A[...] is used
|
||||
|
||||
reference_type: $ => prec(-1, seq($._reference, $._scoped_type)),
|
||||
|
||||
|
|
@ -244,23 +243,18 @@ module.exports = grammar({
|
|||
$.simple_type,
|
||||
$.reference_type,
|
||||
$.modified_type,
|
||||
$.array_type,
|
||||
$.variant_type,
|
||||
$.tuple_type,
|
||||
$.function_type,
|
||||
),
|
||||
|
||||
_scoped_type: $ => choice(
|
||||
$.simple_type,
|
||||
$.reference_type,
|
||||
$.modified_type,
|
||||
$.array_type,
|
||||
seq('(', choice(
|
||||
$.variant_type,
|
||||
$.tuple_type,
|
||||
//$.function_type,
|
||||
), ')'),
|
||||
$.function_type,
|
||||
),
|
||||
|
||||
// --- comments
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue