Commit earlier on ? CASE

This commit is contained in:
Adam Sampson 2007-04-05 18:02:40 +00:00
parent 667731f892
commit fc1eee669c
3 changed files with 26 additions and 2 deletions

View File

@ -831,7 +831,7 @@ process :: OccParser A.Process
process
= try assignment
<|> try inputProcess
<|> try caseInput
<|> caseInput
<|> output
<|> do { m <- md; sSKIP; eol; return $ A.Skip m }
<|> do { m <- md; sSTOP; eol; return $ A.Stop m }
@ -903,7 +903,12 @@ inputItem
--{{{ variant input (? CASE)
caseInput :: OccParser A.Process
caseInput
= do { m <- md; c <- channel; sQuest; sCASE; eol; indent; vs <- many1 variant; outdent; return $ A.Input m c (A.InputCase m (A.Several m vs)) }
= do m <- md
c <- try (do { c <- channel; sQuest; sCASE; eol; return c })
indent
vs <- many1 variant
outdent
return $ A.Input m c (A.InputCase m (A.Several m vs))
<?> "caseInput"
variant :: OccParser A.Structured

View File

@ -7,6 +7,7 @@
--#INCLUDE "consts.inc"
--#USE "course.lib"
VAL BYTE ESCAPE IS 27:
VAL BYTE FLUSH IS 255:
PROC out.int (VAL INT n, w, CHAN OF BYTE out)
STOP
:
@ -20,6 +21,9 @@ PROC make.string ([]BYTE dest, VAL INT len)
PROC erase.screen (CHAN OF BYTE out)
STOP
:
PROC goto.x.y (VAL INT x, y, CHAN OF BYTE out)
STOP
:
--}}}
--{{{ Constants

15
fco2/testcases/incase.occ Normal file
View File

@ -0,0 +1,15 @@
PROTOCOL PROTO
CASE
foo
bar
:
VAL INT max.graphic IS 10:
PROC P ()
CHAN OF PROTO c:
c ? CASE
[max.graphic]INT x:
foo
SKIP
bar
STOP
: