diff options
author | Chimrod <> | 2024-08-08 10:20:24 +0200 |
---|---|---|
committer | Chimrod <> | 2024-08-12 21:35:00 +0200 |
commit | 692d66ba7eb0ff55a46b68601b7cd81f825653cb (patch) | |
tree | a84409684c912c8c49dc49e3225b70f313c41c39 /lib/qparser/qsp_instruction.mly | |
parent | 976f80ed226e53625cd807539b9336f52f6eb091 (diff) |
Created a dedicated file for the single line instruction
Diffstat (limited to 'lib/qparser/qsp_instruction.mly')
-rw-r--r-- | lib/qparser/qsp_instruction.mly | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/lib/qparser/qsp_instruction.mly b/lib/qparser/qsp_instruction.mly index ddcbb8d..d757ab9 100644 --- a/lib/qparser/qsp_instruction.mly +++ b/lib/qparser/qsp_instruction.mly @@ -12,41 +12,6 @@ argument(X): (** At the opposite of an expression, an instruction does not return anything. *) %public instruction: - | s = single_instruction { s } - -(** Action like act or if in a single line *) -%public inline_action: - | a = onliner(ACT) - { let loc, label, statements, _, _ = a in - let label = Analyzer.Expression.v label in - Analyzer.Instruction.act loc ~label statements - } - | a = onliner(IF) - else_opt = preceded(ELSE, instruction)? - { let loc, expr, statements, loc_s, _body = a in - let elifs = [] - and else_ = match else_opt with - | None -> None - | Some instructions -> Some ($loc(else_opt), [ instructions ]) in - Analyzer.Instruction.if_ - loc - (loc_s, Analyzer.Expression.v expr, statements) - ~elifs - ~else_ - } - | a = onliner(IF) - else_ = preceded(ELSE, inline_action) - { let loc, expr, statements, loc_s, _body = a in - let elifs = [] - and else_ = Some ($loc(else_), [ else_ ]) in - - Analyzer.Instruction.if_ - loc - (loc_s, Analyzer.Expression.v expr, statements) - ~elifs - ~else_ - } -single_instruction: | expr = expression { let expr = Analyzer.Expression.v expr in @@ -86,30 +51,3 @@ assignation_operator: | DECR { T.Decr } | MULT_EQUAL { T.Mult } | DIV_EQUAL { T.Div_assign } - -inline_instruction: - | hd = inline_instruction - tl = single_instruction - AMPERSAND+ - { tl :: hd } - | - { [] } - -final_inline_instruction: - | hd = inline_instruction - tl = instruction - | hd = inline_instruction - tl = inline_action - { tl :: hd } - | hd = inline_instruction - COMMENT - { (Analyzer.Instruction.comment $loc) :: hd } - | hd = inline_instruction - { hd } - -onliner(TOKEN): - | TOKEN - e = expression - COLUMN - s = rev (final_inline_instruction) - { $loc, e, s, $loc(s), None } |