aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/expression_parser.messages28
-rw-r--r--lib/parser.mly2
-rw-r--r--test/syntax_error.ml9
3 files changed, 38 insertions, 1 deletions
diff --git a/lib/expression_parser.messages b/lib/expression_parser.messages
index 2bdf477..c9ee7b0 100644
--- a/lib/expression_parser.messages
+++ b/lib/expression_parser.messages
@@ -322,3 +322,31 @@ main: LOCATION_START EOL IF IDENT COLUMN EOL ELSE STAR
##
Unexpected operator after `ELSE`
+
+main: LOCATION_START EOL IDENT DECR INTEGER SET
+##
+## Ends in an error in state: 103.
+##
+## expression -> expression . EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . LT GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . EXCLAMATION expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . PLUS expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . MINUS expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . STAR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . DIV expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL EOL ELSE DIV AND AMPERSAND ]
+## let_assignation -> variable assignation_operator expression . [ EOL ELSE AMPERSAND ]
+##
+## The known suffix of the stack is as follows:
+## variable assignation_operator expression
+##
+
+Missing separator between instructions
diff --git a/lib/parser.mly b/lib/parser.mly
index 9b5297c..84c1af8 100644
--- a/lib/parser.mly
+++ b/lib/parser.mly
@@ -5,7 +5,7 @@
%parameter<Analyzer: Qsp_syntax.S.Analyzer>
%start <Analyzer.Location.repr>main
-%on_error_reduce expression instruction binary_operator unary_operator
+%on_error_reduce expression instruction unary_operator assignation_operator
%%
diff --git a/test/syntax_error.ml b/test/syntax_error.ml
index b907bc7..2ca615f 100644
--- a/test/syntax_error.ml
+++ b/test/syntax_error.ml
@@ -75,6 +75,14 @@ let act_no_column () =
message = "Invalid `ACT` label. You probably missed a ':'";
}
+let missing_ampersand () =
+ _test_instruction "b = 1 a = 2"
+ {
+ level = Error;
+ loc = _position;
+ message = "Missing separator between instructions";
+ }
+
let test =
( "Syntax Errors",
[
@@ -82,4 +90,5 @@ let test =
Alcotest.test_case "elseif" `Quick elseif_no_column;
Alcotest.test_case "(1" `Quick unclosed_paren;
Alcotest.test_case "act 1" `Quick act_no_column;
+ Alcotest.test_case "no &" `Quick missing_ampersand;
] )