Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[parser] Add comments to conditional_cover and logical_cover #7896

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/parser/expression_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module Expression
let as_pattern = Pattern_cover.as_pattern

(* AssignmentExpression :
* [+Yield] YieldExpression
* ConditionalExpression
* LeftHandSideExpression = AssignmentExpression
* LeftHandSideExpression AssignmentOperator AssignmentExpression
Expand Down Expand Up @@ -249,6 +250,10 @@ module Expression
if op <> None then Eat.token env;
op

(* ConditionalExpression :
* LogicalExpression
* LogicalExpression ? AssignmentExpression : AssignmentExpression
*)
and conditional_cover env =
let start_loc = Peek.loc env in
let expr = logical_cover env in
Expand All @@ -270,6 +275,19 @@ module Expression

and conditional env = as_expression env (conditional_cover env)

(*
* LogicalANDExpression :
* BinaryExpression
* LogicalANDExpression && BitwiseORExpression
*
* LogicalORExpression :
* LogicalANDExpression
* LogicalORExpression || LogicalANDExpression
* LogicalORExpression ?? LogicalANDExpression
*
* LogicalExpression :
* LogicalORExpression
*)
and logical_cover =
let open Expression in
let make_logical env left right operator loc =
Expand Down