From 8809a3695241602a5db276e544cf3bcca8a9b715 Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Sat, 14 Jan 2017 11:59:31 -0800 Subject: [PATCH] Warn when finding HTML entities like & --- ShellCheck/Parser.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index eeaaff9..1990c01 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -1696,11 +1696,19 @@ readLineBreak = optional readNewlineList prop_readSeparator1 = isWarning readScript "a &; b" prop_readSeparator2 = isOk readScript "a & b" +prop_readSeparator3 = isWarning readScript "a & b" +prop_readSeparator4 = isWarning readScript "a > file; b" readSeparatorOp = do notFollowedBy2 (void g_AND_IF <|> void readCaseSeparator) notFollowedBy2 (string "&>") f <- try (do + pos <- getPosition char '&' + optional $ do + s <- lookAhead . choice . map (try . string) $ + ["amp;", "gt;", "lt;"] + parseProblemAt pos ErrorC 1109 "This is an unquoted HTML entity. Replace with corresponding character." + spacing pos <- getPosition char ';'