From 166ffdefbcf55ddc709ab2ab197c83af51236e05 Mon Sep 17 00:00:00 2001 From: Chimrod <> Date: Mon, 24 Mar 2025 15:01:18 +0100 Subject: Added a new specific error message --- lib/qparser/expression_parser.messages | 4 ++++ test/syntax_error.ml | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/lib/qparser/expression_parser.messages b/lib/qparser/expression_parser.messages index 2ba26fc..22ffd7d 100644 --- a/lib/qparser/expression_parser.messages +++ b/lib/qparser/expression_parser.messages @@ -116,3 +116,7 @@ dynamics: IDENT R_PAREN dynamics: TEXT_MARKER ENTER_EMBED FUNCTION_NOARGS TEXT_MARKER Unbalanced paren + +dynamics: IDENT PLUS FUNCTION_NOARGS TEXT_MARKER + + Missing operator before text diff --git a/test/syntax_error.ml b/test/syntax_error.ml index 99f324a..9d51cf3 100644 --- a/test/syntax_error.ml +++ b/test/syntax_error.ml @@ -284,6 +284,12 @@ let unexpected_bracket () = _test_instruction {|"<>"|} expected; _test_instruction "'<>'" expected +let missing_operator () = + _test_instruction {| +'' + $func('f', '') '' +|} + { level = Error; loc = _position; message = "Missing operator before text" } + let test = ( "Syntax Errors", [ @@ -308,4 +314,5 @@ let test = Alcotest.test_case "+ =" `Quick unknown_operator; Alcotest.test_case "'<<''>>'" `Quick nested_string_mess; Alcotest.test_case "a[]]" `Quick unexpected_bracket; + Alcotest.test_case "Missing +" `Quick missing_operator; ] ) -- cgit v1.2.3