jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder Java Examples

The following examples show how to use jdk.nashorn.internal.runtime.regexp.joni.encoding.IntHolder. 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: ByteCodeMachine.java    From nashorn with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(int caseFlodFlag, int s1, IntHolder ps2, int mbLen, int textEnd) {

        int s2 = ps2.value;
        int end1 = s1 + mbLen;

        while (s1 < end1) {
            char c1 = Character.toLowerCase(chars[s1++]);
            char c2 = Character.toLowerCase(chars[s2++]);

            if (c1 != c2) {
                return false;
            }
        }
        ps2.value = s2;
        return true;
    }
 
Example #2
Source File: ByteCodeMachine.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) {
    int s1 = s1p;
    int s2 = ps2.value;
    final int end1 = s1 + mbLen;

    while (s1 < end1) {
        final char c1 = EncodingHelper.toLowerCase(chars[s1++]);
        final char c2 = EncodingHelper.toLowerCase(chars[s2++]);

        if (c1 != c2) {
            return false;
        }
    }
    ps2.value = s2;
    return true;
}
 
Example #3
Source File: ByteCodeMachine.java    From jdk8u_nashorn with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) {
    int s1 = s1p;
    int s2 = ps2.value;
    final int end1 = s1 + mbLen;

    while (s1 < end1) {
        final char c1 = EncodingHelper.toLowerCase(chars[s1++]);
        final char c2 = EncodingHelper.toLowerCase(chars[s2++]);

        if (c1 != c2) {
            return false;
        }
    }
    ps2.value = s2;
    return true;
}
 
Example #4
Source File: ByteCodeMachine.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) {
    int s1 = s1p;
    int s2 = ps2.value;
    final int end1 = s1 + mbLen;

    while (s1 < end1) {
        final char c1 = EncodingHelper.toLowerCase(chars[s1++]);
        final char c2 = EncodingHelper.toLowerCase(chars[s2++]);

        if (c1 != c2) {
            return false;
        }
    }
    ps2.value = s2;
    return true;
}
 
Example #5
Source File: ByteCodeMachine.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(int caseFlodFlag, int s1, IntHolder ps2, int mbLen, int textEnd) {

        int s2 = ps2.value;
        int end1 = s1 + mbLen;

        while (s1 < end1) {
            char c1 = Character.toLowerCase(chars[s1++]);
            char c2 = Character.toLowerCase(chars[s2++]);

            if (c1 != c2) {
                return false;
            }
        }
        ps2.value = s2;
        return true;
    }
 
Example #6
Source File: ByteCodeMachine.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) {
    int s1 = s1p;
    int s2 = ps2.value;
    final int end1 = s1 + mbLen;

    while (s1 < end1) {
        final char c1 = EncodingHelper.toLowerCase(chars[s1++]);
        final char c2 = EncodingHelper.toLowerCase(chars[s2++]);

        if (c1 != c2) {
            return false;
        }
    }
    ps2.value = s2;
    return true;
}
 
Example #7
Source File: ByteCodeMachine.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(int caseFlodFlag, int s1, IntHolder ps2, int mbLen, int textEnd) {

        int s2 = ps2.value;
        int end1 = s1 + mbLen;

        while (s1 < end1) {
            char c1 = Character.toLowerCase(chars[s1++]);
            char c2 = Character.toLowerCase(chars[s2++]);

            if (c1 != c2) {
                return false;
            }
        }
        ps2.value = s2;
        return true;
    }
 
Example #8
Source File: ByteCodeMachine.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) {
    int s1 = s1p;
    int s2 = ps2.value;
    final int end1 = s1 + mbLen;

    while (s1 < end1) {
        final char c1 = EncodingHelper.toLowerCase(chars[s1++]);
        final char c2 = EncodingHelper.toLowerCase(chars[s2++]);

        if (c1 != c2) {
            return false;
        }
    }
    ps2.value = s2;
    return true;
}
 
Example #9
Source File: ByteCodeMachine.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) {
    int s1 = s1p;
    int s2 = ps2.value;
    final int end1 = s1 + mbLen;

    while (s1 < end1) {
        final char c1 = EncodingHelper.toLowerCase(chars[s1++]);
        final char c2 = EncodingHelper.toLowerCase(chars[s2++]);

        if (c1 != c2) {
            return false;
        }
    }
    ps2.value = s2;
    return true;
}
 
Example #10
Source File: ByteCodeMachine.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private boolean stringCmpIC(final int caseFlodFlag, final int s1p, final IntHolder ps2, final int mbLen, final int textEnd) {
    int s1 = s1p;
    int s2 = ps2.value;
    final int end1 = s1 + mbLen;

    while (s1 < end1) {
        final char c1 = EncodingHelper.toLowerCase(chars[s1++]);
        final char c2 = EncodingHelper.toLowerCase(chars[s2++]);

        if (c1 != c2) {
            return false;
        }
    }
    ps2.value = s2;
    return true;
}
 
