aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChimrod <>2023-10-17 19:49:48 +0200
committerChimrod <>2023-10-18 11:19:35 +0200
commit736456d9952c1d58008f4ca5755913dfff7a32b8 (patch)
tree11d5d06db99d0e0eb1b092036586cf88eeb09997
parentee2cddf734b66fa39a8ad7aa3662f22bbc62cf47 (diff)
New message for error
-rw-r--r--lib/qparser/expression_parser.messages4
-rw-r--r--test/syntax_error.ml13
2 files changed, 16 insertions, 1 deletions
diff --git a/lib/qparser/expression_parser.messages b/lib/qparser/expression_parser.messages
index eb13846..4f99943 100644
--- a/lib/qparser/expression_parser.messages
+++ b/lib/qparser/expression_parser.messages
@@ -307,3 +307,7 @@ main: LOCATION_START EOL IF STAR
main: LOCATION_START EOL IDENT DECR STAR
Missing operand
+
+main: LOCATION_START EOL IF IDENT COLUMN EOL ELIF IDENT COLUMN STAR
+
+Mix between IF block and inline ELIF
diff --git a/test/syntax_error.ml b/test/syntax_error.ml
index d395dba..6c28f0f 100644
--- a/test/syntax_error.ml
+++ b/test/syntax_error.ml
@@ -1,4 +1,3 @@
-module Parser = Qparser.Parser.Make (Qsp_syntax.Tree)
module Ast = Qsp_syntax.Tree.Ast
module S = Qsp_syntax.S
@@ -109,6 +108,17 @@ let unknow_function () =
_test_instruction "a = ran(1, 2)"
{ level = Error; loc = _position; message = "Unexpected expression here." }
+let inline_elif () =
+ _test_instruction {|
+ if a = 1:
+ elseif a = 1: a = 1
+ end|}
+ {
+ level = Error;
+ loc = _position;
+ message = "Mix between IF block and inline ELIF";
+ }
+
let test =
( "Syntax Errors",
[
@@ -121,4 +131,5 @@ let test =
Alcotest.test_case "Syntax error $" `Quick syntax_error;
Alcotest.test_case "Missing operand" `Quick missing_operand;
Alcotest.test_case "Unknown function" `Quick unknow_function;
+ Alcotest.test_case "Inline elif" `Quick inline_elif;
] )