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

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.exception.ErrorMessages. 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: Regex.java    From openjdk-jdk9 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 #2
Source File: ByteCodeMachine.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #3
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 #4
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 #5
Source File: ByteCodeMachine.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #6
Source File: ByteCodeMachine.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #7
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 #8
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 #9
Source File: Regex.java    From openjdk-8 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 #10
Source File: ByteCodeMachine.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #11
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 #12
Source File: ByteCodeMachine.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #13
Source File: ByteCodeMachine.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #14
Source File: Regex.java    From nashorn 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 #15
Source File: ByteCodeMachine.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #16
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 #17
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 #18
Source File: ByteCodeMachine.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #19
Source File: ByteCodeMachine.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void nullCheckFound() {
    // null_check_found:
    /* empty loop founded, skip next instruction */
    switch(code[ip++]) {
    case OPCode.JUMP:
    case OPCode.PUSH:
        ip++;       // p += SIZE_RELADDR;
        break;
    case OPCode.REPEAT_INC:
    case OPCode.REPEAT_INC_NG:
    case OPCode.REPEAT_INC_SG:
    case OPCode.REPEAT_INC_NG_SG:
        ip++;        // p += SIZE_MEMNUM;
        break;
    default:
        throw new InternalException(ErrorMessages.ERR_UNEXPECTED_BYTECODE);
    } // switch
}
 
Example #20
Source File: ScanEnvironment.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
public void setMemNode(final int num, final Node node) {
    if (numMem >= num) {
        memNodes[num] = node;
    } else {
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    }
}
 
Example #21
Source File: CodeRangeBuffer.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
public static CodeRangeBuffer addCodeRange(final CodeRangeBuffer pbuf, final ScanEnvironment env, final int from, final int to) {
    if (from > to) {
        if (env.syntax.allowEmptyRangeInCC()) {
            return pbuf;
        }
        throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS);
    }
    return addCodeRangeToBuff(pbuf, from, to);
}
 
Example #22
Source File: ConsAltNode.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getName() {
    switch (type) {
    case ALT:
        return "Alt";
    case LIST:
        return "List";
    default:
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    }
}
 
Example #23
Source File: CClassNode.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
public void nextStateClass(final CCStateArg arg, final ScanEnvironment env) {
    if (arg.state == CCSTATE.RANGE) {
        throw new SyntaxException(ErrorMessages.ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE);
    }

    if (arg.state == CCSTATE.VALUE && arg.type != CCVALTYPE.CLASS) {
        if (arg.type == CCVALTYPE.SB) {
            bs.set(arg.vs);
        } else if (arg.type == CCVALTYPE.CODE_POINT) {
            addCodeRange(env, arg.vs, arg.vs);
        }
    }
    arg.state = CCSTATE.VALUE;
    arg.type = CCVALTYPE.CLASS;
}
 
Example #24
Source File: CClassNode.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void nextStateClass(CCStateArg arg, ScanEnvironment env) {
    if (arg.state == CCSTATE.RANGE) throw new SyntaxException(ErrorMessages.ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE);

    if (arg.state == CCSTATE.VALUE && arg.type != CCVALTYPE.CLASS) {
        if (arg.type == CCVALTYPE.SB) {
            bs.set(arg.vs);
        } else if (arg.type == CCVALTYPE.CODE_POINT) {
            addCodeRange(env, arg.vs, arg.vs);
        }
    }
    arg.state = CCSTATE.VALUE;
    arg.type = CCVALTYPE.CLASS;
}
 
Example #25
Source File: CClassNode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void nextStateClass(CCStateArg arg, ScanEnvironment env) {
    if (arg.state == CCSTATE.RANGE) throw new SyntaxException(ErrorMessages.ERR_CHAR_CLASS_VALUE_AT_END_OF_RANGE);

    if (arg.state == CCSTATE.VALUE && arg.type != CCVALTYPE.CLASS) {
        if (arg.type == CCVALTYPE.SB) {
            bs.set(arg.vs);
        } else if (arg.type == CCVALTYPE.CODE_POINT) {
            addCodeRange(env, arg.vs, arg.vs);
        }
    }
    arg.state = CCSTATE.VALUE;
    arg.type = CCVALTYPE.CLASS;
}
 
Example #26
Source File: ScanEnvironment.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void setMemNode(int num, Node node) {
    if (numMem >= num) {
        memNodes[num] = node;
    } else {
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    }
}
 
Example #27
Source File: ScanEnvironment.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void setMemNode(final int num, final Node node) {
    if (numMem >= num) {
        memNodes[num] = node;
    } else {
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    }
}
 
Example #28
Source File: ConsAltNode.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getName() {
    switch (type) {
    case ALT:
        return "Alt";
    case LIST:
        return "List";
    default:
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    }
}
 
Example #29
Source File: ConsAltNode.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
@Override
public String getName() {
    switch (type) {
    case ALT:
        return "Alt";
    case LIST:
        return "List";
    default:
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    }
}
 
Example #30
Source File: CodeRangeBuffer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static CodeRangeBuffer addCodeRange(final CodeRangeBuffer pbuf, final ScanEnvironment env, final int from, final int to) {
    if (from > to) {
        if (env.syntax.allowEmptyRangeInCC()) {
            return pbuf;
        }
        throw new ValueException(ErrorMessages.ERR_EMPTY_RANGE_IN_CHAR_CLASS);
    }
    return addCodeRangeToBuff(pbuf, from, to);
}