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
4243444546474849505152
return false; } @Override public IScriptCompletionProposal[] getAssists(IInvocationContext context, IProblemLocation[] locations) throws CoreException { final ASTNode coveringNode = context.getCoveringNode(); if (hasAssists(context)) { return new IScriptCompletionProposal[]{ new AssignToLocalCompletionProposal(context.getCompilationUnit(), coveringNode) }; }
347348349350351352353354355356357
// this is also an indicator, whether this loop was already gone through if(createdMethodBody) { inlineReplacementEditGroup = additionalInlineReplacementEdit; } ASTNode parent = selectedNodeOccurence.get(0).getParent(); inlineMethodCall = ASTNode.copySubtree(ast, inlineMethodCall); ListRewrite lrw;
117118119120121122123124125126127128129130131132
if (basic == null || basic.length() < 1) { basic = DEFAULT_NAME; } basic = Character.toLowerCase(basic.charAt(0)) + basic.substring(1); ASTNode scope = searchScope(node); FindVariableVisitor find; int num = -1; do { num++; find = new FindVariableVisitor(num == 0 ? basic : basic + num); scope.childrenAccept(find); } while(find.found); return new String[] {find.search}; }
279280281282283284285286287288289
Program program = parser.createAST(new NullProgressMonitor()); // program.recordModifications(); // AST ast = program.getAST(); ISourceRange range = type.getSourceRange(); ASTNode node = program.getElementAt(range.getOffset()); if (!(node instanceof ClassDeclaration)) { return ; }
474849505152535455565758
* @since 2.1 */ public static ASTNode perform(ASTNode root, int start, int length) { NodeFinder finder = new NodeFinder(start, length); root.accept(finder); ASTNode result = finder.getCoveredNode(); if (result == null || result.getStart() != start || result.getLength() != length) { return finder.getCoveringNode(); } return result; }
5960616263646566676869
assertNotNull(program); // select the class name. int start = 54; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASSNAME, PhpElementConciliator.concile(selectedNode));
90919293949596979899100
assertNotNull(program); // select the class name. int start = 82; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASSNAME, PhpElementConciliator.concile(selectedNode)); }
113114115116117118119120121122123
assertNotNull(program); // select the class name. int start = 59; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASSNAME, PhpElementConciliator.concile(selectedNode));
143144145146147148149150151152153
assertNotNull(program); // select the class name. int start = 25; ASTNode selectedNode = locateNode(program, start, 0); assertNotNull(selectedNode); assertEquals(PhpElementConciliator.CONCILIATOR_CLASSNAME, PhpElementConciliator.concile(selectedNode));
175176177178179180181182183184185