An AST node represents a PHP source code construct, such as a name, type, expression, statement, or declaration.
ASTs do not contain cycles.
@see Visitable @author Modhe S., Roy G. ,2007
364365366367368369370371372373374
assertNotNull(program); // select the function declaration. int start = 91; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASS_MEMBER, PhpElementConciliator.concile(selectedNode)); }
388389390391392393394395396397398
assertNotNull(program); // select the function declaration. int start = 99; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASS_MEMBER, PhpElementConciliator.concile(selectedNode)); }
412413414415416417418419420421422
assertNotNull(program); // select the function declaration. int start = 96; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASS_MEMBER, PhpElementConciliator.concile(selectedNode)); }
436437438439440441442443444445446
assertNotNull(program); // select the function declaration. int start = 30; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASS_MEMBER, PhpElementConciliator.concile(selectedNode)); }
460461462463464465466467468469470
assertNotNull(program); // int start = 14; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASS_MEMBER, PhpElementConciliator.concile(selectedNode));
492493494495496497498499500501502
assertNotNull(program); // int start = 78; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASS_MEMBER, PhpElementConciliator.concile(selectedNode)); }
516517518519520521522523524525526527
assertNotNull(program); // int start = 18; ASTNode selectedNode = locateNode(program, start, 0); selectedNode = selectedNode.getParent(); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASS_MEMBER, PhpElementConciliator.concile(selectedNode)); }
541542543544545546547548549550551
assertNotNull(program); // int start = 28; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASS_MEMBER, PhpElementConciliator.concile(selectedNode));
580581582583584585586587588589590
assertNotNull(program); // select 'echo $x' int start = 46; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_LOCAL_VARIABLE, PhpElementConciliator.concile(selectedNode));
612613614615616617618619620621622623
assertNotNull(program); // select 'echo $x' int start = 33; ASTNode selectedNode = locateNode(program, start, 0); selectedNode = selectedNode.getParent(); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_LOCAL_VARIABLE, PhpElementConciliator.concile(selectedNode));