diff --git a/fco2/Parse.hs b/fco2/Parse.hs index 14bc411..a79d215 100644 --- a/fco2/Parse.hs +++ b/fco2/Parse.hs @@ -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 diff --git a/fco2/testcases/ats1-q7.occ b/fco2/testcases/ats1-q7.occ index e824a75..f6fcd87 100644 --- a/fco2/testcases/ats1-q7.occ +++ b/fco2/testcases/ats1-q7.occ @@ -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 diff --git a/fco2/testcases/incase.occ b/fco2/testcases/incase.occ new file mode 100644 index 0000000..f0ddd55 --- /dev/null +++ b/fco2/testcases/incase.occ @@ -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 +: