Parse keywords with case sensitivity (fixes #1809)
This commit is contained in:
parent
1da0becb0f
commit
106f321cf0
|
@ -12,7 +12,8 @@
|
||||||
- SC2256: Warn about translated strings that are known variables
|
- SC2256: Warn about translated strings that are known variables
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- SC2230: This check is now off by default
|
- SC2230: 'command -v' suggestion is now off by default (-i deprecate-which)
|
||||||
|
- SC1081: Keywords are now correctly parsed case sensitively, with a warning
|
||||||
|
|
||||||
## v0.7.0 - 2019-07-28
|
## v0.7.0 - 2019-07-28
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -2304,6 +2304,7 @@ prop_readIfClause2 = isWarning readIfClause "if false; then; echo oo; fi"
|
||||||
prop_readIfClause3 = isWarning readIfClause "if false; then true; else; echo lol; fi"
|
prop_readIfClause3 = isWarning readIfClause "if false; then true; else; echo lol; fi"
|
||||||
prop_readIfClause4 = isWarning readIfClause "if false; then true; else if true; then echo lol; fi; fi"
|
prop_readIfClause4 = isWarning readIfClause "if false; then true; else if true; then echo lol; fi; fi"
|
||||||
prop_readIfClause5 = isOk readIfClause "if false; then true; else\nif true; then echo lol; fi; fi"
|
prop_readIfClause5 = isOk readIfClause "if false; then true; else\nif true; then echo lol; fi; fi"
|
||||||
|
prop_readIfClause6 = isWarning readIfClause "if true\nthen\nDo the thing\nfi"
|
||||||
readIfClause = called "if expression" $ do
|
readIfClause = called "if expression" $ do
|
||||||
start <- startSpan
|
start <- startSpan
|
||||||
pos <- getPosition
|
pos <- getPosition
|
||||||
|
@ -2890,6 +2891,7 @@ redirToken c t = try $ do
|
||||||
|
|
||||||
tryWordToken s t = tryParseWordToken s t `thenSkip` spacing
|
tryWordToken s t = tryParseWordToken s t `thenSkip` spacing
|
||||||
tryParseWordToken keyword t = try $ do
|
tryParseWordToken keyword t = try $ do
|
||||||
|
pos <- getPosition
|
||||||
start <- startSpan
|
start <- startSpan
|
||||||
str <- anycaseString keyword
|
str <- anycaseString keyword
|
||||||
id <- endSpan start
|
id <- endSpan start
|
||||||
|
@ -2905,9 +2907,10 @@ tryParseWordToken keyword t = try $ do
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
|
|
||||||
lookAhead keywordSeparator
|
lookAhead keywordSeparator
|
||||||
when (str /= keyword) $
|
when (str /= keyword) $ do
|
||||||
parseProblem ErrorC 1081 $
|
parseProblemAt pos ErrorC 1081 $
|
||||||
"Scripts are case sensitive. Use '" ++ keyword ++ "', not '" ++ str ++ "'."
|
"Scripts are case sensitive. Use '" ++ keyword ++ "', not '" ++ str ++ "' (or quote if literal)."
|
||||||
|
fail ""
|
||||||
return $ t id
|
return $ t id
|
||||||
|
|
||||||
anycaseString =
|
anycaseString =
|
||||||
|
|
Loading…
Reference in New Issue