Java Code Examples for jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType#CC_RANGE

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.constants.TokenType#CC_RANGE . 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: Lexer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) {
            return token.type;
        }
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            }
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            }
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            final int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 2
Source File: Lexer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) {
            return token.type;
        }
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            }
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            }
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            final int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 3
Source File: Lexer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) {
            return token.type;
        }
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            }
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            }
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            final int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 4
Source File: Lexer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) {
            return token.type;
        }
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            }
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            }
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            final int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 5
Source File: Lexer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) {
            return token.type;
        }
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            }
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            }
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            final int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 6
Source File: Lexer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) {
            return token.type;
        }
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            }
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            }
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            final int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 7
Source File: Lexer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) return token.type;
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 8
Source File: Lexer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) return token.type;
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 9
Source File: Lexer.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) {
            return token.type;
        }
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            }
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) {
                fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            }
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            final int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}
 
Example 10
Source File: Lexer.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
protected final TokenType fetchTokenInCC() {
    if (!left()) {
        token.type = TokenType.EOT;
        return token.type;
    }

    fetch();
    token.type = TokenType.CHAR;
    token.setC(c);
    token.escaped = false;

    if (c == ']') {
        token.type = TokenType.CC_CLOSE;
    } else if (c == '-') {
        token.type = TokenType.CC_RANGE;
    } else if (c == syntax.metaCharTable.esc) {
        if (!syntax.backSlashEscapeInCC()) return token.type;
        if (!left()) {
            throw new SyntaxException(ERR_END_PATTERN_AT_ESCAPE);
        }
        fetch();
        token.escaped = true;
        token.setC(c);

        switch (c) {
        case 'w':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'W':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.W : CharacterType.WORD);
            break;
        case 'd':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 'D':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.D : CharacterType.DIGIT);
            break;
        case 's':
            fetchTokenInCCFor_charType(false, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'S':
            fetchTokenInCCFor_charType(true, Config.NON_UNICODE_SDW ? CharacterType.S : CharacterType.SPACE);
            break;
        case 'h':
            if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(false, CharacterType.XDIGIT);
            break;
        case 'H':
            if (syntax.op2EscHXDigit()) fetchTokenInCCFor_charType(true, CharacterType.XDIGIT);
            break;
        case 'x':
            fetchTokenInCCFor_x();
            break;
        case 'u':
            fetchTokenInCCFor_u();
            break;
        case '0':
        case '1':
        case '2':
        case '3':
        case '4':
        case '5':
        case '6':
        case '7':
            fetchTokenInCCFor_digit();
            break;

        default:
            unfetch();
            int num = fetchEscapedValue();
            if (token.getC() != num) {
                token.setCode(num);
                token.type = TokenType.CODE_POINT;
            }
            break;
        } // switch

    } else if (c == '&') {
        fetchTokenInCCFor_and();
    }
    return token.type;
}