mirror of
https://codeberg.org/ProgramSnail/tree-sitter-lang.git
synced 2025-12-06 06:38:51 +00:00
minor fixes
This commit is contained in:
parent
4a553f24fb
commit
1b517b8723
3 changed files with 34 additions and 31 deletions
|
|
@ -219,6 +219,7 @@ arg_deduction_example 'name 'duration : <- String <- Float -> Task = Task 'name
|
|||
(import
|
||||
(simple_name_identifier))
|
||||
(import
|
||||
(placeholder)
|
||||
(simple_name_identifier))
|
||||
(import
|
||||
(simple_name_identifier)
|
||||
|
|
@ -635,13 +636,14 @@ arg_deduction_example 'name 'duration : <- String <- Float -> Task = Task 'name
|
|||
(simple_name_identifier))))
|
||||
(type_definition
|
||||
(simple_type_identifier)
|
||||
(tuple_type
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(simple_type_identifier))
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(simple_type_identifier))))
|
||||
(variant_type
|
||||
(tuple_type
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(simple_type_identifier))
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(simple_type_identifier)))))
|
||||
(type_definition
|
||||
(simple_type_identifier)
|
||||
(variant_type
|
||||
|
|
@ -800,27 +802,28 @@ arg_deduction_example 'name 'duration : <- String <- Float -> Task = Task 'name
|
|||
(simple_type_identifier)
|
||||
(argument_type_identifier)
|
||||
(argument_type_identifier)
|
||||
(tuple_type
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(simple_type_identifier))
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(simple_type_identifier))
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(simple_type_identifier)
|
||||
(variant_type
|
||||
(tuple_type
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(argument_type_identifier))
|
||||
(simple_type_identifier))
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(argument_type_identifier)))
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(simple_type_identifier)
|
||||
(simple_type_identifier))
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(argument_type_identifier))
|
||||
(simple_type_identifier)
|
||||
(type
|
||||
(argument_type_identifier))
|
||||
(type
|
||||
(argument_type_identifier)))
|
||||
(annotation_identifier)
|
||||
(type
|
||||
(argument_type_identifier)))))
|
||||
(simple_type_identifier)
|
||||
(type
|
||||
(argument_type_identifier))
|
||||
(type
|
||||
(argument_type_identifier))))))
|
||||
(type_definition
|
||||
(simple_type_identifier)
|
||||
(function_definition
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ import: ('::' | 'import') (SIMPLE_NAME_IDENTIFIER | '_') ('=' SIMPLE_NAME_IDENTI
|
|||
constraint: '?' expression ;
|
||||
|
||||
type_definition: (DEFINITION_INFO)? (ANNOTATION_INFO)* ('^')?
|
||||
SIMPLE_TYPE_IDENTIFIER ((ARGUMENT_TYPE_IDENTIFIER)* '=' (variant_type | typle_type))?
|
||||
SIMPLE_TYPE_IDENTIFIER ((ARGUMENT_TYPE_IDENTIFIER)* '=' variant_type)?
|
||||
(('{' function_definietion '}')|';')
|
||||
;
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ not_name_scoped_expression: block
|
|||
| '(' super_expression ')'
|
||||
;
|
||||
|
||||
variant_type: ('|')? tuple_type ('|' tuple_type)+ ;
|
||||
variant_type: ('|')? tuple_type ('|' tuple_type)* ;
|
||||
|
||||
tuple_type: ('&')? annotated_type ('&' _annotated_type)* ;
|
||||
|
||||
|
|
|
|||
10
grammar.js
10
grammar.js
|
|
@ -25,7 +25,7 @@ module.exports = grammar({
|
|||
|
||||
import: $ => seq(
|
||||
choice('::', 'import'),
|
||||
field('name', choice($.simple_name_identifier, '_')),
|
||||
field('name', choice($.simple_name_identifier, $.placeholder)),
|
||||
optional(seq('=', field('module', $.simple_name_identifier))),
|
||||
optional(seq(':', repeat1(choice(
|
||||
$.simple_type_identifier,
|
||||
|
|
@ -45,7 +45,7 @@ module.exports = grammar({
|
|||
repeat($.annotation_info),
|
||||
optional('^'),
|
||||
field('name', $.simple_type_identifier),
|
||||
optional(seq(repeat($.argument_type_identifier), '=', choice($.variant_type, $.tuple_type))),
|
||||
optional(seq(repeat($.argument_type_identifier), '=', $.variant_type)),
|
||||
choice(seq('{', repeat($.function_definition), '}'), ';')
|
||||
),
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ module.exports = grammar({
|
|||
optional($.definition_info),
|
||||
repeat($.annotation_info),
|
||||
repeat(seq($.constraint, ';')),
|
||||
/*optional(seq(*/optional($._var_let)/*, '.'))*/,
|
||||
optional($._var_let),
|
||||
choice(field('name', $.simple_name_identifier), seq('(', field('name', $.operator), ')')),
|
||||
repeat(seq(
|
||||
optional($.annotation_identifier),
|
||||
|
|
@ -71,7 +71,7 @@ module.exports = grammar({
|
|||
|
||||
typeclass_definition: $ => seq(
|
||||
optional($.definition_info),
|
||||
repeat($.annotation_info),
|
||||
// no argumenmts => no annotation info
|
||||
field('name', $.typeclass_identifier),
|
||||
optional(seq(':', repeat1($.typeclass_identifier))),
|
||||
choice(seq('{', repeat($.function_definition), '}'), ';'),
|
||||
|
|
@ -218,7 +218,7 @@ module.exports = grammar({
|
|||
variant_type: $ => seq(
|
||||
optional('|'),
|
||||
$.tuple_type,
|
||||
repeat1(seq('|', $.tuple_type)),
|
||||
repeat(seq('|', $.tuple_type)),
|
||||
),
|
||||
|
||||
tuple_type: $ => seq(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue