diff options
-rw-r--r-- | Sil/Parse.icl | 10 | ||||
-rw-r--r-- | test.sil | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/Sil/Parse.icl b/Sil/Parse.icl index a9d733d..5c13c48 100644 --- a/Sil/Parse.icl +++ b/Sil/Parse.icl @@ -104,16 +104,16 @@ function = } codeblock :: Parser Token CodeBlock -codeblock = many initialisation >>= \i -> +codeblock = many initialisation >>= \is -> many statement >>= \s -> - pure {cb_init=i, cb_content=s} + pure {cb_init=flatten is, cb_content=s} -initialisation :: Parser Token Initialisation +initialisation :: Parser Token [Initialisation] initialisation = type >>= \t -> - name >>= \n -> + seplist TComma name >>= \ns -> item TSemicolon >>= \_ -> - pure {init_type=t, init_name=n} + pure [{init_type=t, init_name=n} \\ n <- ns] statement :: Parser Token Statement statement = (declaration @@ -1,8 +1,8 @@ Int second(Int x, Int y) { - Int z; - z := x; + Int a, b; + a := x; x := y; - y := z; + y := a; return y; } |