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
5657585960616263646566
assertNotNull(program); // select the class name. int start = 13; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASSNAME, PhpElementConciliator.concile(selectedNode));
8788899091929394959697
assertNotNull(program); // select the class name. int start = 63; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASSNAME, PhpElementConciliator.concile(selectedNode)); }
110111112113114115116117118119120
assertNotNull(program); // select the class name. int start = 68; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASSNAME, PhpElementConciliator.concile(selectedNode));
140141142143144145146147148149150
assertNotNull(program); // select the class name. int start = 6; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASSNAME, PhpElementConciliator.concile(selectedNode));
172173174175176177178179180181182
222223224225226227228229230231232
assertNotNull(program); // select the variable declaration. int start = 7; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_GLOBAL_VARIABLE, PhpElementConciliator.concile(selectedNode));
260261262263264265266267268269270
Program program = createProgram(file); assertNotNull(program); int start = 48; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_GLOBAL_VARIABLE, PhpElementConciliator.concile(selectedNode)); }
284285286287288289290291292293294295
assertNotNull(program); // select the variable declaration. int start = 41; ASTNode selectedNode = locateNode(program, start, 0); selectedNode = selectedNode.getParent(); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_GLOBAL_VARIABLE, PhpElementConciliator.concile(selectedNode));
309310311312313314315316317318319
assertNotNull(program); // select the function declaration. int start = 16; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_FUNCTION, PhpElementConciliator.concile(selectedNode));
340341342343344345346347348349350
assertNotNull(program); // select the function declaration. int start = 45; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_FUNCTION, PhpElementConciliator.concile(selectedNode)); }