diff options
author | Chimrod <> | 2024-02-05 09:37:27 +0100 |
---|---|---|
committer | Chimrod <> | 2024-02-08 11:45:10 +0100 |
commit | 82c63921c09e2b07d3d5fbf82a912bbe707ffecb (patch) | |
tree | 74cae4200f0405eb2bb2f569d82afd28fe6e2332 | |
parent | e2bcf0a034b9c83b44158d299b2b255d328b17b0 (diff) |
Added a new error message
-rw-r--r-- | lib/qparser/expression_parser.messages | 5 | ||||
-rw-r--r-- | test/syntax_error.ml | 15 |
2 files changed, 20 insertions, 0 deletions
diff --git a/lib/qparser/expression_parser.messages b/lib/qparser/expression_parser.messages index 264e37d..6bf33d9 100644 --- a/lib/qparser/expression_parser.messages +++ b/lib/qparser/expression_parser.messages @@ -36,6 +36,10 @@ main: LOCATION_START EOL IF IDENT COLUMN EOL ELSE EOL LOCATION_END A block starting with `IF` is not closed by `END` If there are nested blocks, the error will points the highest block. +main: LOCATION_START EOL ACT IDENT COLUMN EOL IDENT AMPERSAND LOCATION_END + + A block starting with `ACT` is not closed by `END` + main: LOCATION_START EOL IDENT AMPERSAND END Unexpected `END`. @@ -107,3 +111,4 @@ main: LOCATION_START EOL ACT IDENT COLUMN EOL END TEXT_MARKER main: LOCATION_START EOL FUNCTION L_PAREN IDENT COMA IDENT EOL Unclosed `(` + diff --git a/test/syntax_error.ml b/test/syntax_error.ml index 66f442d..f65042a 100644 --- a/test/syntax_error.ml +++ b/test/syntax_error.ml @@ -234,6 +234,20 @@ iif(1,0,0 + iif(1, 1, 2) |} { level = Error; loc = _position; message = "Unclosed `(`" } +let unclosed_act () = + _test_instruction {| + act 'Smthg': + else + end + end|} + { + level = Error; + loc = _position; + message = + "A block starting with `ACT` is not closed by `END`\n\ + If there are nested blocks, the error will points the highest block."; + } + let test = ( "Syntax Errors", [ @@ -253,4 +267,5 @@ let test = Alcotest.test_case "Location change" `Quick location_change; Alcotest.test_case "Misplaced if" `Quick misplaced_if; Alcotest.test_case "(()" `Quick unclosed_paren2; + Alcotest.test_case "act: else" `Quick unclosed_act; ] ) |