From 86fd78a5ab65015a9c18ad601856f1b16ed90fa9 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Fri, 19 Jan 2024 11:55:15 +0100 Subject: Wait to get a valid syntax before considering a new location --- lib/qparser/parser.mly | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/qparser/parser.mly') diff --git a/lib/qparser/parser.mly b/lib/qparser/parser.mly index 73d77b7..6fc9b8f 100644 --- a/lib/qparser/parser.mly +++ b/lib/qparser/parser.mly @@ -25,7 +25,7 @@ main: | before_location* - LOCATION_START + start_location EOL+ instructions = line_statement* LOCATION_END @@ -38,6 +38,13 @@ before_location: | EOL {} | COMMENT EOL { } +(* Defer the registration here, and ensure we get a valid rule. *) +start_location: + | l = LOCATION_START + { + ignore (l ()) + } + (* All these statement should terminate with EOL *) line_statement: | COMMENT EOL+ { Analyzer.Instruction.comment $loc } -- cgit v1.2.3