improve parser robustness
This commit is contained in:
parent
4d5e0a90ed
commit
ce3f5138c2
1 changed files with 4 additions and 5 deletions
|
@ -81,17 +81,16 @@ parseGccLink = do
|
||||||
{- Find where collect2 calls ld. -}
|
{- Find where collect2 calls ld. -}
|
||||||
parseCollect2 :: Parser CmdParams
|
parseCollect2 :: Parser CmdParams
|
||||||
parseCollect2 = do
|
parseCollect2 = do
|
||||||
try $ do
|
manyTill restOfLine (try versionline)
|
||||||
string "GNU ld"
|
|
||||||
restOfLine
|
|
||||||
string "collect2 version"
|
|
||||||
restOfLine
|
|
||||||
path <- manyTill anyChar (try $ string ldcmd)
|
path <- manyTill anyChar (try $ string ldcmd)
|
||||||
char ' '
|
char ' '
|
||||||
params <- restOfLine
|
params <- restOfLine
|
||||||
return $ CmdParams (path ++ ldcmd) (escapeDosPaths params) Nothing
|
return $ CmdParams (path ++ ldcmd) (escapeDosPaths params) Nothing
|
||||||
where
|
where
|
||||||
ldcmd = "ld.exe"
|
ldcmd = "ld.exe"
|
||||||
|
versionline = do
|
||||||
|
string "collect2 version"
|
||||||
|
restOfLine
|
||||||
|
|
||||||
{- Input contains something like
|
{- Input contains something like
|
||||||
- c:/program files/haskell platform/foo -LC:/Program Files/Haskell Platform/ -L...
|
- c:/program files/haskell platform/foo -LC:/Program Files/Haskell Platform/ -L...
|
||||||
|
|
Loading…
Add table
Reference in a new issue