Beispiel #1
0
 /**
  * Get a string represenation of this token instance.
  *
  * @return A formatted string describing the token.
  */
 public String toString() {
   StringBuilder builder = new StringBuilder();
   builder.append(kind.name());
   switch (kind) {
     case ERROR:
       builder.append("(");
       builder.append("Unexpected character: ");
       builder.append(lexeme);
       builder.append(")");
       break;
     case INTEGER:
     case FLOAT:
     case IDENTIFIER:
       builder.append("(");
       builder.append(lexeme);
       builder.append(")");
       break;
   }
   builder.append("(");
   builder.append("lineNum:").append(lineNum);
   builder.append(", ");
   builder.append("charPos:").append(charPos);
   builder.append(")");
   return builder.toString();
 }
Beispiel #2
0
  public String toString() {
    String str = kind.name();

    if (!kind.hasStaticLexeme()) str += "(" + lexeme() + ")";

    str += "(";
    str += "lineNum:" + lineNum;
    str += ", ";
    str += "charPos:" + charPos;
    str += ")";

    return str;
  }
 private MethodInvocationExpr factoryCall(NodeList<Expr> args) {
   Name methodName = name(lowerCaseFirst(kind.name()));
   return methodInvocationExpr(methodName).withArgs(args).prependLeadingNewLine();
 }