diff options
Diffstat (limited to 'lib/qparser')
-rw-r--r-- | lib/qparser/analyzer.ml | 1 | ||||
-rw-r--r-- | lib/qparser/parser.mly | 15 | ||||
-rw-r--r-- | lib/qparser/qsp_instruction.mly | 14 |
3 files changed, 14 insertions, 16 deletions
diff --git a/lib/qparser/analyzer.ml b/lib/qparser/analyzer.ml index 06960f6..58a117f 100644 --- a/lib/qparser/analyzer.ml +++ b/lib/qparser/analyzer.ml @@ -36,7 +36,6 @@ let parse : in evaluation - |> Result.map (fun e -> e []) |> Result.map_error (fun e -> let message = match e.IncrementalParser.code with diff --git a/lib/qparser/parser.mly b/lib/qparser/parser.mly index d84e534..81b630a 100644 --- a/lib/qparser/parser.mly +++ b/lib/qparser/parser.mly @@ -5,21 +5,20 @@ type action_block = { loc : Qsp_syntax.S.pos ; expression : - Analyzer.Expression.t' * Qsp_syntax.Report.t list - ; body : Analyzer.Instruction.t Qsp_syntax.S.repr list + Analyzer.Expression.t' + ; body : Analyzer.Instruction.t list ; pos : Qsp_syntax.S.pos ; clauses : ( ( (Analyzer.Instruction.expression, Analyzer.Instruction.t) Qsp_syntax.S.clause list - * (Qsp_syntax.S.pos *Analyzer.Instruction.t Qsp_syntax.S.repr list) option + * (Qsp_syntax.S.pos * Analyzer.Instruction.t list) option ) option ) } module Helper = Qsp_syntax.S.Helper(Analyzer.Expression) - module HelperI = Qsp_syntax.S.Helper(Analyzer.Instruction) %} %parameter<Analyzer: Qsp_syntax.S.Analyzer> -%start <(Analyzer.Location.t * Qsp_syntax.Report.t list) Qsp_syntax.S.repr>main +%start <(Analyzer.Location.t * Qsp_syntax.Report.t list)>main %on_error_reduce expression instruction unary_operator assignation_operator %% @@ -31,7 +30,7 @@ main: instructions = line_statement* LOCATION_END { - let instructions = List.map instructions ~f:(HelperI.v) in + let instructions = List.map instructions ~f:(Analyzer.Instruction.v) in Analyzer.Location.location $loc instructions } @@ -75,7 +74,7 @@ line_statement: END TOKEN? line_sep { - let expression = Helper.v' e in + let expression = Analyzer.Expression.v e in let clauses = match b with | None -> None | Some (elifs, clauses) -> @@ -84,7 +83,7 @@ line_statement: | _ -> List.map elifs ~f:(fun ((pos:Qsp_syntax.S.pos), e, instructions) -> - let e = Helper.v' e in + let e = Analyzer.Expression.v e in (pos, e, instructions) ) diff --git a/lib/qparser/qsp_instruction.mly b/lib/qparser/qsp_instruction.mly index e8f5a77..b7d2558 100644 --- a/lib/qparser/qsp_instruction.mly +++ b/lib/qparser/qsp_instruction.mly @@ -18,7 +18,7 @@ argument(X): %public inline_action: | a = onliner(ACT) { let loc, label, statements, _, _ = a in - let label = Helper.v' label in + let label = Analyzer.Expression.v label in Analyzer.Instruction.act loc ~label statements } | a = onliner(IF) @@ -30,7 +30,7 @@ argument(X): | Some instructions -> Some ($loc(else_opt), [ instructions ]) in Analyzer.Instruction.if_ loc - (loc_s, Helper.v' expr, statements) + (loc_s, Analyzer.Expression.v expr, statements) ~elifs ~else_ } @@ -42,21 +42,21 @@ argument(X): Analyzer.Instruction.if_ loc - (loc_s, Helper.v' expr, statements) + (loc_s, Analyzer.Expression.v expr, statements) ~elifs ~else_ } single_instruction: | expr = expression { - let expr = Helper.v' expr in + let expr = Analyzer.Expression.v expr in Analyzer.Instruction.expression expr } | e = let_assignation { e } | k = keyword args = argument(expression) { - let args = List.map args ~f:(Helper.v') in + let args = List.map args ~f:(Analyzer.Expression.v) in Analyzer.Instruction.call $loc k args } @@ -69,8 +69,8 @@ let_assignation: op = assignation_operator value = expression { - let variable = Helper.variable' variable - and value = Helper.v' value in + let variable = Helper.variable variable + and value = Analyzer.Expression.v value in Analyzer.Instruction.assign $loc variable op value } |