mirror of
https://codeberg.org/ProgramSnail/tree-sitter-lang.git
synced 2026-01-25 13:07:09 +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
|
(import
|
||||||
(simple_name_identifier))
|
(simple_name_identifier))
|
||||||
(import
|
(import
|
||||||
|
(placeholder)
|
||||||
(simple_name_identifier))
|
(simple_name_identifier))
|
||||||
(import
|
(import
|
||||||
(simple_name_identifier)
|
(simple_name_identifier)
|
||||||
|
|
@ -635,13 +636,14 @@ arg_deduction_example 'name 'duration : <- String <- Float -> Task = Task 'name
|
||||||
(simple_name_identifier))))
|
(simple_name_identifier))))
|
||||||
(type_definition
|
(type_definition
|
||||||
(simple_type_identifier)
|
(simple_type_identifier)
|
||||||
(tuple_type
|
(variant_type
|
||||||
(annotation_identifier)
|
(tuple_type
|
||||||
(type
|
(annotation_identifier)
|
||||||
(simple_type_identifier))
|
(type
|
||||||
(annotation_identifier)
|
(simple_type_identifier))
|
||||||
(type
|
(annotation_identifier)
|
||||||
(simple_type_identifier))))
|
(type
|
||||||
|
(simple_type_identifier)))))
|
||||||
(type_definition
|
(type_definition
|
||||||
(simple_type_identifier)
|
(simple_type_identifier)
|
||||||
(variant_type
|
(variant_type
|
||||||
|
|
@ -800,27 +802,28 @@ arg_deduction_example 'name 'duration : <- String <- Float -> Task = Task 'name
|
||||||
(simple_type_identifier)
|
(simple_type_identifier)
|
||||||
(argument_type_identifier)
|
(argument_type_identifier)
|
||||||
(argument_type_identifier)
|
(argument_type_identifier)
|
||||||
(tuple_type
|
(variant_type
|
||||||
(annotation_identifier)
|
(tuple_type
|
||||||
(type
|
(annotation_identifier)
|
||||||
(simple_type_identifier))
|
|
||||||
(annotation_identifier)
|
|
||||||
(type
|
|
||||||
(simple_type_identifier))
|
|
||||||
(annotation_identifier)
|
|
||||||
(type
|
|
||||||
(simple_type_identifier)
|
|
||||||
(type
|
(type
|
||||||
(argument_type_identifier))
|
(simple_type_identifier))
|
||||||
|
(annotation_identifier)
|
||||||
(type
|
(type
|
||||||
(argument_type_identifier)))
|
(simple_type_identifier))
|
||||||
(annotation_identifier)
|
(annotation_identifier)
|
||||||
(type
|
|
||||||
(simple_type_identifier)
|
|
||||||
(type
|
(type
|
||||||
(argument_type_identifier))
|
(simple_type_identifier)
|
||||||
|
(type
|
||||||
|
(argument_type_identifier))
|
||||||
|
(type
|
||||||
|
(argument_type_identifier)))
|
||||||
|
(annotation_identifier)
|
||||||
(type
|
(type
|
||||||
(argument_type_identifier)))))
|
(simple_type_identifier)
|
||||||
|
(type
|
||||||
|
(argument_type_identifier))
|
||||||
|
(type
|
||||||
|
(argument_type_identifier))))))
|
||||||
(type_definition
|
(type_definition
|
||||||
(simple_type_identifier)
|
(simple_type_identifier)
|
||||||
(function_definition
|
(function_definition
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import: ('::' | 'import') (SIMPLE_NAME_IDENTIFIER | '_') ('=' SIMPLE_NAME_IDENTI
|
||||||
constraint: '?' expression ;
|
constraint: '?' expression ;
|
||||||
|
|
||||||
type_definition: (DEFINITION_INFO)? (ANNOTATION_INFO)* ('^')?
|
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 '}')|';')
|
(('{' function_definietion '}')|';')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -122,7 +122,7 @@ not_name_scoped_expression: block
|
||||||
| '(' super_expression ')'
|
| '(' super_expression ')'
|
||||||
;
|
;
|
||||||
|
|
||||||
variant_type: ('|')? tuple_type ('|' tuple_type)+ ;
|
variant_type: ('|')? tuple_type ('|' tuple_type)* ;
|
||||||
|
|
||||||
tuple_type: ('&')? annotated_type ('&' _annotated_type)* ;
|
tuple_type: ('&')? annotated_type ('&' _annotated_type)* ;
|
||||||
|
|
||||||
|
|
|
||||||
10
grammar.js
10
grammar.js
|
|
@ -25,7 +25,7 @@ module.exports = grammar({
|
||||||
|
|
||||||
import: $ => seq(
|
import: $ => seq(
|
||||||
choice('::', 'import'),
|
choice('::', 'import'),
|
||||||
field('name', choice($.simple_name_identifier, '_')),
|
field('name', choice($.simple_name_identifier, $.placeholder)),
|
||||||
optional(seq('=', field('module', $.simple_name_identifier))),
|
optional(seq('=', field('module', $.simple_name_identifier))),
|
||||||
optional(seq(':', repeat1(choice(
|
optional(seq(':', repeat1(choice(
|
||||||
$.simple_type_identifier,
|
$.simple_type_identifier,
|
||||||
|
|
@ -45,7 +45,7 @@ module.exports = grammar({
|
||||||
repeat($.annotation_info),
|
repeat($.annotation_info),
|
||||||
optional('^'),
|
optional('^'),
|
||||||
field('name', $.simple_type_identifier),
|
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), '}'), ';')
|
choice(seq('{', repeat($.function_definition), '}'), ';')
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@ module.exports = grammar({
|
||||||
optional($.definition_info),
|
optional($.definition_info),
|
||||||
repeat($.annotation_info),
|
repeat($.annotation_info),
|
||||||
repeat(seq($.constraint, ';')),
|
repeat(seq($.constraint, ';')),
|
||||||
/*optional(seq(*/optional($._var_let)/*, '.'))*/,
|
optional($._var_let),
|
||||||
choice(field('name', $.simple_name_identifier), seq('(', field('name', $.operator), ')')),
|
choice(field('name', $.simple_name_identifier), seq('(', field('name', $.operator), ')')),
|
||||||
repeat(seq(
|
repeat(seq(
|
||||||
optional($.annotation_identifier),
|
optional($.annotation_identifier),
|
||||||
|
|
@ -71,7 +71,7 @@ module.exports = grammar({
|
||||||
|
|
||||||
typeclass_definition: $ => seq(
|
typeclass_definition: $ => seq(
|
||||||
optional($.definition_info),
|
optional($.definition_info),
|
||||||
repeat($.annotation_info),
|
// no argumenmts => no annotation info
|
||||||
field('name', $.typeclass_identifier),
|
field('name', $.typeclass_identifier),
|
||||||
optional(seq(':', repeat1($.typeclass_identifier))),
|
optional(seq(':', repeat1($.typeclass_identifier))),
|
||||||
choice(seq('{', repeat($.function_definition), '}'), ';'),
|
choice(seq('{', repeat($.function_definition), '}'), ';'),
|
||||||
|
|
@ -218,7 +218,7 @@ module.exports = grammar({
|
||||||
variant_type: $ => seq(
|
variant_type: $ => seq(
|
||||||
optional('|'),
|
optional('|'),
|
||||||
$.tuple_type,
|
$.tuple_type,
|
||||||
repeat1(seq('|', $.tuple_type)),
|
repeat(seq('|', $.tuple_type)),
|
||||||
),
|
),
|
||||||
|
|
||||||
tuple_type: $ => seq(
|
tuple_type: $ => seq(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue