예제 #1
0
 def test_any5(self):
     _ = DummyVar('_')
     y = LogicVar('y')
     eq_(
         eval(
             begin(set_text('aaa'), any(char(_), _, y), char(_), eoi,
                   getvalue(y))), ['a', 'a'])
예제 #2
0
 def test_some5(self):
     _ = DummyVar('_')
     y = LogicVar('y')
     eq_(
         eval(
             begin(set_text('abc'), some(char(_), _, y), char(_), eoi,
                   getvalue(y))), ['a', 'b'])
예제 #3
0
 def test_greedy_seplist5(self):
     _ = DummyVar('_')
     y = LogicVar('y')
     assert_raises(
         NoSolution, eval,
         begin(set_text('a,a,a'), greedy_seplist(char(_), char(','), _, y),
               char(_), eoi, getvalue(y)))
예제 #4
0
 def test_greedy_some5(self):
     _ = DummyVar('_')
     y = LogicVar('y')
     assert_raises(
         NoSolution, eval,
         begin(set_text('aaa'), greedy_some(char(_), _, y), char(_), eoi,
               y))
예제 #5
0
 def test_seplist5(self):
     _ = DummyVar('_')
     y = LogicVar('y')
     eq_(
         eval(
             begin(set_text('a,b,cd'), seplist(char(_), char(','), _, y),
                   char(_), eoi, getvalue(y))), ['a', 'b', 'c'])
예제 #6
0
 def test_greedy_some4(self):
     _ = DummyVar('_')
     y = LogicVar('y')
     eq_(
         eval(
             begin(set_text('aaa'), greedy_some(char(_), _, y), eoi,
                   getvalue(y))), ['a', 'a', 'a'])
예제 #7
0
 def test_times4(self):
     _ = DummyVar('_')
     x = LogicVar('x')
     eq_(
         eval(
             begin(set_text('aaa'), times(char(_), 3, _, x), eoi,
                   getvalue(x))), ['a', 'a', 'a'])
예제 #8
0
 def test_kleene2(self):
     f, kleene = MacroVar('f'), MacroVar('kleene')
     _ = DummyVar('_')
     item = Var('item')
     fun = macro((item, ),
                 letrec([(f, macrorules(((), item, f()), ((), nullword)))],
                        f()))
     eq_(eval(let([(kleene, fun)], set_text('ab'), kleene(char(_)))), True)
예제 #9
0
 def test_lazy_seplist5(self):
     _ = DummyVar('_')
     y = LogicVar('y')
     eq_(
         eval(
             begin(set_text('a,a,aa'), lazy_seplist(char(_), char(','), _,
                                                    y), char(_), eoi,
                   getvalue(y))), ['a', 'a', 'a'])
예제 #10
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_kleene1(self):
   f, kleene = MacroVar('f'), MacroVar('kleene')
   item = Var('item')
   fun = macro((item,),  
           letrec([(f, macrorules(
             ((), item, f()),
             ((), nullword)))], 
                f()))
   eq_(eval(let([(kleene, fun)], set_text('aa'), kleene(char('a')))), True)
예제 #11
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_left(self):
   eq_(eval(begin(set_text('ab'), left())), 'ab')
예제 #12
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_times3(self):
   assert_raises(NoSolution, eval,begin(set_text('aa'), times(char('a'), 3)))
예제 #13
0
 def test_left(self):
     eq_(eval(begin(set_text('ab'), left())), 'ab')
예제 #14
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_seplist3(self):
   assert_raises(NoSolution, eval, begin(set_text(''), seplist(char('a'), char(','))))
예제 #15
0
 def test_seplist1(self):
     eq_(eval(begin(set_text('a,a,a'), seplist(char('a'), char(',')), eoi)),
         True)
예제 #16
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_char_eoi(self):
   eq_(eval(begin(set_text('a'), char('a'), eoi)), True)
   assert_raises(NoSolution, eval, begin(set_text('ab'), char('a'), eoi))
