mirror of
https://codeberg.org/ProgramSnail/tree-sitter-lang.git
synced 2025-12-06 06:38:51 +00:00
other symbol for reference types, any references in reference type
This commit is contained in:
parent
17a67d2361
commit
f94edb035c
2 changed files with 6 additions and 6 deletions
|
|
@ -149,13 +149,13 @@ bubble_sort_2 'arr : ref Array['A] = {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
: example of ^ and generics. ^ used to denote that this object allocated on heap
|
: example of <> and generics. <> (in type definition) used to denote that this object allocated on heap
|
||||||
: object allocated by unique reference by default
|
: object allocated by unique reference by default
|
||||||
^TreeNode 'Key 'Value =
|
<> TreeNode 'Key 'Value =
|
||||||
& @key Key
|
& @key Key
|
||||||
& @value Value
|
& @value Value
|
||||||
& @left ^TreeNode['Key 'Value]
|
& @left <> TreeNode['Key 'Value]
|
||||||
& @right ^TreeNode['Key 'Value];
|
& @right <> TreeNode['Key 'Value];
|
||||||
|
|
||||||
.new = do_something; // static methods
|
.new = do_something; // static methods
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ module.exports = grammar({
|
||||||
type_definition: $ => seq(
|
type_definition: $ => seq(
|
||||||
optional($.definition_info),
|
optional($.definition_info),
|
||||||
repeat($.annotation_info), // for datatypes only
|
repeat($.annotation_info), // for datatypes only
|
||||||
optional('^'),
|
optional('<>'),
|
||||||
field('name', choice($.simple_type_identifier, $.typeclass_identifier)),
|
field('name', choice($.simple_type_identifier, $.typeclass_identifier)),
|
||||||
optional(seq('[', repeat($.typeclass_identifier), ']')), // parametric typeclasses ??
|
optional(seq('[', repeat($.typeclass_identifier), ']')), // parametric typeclasses ??
|
||||||
repeat($.argument_type_identifier), // for datatypes only
|
repeat($.argument_type_identifier), // for datatypes only
|
||||||
|
|
@ -232,7 +232,7 @@ module.exports = grammar({
|
||||||
// same to Array[...]
|
// same to Array[...]
|
||||||
array_type: $ => seq('[[', $._type, ']]'),
|
array_type: $ => seq('[[', $._type, ']]'),
|
||||||
|
|
||||||
reference_type: $ => prec(-1, seq('^', $._scoped_type)),
|
reference_type: $ => prec(-1, seq($._reference, $._scoped_type)),
|
||||||
|
|
||||||
// same to Optional[...] or Result[...]
|
// same to Optional[...] or Result[...]
|
||||||
modified_type: $ => seq($._scoped_type, $._optional_or_result),
|
modified_type: $ => seq($._scoped_type, $._optional_or_result),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue