Make $ special

This commit is contained in:
2024-11-30 15:51:06 -08:00
parent d2bbf681ea
commit 71cf4f39f5
7 changed files with 173 additions and 29 deletions

View File

@@ -296,8 +296,9 @@ ifThenElse = do
c <- term
pure $ RIf fc a b c
-- This hits an idris codegen bug if parseOp is last and Lazy
term = caseExpr
term' : Parser Raw
term' = caseExpr
<|> caseLet
<|> letExpr
<|> lamExpr
@@ -306,6 +307,15 @@ term = caseExpr
-- Make this last for better error messages
<|> parseOp
term = do
t <- term'
rest <- many ((,) <$> getPos <* keyword "$" <*> term')
pure $ apply t rest
where
apply : Raw -> List (FC,Raw) -> Raw
apply t [] = t
apply t ((fc,x) :: xs) = RApp fc t (apply x xs) Explicit
varname : Parser String
varname = (ident <|> uident <|> keyword "_" *> pure "_")

View File

@@ -11,6 +11,7 @@ keywords = ["let", "in", "where", "case", "of", "data", "U", "do",
"", "forall",
"class", "instance",
"if", "then", "else",
"$", "λ",
"->", "", ":", "=>", ":=", "=", "<-", "\\", "_", "|"]
checkKW : String -> Token Kind