Rework (but don't yet fix) formalArgSet
This commit is contained in:
parent
200619042d
commit
3d897a70fd
|
@ -1437,20 +1437,19 @@ formalList
|
||||||
return $ concat fs
|
return $ concat fs
|
||||||
<?> "formal list"
|
<?> "formal list"
|
||||||
|
|
||||||
|
formalItem :: OccParser (A.AbbrevMode, A.Type) -> OccParser A.Name -> OccParser [A.Formal]
|
||||||
|
formalItem spec name
|
||||||
|
= do (am, t) <- spec
|
||||||
|
ns <- sepBy1NE name sComma
|
||||||
|
return [A.Formal am t n | n <- ns]
|
||||||
|
|
||||||
formalArgSet :: OccParser [A.Formal]
|
formalArgSet :: OccParser [A.Formal]
|
||||||
formalArgSet
|
formalArgSet
|
||||||
= do (am, t) <- formalVariableType
|
= formalItem formalVariableType newVariableName
|
||||||
ns <- sepBy1NE newVariableName sComma
|
<|> formalItem (aa channelSpecifier) newChannelName
|
||||||
return [A.Formal am t n | n <- ns]
|
<|> formalItem (aa timerSpecifier) newTimerName
|
||||||
<|> do t <- channelSpecifier
|
<|> formalItem (aa portSpecifier) newPortName
|
||||||
ns <- sepBy1NE newChannelName sComma
|
where aa = liftM (\t -> (A.Abbrev, t))
|
||||||
return [A.Formal A.Abbrev t n | n <- ns]
|
|
||||||
<|> do t <- timerSpecifier
|
|
||||||
ns <- sepBy1NE newTimerName sComma
|
|
||||||
return [A.Formal A.Abbrev t n | n <- ns]
|
|
||||||
<|> do t <- portSpecifier
|
|
||||||
ns <- sepBy1NE newPortName sComma
|
|
||||||
return [A.Formal A.Abbrev t n | n <- ns]
|
|
||||||
|
|
||||||
formalVariableType :: OccParser (A.AbbrevMode, A.Type)
|
formalVariableType :: OccParser (A.AbbrevMode, A.Type)
|
||||||
formalVariableType
|
formalVariableType
|
||||||
|
|
16
fco2/testcases/datatype-formals.occ
Normal file
16
fco2/testcases/datatype-formals.occ
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
DATA TYPE MYINT IS INT:
|
||||||
|
-- This next line falls in the category of awkward things to parse.
|
||||||
|
-- The problem is that:
|
||||||
|
-- PROC copy.MYINT (VAL MYINT x, MYINT)
|
||||||
|
-- would be a perfectly legal (if silly) thing to say, so we have to make
|
||||||
|
-- sure we try this interpretation first:
|
||||||
|
PROC copy.MYINT (VAL MYINT x, MYINT y)
|
||||||
|
y := x
|
||||||
|
:
|
||||||
|
PROC P ()
|
||||||
|
MYINT a, b:
|
||||||
|
SEQ
|
||||||
|
a := 42
|
||||||
|
copy.MYINT (a, b)
|
||||||
|
ASSERT (b = 42)
|
||||||
|
:
|
Loading…
Reference in New Issue
Block a user