From a793e09bab521d4998ed2cfc5c7b1c7ec99e9faa Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sun, 17 Nov 2013 14:41:55 -0800 Subject: [PATCH] Added hint to suggest missing ;; in case --- ShellCheck/Parser.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index 6d013a5..8220dc4 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -34,7 +34,7 @@ import System.IO import Text.Parsec.Error import GHC.Exts (sortWith) - +lastError = 1074 backslash = char '\\' linefeed = (optional carriageReturn) >> char '\n' @@ -1464,7 +1464,11 @@ readCaseItem = called "case item" $ do g_Rparen readLineBreak list <- ((lookAhead g_DSEMI >> return []) <|> readCompoundList) - (g_DSEMI <|> lookAhead (readLineBreak >> g_Esac)) + (g_DSEMI <|> lookAhead (readLineBreak >> g_Esac)) `attempting` do + pos <- getPosition + lookAhead g_Rparen + parseProblemAt pos ErrorC 1074 + "Did you forget the ;; after the previous case item?" readLineBreak return (pattern, list)