Returns the string representation of this source node along with a source map.
188245
public Code toStringWithSourceMap(String file, String sourceRoot) {
        StringBuilder generatedCode = new StringBuilder();
        int[] generatedLine = new int[] { 1 };
        int[] generatedColumn = new int[] { 0 };
        final SourceMapGenerator map = new SourceMapGenerator(file, sourceRoot);
        boolean[] sourceMappingActive = new boolean[] { false };
        String[] lastOriginalSource = new String[1];
        Integer[] lastOriginalLine = new Integer[1];
        Integer[] lastOriginalColumn = new Integer[1];
        String[] lastOriginalName = new String[1];
        this.walk((chunk, original) -> {
            generatedCode.append(chunk);
            if (original.source != null && original.line != null && original.column != null) {
                if (!original.source.equals(lastOriginalSource[0]) || lastOriginalLine[0] != original.line || lastOriginalColumn[0] != original.column
                        || (original.name == null ? lastOriginalName[0] != null : !original.name.equals(lastOriginalName[0]))) {
                    map.addMapping(new Mapping(new Position(generatedLine[0], generatedColumn[0]), new Position(original.line, original.column),
                            original.source, original.name));
                }
                lastOriginalSource[0] = original.source;
                lastOriginalLine[0] = original.line;
                lastOriginalColumn[0] = original.column;
                lastOriginalName[0] = original.name;
                sourceMappingActive[0] = true;
            } else if (sourceMappingActive[0]) {
                map.addMapping(new Mapping(new Position(generatedLine[0], generatedColumn[0])));
                lastOriginalSource[0] = null;
                sourceMappingActive[0] = false;
            }
            for (int idx = 0, length = chunk.length(); idx < length; idx++) {
                if (chunk.charAt(idx) == NEWLINE_CODE) {
                    generatedLine[0]++;
                    generatedColumn[0] = 0;
                    // Mappings end at eol
                    if (idx + 1 == length) {
                        lastOriginalSource[0] = null;
                        sourceMappingActive[0] = false;
                    } else if (sourceMappingActive[0]) {
                        map.addMapping(new Mapping(new Position(generatedLine[0], generatedColumn[0]), new Position(original.line, original.column),
                                original.source, original.name));
                    }
                } else {
                    generatedColumn[0]++;
                }
            }
        });
        this.walkSourceContents((sourceFile, sourceContent) -> {
            map.setSourceContent(sourceFile, sourceContent);
        });

        return new Code(generatedCode.toString(), map);
    }
553922
def getSource(self):
        
        bracket = self.next()
        # we should only be here because that was a bracket
        if not bracket == u'{':
            raise Exception(u"parse error getting source")
        c = u''
        identifier = u''
        while True:
            c = self.next()
            if not c:
                raise Exception(u"unexpected end of input getting source")
            elif c == u'}':
                break
            else:
                identifier += c
        if not identifier or not isidentifier(identifier):
            raise StringGenerator.SyntaxError(u"not a valid identifier: %s"%identifier)
        return StringGenerator.Source(identifier)
539463
def toString(self):
        
        output = ""

        if self.childs or self.isOpeningTag():
            output += self.tagToString()

            for c in self.childs:
                output += c.toString()

            if self.endtag is not None:
                output += self.endtag.tagToString()

        elif not self.isEndTag():
            output += self.tagToString()

        return output
728628
private String toStringIterative() {
		final String PADDING = "                                 ";
		final StringBuilder sb = new StringBuilder();
		int elements_debug_local_recounter = 0;
		Node<K, V> node = null;
		int nodeid = rootIdx;
		int depth = 0;
		stackSlots.clear();
		stackSlots.push(rootIdx); // init seed, root node
		boolean lastIsInternal = !Node.isLeaf(rootIdx);
		while (!stackSlots.isEmpty()) {
			nodeid = stackSlots.pop();
			node = getNode(nodeid);
			if (!node.isLeaf()) {
				for (int i = node.allocated; i >= 0; i--) {
					stackSlots.push(((InternalNode<K, V>) node).childs[i]);
				}
			} else {
				elements_debug_local_recounter += node.allocated;
			}
			// For Indentation
			if (lastIsInternal || !node.isLeaf()) { // Last or Curret are Internal
				depth += (lastIsInternal ? +1 : -1);
			}
			lastIsInternal = !node.isLeaf();
			sb.append(PADDING.substring(0, Math.min(PADDING.length(), Math.max(depth - 1, 0))));
			//
			sb.append(node.toString()).append("\n");
		}

		// Count elements
		sb.append("height=").append(getHeight()).append(" root=").append(rootIdx).append(" low=")
				.append(lowIdx).append(" high=").append(highIdx).append(" elements=").append(elements)
				.append(" recounter=").append(elements_debug_local_recounter);

		return sb.toString();
	}
497884
private static Stream<String> nodeToStringStream(final org.apache.jena.graph.Node object) {
        if (object.isURI()) {
            return of(object.getURI());
        } else if (object.isLiteral()) {
            return of(object.getLiteralValue().toString());
        } else {
            return empty();
        }
    }
