diff --git a/lark/parser_frontends.py b/lark/parser_frontends.py index 0ea3138..c4a6f9b 100644 --- a/lark/parser_frontends.py +++ b/lark/parser_frontends.py @@ -81,7 +81,7 @@ class Earley_NoLex: regexp = t.pattern.to_regexp() width = get_regexp_width(regexp) if width != (1,1): - raise GrammarError('Scanless parsing (lexer=None) requires all tokens to have a width of 1 (terminal %s: %s is %s)' % (sym, regexp, width)) + raise GrammarError('Scanless parsing (lexer=None) requires all tokens to have a width of 1 (terminal %s: %s is %s)' % (t.name, regexp, width)) self.regexps[t.name] = re.compile(regexp) def parse(self, text): diff --git a/tests/test_trees.py b/tests/test_trees.py index 6a8866f..2512c3b 100644 --- a/tests/test_trees.py +++ b/tests/test_trees.py @@ -1,5 +1,6 @@ from __future__ import absolute_import +import unittest from unittest import TestCase import logging import copy