Support nested trinary expressions.
This commit is contained in:
parent
10276c878d
commit
090e09e4ca
|
@ -553,6 +553,8 @@ prop_a16= isOk readArithmeticContents "$foo$bar"
|
||||||
prop_a17= isOk readArithmeticContents "i<(0+(1+1))"
|
prop_a17= isOk readArithmeticContents "i<(0+(1+1))"
|
||||||
prop_a18= isOk readArithmeticContents "a?b:c"
|
prop_a18= isOk readArithmeticContents "a?b:c"
|
||||||
prop_a19= isOk readArithmeticContents "\\\n3 +\\\n 2"
|
prop_a19= isOk readArithmeticContents "\\\n3 +\\\n 2"
|
||||||
|
prop_a20= isOk readArithmeticContents "a ? b ? c : d : e"
|
||||||
|
prop_a21= isOk readArithmeticContents "a ? b : c ? d : e"
|
||||||
readArithmeticContents =
|
readArithmeticContents =
|
||||||
readSequence
|
readSequence
|
||||||
where
|
where
|
||||||
|
@ -618,16 +620,15 @@ readArithmeticContents =
|
||||||
|
|
||||||
readAssignment = readTrinary `splitBy` ["=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", "&=", "^=", "|="]
|
readAssignment = readTrinary `splitBy` ["=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", "&=", "^=", "|="]
|
||||||
readTrinary = do
|
readTrinary = do
|
||||||
let part = readLogicalOr
|
x <- readLogicalOr
|
||||||
x <- part
|
|
||||||
do
|
do
|
||||||
id <- getNextId
|
id <- getNextId
|
||||||
string "?"
|
string "?"
|
||||||
spacing
|
spacing
|
||||||
y <- part
|
y <- readTrinary
|
||||||
string ":"
|
string ":"
|
||||||
spacing
|
spacing
|
||||||
z <- part
|
z <- readTrinary
|
||||||
return $ TA_Trinary id x y z
|
return $ TA_Trinary id x y z
|
||||||
<|>
|
<|>
|
||||||
return x
|
return x
|
||||||
|
|
Loading…
Reference in New Issue