Parser support for $[..], plus deprecation warning.

This commit is contained in:
Vidar Holen
2013-07-05 09:42:08 -07:00
parent fc4a6043d7
commit 76c5af2973
3 changed files with 18 additions and 2 deletions

View File

@@ -843,7 +843,7 @@ readBraced = try $ do
readNormalDollar = readDollarExpression <|> readDollarLonely <|> readDollarDoubleQuote
readDoubleQuotedDollar = readDollarExpression <|> readDollarLonely
readDollarExpression = readDollarArithmetic <|> readDollarBraced <|> readDollarExpansion <|> readDollarVariable <|> readDollarSingleQuote
readDollarExpression = readDollarArithmetic <|> readDollarBracket <|> readDollarBraced <|> readDollarExpansion <|> readDollarVariable <|> readDollarSingleQuote
prop_readDollarSingleQuote = isOk readDollarSingleQuote "$'foo\\\'lol'"
readDollarSingleQuote = called "$'..' expression" $ do
@@ -873,6 +873,13 @@ readDollarArithmetic = called "$((..)) expression" $ do
string "))"
return (T_DollarArithmetic id c)
readDollarBracket = called "$[..] expression" $ do
id <- getNextId
try (string "$[")
c <- readArithmeticContents
string "]"
return (T_DollarBracket id c)
readArithmeticExpression = called "((..)) command" $ do
id <- getNextId
try (string "((")