Example #11
Source File: EncodingHelper.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(final int ctype, final IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #12
Source File: EncodingHelper.java    From nashorn with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(int ctype, IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #13
Source File: EncodingHelper.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(final int ctype, final IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #14
Source File: EncodingHelper.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(int ctype, IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #15
Source File: EncodingHelper.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(int ctype, IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #16
Source File: EncodingHelper.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(final int ctype, final IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #17
Source File: EncodingHelper.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(final int ctype, final IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #18
Source File: EncodingHelper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(final int ctype, final IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #19
Source File: EncodingHelper.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(final int ctype, final IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #20
Source File: EncodingHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static int[] ctypeCodeRange(final int ctype, final IntHolder sbOut) {
    sbOut.value = 0x100; // use bitset for codes smaller than 256
    int[] range = null;

    if (ctype < codeRanges.length) {
        range = codeRanges[ctype];

        if (range == null) {
            // format: [numberOfRanges, rangeStart, rangeEnd, ...]
            range = new int[16];
            int rangeCount = 0;
            int lastCode = -2;

            for (int code = 0; code <= 0xffff; code++) {
                if (isCodeCType(code, ctype)) {
                    if (lastCode < code -1) {
                        if (rangeCount * 2 + 2 >= range.length) {
                            range = Arrays.copyOf(range, range.length * 2);
                        }
                        range[rangeCount * 2 + 1] = code;
                        rangeCount++;
                    }
                    range[rangeCount * 2] = lastCode = code;
                }
            }

            if (rangeCount * 2 + 1 < range.length) {
                range = Arrays.copyOf(range, rangeCount * 2 + 1);
            }

            range[0] = rangeCount;
            codeRanges[ctype] = range;
        }
    }

    return range;
}
 
Example #21
Source File: CClassNode.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void addCType(int ctype, boolean not, ScanEnvironment env, IntHolder sbOut) {
    if (Config.NON_UNICODE_SDW) {
        switch(ctype) {
        case CharacterType.D:
        case CharacterType.S:
        case CharacterType.W:
            ctype ^= CharacterType.SPECIAL_MASK;

            if (env.syntax == Syntax.JAVASCRIPT && ctype == CharacterType.SPACE) {
                // \s in JavaScript includes unicode characters.
                break;
            }

            if (not) {
                for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
                    // if (!ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
                    if ((AsciiCtypeTable[c] & (1 << ctype)) == 0) bs.set(c);
                }
                addAllMultiByteRange();
            } else {
                for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
                    // if (ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
                    if ((AsciiCtypeTable[c] & (1 << ctype)) != 0) bs.set(c);
                }
            }
            return;
        }
    }

    int[] ranges = EncodingHelper.ctypeCodeRange(ctype, sbOut);
    if (ranges != null) {
        addCTypeByRange(ctype, not, sbOut.value, ranges);
        return;
    }

    switch(ctype) {
    case CharacterType.ALPHA:
    case CharacterType.BLANK:
    case CharacterType.CNTRL:
    case CharacterType.DIGIT:
    case CharacterType.LOWER:
    case CharacterType.PUNCT:
    case CharacterType.SPACE:
    case CharacterType.UPPER:
    case CharacterType.XDIGIT:
    case CharacterType.ASCII:
    case CharacterType.ALNUM:
        if (not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
            addAllMultiByteRange();
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
        }
        break;

    case CharacterType.GRAPH:
    case CharacterType.PRINT:
        if (not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
            addAllMultiByteRange();
        }
        break;

    case CharacterType.WORD:
        if (!not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isWord(c)) bs.set(c);
            }

            addAllMultiByteRange();
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isWord(c)) bs.set(c);
            }
        }
        break;

    default:
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    } // switch
}
 
Example #22
Source File: CClassNode.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
public void addCType(int ctype, boolean not, ScanEnvironment env, IntHolder sbOut) {
    if (Config.NON_UNICODE_SDW) {
        switch(ctype) {
        case CharacterType.D:
        case CharacterType.S:
        case CharacterType.W:
            ctype ^= CharacterType.SPECIAL_MASK;

            if (env.syntax == Syntax.JAVASCRIPT && ctype == CharacterType.SPACE) {
                // \s in JavaScript includes unicode characters.
                break;
            }

            if (not) {
                for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
                    // if (!ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
                    if ((AsciiCtypeTable[c] & (1 << ctype)) == 0) bs.set(c);
                }
                addAllMultiByteRange();
            } else {
                for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
                    // if (ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
                    if ((AsciiCtypeTable[c] & (1 << ctype)) != 0) bs.set(c);
                }
            }
            return;
        }
    }

    int[] ranges = EncodingHelper.ctypeCodeRange(ctype, sbOut);
    if (ranges != null) {
        addCTypeByRange(ctype, not, sbOut.value, ranges);
        return;
    }

    switch(ctype) {
    case CharacterType.ALPHA:
    case CharacterType.BLANK:
    case CharacterType.CNTRL:
    case CharacterType.DIGIT:
    case CharacterType.LOWER:
    case CharacterType.PUNCT:
    case CharacterType.SPACE:
    case CharacterType.UPPER:
    case CharacterType.XDIGIT:
    case CharacterType.ASCII:
    case CharacterType.ALNUM:
        if (not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
            addAllMultiByteRange();
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
        }
        break;

    case CharacterType.GRAPH:
    case CharacterType.PRINT:
        if (not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
            addAllMultiByteRange();
        }
        break;

    case CharacterType.WORD:
        if (!not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isWord(c)) bs.set(c);
            }

            addAllMultiByteRange();
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isWord(c)) bs.set(c);
            }
        }
        break;

    default:
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    } // switch
}
 
