mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-21 22:17:19 +03:00
PParser.hs: Add |filename| parser
As it stands, it reads in either a (possibly namespaced) identifier, which was the old behavior, or a double-quoted string, which is the new behavior. This could be improved by actually testing that it's returning a filename, but I'm clumsy with the parser abstraction, and it wasn't clear to me from the Trifecta docs I looked through how to pass it through System.FilePath.takeFileName and then enforce that it was a non-empty string.
This commit is contained in:
parent
2cda43e36c
commit
c772bf53c4
@ -62,6 +62,14 @@ pPkg = do
|
||||
eof
|
||||
return st
|
||||
|
||||
|
||||
-- | Parses a filename.
|
||||
-- |
|
||||
-- | Treated for now as an identifier or a double-quoted string.
|
||||
filename :: (MonadicParsing m, HasLastTokenSpan m) => m String
|
||||
filename = try $ (token $ stringLiteral <|> (fst <$> identifier)) <?> "filename"
|
||||
|
||||
|
||||
pClause :: PParser ()
|
||||
pClause = do reserved "executable"; lchar '=';
|
||||
exec <- fst <$> iName []
|
||||
|
Loading…
Reference in New Issue
Block a user