@@ -164,6 +164,7 @@ and keywords = [
164
164
" throws" ;
165
165
" true" ;
166
166
" try" ;
167
+ " await" ;
167
168
]
168
169
169
170
and identifier () = identifier' keywords
@@ -937,6 +938,12 @@ and tryOperator () =
937
938
< |> wstring " try"
938
939
) >> = mkString
939
940
941
+ (* | await-operator -> "await" |*)
942
+ and awaitOperator () =
943
+ (
944
+ wstring " await"
945
+ ) >> = mkString
946
+
940
947
(* | GRAMMAR OF AN ASSIGNMENT OPERATOR |*)
941
948
942
949
(* | assignment-operator -> "=" |*)
@@ -1466,11 +1473,13 @@ and binaryExpression ~allowAssignment ~allowTrailingClosure ~allowTypeAnnotation
1466
1473
mkNode " AssignmentExpression"
1467
1474
< :> mkProp " Assignee" (return exp)
1468
1475
< * assignmentOperator ()
1476
+ < :> mkOptPropE " Await" awaitOperator
1469
1477
< :> mkOptPropE " Try" tryOperator
1470
1478
< :> mkPropE " Value" (prefixExpression ~allow TrailingClosure ~allow TypeAnnotation)
1471
1479
and conditionalExpression () =
1472
1480
mkNode " ConditionalExpression"
1473
1481
< :> conditionalOperator ()
1482
+ < :> mkOptPropE " Await" awaitOperator
1474
1483
< :> mkOptPropE " AlternateTry" tryOperator
1475
1484
< :> mkPropE " Alternate" (prefixExpression ~allow TrailingClosure ~allow TypeAnnotation)
1476
1485
and typeCastingExpression () =
@@ -1510,17 +1519,25 @@ and binaryExpressions ~allowAssignment ~allowTrailingClosure ~allowTypeAnnotatio
1510
1519
1511
1520
(* | GRAMMAR OF AN EXPRESSION |*)
1512
1521
1513
- (* | expression -> try-operator ??? prefix-expression binary-expressions ??? |*)
1522
+ (* | expression -> await-operator ??? try-operator ??? prefix-expression binary-expressions ??? |*)
1514
1523
and expression
1515
1524
?allowAssignment :(allowAssignment:bool = true )
1516
1525
?allowTrailingClosure:(allowTrailingClosure:bool = true )
1517
1526
?(allowTypeAnnotation= true )
1518
1527
_
1519
1528
=
1520
- mkOptE tryOperator >> = fun tryop ->
1521
- prefixExpression ~allow TrailingClosure ~allow TypeAnnotation () >> = fun pre ->
1522
- option pre (binaryExpressions ~allow Assignment ~allow TrailingClosure ~allow TypeAnnotation pre)
1523
- < :> mkProp " Try" (return tryop)
1529
+ mkOptE tryOperator
1530
+ >> =
1531
+ fun tryop ->
1532
+ mkOptE awaitOperator
1533
+ >> =
1534
+ fun awaitop ->
1535
+ prefixExpression ~allow TrailingClosure ~allow TypeAnnotation ()
1536
+ >> =
1537
+ fun pre ->
1538
+ option pre (binaryExpressions ~allow Assignment ~allow TrailingClosure ~allow TypeAnnotation pre)
1539
+ < :> mkProp " Try" (return tryop)
1540
+ < :> mkProp " Await" (return awaitop)
1524
1541
1525
1542
(* | expression-list -> expression | expression "," expression-list |*)
1526
1543
and expressionList () =
@@ -1630,11 +1647,18 @@ and loopStatement () =
1630
1647
1631
1648
(* | GRAMMAR OF A FOR-IN STATEMENT |*)
1632
1649
1650
+ (* | async-sequence-operator -> "try ??? await" |*)
1651
+ and asyncSequenceOperator () =
1652
+ (wstring " await" ) < |> (wstring " try" *> anyspace *> wstring " await" )
1653
+
1654
+
1633
1655
(* | for-in-statement -> "for" "case ???" pattern "in" expression where-clause ??? code-block |*)
1656
+ (* | for-in-statement -> "for" async-sequence-operator ??? pattern "in" expression where-clause ??? code-block |*)
1634
1657
and forInStatement () =
1635
1658
mkNode " ForInStatement"
1636
1659
< * wstring " for"
1637
1660
< :> mkOptPropEmpty (mkBoolProp " Case" (wstring " case" ))
1661
+ < :> mkOptPropEmpty (mkBoolProp " AsyncSequence" (asyncSequenceOperator () ))
1638
1662
< :> mkProp " Pattern" (fix (pattern ~allow Expression:false ))
1639
1663
< * wstring " in"
1640
1664
< :> mkProp " Condition" (fix (expression ~allow TrailingClosure:false ))
@@ -2591,6 +2615,13 @@ and classMembers () =
2591
2615
and classBody () =
2592
2616
wchar '{' *> mkOptE classMembers < * wchar '}'
2593
2617
2618
+ (* | reference-type -> class | actor |*)
2619
+ and referenceType () =
2620
+ (
2621
+ mkBoolProp " Actor" (wstring " actor" )
2622
+ < |> (wstring " class" *> mkPropHolder)
2623
+ )
2624
+
2594
2625
(* | class-declaration -> attributes??? access-level-modifier??? "final"??? "class" class-name generic-parameter-clause??? type-inheritance-clause??? generic-where-clause??? class-body |*)
2595
2626
(* | class-declaration -> attributes??? "final" access-level-modifier??? "class" class-name generic-parameter-clause??? type-inheritance-clause??? generic-where-clause??? class-body |*)
2596
2627
and classDeclaration () =
@@ -2605,7 +2636,7 @@ and classDeclaration () =
2605
2636
< :> mkOptPropEmpty (mkBoolProp " Final" (wstring " final" ))
2606
2637
)
2607
2638
)
2608
- < * wstring " class "
2639
+ < : > referenceType ()
2609
2640
< :> mkPropE " ClassName" className
2610
2641
< :> mkOptPropE " GenericParameterClause" genericParameterClause
2611
2642
< :> mkOptPropE " TypeInheritanceClause" typeInheritanceClause
@@ -2951,6 +2982,8 @@ and declarationModifier () =
2951
2982
< |>
2952
2983
mkBoolProp " Weak" (wstring " weak" )
2953
2984
< |>
2985
+ mkBoolProp " ParallelAsync" (wstring " async" )
2986
+ < |>
2954
2987
accessLevelModifier ()
2955
2988
< |>
2956
2989
mutationModifier ()
0 commit comments