File tree Expand file tree Collapse file tree 2 files changed +37
-8
lines changed Expand file tree Collapse file tree 2 files changed +37
-8
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,8 @@ module.exports = grammar({
6969 ] ,
7070 [ $ . _jsx_attribute_value , $ . pipe_expression ] ,
7171 [ $ . function_type_parameters , $ . function_type ] ,
72- [ $ . _reserved_identifier , $ . module_unpack ]
72+ [ $ . _reserved_identifier , $ . module_unpack ] ,
73+ [ $ . lazy_pattern , $ . or_pattern ]
7374 ] ,
7475
7576 conflicts : $ => [
@@ -925,13 +926,7 @@ module.exports = grammar({
925926
926927 lazy_pattern : $ => seq (
927928 'lazy' ,
928- choice (
929- $ . value_identifier ,
930- $ . _literal_pattern ,
931- $ . _destructuring_pattern ,
932- $ . polyvar_type_pattern ,
933- $ . parenthesized_pattern ,
934- )
929+ $ . _pattern
935930 ) ,
936931
937932 _jsx_element : $ => choice ( $ . jsx_element , $ . jsx_self_closing_element ) ,
Original file line number Diff line number Diff line change @@ -1108,6 +1108,40 @@ switch c {
11081108 (expression_statement
11091109 (number)))))))
11101110
1111+ ================================================================================
1112+ Switch of lazy patterns
1113+ ================================================================================
1114+
1115+ switch c {
1116+ | lazy(r) => r
1117+ | (lazy (), lazy 3) => false
1118+ }
1119+
1120+ --------------------------------------------------------------------------------
1121+
1122+ (source_file
1123+ (expression_statement
1124+ (switch_expression
1125+ (value_identifier)
1126+ (switch_match
1127+ (lazy_pattern
1128+ (parenthesized_pattern
1129+ (value_identifier)))
1130+ (sequence_expression
1131+ (expression_statement
1132+ (value_identifier))))
1133+ (switch_match
1134+ (tuple_pattern
1135+ (tuple_item_pattern
1136+ (lazy_pattern
1137+ (unit)))
1138+ (tuple_item_pattern
1139+ (lazy_pattern
1140+ (number))))
1141+ (sequence_expression
1142+ (expression_statement
1143+ (false)))))))
1144+
11111145================================================================================
11121146Math operators
11131147================================================================================
You can’t perform that action at this time.
0 commit comments