Пример #1
0
 def test_no_flatten_or(self):
     matcher = Or('a', Join(Or('b', 'c')))
     matcher.config.clear().flatten()
     parser = matcher.get_parse()
     text = str(parser.matcher)
     assert text == "Or(Literal, Transform)", text
     result = parser('abcd')
     assert result == ['a'], result
Пример #2
0
 def test_nfa(self):
     first = Join(UnsignedFloat(), Any('eE'), SignedInteger())
     second = UnsignedFloat()
     all = Or(first, second)
     all.config.clear().compile_to_nfa()
     m = all.get_parse()
Пример #3
0
 def test_nfa(self):
     first = Join(UnsignedFloat(), Any('eE'), SignedInteger())
     second = UnsignedFloat()
     all = Or(first, second)
     all.config.clear().compile_to_nfa()
     m = all.get_parse()