예제 #17
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_unify_parse_text(self):
   x = LogicVar('x')
   eq_(eval(begin(set_text('abcde'), unify_parse_text(x), getvalue(x))), 'abcde')
   eq_(eval(begin(set_text('abcde'), unify_parse_text('abcde'))), True)
예제 #18
0
 def test_times2(self):
     eq_(eval(begin(set_text('aaaa'), times(char('a'), 3), char('a'), eoi)),
         True)
예제 #19
0
 def test_subtext(self):
     eq_(eval(begin(set_text('abcde'), subtext(0, 3))), 'abc')
예제 #20
0
 def test_next(self):
     eq_(eval(begin(set_text('ab'), next_char(), next_char())), 'a')
예제 #21
0
 def test_greedy_seplist3(self):
     assert_raises(
         NoSolution, eval,
         begin(set_text('a,a,a'), greedy_seplist(char('a'), char(',')),
               char('a'), eoi))
예제 #22
0
 def test_position(self):
     eq_(eval(begin(set_text('ab'), position())), 0)
예제 #23
0
 def test_greedy_seplist2(self):
     eq_(
         eval(
             begin(set_text('a,a,a'), greedy_seplist(char('a'), char(',')),
                   eoi)), True)
예제 #24
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_subtext(self):
   eq_(eval(begin(set_text('abcde'), subtext(0,3))), 'abc')
예제 #25
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_skip(self):
   eq_(eval(begin(set_text('abcde'), goto(2), next_char())), 'c')
예제 #26
0
 def test_times3(self):
     assert_raises(NoSolution, eval,
                   begin(set_text('aa'), times(char('a'), 3)))
예제 #27
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_step2(self):
   eq_(eval(begin(set_text('ab'), step(), left())), 'b')
예제 #28
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_greedy_seplist2(self):
   eq_(eval(begin(set_text('a,a,a'), greedy_seplist(char('a'), char(',')), eoi)), True)
예제 #29
0
 def test_seplist3(self):
     assert_raises(NoSolution, eval,
                   begin(set_text(''), seplist(char('a'), char(','))))
예제 #30
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_next(self):
   eq_(eval(begin(set_text('ab'), next_char(), next_char())), 'a')
예제 #31
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_seplist1(self):
   eq_(eval(begin(set_text('a,a,a'), seplist(char('a'), char(',')), eoi)), True)
예제 #32
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_greedy_seplist5(self):
   _ = DummyVar('_')
   y = LogicVar('y')
   assert_raises(NoSolution, eval,
                 begin(set_text('a,a,a'), greedy_seplist(char(_), char(','), _, y), char(_), eoi, getvalue(y)))
예제 #33
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_seplist5(self):
   _ = DummyVar('_')
   y = LogicVar('y')
   eq_(eval(begin(set_text('a,b,cd'), seplist(char(_), char(','), _, y), char(_), eoi, getvalue(y))), ['a', 'b', 'c'])
예제 #34
0
 def test_lazy_seplist3(self):
     eq_(
         eval(
             begin(set_text('a,a,aa'), lazy_seplist(char('a'), char(',')),
                   char('a'), eoi)), True)
예제 #35
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_lazy_seplist3(self):
   eq_(eval(begin(set_text('a,a,aa'), lazy_seplist(char('a'), char(',')), char('a'), eoi)), True)
예제 #36
0
 def test_skip(self):
     eq_(eval(begin(set_text('abcde'), skip(3), next())), 'd')
     eq_(eval(begin(set_text('abcde'), skip(4), skip(-2), next())), 'c')
예제 #37
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_greedy_seplist3(self):
   assert_raises(NoSolution, eval, 
                 begin(set_text('a,a,a'), greedy_seplist(char('a'), char(',')), char('a'), eoi))
예제 #38
0
 def test_skip(self):
     eq_(eval(begin(set_text('abcde'), goto(2), next_char())), 'c')
