diff options
Diffstat (limited to 'lib/qparser/qsp_instruction.mly')
-rw-r--r-- | lib/qparser/qsp_instruction.mly | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/qparser/qsp_instruction.mly b/lib/qparser/qsp_instruction.mly index fe8a51a..8272cff 100644 --- a/lib/qparser/qsp_instruction.mly +++ b/lib/qparser/qsp_instruction.mly @@ -25,7 +25,9 @@ argument(X): else_opt = preceded(ELSE, instruction)? { let loc, expr, statements, loc_s, _body = a in let elifs = [] - and else_ = Option.to_list else_opt in + and else_ = match else_opt with + | None -> None + | Some instructions -> Some ($loc(else_opt), [ instructions ]) in Analyzer.Instruction.if_ loc (loc_s, Helper.v expr, statements) @@ -33,10 +35,10 @@ argument(X): ~else_ } | a = onliner(IF) - else_= preceded(ELSE, inline_action) + else_ = preceded(ELSE, inline_action) { let loc, expr, statements, loc_s, _body = a in let elifs = [] - and else_ = [ else_ ] in + and else_ = Some ($loc(else_), [ else_ ]) in Analyzer.Instruction.if_ loc |