Broken commit
This commit is contained in:
parent
41a90dc6bf
commit
99dcfbd976
5 changed files with 38 additions and 19 deletions
|
@ -3,19 +3,31 @@ module Ubc.Parse.Syntax.Import
|
|||
parse)
|
||||
where
|
||||
|
||||
import Data.Functor ((<&>))
|
||||
import Text.Parsec (sepBy1, ParsecT, anyChar, many, char, choice, notFollowedBy, oneOf)
|
||||
|
||||
import Text.Parsec (sepBy1, ParsecT)
|
||||
|
||||
import qualified Data.List as List
|
||||
import OsPath as OsPath
|
||||
|
||||
import qualified Ubc.Parse.Syntax.Language as UbcLanguage
|
||||
import System.OsPath (encodeUtf, OsPath)
|
||||
import System.OsPath.Encoding (EncodingException (EncodingError))
|
||||
import Control.Exception (SomeException(SomeException))
|
||||
|
||||
importPath :: Monad m => ParsecT String u m [String]
|
||||
importPath = UbcLanguage.identifier `sepBy1` UbcLanguage.symbol "/"
|
||||
importPath = UbcLanguage.angles (many importChar `sepBy1` char '/')
|
||||
|
||||
parse :: Monad m => ParsecT String u m [String]
|
||||
importChar :: (Monad m) => ParsecT String u m Char
|
||||
importChar = choice
|
||||
[ char '\\' >> oneOf ">/\\"
|
||||
, notFollowedBy (oneOf ">/") >> anyChar
|
||||
]
|
||||
|
||||
parse :: ParsecT String u IO [String]
|
||||
parse = do
|
||||
UbcLanguage.reserved "import"
|
||||
importPath
|
||||
fragments <- importPath
|
||||
case mapM encodeUtf fragments :: Either EncodingException [OsPath] of
|
||||
Left err -> pure ()
|
||||
Right success -> pure ()
|
||||
|
||||
pure []
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue