aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChimrod <>2023-10-05 21:29:52 +0200
committerChimrod <>2023-10-05 21:29:52 +0200
commit40f4dbe7844725e0ab07f03f25c35f55b4699b46 (patch)
tree4b5750edaa5417a262121de2633f12e57988a73d
parent002ec21cce78961fe5a74c8b51dae0dd55aa4457 (diff)
Two new error messages
-rw-r--r--lib/expression_parser.messages52
-rw-r--r--test/syntax_error.ml22
2 files changed, 22 insertions, 52 deletions
diff --git a/lib/expression_parser.messages b/lib/expression_parser.messages
index c9ee7b0..a493067 100644
--- a/lib/expression_parser.messages
+++ b/lib/expression_parser.messages
@@ -81,32 +81,6 @@ main: LOCATION_START EOL COLUMN STAR
A location is expected after ':' not an expression
main: LOCATION_START EOL ACT INTEGER SET
-##
-## Ends in an error in state: 98.
-##
-## expression -> expression . EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . LT GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . EXCLAMATION expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . PLUS expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . MINUS expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . STAR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . DIV expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . MOD expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . AND expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . GT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . LT EQUAL expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . EQUAL GT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . EQUAL LT expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## expression -> expression . OR expression [ STAR PLUS OR MOD MINUS LT GT EXCLAMATION EQUAL DIV COLUMN AND ]
-## line_statement -> ACT expression . COLUMN nonempty_list(EOL) list(line_statement) empty_body END option(ACT) nonempty_list(EOL) [ STAR SET PLUS OBJ NO MINUS L_PAREN LOCATION_END LITERAL LET KEYWORD INTEGER IF IDENT FUNCTION END ELSE ELIF COMMENT COLUMN ACT ]
-## line_statement -> ACT expression . COLUMN nonempty_list(EOL) list(line_statement) empty_body END option(ACT) nonempty_list(AMPERSAND) list(EOL) [ STAR SET PLUS OBJ NO MINUS L_PAREN LOCATION_END LITERAL LET KEYWORD INTEGER IF IDENT FUNCTION END ELSE ELIF COMMENT COLUMN ACT ]
-## onliner(ACT) -> ACT expression . COLUMN final_inline_instruction [ EOL AMPERSAND ]
-##
-## The known suffix of the stack is as follows:
-## ACT expression
-##
Invalid `ACT` label. You probably missed a ':'
@@ -324,29 +298,7 @@ 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
-##
+main: LOCATION_START EOL SET IDENT DECR INTEGER SET
+main: LOCATION_START EOL LET IDENT DECR INTEGER SET
Missing separator between instructions
diff --git a/test/syntax_error.ml b/test/syntax_error.ml
index 2ca615f..ee39001 100644
--- a/test/syntax_error.ml
+++ b/test/syntax_error.ml
@@ -75,7 +75,7 @@ let act_no_column () =
message = "Invalid `ACT` label. You probably missed a ':'";
}
-let missing_ampersand () =
+let missing_ampersand_1 () =
_test_instruction "b = 1 a = 2"
{
level = Error;
@@ -83,6 +83,22 @@ let missing_ampersand () =
message = "Missing separator between instructions";
}
+let missing_ampersand_2 () =
+ _test_instruction "let b = 1 a = 2"
+ {
+ level = Error;
+ loc = _position;
+ message = "Missing separator between instructions";
+ }
+
+let missing_ampersand_3 () =
+ _test_instruction "set b = 1 a = 2"
+ {
+ level = Error;
+ loc = _position;
+ message = "Missing separator between instructions";
+ }
+
let test =
( "Syntax Errors",
[
@@ -90,5 +106,7 @@ 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;
+ Alcotest.test_case "no &" `Quick missing_ampersand_1;
+ Alcotest.test_case "no &" `Quick missing_ampersand_2;
+ Alcotest.test_case "no &" `Quick missing_ampersand_3;
] )