コード例 #1
0
ファイル: testtreewizard.py プロジェクト: 166MMX/antlr3
 def testFindPattern(self):
     wiz = TreeWizard(self.adaptor, self.tokens)
     t = wiz.create("(A B C (A[foo] B[bar]) (D (A[big] B[dog])))")
     subtrees = wiz.find(t, "(A B)")
     found = [str(node) for node in subtrees]
     expecting = ['foo', 'big']
     self.assertEqual(expecting, found)
コード例 #2
0
 def testFindTokenType(self):
     wiz = TreeWizard(self.adaptor, self.tokens)
     t = wiz.create("(A B C (A[foo] B[bar]) (D (A[big] B[dog])))")
     subtrees = wiz.find(t, wiz.getTokenType('A'))
     found = [str(node) for node in subtrees]
     expecting = ['A', 'foo', 'big']
     self.failUnlessEqual(expecting, found)
コード例 #3
0
ファイル: testtreewizard.py プロジェクト: zweib730/antlr3
 def testFindPattern(self):
     wiz = TreeWizard(self.adaptor, self.tokens)
     t = wiz.create("(A B C (A[foo] B[bar]) (D (A[big] B[dog])))")
     subtrees = wiz.find(t, "(A B)")
     found = [str(node) for node in subtrees]
     expecting = ['foo', 'big']
     self.assertEqual(expecting, found)