Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Merge pull request #539 from returntocorp/matthew/pa-1579-scala-for-l…
Browse files Browse the repository at this point in the history
…oops-parse-error

Scala: allow ellipsis in for loop headers
  • Loading branch information
aryx committed Jun 30, 2022
2 parents f80b02c + 71bbc15 commit d636ec7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lang_scala/parsing/AST_scala.ml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ and for_header = enumerators bracket
and enumerators = enumerator list
and enumerator =
| G of generator
| GIf of guard list
| GEllipsis of tok
(* less: GAssign *)

and generator = {
Expand Down
6 changes: 3 additions & 3 deletions lang_scala/parsing/Parser_scala_recursive_descent.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2255,9 +2255,9 @@ and guard_loop in_ : guard list =
and enumerator ~isFirst ?(allowNestedIf=true) in_ : enumerator =
in_ |> with_logging "enumerator" (fun () ->
match in_.token with
| Kif _ when not isFirst ->
let xs = guard_loop in_ in
GIf xs
| Ellipsis tok ->
nextToken in_;
GEllipsis tok
| _ ->
let g = generator ~eqOK:(not isFirst) ~allowNestedIf in_ in
G g
Expand Down

0 comments on commit d636ec7

Please sign in to comment.