aboutsummaryrefslogtreecommitdiff
path: root/lib/parser.mly
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parser.mly')
-rw-r--r--lib/parser.mly11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/parser.mly b/lib/parser.mly
index 353aaab..a0a45e6 100644
--- a/lib/parser.mly
+++ b/lib/parser.mly
@@ -5,19 +5,24 @@
%parameter<Analyzer: Qsp_syntax.S.Analyzer>
%start <Analyzer.Location.repr>main
+%on_error_reduce expression instruction
%%
main:
- | EOL*
- LOCATION_START
+ | before_location*
+ LOCATION_START
EOL+
expressions = line_statement*
- LOCATION_END
+ LOCATION_END
{
Analyzer.Location.location $loc expressions
}
+before_location:
+ | EOL {}
+ | COMMENT EOL { }
+
(* All these statement should terminate with EOL *)
line_statement:
| COMMENT EOL+ { Analyzer.Instruction.comment $loc }