Example #23
Source File: EncodingHelper.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public static int rightAdjustCharHeadWithPrev(final int s, final IntHolder prev) {
    if (prev != null) {
        prev.value = -1; /* Sorry */
    }
    return s;
}
 
Example #24
Source File: EncodingHelper.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
public static int rightAdjustCharHeadWithPrev(int s, IntHolder prev) {
    if (prev != null) prev.value = -1; /* Sorry */
    return s;
}
 
Example #25
Source File: EncodingHelper.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public static int rightAdjustCharHeadWithPrev(final int s, final IntHolder prev) {
    if (prev != null) {
        prev.value = -1; /* Sorry */
    }
    return s;
}
 
Example #26
Source File: EncodingHelper.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
public static int rightAdjustCharHeadWithPrev(final int s, final IntHolder prev) {
    if (prev != null) {
        prev.value = -1; /* Sorry */
    }
    return s;
}
 
Example #27
Source File: EncodingHelper.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public static int rightAdjustCharHeadWithPrev(final int s, final IntHolder prev) {
    if (prev != null) {
        prev.value = -1; /* Sorry */
    }
    return s;
}
 
Example #28
Source File: EncodingHelper.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public static int rightAdjustCharHeadWithPrev(final int s, final IntHolder prev) {
    if (prev != null) {
        prev.value = -1; /* Sorry */
    }
    return s;
}
 
Example #29
Source File: EncodingHelper.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public static int rightAdjustCharHeadWithPrev(int s, IntHolder prev) {
    if (prev != null) prev.value = -1; /* Sorry */
    return s;
}
 
Example #30
Source File: CClassNode.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void addCType(int ctype, boolean not, ScanEnvironment env, IntHolder sbOut) {
    if (Config.NON_UNICODE_SDW) {
        switch(ctype) {
        case CharacterType.D:
        case CharacterType.S:
        case CharacterType.W:
            ctype ^= CharacterType.SPECIAL_MASK;

            if (env.syntax == Syntax.JAVASCRIPT && ctype == CharacterType.SPACE) {
                // \s in JavaScript includes unicode characters.
                break;
            }

            if (not) {
                for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
                    // if (!ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
                    if ((AsciiCtypeTable[c] & (1 << ctype)) == 0) bs.set(c);
                }
                addAllMultiByteRange();
            } else {
                for (int c = 0; c < BitSet.SINGLE_BYTE_SIZE; c++) {
                    // if (ASCIIEncoding.INSTANCE.isCodeCType(c, ctype)) bs.set(c);
                    if ((AsciiCtypeTable[c] & (1 << ctype)) != 0) bs.set(c);
                }
            }
            return;
        }
    }

    int[] ranges = EncodingHelper.ctypeCodeRange(ctype, sbOut);
    if (ranges != null) {
        addCTypeByRange(ctype, not, sbOut.value, ranges);
        return;
    }

    switch(ctype) {
    case CharacterType.ALPHA:
    case CharacterType.BLANK:
    case CharacterType.CNTRL:
    case CharacterType.DIGIT:
    case CharacterType.LOWER:
    case CharacterType.PUNCT:
    case CharacterType.SPACE:
    case CharacterType.UPPER:
    case CharacterType.XDIGIT:
    case CharacterType.ASCII:
    case CharacterType.ALNUM:
        if (not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
            addAllMultiByteRange();
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
        }
        break;

    case CharacterType.GRAPH:
    case CharacterType.PRINT:
        if (not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isCodeCType(c, ctype)) bs.set(c);
            }
            addAllMultiByteRange();
        }
        break;

    case CharacterType.WORD:
        if (!not) {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (EncodingHelper.isWord(c)) bs.set(c);
            }

            addAllMultiByteRange();
        } else {
            for (int c=0; c<BitSet.SINGLE_BYTE_SIZE; c++) {
                if (!EncodingHelper.isWord(c)) bs.set(c);
            }
        }
        break;

    default:
        throw new InternalException(ErrorMessages.ERR_PARSER_BUG);
    } // switch
}