Hacked in place warnings for if [[ 1 ]] then :; fi
This commit is contained in:
parent
6e263e6b76
commit
6d2e739e09
|
@ -465,20 +465,22 @@ readArithmeticContents =
|
||||||
prop_readCondition = isOk readCondition "[ \\( a = b \\) -a \\( c = d \\) ]"
|
prop_readCondition = isOk readCondition "[ \\( a = b \\) -a \\( c = d \\) ]"
|
||||||
prop_readCondition2 = isOk readCondition "[[ (a = b) || (c = d) ]]"
|
prop_readCondition2 = isOk readCondition "[[ (a = b) || (c = d) ]]"
|
||||||
readCondition = called "test expression" $ do
|
readCondition = called "test expression" $ do
|
||||||
opos <- getPosition
|
opos <- getPosition
|
||||||
id <- getNextId
|
id <- getNextId
|
||||||
open <- (try $ string "[[") <|> (string "[")
|
open <- (try $ string "[[") <|> (string "[")
|
||||||
let single = open == "["
|
let single = open == "["
|
||||||
condSpacingMsg False $ if single
|
condSpacingMsg False $ if single
|
||||||
then "You need spaces after the opening [ and before the closing ]."
|
then "You need spaces after the opening [ and before the closing ]."
|
||||||
else "You need spaces after the opening [[ and before the closing ]]."
|
else "You need spaces after the opening [[ and before the closing ]]."
|
||||||
condition <- readConditionContents single
|
condition <- readConditionContents single
|
||||||
|
|
||||||
cpos <- getPosition
|
cpos <- getPosition
|
||||||
close <- (try $ string "]]") <|> (string "]")
|
close <- (try $ string "]]") <|> (string "]")
|
||||||
when (open == "[[" && close /= "]]") $ parseProblemAt cpos ErrorC "Did you mean ]] ?"
|
when (open == "[[" && close /= "]]") $ parseProblemAt cpos ErrorC "Did you mean ]] ?"
|
||||||
when (open == "[" && close /= "]" ) $ parseProblemAt opos ErrorC "Did you mean [[ ?"
|
when (open == "[" && close /= "]" ) $ parseProblemAt opos ErrorC "Did you mean [[ ?"
|
||||||
return $ T_Condition id (if single then SingleBracket else DoubleBracket) condition
|
spacing
|
||||||
|
many readCmdWord -- Read and throw away remainders to get then/do warnings. Fixme?
|
||||||
|
return $ T_Condition id (if single then SingleBracket else DoubleBracket) condition
|
||||||
|
|
||||||
|
|
||||||
hardCondSpacing = condSpacingMsg False "You need a space here."
|
hardCondSpacing = condSpacingMsg False "You need a space here."
|
||||||
|
|
Loading…
Reference in New Issue