• Home
  • Raw
  • Download

Lines Matching refs:tree

95     tree = Wizard::PatternParser.parse( 'ID', Tokens, @adaptor )
97 assert_instance_of(CommonTree, tree)
98 assert_equal( ID, tree.type )
99 assert_equal( 'ID', tree.text )
103 tree = Wizard::PatternParser.parse( 'ID[foo]', Tokens, @adaptor )
105 assert_instance_of( CommonTree, tree )
106 assert_equal( ID, tree.type )
107 assert_equal( 'foo', tree.text )
111 tree = Wizard::PatternParser.parse( '(A B)', Tokens, @adaptor )
113 assert_instance_of( CommonTree, tree )
114 assert_equal(A, tree.type)
115 assert_equal('A', tree.text)
116 assert_equal(tree.child_count, 1)
117 assert_equal(tree.child(0).type, B)
118 assert_equal(tree.child(0).text, 'B')
122 tree = Wizard::PatternParser.parse( 'nil', Tokens, @adaptor )
124 assert_instance_of(CommonTree, tree)
125 assert_equal(0, tree.type)
126 assert_nil tree.text
130 tree = Wizard::PatternParser.parse( '(.)', Tokens, @adaptor )
131 assert_instance_of( Wizard::WildcardPattern, tree )
135 tree = Wizard::PatternParser.parse( '(%a:A)', Tokens, @pattern_adaptor )
136 assert_instance_of(Wizard::Pattern, tree)
137 assert_equal('a', tree.label)
141 tree = Wizard::PatternParser.parse( ')', Tokens, @adaptor )
142 assert_nil tree
146 tree = Wizard::PatternParser.parse( '()', Tokens, @adaptor )
147 assert_nil tree
151 tree = Wizard::PatternParser.parse( '(A ])', Tokens, @adaptor )
152 assert_nil tree
222 tree = @wizard.create("ID")
223 index_map = SIMPLIFY_MAP[@wizard.index(tree)]
230 tree = @wizard.create("(A B C D)")
231 index_map = SIMPLIFY_MAP[@wizard.index(tree)]
240 tree = @wizard.create("(A B (A C B) B D D)")
241 index_map = SIMPLIFY_MAP[@wizard.index(tree)]
251 tree = @wizard.create("(A B C D)")
254 @wizard.visit( tree, B ) do |node, parent, child_index, labels|
263 tree = @wizard.create("(A B (A C B) B D D)")
266 @wizard.visit( tree, C ) do |node, parent, child_index, labels|
275 tree = @wizard.create("(A B (A C B) B D D)")
278 @wizard.visit( tree, B ) do |node, parent, child_index, labels|
287 tree = @wizard.create("(A B (A C B) B D D)")
290 @wizard.visit( tree, A ) do |node, parent, child_index, labels|
302 tree = @wizard.create("(A B (A C B) B D D)")
305 @wizard.visit( tree, B ) do |node, parent, child_index, labels|
314 tree = @wizard.create("(A B (A C B) B D D)")
317 @wizard.visit( tree, A ) do |node, parent, child_index, labels|
325 tree = @wizard.create("(A B C (A B) D)")
328 @wizard.visit(tree, '(A B)') do |node, parent, child_index, labels|
337 tree = @wizard.create("(A B C (A B) (D (A B)))")
340 @wizard.visit(tree, '(A B)') do |node, parent, child_index, labels|
353 tree = @wizard.create("(A B C (A[foo] B[bar]) (D (A[big] B[dog])))")
356 @wizard.visit(tree, '(%a:A %b:B)') do |node, parent, child_index, labels|
365 tree = @wizard.create("(A B C)")
366 assert @wizard.match(tree, "(A B C)")
370 tree = @wizard.create('A')
371 assert @wizard.match(tree, 'A')
375 tree = @wizard.create('A')
376 assert( !(@wizard.match(tree, 'B')) )
381 tree = @wizard.create('(nil A B C)')
382 assert @wizard.match(tree, '(nil A B C)')
386 tree = @wizard.create('(nil A B C)')
387 assert( !(@wizard.match(tree, '(nil A B)')) )
391 tree = @wizard.create('(nil A B C)')
392 assert( !(@wizard.match(tree, '(nil A B A)')) )
396 tree = @wizard.create('(A B C)')
397 assert @wizard.match(tree, '(A . .)')
401 tree = @wizard.create('(A B[foo] C[bar])')
402 assert @wizard.match(tree, '(A B[foo] C)')
406 tree = @wizard.create('(A B C)')
407 assert( !(@wizard.match(tree, '(A[foo] B C)')) )
411 tree = @wizard.create('(A B C)')
412 labels = @wizard.match( tree, '(%a:A %b:B %c:C)' )
420 tree = @wizard.create('(A B C)')
421 labels = @wizard.match(tree, '(A %b:. %c:.)')
429 tree = @wizard.create('(A B[foo] C)')
430 labels = @wizard.match( tree, '(%a:A %b:B[foo] %c:C)' )
438 tree = @wizard.create('(A (B C) (D E))')
439 labels = @wizard.match( tree, '(%a:A (%b:B %c:C) (%d:D %e:E))' )
483 tree = @wizard.create("(A B C (A[foo] B[bar]) (D (A[big] B[dog])))")
484 subtrees = @wizard.find(tree, "(A B)").map { |t| t.to_s }
489 tree = @wizard.create("(A B C (A[foo] B[bar]) (D (A[big] B[dog])))")
490 subtrees = @wizard.find( tree, A ).map { |t| t.to_s }