diff options
Diffstat (limited to 'Sil/Parse.icl')
-rw-r--r-- | Sil/Parse.icl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Sil/Parse.icl b/Sil/Parse.icl index 4d4b5eb..d5c97ef 100644 --- a/Sil/Parse.icl +++ b/Sil/Parse.icl @@ -137,9 +137,14 @@ codeblock = many initialisation >>= \is -> initialisation :: Parser Token [Initialisation] initialisation = type >>= \t -> - seplist TComma name >>= \ns -> + seplist TComma init >>= \nvs -> item TSemicolon $> - [{init_type=t, init_name=n} \\ n <- ns] + [{init_type=t, init_name=n, init_value=v} \\ (n,v) <- nvs] +where + init = + name >>= \n -> + optional (item TAssign *> expression) >>= \v -> + pure (n,v) statement :: Parser Token Statement statement = declaration |