1 /*
2 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
96 int props = getPropertiesEx(ch);
97 return (props & $$maskIdeographic) != 0;
98 }
99
100 int getType(int ch) {
101 int props = getProperties(ch);
102 return (props & $$maskType);
103 }
104
105 boolean isJavaIdentifierStart(int ch) {
106 int props = getProperties(ch);
107 return ((props & $$maskIdentifierInfo) >= $$lowJavaStart);
108 }
109
110 boolean isJavaIdentifierPart(int ch) {
111 int props = getProperties(ch);
112 return ((props & $$nonzeroJavaPart) != 0);
113 }
114
115 boolean isUnicodeIdentifierStart(int ch) {
116 int props = getProperties(ch);
117 return ((props & $$maskIdentifierInfo) == $$valueUnicodeStart);
118 }
119
120 boolean isUnicodeIdentifierPart(int ch) {
121 int props = getProperties(ch);
122 return ((props & $$maskUnicodePart) != 0);
123 }
124
125 boolean isIdentifierIgnorable(int ch) {
126 int props = getProperties(ch);
127 return ((props & $$maskIdentifierInfo) == $$valueIgnorable);
128 }
129
130 int toLowerCase(int ch) {
131 int mapChar = ch;
132 int val = getProperties(ch);
133
134 if ((val & $$maskLowerCase) != 0) {
135 int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
136 mapChar = ch + offset;
137 }
138 return mapChar;
139 }
140
141 int toUpperCase(int ch) {
142 int mapChar = ch;
|
1 /*
2 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
96 int props = getPropertiesEx(ch);
97 return (props & $$maskIdeographic) != 0;
98 }
99
100 int getType(int ch) {
101 int props = getProperties(ch);
102 return (props & $$maskType);
103 }
104
105 boolean isJavaIdentifierStart(int ch) {
106 int props = getProperties(ch);
107 return ((props & $$maskIdentifierInfo) >= $$lowJavaStart);
108 }
109
110 boolean isJavaIdentifierPart(int ch) {
111 int props = getProperties(ch);
112 return ((props & $$nonzeroJavaPart) != 0);
113 }
114
115 boolean isUnicodeIdentifierStart(int ch) {
116 return (getPropertiesEx(ch) & $$maskIDStart) != 0 ||
117 ch == 0x2E2F;
118 }
119
120 boolean isUnicodeIdentifierPart(int ch) {
121 return (getPropertiesEx(ch) & $$maskIDContinue) != 0 ||
122 isIdentifierIgnorable(ch) ||
123 ch == 0x2E2F;
124 }
125
126 boolean isIdentifierIgnorable(int ch) {
127 int props = getProperties(ch);
128 return ((props & $$maskIdentifierInfo) == $$valueIgnorable);
129 }
130
131 int toLowerCase(int ch) {
132 int mapChar = ch;
133 int val = getProperties(ch);
134
135 if ((val & $$maskLowerCase) != 0) {
136 int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
137 mapChar = ch + offset;
138 }
139 return mapChar;
140 }
141
142 int toUpperCase(int ch) {
143 int mapChar = ch;
|