comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java @ 11907:873da100d113

Truffle: another minor tweak to NodeUtil.printSourceAttributionTree
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Sun, 06 Oct 2013 21:17:51 -0700
parents e68922869732
children be0a33a631fa
comparison
equal deleted inserted replaced
11906:82ec5f898e6c 11907:873da100d113
655 if (parent == null) { 655 if (parent == null) {
656 // Add some preliminary information before starting with the root node 656 // Add some preliminary information before starting with the root node
657 final SourceSection sourceSection = node.getSourceSection(); 657 final SourceSection sourceSection = node.getSourceSection();
658 if (sourceSection != null) { 658 if (sourceSection != null) {
659 final String txt = sourceSection.getSource().getCode(); 659 final String txt = sourceSection.getSource().getCode();
660 p.println("Full source len=(" + txt.length() + ") txt=___" + txt + "___"); 660 p.println("Full source len=(" + txt.length() + ") ___" + txt + "___");
661 p.println("AST source attribution:"); 661 p.println("AST source attribution:");
662 } 662 }
663 } 663 }
664 final StringBuilder sb = new StringBuilder(); 664 final StringBuilder sb = new StringBuilder();
665 for (int i = 0; i < level; i++) { 665 for (int i = 0; i < level; i++) {
791 if (section != null) { 791 if (section != null) {
792 final String srcText = section.getCode(); 792 final String srcText = section.getCode();
793 final StringBuilder sb = new StringBuilder(); 793 final StringBuilder sb = new StringBuilder();
794 sb.append("source: len=" + srcText.length()); 794 sb.append("source: len=" + srcText.length());
795 sb.append(" (" + section.getCharIndex() + "," + (section.getCharEndIndex() - 1) + ")"); 795 sb.append(" (" + section.getCharIndex() + "," + (section.getCharEndIndex() - 1) + ")");
796 sb.append(" txt=___" + srcText + "___"); 796 sb.append(" ___" + srcText + "___");
797 return sb.toString(); 797 return sb.toString();
798 } 798 }
799 return ""; 799 return "";
800 } 800 }
801 } 801 }