aboutsummaryrefslogtreecommitdiff
path: root/lib/parser.mly
diff options
context:
space:
mode:
authorChimrod <>2023-09-28 14:34:11 +0200
committerChimrod <>2023-09-29 10:00:21 +0200
commit93355b06a8270f02d345bdbe7b6a8c1bea9789bb (patch)
tree486b89672215278d7ff1a25a853ab25e1c8d2a38 /lib/parser.mly
parent4efc1d21441c5e9ad7f24a3e473bbbd8025de124 (diff)
Reduced the number of error messages
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 }