Browse Source

Add test for UTF-8 characters in grammar

tags/gm/2021-09-23T00Z/github.com--lark-parser-lark/0.5.1
Kaspar Emanuel 7 years ago
parent
commit
7d21c754a1
1 changed files with 14 additions and 0 deletions
  1. +14
    -0
      tests/test_parser.py

+ 14
- 0
tests/test_parser.py View File

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import unittest
@@ -53,6 +54,19 @@ class TestParsers(unittest.TestCase):
l = Lark(g, parser='earley', lexer='dynamic')
self.assertRaises(ParseError, l.parse, 'a')

def test_utf8(self):
g = """start: a
a: "±a"
"""
l = Lark(g)
l.parse('±a')

l = Lark(g, parser='earley', lexer=None)
l.parse('±a')

l = Lark(g, parser='earley', lexer='dynamic')
l.parse('±a')


def _make_full_earley_test(LEXER):
class _TestFullEarley(unittest.TestCase):


Loading…
Cancel
Save