From 7ec6566495934a886b08da74570145a4c59327ce Mon Sep 17 00:00:00 2001 From: Adam Sampson Date: Tue, 4 Mar 2008 11:59:13 +0000 Subject: [PATCH] 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... --- frontends/ParseOccam.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontends/ParseOccam.hs b/frontends/ParseOccam.hs index 3775e27..688ddef 100644 --- a/frontends/ParseOccam.hs +++ b/frontends/ParseOccam.hs @@ -2006,7 +2006,9 @@ sourceFile runTockParser :: [Token] -> OccParser t -> CompState -> PassM t runTockParser toks prod cs = 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 -- | Parse an occam program.