diff options
Diffstat (limited to 'src/java/com/sun/gluegen/cgram/TNode.java')
-rw-r--r-- | src/java/com/sun/gluegen/cgram/TNode.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/java/com/sun/gluegen/cgram/TNode.java b/src/java/com/sun/gluegen/cgram/TNode.java index f5b2c17..9fca506 100644 --- a/src/java/com/sun/gluegen/cgram/TNode.java +++ b/src/java/com/sun/gluegen/cgram/TNode.java @@ -153,6 +153,16 @@ public void initialize(AST tr) { text = text_; } + /** Returns the text for this node and all children */ + public String getAllChildrenText() { + StringBuffer buf = new StringBuffer(); + buf.append(getText()); + for (TNode node = (TNode) getFirstChild(); node != null; node = (TNode) node.getNextSibling()) { + buf.append(node.getText()); + } + return buf.toString(); + } + /** return the last child of this node, or null if there is none */ public TNode getLastChild() { TNode down = (TNode)getFirstChild(); |