diff options
author | Chimrod <> | 2024-12-14 23:06:12 +0100 |
---|---|---|
committer | Chimrod <> | 2025-01-03 15:05:00 +0100 |
commit | 75f3eabb46eded01460f7700a75d094100047438 (patch) | |
tree | 4dcee7d2fc9310ff41776d9df8986f5efa0db229 /lib/qparser/parser.mly | |
parent | 289dc576624d4233116806e566bb791fee1de178 (diff) |
Diffstat (limited to 'lib/qparser/parser.mly')
-rw-r--r-- | lib/qparser/parser.mly | 19 |
1 files changed, 18 insertions, 1 deletions
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<Analyzer: Qsp_syntax.S.Analyzer> %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 { } |