Do away with operandNotTable -- it's not needed now we have state, and it breaks stuff
This commit is contained in:
parent
6c9293fa7b
commit
db1c16c2cb
|
@ -986,8 +986,7 @@ conversionMode :: OccParser (A.ConversionMode, A.Expression)
|
||||||
conversionMode
|
conversionMode
|
||||||
= do { sROUND; o <- noTypeContext operand; return (A.Round, o) }
|
= do { sROUND; o <- noTypeContext operand; return (A.Round, o) }
|
||||||
<|> do { sTRUNC; o <- noTypeContext operand; return (A.Trunc, o) }
|
<|> do { sTRUNC; o <- noTypeContext operand; return (A.Trunc, o) }
|
||||||
-- This uses operandNotTable to resolve the "x[y]" ambiguity.
|
<|> do { o <- noTypeContext operand; return (A.DefaultConversion, o) }
|
||||||
<|> do { o <- noTypeContext operandNotTable; return (A.DefaultConversion, o) }
|
|
||||||
<?> "conversion mode and operand"
|
<?> "conversion mode and operand"
|
||||||
--}}}
|
--}}}
|
||||||
--{{{ operands
|
--{{{ operands
|
||||||
|
@ -997,16 +996,6 @@ operand
|
||||||
|
|
||||||
operand' :: OccParser A.Expression
|
operand' :: OccParser A.Expression
|
||||||
operand'
|
operand'
|
||||||
= table
|
|
||||||
<|> operandNotTable'
|
|
||||||
<?> "operand'"
|
|
||||||
|
|
||||||
operandNotTable :: OccParser A.Expression
|
|
||||||
operandNotTable
|
|
||||||
= maybeSubscripted "operand other than table" operandNotTable' A.SubscriptedExpr typeOfExpression
|
|
||||||
|
|
||||||
operandNotTable' :: OccParser A.Expression
|
|
||||||
operandNotTable'
|
|
||||||
= do { m <- md; v <- variable; return $ A.ExprVariable m v }
|
= do { m <- md; v <- variable; return $ A.ExprVariable m v }
|
||||||
<|> literal
|
<|> literal
|
||||||
<|> do { sLeftR; e <- expression; sRightR; return e }
|
<|> do { sLeftR; e <- expression; sRightR; return e }
|
||||||
|
@ -1021,7 +1010,8 @@ operandNotTable'
|
||||||
<|> do { m <- md; sOFFSETOF; sLeftR; t <- dataType; sComma; f <- fieldName; sRightR; return $ A.OffsetOf m t f }
|
<|> do { m <- md; sOFFSETOF; sLeftR; t <- dataType; sComma; f <- fieldName; sRightR; return $ A.OffsetOf m t f }
|
||||||
<|> do { m <- md; sTRUE; return $ A.True m }
|
<|> do { m <- md; sTRUE; return $ A.True m }
|
||||||
<|> do { m <- md; sFALSE; return $ A.False m }
|
<|> do { m <- md; sFALSE; return $ A.False m }
|
||||||
<?> "operand other than table'"
|
<|> table
|
||||||
|
<?> "operand"
|
||||||
--}}}
|
--}}}
|
||||||
--{{{ variables, channels, timers, ports
|
--{{{ variables, channels, timers, ports
|
||||||
variable :: OccParser A.Variable
|
variable :: OccParser A.Variable
|
||||||
|
|
|
@ -3,10 +3,7 @@ Bugs in the ordered syntax in the occam2.1 manual
|
||||||
|
|
||||||
-- Things I've worked around in Parse.hs
|
-- Things I've worked around in Parse.hs
|
||||||
|
|
||||||
x[y] is ambiguous -- fixed by splitting operand into a version that permits
|
"x[y]" and "x ! y" are both ambiguous unless you have an idea of what x is.
|
||||||
tables and a version that doesn't.
|
|
||||||
|
|
||||||
x ! y is ambiguous.
|
|
||||||
|
|
||||||
"SIZE cs" where cs is an array of channels isn't allowed.
|
"SIZE cs" where cs is an array of channels isn't allowed.
|
||||||
|
|
||||||
|
|
16
fco2/testcases/lit-slice.occ
Normal file
16
fco2/testcases/lit-slice.occ
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
-- from cgtest07
|
||||||
|
PROC P ()
|
||||||
|
BYTE b:
|
||||||
|
[1]BYTE bs:
|
||||||
|
INT n:
|
||||||
|
SEQ
|
||||||
|
-- With extra brackets...
|
||||||
|
ASSERT ((INT 'e') = (INT ("Hello"[INT ([BYTE 10, BYTE 10, BYTE 1][42 \ 10])])))
|
||||||
|
-- Bits of it
|
||||||
|
b := BYTE 10
|
||||||
|
bs := [BYTE 10]
|
||||||
|
-- But this triggers the operandNotTable problem
|
||||||
|
n := INT [BYTE 10][0]
|
||||||
|
-- As it appeared (in occam2.1-legal form) in the cgtest
|
||||||
|
ASSERT ((INT 'e') = (INT ("Hello"[INT [BYTE 10, BYTE 10, BYTE 1][42 \ 10]])))
|
||||||
|
:
|
7
fco2/testcases/pri-par.occ
Normal file
7
fco2/testcases/pri-par.occ
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
PROC P ()
|
||||||
|
PRI PAR
|
||||||
|
SKIP
|
||||||
|
SKIP
|
||||||
|
SKIP
|
||||||
|
SKIP
|
||||||
|
:
|
Loading…
Reference in New Issue
Block a user