block moved to scoped_expression

This commit is contained in:
ProgramSnail 2023-07-18 14:37:16 +03:00
parent 7f53a21f20
commit f525fce6d7
2 changed files with 8 additions and 7 deletions

View file

@ -26,7 +26,7 @@ function_definition: (definietion_info)? (ANNOTATION_INFO)* (constraint ';')*
(('%' | 'let') | ('$' | 'var'))? SIMPLE_NAME_IDENTIFIER
((ANNOTATION_IDENTIFIER)? ARGUMENT_NAME_IDENTIFIER ('?')?)*
(':' ((ANNOTATION_IDENTIFIER)? ('->' | 'in') | ('<-' | 'out') | ('<>' | 'ref'))? type)+)?
(('=' ((super_expression ';') | block)) | ';')
(('=' ( /*prec 2*/ block | (super_expression ';'))) | ';')
;
typeclass_definition: (DEFINITION_INFO)? (ANNOTATION_INFO)*
@ -102,7 +102,6 @@ expression: name_expression
| return
| lambda
| constructor
| block
| not_name_scoped_expression
;
@ -110,15 +109,17 @@ scoped_expression: name_identifier
| not_name_scoped_expression
;
not_name_scoped_expression: PLACEHOLDER
not_name_scoped_expression: block
| array
| PLACEHOLDER
| name_definition
| access
| tuple_access
| loop_control
| array
| reference
| suffix_expression
| literal
| '(' super_expression ')'
| reference
;
variant_type: ('|')? tuple_type ('|' tuple_type)+ ;

View file

@ -64,7 +64,7 @@ module.exports = grammar({
optional(choice(choice('->', 'out'), choice('<-', 'in'), choice('<>', 'ref'))),
$.type,
)))),
choice(seq('=', choice(seq($._super_expression, ';'), $.block)), ';'),
choice(seq('=', choice(prec(2, $.block), seq($._super_expression, ';'))), ';'),
),
typeclass_definition: $ => seq(
@ -185,7 +185,6 @@ module.exports = grammar({
_expression: $ => choice(
$.operator_expression,
$.block,
$.return,
$.name_expression,
$.constructor,
@ -199,6 +198,7 @@ module.exports = grammar({
),
_not_name_scoped_expression: $ => choice(
$.block,
$.array,
$.placeholder,
$.name_definition,