Home | History | Annotate | Download | only in src

Lines Matching refs:source

6  * This source code is provided as is by Unicode, Inc. No claims are
25 Conversions between UTF32, UTF-16, and UTF-8. Source code file.
31 source sequences, enhanced error detection, added casts
56 const UTF32* source = *sourceStart;
58 while (source < sourceEnd) {
63 ch = *source++;
68 --source; /* return to the illegal value itself */
86 --source; /* Back up source pointer! */
94 *sourceStart = source;
105 const UTF16* source = *sourceStart;
108 while (source < sourceEnd) {
109 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
110 ch = *source++;
113 /* If the 16 bits following the high surrogate are in the source buffer... */
114 if (source < sourceEnd) {
115 ch2 = *source;
120 ++source;
122 --source; /* return to the illegal value itself */
127 --source; /* return to the high surrogate */
134 --source; /* return to the illegal value itself */
140 source = oldSource; /* Back up source pointer! */
145 *sourceStart = source;
209 const UTF16* source = *sourceStart;
211 while (source < sourceEnd) {
216 const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
217 ch = *source++;
220 /* If the 16 bits following the high surrogate are in the source buffer... */
221 if (source < sourceEnd) {
222 UTF32 ch2 = *source;
227 ++source;
229 --source; /* return to the illegal value itself */
234 --source; /* return to the high surrogate */
241 --source; /* return to the illegal value itself */
257 source = oldSource; /* Back up source pointer! */
268 *sourceStart = source;
279 * length = trailingBytesForUTF8[*source]+1;
287 isLegalUTF8(const UTF8 *source, int length) {
289 const UTF8 *srcptr = source+length;
297 switch (*source) {
306 case 1: if (*source >= 0x80 && *source < 0xC2) return ANTLR3_FALSE;
308 if (*source > 0xF4) return ANTLR3_FALSE;
319 isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
320 int length = trailingBytesForUTF8[*source]+1;
321 if (source+length > sourceEnd) {
324 return isLegalUTF8(source, length);
333 const UTF8* source = *sourceStart;
335 while (source < sourceEnd) {
337 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
338 if (source + extraBytesToRead >= sourceEnd) {
342 if (! isLegalUTF8(source, extraBytesToRead+1)) {
350 case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
351 case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
352 case 3: ch += *source++; ch <<= 6;
353 case 2: ch += *source++; ch <<= 6;
354 case 1: ch += *source++; ch <<= 6;
355 case 0: ch += *source++;
360 source -= (extraBytesToRead+1); /* Back up source pointer! */
367 source -= (extraBytesToRead+1); /* return to the illegal value itself */
379 source -= (extraBytesToRead+1); /* return to the start */
387 source -= (extraBytesToRead+1); /* Back up source pointer! */
395 *sourceStart = source;
406 const UTF32* source = *sourceStart;
408 while (source < sourceEnd) {
413 ch = *source++;
417 --source; /* return to the illegal value itself */
437 --source; /* Back up source pointer! */
448 *sourceStart = source;
459 const UTF8* source = *sourceStart;
461 while (source < sourceEnd) {
463 unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
464 if (source + extraBytesToRead >= sourceEnd) {
468 if (! isLegalUTF8(source, extraBytesToRead+1)) {
476 case 5: ch += *source++; ch <<= 6;
477 case 4: ch += *source++; ch <<= 6;
478 case 3: ch += *source++; ch <<= 6;
479 case 2: ch += *source++; ch <<= 6;
480 case 1: ch += *source++; ch <<= 6;
481 case 0: ch += *source++;
486 source -= (extraBytesToRead+1); /* Back up the source pointer! */
496 source -= (extraBytesToRead+1); /* return to the illegal value itself */
510 *sourceStart = source;
524 ch += *source++;