Warn when finding HTML entities like &

This commit is contained in:
Vidar Holen 2017-01-14 11:59:31 -08:00
parent 7f307c5775
commit 8809a36952
1 changed files with 8 additions and 0 deletions

View File

@ -1696,11 +1696,19 @@ readLineBreak = optional readNewlineList
prop_readSeparator1 = isWarning readScript "a &; b" prop_readSeparator1 = isWarning readScript "a &; b"
prop_readSeparator2 = isOk readScript "a & b" prop_readSeparator2 = isOk readScript "a & b"
prop_readSeparator3 = isWarning readScript "a & b"
prop_readSeparator4 = isWarning readScript "a > file; b"
readSeparatorOp = do readSeparatorOp = do
notFollowedBy2 (void g_AND_IF <|> void readCaseSeparator) notFollowedBy2 (void g_AND_IF <|> void readCaseSeparator)
notFollowedBy2 (string "&>") notFollowedBy2 (string "&>")
f <- try (do f <- try (do
pos <- getPosition
char '&' 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 spacing
pos <- getPosition pos <- getPosition
char ';' char ';'