Java Code Examples for jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType#GRAPH_MASK
The following examples show how to use
jdk.nashorn.internal.runtime.regexp.joni.encoding.CharacterType#GRAPH_MASK .
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: EncodingHelper.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> * * @param code code * @param ctype ctype * * @return isCodeCType */ public static boolean isCodeCType(final int code, final int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 2
Source File: EncodingHelper.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> * * @param code code * @param ctype ctype * * @return isCodeCType */ public static boolean isCodeCType(final int code, final int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 3
Source File: EncodingHelper.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> * * @param code code * @param ctype ctype * * @return isCodeCType */ public static boolean isCodeCType(final int code, final int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 4
Source File: EncodingHelper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> * * @param code code * @param ctype ctype * * @return isCodeCType */ public static boolean isCodeCType(final int code, final int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 5
Source File: EncodingHelper.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> * * @param code code * @param ctype ctype * * @return isCodeCType */ public static boolean isCodeCType(final int code, final int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM or U+180E (see JDK-8138758) return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff || code == 0x180e; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 6
Source File: EncodingHelper.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> * * @param code code * @param ctype ctype * * @return isCodeCType */ public static boolean isCodeCType(final int code, final int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 7
Source File: EncodingHelper.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> */ public static boolean isCodeCType(int code, int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 8
Source File: EncodingHelper.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> */ public static boolean isCodeCType(int code, int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 9
Source File: EncodingHelper.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> * * @param code code * @param ctype ctype * * @return isCodeCType */ public static boolean isCodeCType(final int code, final int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }
Example 10
Source File: EncodingHelper.java From nashorn with GNU General Public License v2.0 | 4 votes |
/** * @see <a href="http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt">http://www.geocities.jp/kosako3/oniguruma/doc/RE.txt</a> */ public static boolean isCodeCType(int code, int ctype) { int type; switch (ctype) { case CharacterType.NEWLINE: return isNewLine(code); case CharacterType.ALPHA: return (1 << Character.getType(code) & CharacterType.ALPHA_MASK) != 0; case CharacterType.BLANK: return code == 0x09 || Character.getType(code) == Character.SPACE_SEPARATOR; case CharacterType.CNTRL: type = Character.getType(code); return (1 << type & CharacterType.CNTRL_MASK) != 0 || type == Character.UNASSIGNED; case CharacterType.DIGIT: return EncodingHelper.isDigit(code); case CharacterType.GRAPH: switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return false; default: type = Character.getType(code); return (1 << type & CharacterType.GRAPH_MASK) == 0 && type != Character.UNASSIGNED; } case CharacterType.LOWER: return Character.isLowerCase(code); case CharacterType.PRINT: type = Character.getType(code); return (1 << type & CharacterType.PRINT_MASK) == 0 && type != Character.UNASSIGNED; case CharacterType.PUNCT: return (1 << Character.getType(code) & CharacterType.PUNCT_MASK) != 0; case CharacterType.SPACE: // ECMA 7.2 and 7.3 switch (code) { case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: return true; default: // true if Unicode separator or BOM return (1 << Character.getType(code) & CharacterType.SPACE_MASK) != 0 || code == 0xfeff; } case CharacterType.UPPER: return Character.isUpperCase(code); case CharacterType.XDIGIT: return EncodingHelper.isXDigit(code); case CharacterType.WORD: return (1 << Character.getType(code) & CharacterType.WORD_MASK) != 0; case CharacterType.ALNUM: return (1 << Character.getType(code) & CharacterType.ALNUM_MASK) != 0; case CharacterType.ASCII: return code < 0x80; default: throw new RuntimeException("illegal character type: " + ctype); } }