org.owasp.orizon.mirage.php.parser
Class Nodes
java.lang.Object
org.owasp.orizon.mirage.php.parser.Nodes
public abstract class Nodes
- extends java.lang.Object
A set of static utility routines, mostly for working with Node objects.
These methods were not added to the Node interface in order to keep it
fairly easy for someone to write their own Node implementation.
Nested Class Summary |
static class |
Nodes.Visitor
An abstract base class for classes that
implement the visitor pattern. |
Constructor Summary |
Nodes()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Nodes
public Nodes()
firstChildOfType
public static <T extends Node> T firstChildOfType(Node node,
java.lang.Class<T> clazz)
childrenOfType
public static <T extends Node> java.util.List<T> childrenOfType(Node node,
java.lang.Class<T> clazz)
getTokens
public static java.util.List<Token> getTokens(Node node)
getRealTokens
public static java.util.List<Token> getRealTokens(Node n)
iterator
public static java.util.ListIterator<Node> iterator(Node node)
expandSpecialTokens
public static void expandSpecialTokens(Node n,
boolean recursive)
- Expands (in place) a Node's children to include any comment tokens hanging
off the regular tokens.
- Parameters:
n
- the Noderecursive
- whether to recurse into child nodes.
getAllTokens
public static java.util.List<Token> getAllTokens(Node n,
boolean includeCommentTokens,
boolean recursive)
- Parameters:
n
- The NodeincludeCommentTokens
- Whether to include comment tokensrecursive
- Whether to recurse into child Nodes.
- Returns:
- a List containing all the tokens in a Node
copyLocationInfo
public static void copyLocationInfo(Node from,
Node to)
dump
public static void dump(Node n,
java.lang.String prefix)
getFirstAncestorOfType
public static <T extends Node> T getFirstAncestorOfType(Node n,
java.lang.Class<T> clazz)