diff options
-rw-r--r-- | lib/qparser/expression_parser.messages | 4 | ||||
-rw-r--r-- | test/syntax_error.ml | 13 |
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; ] ) |