1 /*
2 * Copyright (c) 2002, 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
116 int props = getPropertiesEx(ch);
117 return (props & $$maskIdeographic) != 0;
118 }
119
120 int getType(int ch) {
121 int props = getProperties(ch);
122 return (props & $$maskType);
123 }
124
125 boolean isJavaIdentifierStart(int ch) {
126 int props = getProperties(ch);
127 return ((props & $$maskIdentifierInfo) >= $$lowJavaStart);
128 }
129
130 boolean isJavaIdentifierPart(int ch) {
131 int props = getProperties(ch);
132 return ((props & $$nonzeroJavaPart) != 0);
133 }
134
135 boolean isUnicodeIdentifierStart(int ch) {
136 return (getPropertiesEx(ch) & $$maskIDStart) != 0 ||
137 ch == 0x2E2F;
138 }
139
140 boolean isUnicodeIdentifierPart(int ch) {
141 return (getPropertiesEx(ch) & $$maskIDContinue) != 0 ||
142 isIdentifierIgnorable(ch) ||
143 ch == 0x2E2F;
144 }
145
146 boolean isIdentifierIgnorable(int ch) {
147 int props = getProperties(ch);
148 return ((props & $$maskIdentifierInfo) == $$valueIgnorable);
149 }
150
151 int toLowerCase(int ch) {
152 int mapChar = ch;
153 int val = getProperties(ch);
154
155 if (((val & $$maskLowerCase) != 0) &&
156 ((val & $$maskCaseOffset) != $$maskCaseOffset)) {
157 int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
158 mapChar = ch + offset;
159 }
160 return mapChar;
161 }
162
163 int toUpperCase(int ch) {
|
1 /*
2 * Copyright (c) 2002, 2020, 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
116 int props = getPropertiesEx(ch);
117 return (props & $$maskIdeographic) != 0;
118 }
119
120 int getType(int ch) {
121 int props = getProperties(ch);
122 return (props & $$maskType);
123 }
124
125 boolean isJavaIdentifierStart(int ch) {
126 int props = getProperties(ch);
127 return ((props & $$maskIdentifierInfo) >= $$lowJavaStart);
128 }
129
130 boolean isJavaIdentifierPart(int ch) {
131 int props = getProperties(ch);
132 return ((props & $$nonzeroJavaPart) != 0);
133 }
134
135 boolean isUnicodeIdentifierStart(int ch) {
136 return (getPropertiesEx(ch) & $$maskIDStart) != 0;
137 }
138
139 boolean isUnicodeIdentifierPart(int ch) {
140 return (getPropertiesEx(ch) & $$maskIDContinue) != 0 ||
141 isIdentifierIgnorable(ch);
142 }
143
144 boolean isIdentifierIgnorable(int ch) {
145 int props = getProperties(ch);
146 return ((props & $$maskIdentifierInfo) == $$valueIgnorable);
147 }
148
149 int toLowerCase(int ch) {
150 int mapChar = ch;
151 int val = getProperties(ch);
152
153 if (((val & $$maskLowerCase) != 0) &&
154 ((val & $$maskCaseOffset) != $$maskCaseOffset)) {
155 int offset = val << $$shiftCaseOffsetSign >> ($$shiftCaseOffsetSign+$$shiftCaseOffset);
156 mapChar = ch + offset;
157 }
158 return mapChar;
159 }
160
161 int toUpperCase(int ch) {
|