jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException Java Examples

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.exception.ValueException. 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 openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_zero() {
    if (syntax.opEscOctal3()) {
        final int last = p;
        int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.RAW_BYTE;
        token.setC(num);
    } else if (c != '0') {
        inc();
    }
}
 
Example #2
Source File: Regex.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public Regex(final char[] chars, final int p, final int end, final int optionp, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) {
    int option = optionp;

    if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
        (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
        throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS);
    }

    if ((option & Option.NEGATE_SINGLELINE) != 0) {
        option |= syntax.options;
        option &= ~Option.SINGLELINE;
    } else {
        option |= syntax.options;
    }

    this.options = option;
    this.caseFoldFlag = caseFoldFlag;
    this.warnings = warnings;

    this.analyser = new Analyser(new ScanEnvironment(this, syntax), chars, p, end);
    this.analyser.compile();

    this.warnings = null;
}
 
Example #3
Source File: Lexer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_zero() {
    if (syntax.opEscOctal3()) {
        int last = p;
        int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.RAW_BYTE;
        token.setC(num);
    } else if (c != '0') {
        inc();
    }
}
 
Example #4
Source File: Lexer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_digit() {
    unfetch();
    int last = p;
    int num = scanUnsignedNumber();
    if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
    } else if (syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
        if (syntax.strictCheckBackref()) {
            if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
                throw new ValueException(ERR_INVALID_BACKREF);
            }
        }
        token.type = TokenType.BACKREF;
        token.setBackrefRef(num);
        return;
    }

    if (c == '8' || c == '9') { /* normal char */ // skip_backref:
        p = last;
        inc();
        return;
    }
    p = last;

    fetchTokenFor_zero(); /* fall through */
}
 
Example #5
Source File: Regex.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
public Regex(final char[] chars, final int p, final int end, final int optionp, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) {
    int option = optionp;

    if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
        (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
        throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS);
    }

    if ((option & Option.NEGATE_SINGLELINE) != 0) {
        option |= syntax.options;
        option &= ~Option.SINGLELINE;
    } else {
        option |= syntax.options;
    }

    this.options = option;
    this.caseFoldFlag = caseFoldFlag;
    this.warnings = warnings;

    this.analyser = new Analyser(new ScanEnvironment(this, syntax), chars, p, end);
    this.analyser.compile();

    this.warnings = null;
}
 
Example #6
Source File: Lexer.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_uHex() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #7
Source File: Lexer.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenInCCFor_u() {
    if (!left()) return;
    int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) {  /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #8
Source File: Lexer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_digit() {
    unfetch();
    int last = p;
    int num = scanUnsignedNumber();
    if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
    } else if (syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
        if (syntax.strictCheckBackref()) {
            if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
                throw new ValueException(ERR_INVALID_BACKREF);
            }
        }
        token.type = TokenType.BACKREF;
        token.setBackrefRef(num);
        return;
    }

    if (c == '8' || c == '9') { /* normal char */ // skip_backref:
        p = last;
        inc();
        return;
    }
    p = last;

    fetchTokenFor_zero(); /* fall through */
}
 
Example #9
Source File: Regex.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
public Regex(final char[] chars, final int p, final int end, final int optionp, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) {
    int option = optionp;

    if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
        (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
        throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS);
    }

    if ((option & Option.NEGATE_SINGLELINE) != 0) {
        option |= syntax.options;
        option &= ~Option.SINGLELINE;
    } else {
        option |= syntax.options;
    }

    this.options = option;
    this.caseFoldFlag = caseFoldFlag;
    this.warnings = warnings;

    this.analyser = new Analyser(new ScanEnvironment(this, syntax), chars, p, end);
    this.analyser.compile();

    this.warnings = null;
}
 
Example #10
Source File: Lexer.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_uHex() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #11
Source File: Regex.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public Regex(final char[] chars, final int p, final int end, final int optionp, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) {
    int option = optionp;

    if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
        (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
        throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS);
    }

    if ((option & Option.NEGATE_SINGLELINE) != 0) {
        option |= syntax.options;
        option &= ~Option.SINGLELINE;
    } else {
        option |= syntax.options;
    }

    this.options = option;
    this.caseFoldFlag = caseFoldFlag;
    this.warnings = warnings;

    this.analyser = new Analyser(new ScanEnvironment(this, syntax), chars, p, end);
    this.analyser.compile();

    this.warnings = null;
}
 
Example #12
Source File: Lexer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenInCCFor_u() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) {  /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #13
Source File: Lexer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenInCCFor_u() {
    if (!left()) return;
    int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) {  /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #14
Source File: Lexer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_uHex() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #15
Source File: Lexer.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_digit() {
    unfetch();
    final int last = p;
    final int num = scanUnsignedNumber();
    if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
    } else if (syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
        if (syntax.strictCheckBackref()) {
            if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
                throw new ValueException(ERR_INVALID_BACKREF);
            }
        }
        token.type = TokenType.BACKREF;
        token.setBackrefRef(num);
        return;
    }

    if (c == '8' || c == '9') { /* normal char */ // skip_backref:
        p = last;
        inc();
        return;
    }
    p = last;

    fetchTokenFor_zero(); /* fall through */
}
 
