Commit 0409fc2e authored by Jurrien Stutterheim's avatar Jurrien Stutterheim
Browse files

Correctly parse relative paths

parent ad3dc237
......@@ -46,21 +46,16 @@ startPBB args = case filter (\(xs, _) -> xs == []) (begin pBB args) of
[(_, as)] -> as
pBB :: CParser Char BBArgs BBArgs
pBB = pForce <&> \f -> pProj <&> \p -> pEnv <@ \e -> {force_rebuild = f, proj_path = p, env_path = e}
pBB = pForce <&> \f -> pFilename <&> \p -> pEnv <@ \e -> {force_rebuild = f, proj_path = p, env_path = e}
pForce :: CParser Char Bool BBArgs
pForce = (sptoken (fromString "--force") <@ const True) <!> yield False
pProj :: CParser Char (Maybe String) BBArgs
pProj = pFilename "prj"
pEnv :: CParser Char (Maybe String) BBArgs
pEnv = pFilename "env" <!> yield Nothing
pEnv = pFilename <!> yield Nothing
pFilename :: String -> CParser Char (Maybe String) BBArgs
pFilename ext = sp pE
where pE = <*> (satisfy p) <&> \i -> symbol '.' &> token (fromString ext) <@ \e -> Just (toString i +++ toString ['.' : e])
p c = not (c == '.' || isWhite c)
pFilename :: CParser Char (Maybe String) BBArgs
pFilename = sp (<*> (satisfy (not o isWhite))) <@ Just o toString
pinit :: .Bool *GeneralSt -> *GeneralSt
pinit force_rebuild ps
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment