Return sensible Meta from ParseOccam failures.
This means we get the nice annotated source display on a parser failure -- although we still get not-very-useful descriptions of errors sometimes...
This commit is contained in:
parent
168628576d
commit
7ec6566495
|
@ -2006,7 +2006,9 @@ sourceFile
|
||||||
runTockParser :: [Token] -> OccParser t -> CompState -> PassM t
|
runTockParser :: [Token] -> OccParser t -> CompState -> PassM t
|
||||||
runTockParser toks prod cs
|
runTockParser toks prod cs
|
||||||
= do case runParser prod ([], cs) "" toks of
|
= do case runParser prod ([], cs) "" toks of
|
||||||
Left err -> dieReport (Nothing, "Parse error: " ++ show err)
|
Left err ->
|
||||||
|
let m = sourcePosToMeta $ errorPos err
|
||||||
|
in dieReport (Just m, "Parse error: " ++ show err)
|
||||||
Right r -> return r
|
Right r -> return r
|
||||||
|
|
||||||
-- | Parse an occam program.
|
-- | Parse an occam program.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user