893875
public static String nodeToString(final Node node) {
        try {
            final Transformer t = TransformerFactory.newInstance().newTransformer();
            t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
            final StringWriter sw = new StringWriter();
            t.transform(new DOMSource(node), new StreamResult(sw));
            return sw.toString();
        } catch (final TransformerException ex) {
            throw new RuntimeException("Failed to render node", ex);
        }
    }
1341054
function generateLiteralStringChunksFromNode(node, sourceCode) {
  return node.expressions.reduce((chunks, expression, index) => {
    const start = index ? node.expressions[index - 1].end : node.start

    chunks.push(sourceCode.substring(start, expression.start))

    // add the tail to the string
    if (index === node.expressions.length - 1)
      chunks.push(sourceCode.substring(expression.end, node.end))

    return chunks
  }, []).map(str => node.unescape ? unescapeChar(str, node.unescape) : str)
}
212976
static String toStringImpl(Map<?, ?> map) {
    StringBuilder sb = Collections2.newStringBuilderForCollection(map.size()).append('{');
    STANDARD_JOINER.appendTo(sb, map);
    return sb.append('}').toString();
  }
586869
def to_source(node, indentation=' ' * 4):
  """"""
  if isinstance(node, gast.AST):
    node = gast.gast_to_ast(node)
  generator = SourceWithCommentGenerator(indentation, False,
                                         astor.string_repr.pretty_string)
  generator.visit(node)
  generator.result.append('\n')
  return astor.source_repr.pretty_source(generator.result).lstrip()
614956
public static String node2String(final Node node) throws UnsupportedEncodingException
   {
      return node2String(node, true, Constants.DEFAULT_XML_CHARSET);
   }
136414
public Map<String, TreeItemIdNode> getCustomIdNodeMap() {
		// No user context present
		if (getScratchMap() == null) {
			return createCustomIdNodeMapping();
		}
		Map<String, TreeItemIdNode> map = (Map<String, TreeItemIdNode>) getScratchMap().get(CUSTOM_IDS_TO_NODE_SCRATCH_MAP_KEY);
		if (map == null) {
			map = createCustomIdNodeMapping();
			getScratchMap().put(CUSTOM_IDS_TO_NODE_SCRATCH_MAP_KEY, map);
		}
		return map;
	}
1208920
private SourcePosition getNamePosition(Tree node) {
    int start = (int) sourcePositions.getStartPosition(unit, node);
    if (start == -1) {
      return SourcePosition.NO_POSITION;
    }
    String src = newUnit.getSource();
    Kind kind = node.getKind();
    if (kind == Kind.ANNOTATION_TYPE
        || kind == Kind.CLASS
        || kind == Kind.ENUM
        || kind == Kind.INTERFACE) {
      // Skip the class/enum/interface token.
      while (src.charAt(start++) != ' ') {}
    } else if (kind != Kind.METHOD && kind != Kind.VARIABLE) {
      return getPosition(node);
    }
    if (!Character.isJavaIdentifierStart(src.charAt(start))) {
      return getPosition(node);
    }
    int endPos = start + 1;
    while (Character.isJavaIdentifierPart(src.charAt(endPos))) {
      endPos++;
    }
    return getSourcePosition(start, endPos);
  }
84070
VariableMap getStringMap() {
    ImmutableMap.Builder<String, String> map = ImmutableMap.builder();
    for (Result result : Iterables.filter(results.values(), USED_RESULTS)) {
      map.put(result.replacement, result.original);
    }

    VariableMap stringMap = new VariableMap(map.build());
    return stringMap;
  }
1253328
def visit_Str(self, node: AST, dfltChaining: bool = True) -> str:
        """"""
        return repr(node.s)
988665
def toString( self ):
        
        # convert the element tree information
        from xml.etree import ElementTree
        
        xelem = ElementTree.Element('colorset')
        xelem.set('name', self.name())
        xelem.set('colorGroups', ','.join(self.colorGroups()))
        
        for colorName, colors in self._colors.items():
            xcolor = ElementTree.SubElement(xelem, 'color')
            xcolor.set('name', colorName)
            
            for colorGroup, color in colors.items():
                xcolorval = ElementTree.SubElement(xcolor, 'value')
                xcolorval.set('group', colorGroup)
                xcolorval.set('red',    str(color.red()))
                xcolorval.set('green',  str(color.green()))
                xcolorval.set('blue',   str(color.blue()))
                xcolorval.set('alpha',  str(color.alpha()))
        
        # save the text
        return ElementTree.tostring(xelem)
627154
public static String mapToXmlStr(Map<?, ?> data, String rootName) {
		return toStr(mapToXml(data, rootName));
	}
1230087
def tostring(self, root=None, doctype=None, pretty_print=True):
        """"""
        if root is None:
            root = self.root
        return etree.tounicode(
            root, doctype=doctype or self.info.doctype, pretty_print=pretty_print
        )