Java Code Examples for org.mozilla.javascript.Token#COLON

The following examples show how to use org.mozilla.javascript.Token#COLON . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ObjectProperty.java    From JsDroidCmd with Mozilla Public License 2.0 6 votes vote down vote up
@Override
public String toSource(int depth) {
    StringBuilder sb = new StringBuilder();
    sb.append("\n");
    sb.append(makeIndent(depth+1));
    if (isGetterMethod()) {
        sb.append("get ");
    } else if (isSetterMethod()) {
        sb.append("set ");
    }
    sb.append(left.toSource(getType()==Token.COLON ? 0 : depth));
    if (type == Token.COLON) {
        sb.append(": ");
    }
    sb.append(right.toSource(getType()==Token.COLON ? 0 : depth+1));
    return sb.toString();
}
 
Example 2
Source File: ObjectProperty.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Override
public String toSource(int depth) {
    StringBuilder sb = new StringBuilder();
    sb.append(makeIndent(depth));
    if (isGetter()) {
        sb.append("get ");
    } else if (isSetter()) {
        sb.append("set ");
    }
    sb.append(left.toSource(0));
    if (type == Token.COLON) {
        sb.append(": ");
    }
    sb.append(right.toSource(0));
    return sb.toString();
}
 
Example 3
Source File: ObjectProperty.java    From JsDroidCmd with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Sets the node type.  Must be one of
 * {@link Token#COLON}, {@link Token#GET}, or {@link Token#SET}.
 * @throws IllegalArgumentException if {@code nodeType} is invalid
 */
public void setNodeType(int nodeType) {
    if (nodeType != Token.COLON
        && nodeType != Token.GET
        && nodeType != Token.SET
        && nodeType != Token.METHOD)
        throw new IllegalArgumentException("invalid node type: "
                                           + nodeType);
    setType(nodeType);
}
 
Example 4
Source File: ObjectProperty.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the node type.  Must be one of
 * {@link Token#COLON}, {@link Token#GET}, or {@link Token#SET}.
 * @throws IllegalArgumentException if {@code nodeType} is invalid
 */
public void setNodeType(int nodeType) {
    if (nodeType != Token.COLON
        && nodeType != Token.GET
        && nodeType != Token.SET)
        throw new IllegalArgumentException("invalid node type: "
                                           + nodeType);
    setType(nodeType);
}