Fix parsing of [[ a =~ {$var} ]]

This commit is contained in:
Vidar Holen 2016-05-08 12:19:25 -07:00
parent 86999ded1f
commit 40136fe249
2 changed files with 3 additions and 2 deletions

View File

@ -2057,6 +2057,7 @@ prop_checkUnused29= verifyNotTree checkUnusedAssignments "var=(a b); declare -p
prop_checkUnused30= verifyTree checkUnusedAssignments "let a=1"
prop_checkUnused31= verifyTree checkUnusedAssignments "let 'a=1'"
prop_checkUnused32= verifyTree checkUnusedAssignments "let a=b=c; echo $a"
prop_checkUnused33= verifyNotTree checkUnusedAssignments "a=foo; [[ foo =~ ^{$a}$ ]]"
checkUnusedAssignments params t = execWriter (mapM_ warnFor unused)
where
flow = variableFlow params

View File

@ -586,8 +586,8 @@ readConditionContents single =
where
readGlobLiteral = do
id <- getNextId
s <- many1 (extglobStart <|> oneOf "{}[]$")
return $ T_Literal id s
s <- extglobStart <|> oneOf "{}[]$"
return $ T_Literal id [s]
readGroup = called "regex grouping" $ do
id <- getNextId
char '('