File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change @@ -223,7 +223,7 @@ module.exports = grammar({
223223 $ . _operation ,
224224 $ . compound_assignment_expression ,
225225 $ . macrocall_expression ,
226- $ . function_expression ,
226+ $ . arrow_function_expression ,
227227 $ . juxtaposition_expression ,
228228 $ . ternary_expression ,
229229 $ . operator ,
@@ -864,7 +864,7 @@ module.exports = grammar({
864864 $ . _primary_expression ,
865865 ) ) ,
866866
867- function_expression : $ => prec . right ( PREC . afunc , seq (
867+ arrow_function_expression : $ => prec . right ( PREC . afunc , seq (
868868 choice (
869869 $ . identifier ,
870870 $ . argument_list ,
@@ -873,7 +873,7 @@ module.exports = grammar({
873873 '->' ,
874874 choice (
875875 $ . _expression ,
876- $ . assignment ,
876+ alias ( $ . _closed_assignment , $ . assignment ) ,
877877 ) ,
878878 ) ) ,
879879
Original file line number Diff line number Diff line change 234234 ] @keyword.type )
235235
236236; Operators & Punctuation
237- [
238- "->"
239- (operator)
240- ] @operator
237+ (operator) @operator
241238
242239(adjoint_expression
243240 "'" @operator )
244241
245242(range_expression
246243 ":" @operator )
247244
245+ (arrow_function_expression
246+ "->" @operator )
247+
248248[
249249 "."
250250 "..."
Original file line number Diff line number Diff line change @@ -515,14 +515,15 @@ x -> x^2
515515(x,y,z)-> 2*x + y - z
516516()->3
517517() -> (sleep(0.1); i += 1; l)
518+ a -> a = 2, 3
518519
519520---
520521
521522(source_file
522- (function_expression
523+ (arrow_function_expression
523524 (identifier)
524525 (binary_expression (identifier) (operator) (integer_literal)))
525- (function_expression
526+ (arrow_function_expression
526527 (argument_list (identifier) (identifier) (identifier))
527528 (binary_expression
528529 (binary_expression
@@ -531,13 +532,18 @@ x -> x^2
531532 (identifier))
532533 (operator)
533534 (identifier)))
534- (function_expression
535+ (arrow_function_expression
535536 (argument_list)
536537 (integer_literal))
537- (function_expression
538+ (arrow_function_expression
538539 (argument_list)
539540 (parenthesized_expression
540541 (call_expression (identifier) (argument_list (float_literal)))
541542 (compound_assignment_expression (identifier) (operator) (integer_literal))
542- (identifier))))
543+ (identifier)))
544+ (open_tuple
545+ (arrow_function_expression
546+ (identifier)
547+ (assignment (identifier) (operator) (integer_literal)))
548+ (integer_literal)))
543549
You can’t perform that action at this time.
0 commit comments