From ae175bbdf4c827fe9ee7ae3ccbf5d2f36802822b Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Mon, 5 Nov 2012 01:39:37 -0800 Subject: [PATCH] Show 'eof' instead of blank string in unexpected token messages --- Shpell/Parser.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Shpell/Parser.hs b/Shpell/Parser.hs index 0e8a77f..4d63afb 100644 --- a/Shpell/Parser.hs +++ b/Shpell/Parser.hs @@ -1006,10 +1006,13 @@ getStringFromParsec errors = _ -> "Unknown error" where f err = case err of - UnExpect s -> (1, "Aborting due to unexpected " ++ s ++". Is this valid?") - SysUnExpect s -> (2, "Aborting due to unexpected " ++ s ++ ". Is this valid?") + UnExpect s -> (1, unexpected s) + SysUnExpect s -> (2, unexpected s) Expect s -> (3, "Expected " ++ s ++ "") Message s -> (4, "Message: " ++ s) + wut "" = "eof" + wut x = x + unexpected s = "Aborting due to unexpected " ++ (wut s) ++ ". Is this valid?" parseShell filename contents = do case rp (parseWithNotes readScript) filename contents of