Java Code Examples for org.mozilla.javascript.Token#isValidToken()

The following examples show how to use org.mozilla.javascript.Token#isValidToken() . 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: UnaryExpression.java    From JsDroidCmd with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Sets operator – same as {@link #setType}, but throws an
 * exception if the operator is invalid
 * @throws IllegalArgumentException if operator is not a valid
 * Token code
 */
public void setOperator(int operator) {
    if (!Token.isValidToken(operator))
        throw new IllegalArgumentException("Invalid token: " + operator);
    setType(operator);
}
 
Example 2
Source File: InfixExpression.java    From JsDroidCmd with Mozilla Public License 2.0 2 votes vote down vote up
/**
 * Sets operator token – like {@link #setType}, but throws
 * an exception if the operator is invalid.
 * @throws IllegalArgumentException if operator is not a valid token
 * code
 */
public void setOperator(int operator) {
    if (!Token.isValidToken(operator))
        throw new IllegalArgumentException("Invalid token: " + operator);
    setType(operator);
}
 
Example 3
Source File: UnaryExpression.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets operator – same as {@link #setType}, but throws an
 * exception if the operator is invalid
 * @throws IllegalArgumentException if operator is not a valid
 * Token code
 */
public void setOperator(int operator) {
    if (!Token.isValidToken(operator))
        throw new IllegalArgumentException("Invalid token: " + operator);
    setType(operator);
}
 
Example 4
Source File: InfixExpression.java    From astor with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Sets operator token – like {@link #setType}, but throws
 * an exception if the operator is invalid.
 * @throws IllegalArgumentException if operator is not a valid token
 * code
 */
public void setOperator(int operator) {
    if (!Token.isValidToken(operator))
        throw new IllegalArgumentException("Invalid token: " + operator);
    setType(operator);
}