Remove some ambiguities in parsing

This commit is contained in:
2026-03-06 21:41:26 -08:00
parent b1c2bfc896
commit 90e36d8faf
8 changed files with 41 additions and 39 deletions

View File

@@ -314,7 +314,7 @@ lamExpr = do
caseAlt : Parser RCaseAlt
caseAlt = do
pure MkUnit
pat <- typeExpr
pat <- term
t <- optional (keyword "=>" >> term)
pure $ MkAlt pat t
@@ -364,6 +364,7 @@ doCaseLet = do
keyword "="
sc <- typeExpr
alts <- startBlock $ manySame $ symbol "|" *> caseAlt
-- REVIEW why am I collecting the rest here?
bodyFC <- getPos
body <- RDo <$> getPos <*> someSame doStmt
pure $ DoExpr fc (RCase fc sc Nothing (MkAlt pat (Just body) :: alts))
@@ -457,9 +458,9 @@ ibind = do
symbol "{"
quant <- quantity
names <- (some (addPos varname))
ty <- optional (symbol ":" *> typeExpr)
ty <- symbol ":" *> typeExpr
symbol "}"
pure $ map (makeBind quant ty) names
pure $ map (makeBind quant (Just ty)) names
where
makeBind : Quant Maybe Raw FC × String BindInfo × Raw
makeBind quant ty (pos, name) = (BI pos name Implicit quant, fromMaybe (RImplicit pos) ty)