提交 6abb5fe7 编写于 作者: V Vidar Holen

Quick hack to read and discard array indexing in arithmetic contexts

上级 9f244eda
......@@ -345,6 +345,7 @@ prop_a9 = isOk readArithmeticContents "a^!-b"
prop_aA = isOk readArithmeticContents "! $?"
prop_aB = isOk readArithmeticContents "10#08 * 16#f"
prop_aC = isOk readArithmeticContents "\"$((3+2))\" + '37'"
prop_aD = isOk readArithmeticContents "foo[9*y+x]++"
readArithmeticContents =
readSequence
where
......@@ -364,8 +365,17 @@ readArithmeticContents =
readVar = do
id <- getNextId
x <- readVariableName `thenSkip` spacing
return $ TA_Variable id x
x <- readVariableName
y <- readArrayIndex <|> return ""
optional spacing
return $ TA_Variable id (x ++ y)
-- Doesn't help with foo[foo]
readArrayIndex = do
char '['
x <- anyChar `reluctantlyTill1` (char ']')
char ']'
return $ "[" ++ x ++ "]"
readExpansion = do
id <- getNextId
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册