Example #16
Source File: Lexer.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_uHex() {
    if (!left()) return;
    int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #17
Source File: Regex.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public Regex(char[] chars, int p, int end, int option, int caseFoldFlag, Syntax syntax, WarnCallback warnings) {

        if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
            (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
            throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS);
        }

        if ((option & Option.NEGATE_SINGLELINE) != 0) {
            option |= syntax.options;
            option &= ~Option.SINGLELINE;
        } else {
            option |= syntax.options;
        }

        this.options = option;
        this.caseFoldFlag = caseFoldFlag;
        this.warnings = warnings;

        this.analyser = new Analyser(new ScanEnvironment(this, syntax), chars, p, end);
        this.analyser.compile();

        this.warnings = null;
    }
 
Example #18
Source File: Regex.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public Regex(final char[] chars, final int p, final int end, final int optionp, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) {
    int option = optionp;

    if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
        (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
        throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS);
    }

    if ((option & Option.NEGATE_SINGLELINE) != 0) {
        option |= syntax.options;
        option &= ~Option.SINGLELINE;
    } else {
        option |= syntax.options;
    }

    this.options = option;
    this.caseFoldFlag = caseFoldFlag;
    this.warnings = warnings;

    this.analyser = new Analyser(new ScanEnvironment(this, syntax), chars, p, end);
    this.analyser.compile();

    this.warnings = null;
}
 
Example #19
Source File: Lexer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_zero() {
    if (syntax.opEscOctal3()) {
        final int last = p;
        int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.RAW_BYTE;
        token.setC(num);
    } else if (c != '0') {
        inc();
    }
}
 
Example #20
Source File: Lexer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_digit() {
    unfetch();
    final int last = p;
    final int num = scanUnsignedNumber();
    if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
    } else if (syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
        if (syntax.strictCheckBackref()) {
            if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
                throw new ValueException(ERR_INVALID_BACKREF);
            }
        }
        token.type = TokenType.BACKREF;
        token.setBackrefRef(num);
        return;
    }

    if (c == '8' || c == '9') { /* normal char */ // skip_backref:
        p = last;
        inc();
        return;
    }
    p = last;

    fetchTokenFor_zero(); /* fall through */
}
 
Example #21
Source File: Lexer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenInCCFor_u() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) {  /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #22
Source File: Lexer.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_uHex() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #23
Source File: Lexer.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_zero() {
    if (syntax.opEscOctal3()) {
        final int last = p;
        int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.RAW_BYTE;
        token.setC(num);
    } else if (c != '0') {
        inc();
    }
}
 
Example #24
Source File: Lexer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_digit() {
    unfetch();
    final int last = p;
    final int num = scanUnsignedNumber();
    if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
    } else if (syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
        if (syntax.strictCheckBackref()) {
            if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
                throw new ValueException(ERR_INVALID_BACKREF);
            }
        }
        token.type = TokenType.BACKREF;
        token.setBackrefRef(num);
        return;
    }

    if (c == '8' || c == '9') { /* normal char */ // skip_backref:
        p = last;
        inc();
        return;
    }
    p = last;

    fetchTokenFor_zero(); /* fall through */
}
 
Example #25
Source File: Regex.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public Regex(final char[] chars, final int p, final int end, final int optionp, final int caseFoldFlag, final Syntax syntax, final WarnCallback warnings) {
    int option = optionp;

    if ((option & (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) ==
        (Option.DONT_CAPTURE_GROUP | Option.CAPTURE_GROUP)) {
        throw new ValueException(ErrorMessages.ERR_INVALID_COMBINATION_OF_OPTIONS);
    }

    if ((option & Option.NEGATE_SINGLELINE) != 0) {
        option |= syntax.options;
        option &= ~Option.SINGLELINE;
    } else {
        option |= syntax.options;
    }

    this.options = option;
    this.caseFoldFlag = caseFoldFlag;
    this.warnings = warnings;

    this.analyser = new Analyser(new ScanEnvironment(this, syntax), chars, p, end);
    this.analyser.compile();

    this.warnings = null;
}
 
Example #26
Source File: Lexer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_zero() {
    if (syntax.opEscOctal3()) {
        final int last = p;
        int num = scanUnsignedOctalNumber(c == '0' ? 2 : 3);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.RAW_BYTE;
        token.setC(num);
    } else if (c != '0') {
        inc();
    }
}
 
Example #27
Source File: Lexer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_digit() {
    unfetch();
    final int last = p;
    final int num = scanUnsignedNumber();
    if (num < 0 || num > Config.MAX_BACKREF_NUM) { // goto skip_backref
    } else if (syntax.opDecimalBackref() && (num <= env.numMem || num <= 9)) { /* This spec. from GNU regex */
        if (syntax.strictCheckBackref()) {
            if (num > env.numMem || env.memNodes == null || env.memNodes[num] == null) {
                throw new ValueException(ERR_INVALID_BACKREF);
            }
        }
        token.type = TokenType.BACKREF;
        token.setBackrefRef(num);
        return;
    }

    if (c == '8' || c == '9') { /* normal char */ // skip_backref:
        p = last;
        inc();
        return;
    }
    p = last;

    fetchTokenFor_zero(); /* fall through */
}
 
Example #28
Source File: Lexer.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenInCCFor_u() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) {  /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #29
Source File: Lexer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenInCCFor_u() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) {  /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}
 
Example #30
Source File: Lexer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void fetchTokenFor_uHex() {
    if (!left()) {
        return;
    }
    final int last = p;

    if (syntax.op2EscUHex4()) {
        int num = scanUnsignedHexadecimalNumber(4);
        if (num < 0) {
            throw new ValueException(ERR_TOO_BIG_NUMBER);
        }
        if (p == last) { /* can't read nothing. */
            num = 0; /* but, it's not error */
        }
        token.type = TokenType.CODE_POINT;
        token.setCode(num);
    }
}