summaryrefslogtreecommitdiff
path: root/src/LambdaCube/Compiler/Parser.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/LambdaCube/Compiler/Parser.hs')
-rw-r--r--src/LambdaCube/Compiler/Parser.hs8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/LambdaCube/Compiler/Parser.hs b/src/LambdaCube/Compiler/Parser.hs
index 78942063..b7112bf4 100644
--- a/src/LambdaCube/Compiler/Parser.hs
+++ b/src/LambdaCube/Compiler/Parser.hs
@@ -363,7 +363,7 @@ parseTerm prec = withRange setSI $ case prec of
363 PrecApp -> 363 PrecApp ->
364 apps' <$> try "record" (sVar upperCase <* reservedOp "{") <*> (commaSep $ lowerCase *> reservedOp "=" *> ((,) Visible <$> parseTerm PrecLam)) <* reservedOp "}" 364 apps' <$> try "record" (sVar upperCase <* reservedOp "{") <*> (commaSep $ lowerCase *> reservedOp "=" *> ((,) Visible <$> parseTerm PrecLam)) <* reservedOp "}"
365 <|> apps' <$> parseTerm PrecSwiz <*> many (hiddenTerm (parseTTerm PrecSwiz) $ parseTerm PrecSwiz) 365 <|> apps' <$> parseTerm PrecSwiz <*> many (hiddenTerm (parseTTerm PrecSwiz) $ parseTerm PrecSwiz)
366 PrecSwiz -> level PrecProj $ \t -> try "swizzling" $ mkSwizzling t <$> lexeme (char '%' *> manyNM 1 4 (satisfy (`elem` ("xyzwrgba" :: String)))) 366 PrecSwiz -> level PrecProj $ \t -> mkSwizzling t <$> lexeme (try "swizzling" $ char '%' *> manyNM 1 4 (satisfy (`elem` ("xyzwrgba" :: String))))
367 PrecProj -> level PrecAtom $ \t -> try "projection" $ mkProjection t <$ char '.' <*> sepBy1 (sLit . LString <$> lowerCase) (char '.') 367 PrecProj -> level PrecAtom $ \t -> try "projection" $ mkProjection t <$ char '.' <*> sepBy1 (sLit . LString <$> lowerCase) (char '.')
368 PrecAtom -> 368 PrecAtom ->
369 mkLit <$> namespace <*> try "literal" parseLit 369 mkLit <$> namespace <*> try "literal" parseLit
@@ -998,12 +998,8 @@ extensionMap = Map.fromList $ map (show &&& id) [toEnum 0 .. ]
998 998
999parseExtensions :: P [Extension] 999parseExtensions :: P [Extension]
1000parseExtensions 1000parseExtensions
1001 = lexeme (try "language pragma" $ string "{-#") 1001 = try "pragma" (symbol "{-#") *> symbol "LANGUAGE" *> commaSep (lexeme ext) <* symbol "#-}"
1002 *> lexeme (string "LANGUAGE")
1003 *> lexeme (commaSep $ lexeme ext)
1004 <* lexeme (string "#-}")
1005 where 1002 where
1006 lexeme p = p <* skipMany (satisfy isSpace)
1007 ext = do 1003 ext = do
1008 s <- some $ satisfy isAlphaNum 1004 s <- some $ satisfy isAlphaNum
1009 maybe 1005 maybe