Warn about 'while!' and 'while:'

This commit is contained in:
Vidar Holen 2018-02-17 21:58:29 -08:00
parent d8717c7046
commit 6d257bfa17
1 changed files with 8 additions and 5 deletions

View File

@ -2582,11 +2582,14 @@ tryParseWordToken keyword t = try $ do
str <- anycaseString keyword
optional $ do
try . lookAhead $ char '['
parseProblem ErrorC 1069 "You need a space before the [."
optional $ do
try . lookAhead $ char '#'
parseProblem ErrorC 1099 "You need a space before the #."
c <- try . lookAhead $ anyChar
let warning code = parseProblem ErrorC code $ "You need a space before the " ++ [c] ++ "."
case c of
'[' -> warning 1069
'#' -> warning 1099
'!' -> warning 1129
':' -> warning 1130
_ -> return ()
lookAhead keywordSeparator
when (str /= keyword) $