Skip to content

Commit

Permalink
Bring annotation parsing closer in line with the official grammar (#1958
Browse files Browse the repository at this point in the history
)
  • Loading branch information
sjakobi authored Jul 30, 2020
1 parent 4b95c08 commit 2452fe3
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions dhall/src/Dhall/Parser/Expression.hs
Original file line number Diff line number Diff line change
Expand Up @@ -281,15 +281,23 @@ parsers embedded = Parsers {..}
let alternative5B1 = do
_colon
nonemptyWhitespace
b <- expression
case (shallowDenote a, a0Info) of
(ListLit Nothing [], _) ->
(ListLit Nothing [], _) -> do
b <- applicationExpression

return (ListLit (Just b) [])
(Merge c d Nothing, NakedMergeOrSomeOrToMap) ->
(Merge c d Nothing, NakedMergeOrSomeOrToMap) -> do
b <- applicationExpression

return (Merge c d (Just b))
(ToMap c Nothing, NakedMergeOrSomeOrToMap) ->
(ToMap c Nothing, NakedMergeOrSomeOrToMap) -> do
b <- applicationExpression

return (ToMap c (Just b))
_ -> return (Annot a b)
_ -> do
b <- expression

return (Annot a b)

alternative5B0 <|> alternative5B1 <|> pure a

Expand Down

0 comments on commit 2452fe3

Please sign in to comment.