From a169f0b35467e586610042a307cf51fe6d12b01e Mon Sep 17 00:00:00 2001 From: Erez Sh Date: Tue, 16 Feb 2021 09:41:07 -0500 Subject: [PATCH] Better error messages --- lark/load_grammar.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lark/load_grammar.py b/lark/load_grammar.py index c6fbea6..b633a96 100644 --- a/lark/load_grammar.py +++ b/lark/load_grammar.py @@ -814,6 +814,7 @@ def _get_parser(): return _get_parser.cache GRAMMAR_ERRORS = [ + ('Incorrect type of value', ['a: 1\n']), ('Unclosed parenthesis', ['a: (\n']), ('Unmatched closing parenthesis', ['a: )\n', 'a: [)\n', 'a: (]\n']), ('Expecting rule or terminal definition (missing colon)', ['a\n', 'A\n', 'a->\n', 'A->\n', 'a A\n']), @@ -823,6 +824,7 @@ GRAMMAR_ERRORS = [ ('Misplaced operator', ['a: b??', 'a: b(?)', 'a:+\n', 'a:?\n', 'a:*\n', 'a:|*\n']), ('Expecting option ("|") or a new rule or terminal definition', ['a:a\n()\n']), ('Terminal names cannot contain dots', ['A.B\n']), + ('Expecting rule or terminal definition', ['"a"\n']), ('%import expects a name', ['%import "a"\n']), ('%ignore expects a value', ['%ignore %import\n']), ]