1
/*******************************************************************************
2
* Copyright (c) 2008, 2010 Wind River Systems, Inc. and others.
3
* All rights reserved. This program and the accompanying materials
4
* are made available under the terms of the Eclipse Public License v1.0
5
* which accompanies this distribution, and is available at
6
* http://www.eclipse.org/legal/epl-v10.html
9
* Markus Schorn - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.core.dom.ast;
14
* Interface for searching nodes in a translation unit. An instance of this interface, responsible
15
* for one file contained in a translation-unit, can be obtained using
16
* {@link IASTTranslationUnit#getNodeSelector(String)}.
18
* @noextend This interface is not intended to be extended by clients.
19
* @noimplement This interface is not intended to be implemented by clients.
22
public interface IASTNodeSelector {
25
* Returns the name for the exact given range, or <code>null</code> if there is no such node.
26
* Will not return an implicit name.
28
IASTName findName(int offset, int length);
31
* Returns the smallest name enclosing the given range, or <code>null</code> if there is no such node.
32
* Will not return an implicit name.
34
IASTName findEnclosingName(int offset, int length);
37
* Returns the first name contained in the given range, or <code>null</code> if there is no such node.
38
* Will not return an implicit name.
40
IASTName findFirstContainedName(int offset, int length);
43
* Returns the implicit name for the exact given range, or <code>null</code> if there is no such node.
45
* Note that there can be more than one implicit name in the same location.
46
* The implicit name's parent can be used to get all the names at the location.
50
IASTImplicitName findImplicitName(int offset, int length);
53
* Returns the first implicit name enclosing the given range.
55
* Note that there can be more than one implicit name in the same location.
56
* The implicit name's parent can be used to get all the names at the location.
60
IASTImplicitName findEnclosingImplicitName(int offset, int length);
63
* Returns the node for the exact given range, or <code>null</code> if there is no such node.
65
* For nodes with the same location, macro-expansions ({@link IASTPreprocessorMacroExpansion}) are preferred
66
* over c/c++-nodes and children are preferred over their parents.
68
IASTNode findNode(int offset, int length);
71
* Returns the smallest node enclosing the given range, or <code>null</code> if there is no such node.
73
* For nodes with the same location, macro-expansions ({@link IASTPreprocessorMacroExpansion}) are preferred
74
* over c/c++-nodes nodes and children are preferred over their parents.
76
IASTNode findEnclosingNode(int offset, int length);
79
* Returns the smallest node strictly enclosing the given range, or <code>null</code> if there is no such node.
81
* For nodes with the same location, macro-expansions ({@link IASTPreprocessorMacroExpansion}) are preferred
82
* over c/c++-nodes nodes and children are preferred over their parents.
85
IASTNode findStrictlyEnclosingNode(int offset, int length);
88
* Returns the first node contained in the given range, or <code>null</code> if there is no such node.
90
* For nodes with the same location, macro-expansions ({@link IASTPreprocessorMacroExpansion}) are preferred
91
* over c/c++-nodes nodes and children are preferred over their parents.
93
IASTNode findFirstContainedNode(int offset, int length);
96
* Returns the node for the exact given range, or <code>null</code> if there is no such node.
98
* The method never returns a macro expansion ({@link IASTPreprocessorMacroExpansion}) or the name for
99
* an expansion. Rather than that the expansion itself is searched for a matching node.
102
IASTNode findNodeInExpansion(int offset, int length);
105
* Returns the smallest node enclosing the range, or <code>null</code> if there is no such node.
107
* The method never returns a macro expansion ({@link IASTPreprocessorMacroExpansion}) or the name for
108
* an expansion. Rather than that the expansion itself is searched for a matching node.
111
IASTNode findEnclosingNodeInExpansion(int offset, int length);
114
* Returns the first node contained in the given expansion, or <code>null</code> if there is no such node.
116
* The method never returns a macro expansion ({@link IASTPreprocessorMacroExpansion}) or the name for
117
* an expansion. Rather than that the expansion itself is searched for a matching node.
120
IASTNode findFirstContainedNodeInExpansion(int offset, int length);
123
* Returns a macro expansion enclosing the given range, or <code>null</code>.
125
IASTPreprocessorMacroExpansion findEnclosingMacroExpansion(int offset, int length);