| @@ -19,9 +19,9 @@ class TestStandalone(TestCase): | |||||
| def setUp(self): | def setUp(self): | ||||
| pass | pass | ||||
| def _create_standalone(self, grammar): | |||||
| def _create_standalone(self, grammar, compress=False): | |||||
| code_buf = StringIO() | code_buf = StringIO() | ||||
| standalone.gen_standalone(Lark(grammar, parser='lalr'), out=code_buf) | |||||
| standalone.gen_standalone(Lark(grammar, parser='lalr'), out=code_buf, compress=compress) | |||||
| code = code_buf.getvalue() | code = code_buf.getvalue() | ||||
| context = {'__doc__': None} | context = {'__doc__': None} | ||||
| @@ -52,6 +52,11 @@ class TestStandalone(TestCase): | |||||
| self.assertRaises(context['UnexpectedToken'], l.parse, 'twelve') | self.assertRaises(context['UnexpectedToken'], l.parse, 'twelve') | ||||
| self.assertRaises(context['UnexpectedCharacters'], l.parse, '$ talks') | self.assertRaises(context['UnexpectedCharacters'], l.parse, '$ talks') | ||||
| context = self._create_standalone(grammar, compress=True) | |||||
| _Lark = context['Lark_StandAlone'] | |||||
| l = _Lark() | |||||
| x = l.parse('12 elephants') | |||||
| def test_contextual(self): | def test_contextual(self): | ||||
| grammar = """ | grammar = """ | ||||
| start: a b | start: a b | ||||