Here you can find the source of oneLineStringOf(AstNode node)
public static String oneLineStringOf(AstNode node)
//package com.java2s; //License from project: Open Source License import org.mozilla.javascript.ast.AstNode; public class Main { public static String oneLineStringOf(AstNode node) { if (node == null) return ""; String[] str = node.toSource().split("\n"); if (str.length == 1) return str[0]; else {/*w w w. j a va2 s. c o m*/ int numOfShownLine = 2; boolean use1 = str.length > 2 && str[0].length() < 10; boolean useLast2 = str.length + (use1 ? 1 : 0) > 2 && str[str.length - 1].length() < 10; numOfShownLine += (use1 ? 1 : 0) + (useLast2 ? 1 : 0); return str[0] + (use1 ? str[1] : "") + " ..(" + (str.length - numOfShownLine) + ").. " + (useLast2 ? str[str.length - 2] : "") + str[str.length - 1]; } } }