system/src/sc/parser/ParentParseNode.java
public String formatString(Object parSemVal, ParentParseNode curParseNode, int curChildIndex, boolean replaceFormatting) {
      // If the parse node is generated, we need to use the formatting process to add in
      // the spacing.  If the parse node was parsed, we toString it just as it
      // was parsed so we get back the identical input strings.
      // For non-generated parse nodes, the child.toString() should have all of the formatting already.  But we may have invalidated some children.
      // To get the proper spacing for those children, we need the parent parse nodes in the FormatContext - so they can find the prev/next chars to do proper spacing.
      // If there's overhead here, we could still optimize the case where there are no invalidated children nodes
      if (isGeneratedTree()) {
         FormatContext ctx = createFormatContext(parSemVal, curParseNode, curChildIndex);
         ctx.replaceFormatting = replaceFormatting;
         //ctx.append(FormatContext.INDENT_STR);
         PerfMon.start("format", false);
         format(ctx);
         PerfMon.end("format");
         return ctx.getResult().toString();
      }
      else {
         if (children == null)
              return "";
         if (children.size() == 1) {
            Object child = children.get(0);
            if (child == null)
               return "";
            return child.toString();
         }
         else {
            StringBuilder sb = new StringBuilder();
            for (Object o:children)
               if (o != null)
                  sb.append(o);
            return sb.toString();
         }
      }
   }
/**
    * Formats the parse node - turning it into a String.  Parent should specify the semantic node parent of this parse node.
    * If null is specified, it's no problem as long as this parse-node's semantic value has a parent.  Some primitive parse nodes have a string
    * semantic value with no ref to their parent.  For the spacing to be computed properly we need this context (for FormatContext.getNextSemanticValue())
    */
Formats the parse node - turning it into a String.  Parent should specify the semantic node parent of this parse node.
If null is specified, it's no problem as long as this parse-node's semantic value has a parent.  Some primitive parse nodes have a string
semantic value with no ref to their parent.  For the spacing to be computed properly we need this context (for FormatContext.getNextSemanticValue())
Formats the parse node - turning it into a String . Parent should specify the semantic node parent of this parse node . If null is specified it ' s no problem as long as this parse - node ' s semantic value has a parent . Some primitive parse nodes have a string semantic value with no ref to their parent . For the spacing to be computed properly we need this context ( for FormatContext . getNextSemanticValue () )
public String formatString(Object parSemVal, ParentParseNode curParseNode, int curChildIndex, boolean replaceFormatting) {
      if (isGeneratedTree()) {
         FormatContext ctx = createFormatContext(parSemVal, curParseNode, curChildIndex);
         ctx.replaceFormatting = replaceFormatting;
         PerfMon.start("format", false);
         format(ctx);
         PerfMon.end("format");
         return ctx.getResult().toString();
      }
      else {
         if (children == null)
              return "";
         if (children.size() == 1) {
            Object child = children.get(0);
            if (child == null)
               return "";
            return child.toString();
         }
         else {
            StringBuilder sb = new StringBuilder();
            for (Object o:children)
               if (o != null)
                  sb.append(o);
            return sb.toString();
         }
      }
   }
public String formatString ( Object parSemVal , ParentParseNode curParseNode , int curChildIndex , boolean replaceFormatting ) { if ( isGeneratedTree ( ) ) { FormatContext ctx = createFormatContext ( parSemVal , curParseNode , curChildIndex ) ; ctx . replaceFormatting = replaceFormatting ; PerfMon . start ( "format" , false ) ; format ( ctx ) ; PerfMon . end ( "format" ) ; return ctx . getResult ( ) . toString ( ) ; } else { if ( children == null ) return "" ; if ( children . size ( ) == 1 ) { Object child = children . get ( 0 ) ; if ( child == null ) return "" ; return child . toString ( ) ; } else { StringBuilder sb = new StringBuilder ( ) ; for ( Object o : children ) if ( o != null ) sb . append ( o ) ; return sb . toString ( ) ; } } }
Formats the parse node - turning it into a String.
Formats the parse node - turning it into a String .
// If the parse node is generated, we need to use the formatting process to add in // the spacing.  If the parse node was parsed, we toString it just as it // was parsed so we get back the identical input strings. // For non-generated parse nodes, the child.toString() should have all of the formatting already.  But we may have invalidated some children. // To get the proper spacing for those children, we need the parent parse nodes in the FormatContext - so they can find the prev/next chars to do proper spacing. // If there's overhead here, we could still optimize the case where there are no invalidated children nodes //ctx.append(FormatContext.INDENT_STR);