From 75f3eabb46eded01460f7700a75d094100047438 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Sat, 14 Dec 2024 23:06:12 +0100 Subject: Added dynamic check mecanism --- lib/qparser/parser.mly | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/qparser/parser.mly') diff --git a/lib/qparser/parser.mly b/lib/qparser/parser.mly index d075e3e..469cf79 100644 --- a/lib/qparser/parser.mly +++ b/lib/qparser/parser.mly @@ -19,11 +19,13 @@ %parameter %start <(Analyzer.context -> Analyzer.Location.t)>main +%start<(Analyzer.context -> Analyzer.Location.t)>dynamics + %on_error_reduce expression instruction unary_operator assignation_operator %% -main: +main: | before_location* start_location EOL+ @@ -34,6 +36,21 @@ main: fun context -> Analyzer.Location.location context $loc instructions } +dynamics: + | EOL* + instructions = line_statement+ + EOF + { + let instructions = List.map instructions ~f:(Analyzer.Instruction.v) in + fun context -> Analyzer.Location.location context $loc instructions + } + | EOL* + b = inlined_block(EOF) + { + let instruction = (Analyzer.Instruction.v b) in + fun context -> Analyzer.Location.location context $loc [instruction] + } + before_location: | EOL {} | COMMENT EOL { } -- cgit v1.2.3