diff options
Diffstat (limited to 'src/java/com/sun/gluegen')
-rw-r--r-- | src/java/com/sun/gluegen/cgram/HeaderParser.g | 4 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/cgram/TNode.java | 10 | ||||
-rw-r--r-- | src/java/com/sun/gluegen/pcpp/PCPP.java | 2 |
3 files changed, 13 insertions, 3 deletions
diff --git a/src/java/com/sun/gluegen/cgram/HeaderParser.g b/src/java/com/sun/gluegen/cgram/HeaderParser.g index f91f146..7c13968 100644 --- a/src/java/com/sun/gluegen/cgram/HeaderParser.g +++ b/src/java/com/sun/gluegen/cgram/HeaderParser.g @@ -597,7 +597,7 @@ enumerator[EnumType enumeration, long defaultValue] returns [long newDefaultValu : eName:ID ( ASSIGN eVal:expr )? { long value = 0; if (eVal != null) { - String vTxt = eVal.getText(); + String vTxt = eVal.getAllChildrenText(); if (enumHash.containsKey(vTxt)) { EnumType oldEnumType = (EnumType) enumHash.get(vTxt); value = oldEnumType.getEnumValue(vTxt); @@ -605,7 +605,7 @@ enumerator[EnumType enumeration, long defaultValue] returns [long newDefaultValu try { value = Long.decode(vTxt).longValue(); } catch (NumberFormatException e) { - System.err.println("NumberFormatException: " + enumerator_AST_in); + System.err.println("NumberFormatException: ID[" + eName.getText() + "], VALUE=[" + vTxt + "]"); throw e; } } 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(); diff --git a/src/java/com/sun/gluegen/pcpp/PCPP.java b/src/java/com/sun/gluegen/pcpp/PCPP.java index 4a98542..d5d9604 100644 --- a/src/java/com/sun/gluegen/pcpp/PCPP.java +++ b/src/java/com/sun/gluegen/pcpp/PCPP.java @@ -867,7 +867,7 @@ public class PCPP { } private void lineDirective() { - print("#line " + lineNumber() + " \"" + filename() + "\""); + print("# " + lineNumber() + " \"" + filename() + "\""); println(); } } |