예제 #39
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_greedy_seplist4(self):
   _ = DummyVar('_')
   y = LogicVar('y')
   eq_(eval(begin(set_text('a,a,a'), greedy_seplist(char(_), char(','), _, y), eoi, getvalue(y))), ['a', 'a', 'a'])
예제 #40
0
 def test_goto(self):
     eq_(eval(begin(set_text('abcde'), goto(1))), 'b')
예제 #41
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_times2(self):
   eq_(eval(begin(set_text('aaaa'), times(char('a'), 3), char('a'), eoi)), True)
예제 #42
0
 def test_unify_parse_text(self):
     x = LogicVar('x')
     eq_(eval(begin(set_text('abcde'), unify_parse_text(x), getvalue(x))),
         'abcde')
     eq_(eval(begin(set_text('abcde'), unify_parse_text('abcde'))), True)
예제 #43
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_times4(self):
   _ = DummyVar('_')
   x = LogicVar('x')
   eq_(eval(begin(set_text('aaa'), times(char(_), 3, _, x), eoi, getvalue(x))), ['a', 'a', 'a'])
예제 #44
0
 def test_char(self):
     eq_(eval(begin(set_text('abcde'), char('a'))), 'a')
예제 #45
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_position(self):
   eq_(eval(begin(set_text('ab'), position())), 0)
예제 #46
0
 def test_follew_char(self):
     eq_(eval(begin(set_text('a'), follow(char('a')), char('a'))), 'a')
예제 #47
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_skip(self):
   eq_(eval(begin(set_text('abcde'), skip(3), next())), 'd')
   eq_(eval(begin(set_text('abcde'), skip(4), skip(-2), next())), 'c')
예제 #48
0
 def test_char_eoi(self):
     eq_(eval(begin(set_text('a'), char('a'), eoi)), True)
     assert_raises(NoSolution, eval, begin(set_text('ab'), char('a'), eoi))
예제 #49
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_goto(self):
   eq_(eval(begin(set_text('abcde'), goto(1))), 'b')
예제 #50
0
 def test_any3(self):
     eq_(eval(begin(set_text('aaa'), any(char('a')))), True)
예제 #51
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_char(self):
   eq_(eval(begin(set_text('abcde'), char('a'))), 'a')
예제 #52
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_lazy_any3(self):
   eq_(eval(begin(set_text('aaa'), lazy_any(char('a')), char('a'), eoi)), True)
예제 #53
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_follew_char(self):
   eq_(eval(begin(set_text('a'), follow(char('a')), char('a'))), 'a')
예제 #54
0
파일: testbuiltin.py 프로젝트: chaosim/dao
 def test_repeat(self):
   #return
   # the code below loops for ever, after modifie the behaviour of solver.parse_state and terminals.
   x = LogicVar('x')
   eq_(eval(and_(set_text('123'), repeat, char(x), unify(x, '3'))), True)
예제 #55
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_any3(self):
   eq_(eval(begin(set_text('aaa'), any(char('a')))), True)
예제 #56
0
 def test_step2(self):
     eq_(eval(begin(set_text('ab'), step(), left())), 'b')
예제 #57
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_lazy_any4(self):
   _ = DummyVar('_')
   y = LogicVar('y')
   eq_(eval(begin(set_text('aaa'), lazy_any(char(_), _, y), eoi, getvalue(y))), ['a', 'a', 'a'])
예제 #58
0
 def test_lazy_any1(self):
     eq_(eval(begin(set_text('aaa'), lazy_any(char('a')))), True)
예제 #59
0
파일: testbuiltin.py 프로젝트: chaosim/dao
 def test_repeat2(self):
   #return
   # the code below loops for ever.
   x = LogicVar('x')
   eq_(eval(and_(set_text('123'), repeat, char(x), unify(x, '4'))), True) 
예제 #60
0
파일: testparser.py 프로젝트: chaosim/dao
 def test_greedy_some5(self):
   _ = DummyVar('_')
   y = LogicVar('y')
   assert_raises(NoSolution, eval,
                 begin(set_text('aaa'), greedy_some(char(_), _, y), char(_), eoi, y))