MCPcopy Create free account
hub / github.com/antlr/codebuff / UNICODE

Method UNICODE

output/java/1.4.19/STLexer.java:459–503  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

457 }
458
459 Token UNICODE() {
460 consume();
461 char[] chars = new char[4];
462 if ( !isUnicodeLetter(c) ) {
463 NoViableAltException e = new NoViableAltException("", 0, 0, input);
464 errMgr.lexerError(input.getSourceName(),
465 "invalid unicode char: '"+str(c)+"'",
466 templateToken,
467 e);
468 }
469 chars[0] = c;
470 consume();
471 if ( !isUnicodeLetter(c) ) {
472 NoViableAltException e = new NoViableAltException("", 0, 0, input);
473 errMgr.lexerError(input.getSourceName(),
474 "invalid unicode char: '"+str(c)+"'",
475 templateToken,
476 e);
477 }
478 chars[1] = c;
479 consume();
480 if ( !isUnicodeLetter(c) ) {
481 NoViableAltException e = new NoViableAltException("", 0, 0, input);
482 errMgr.lexerError(input.getSourceName(),
483 "invalid unicode char: '"+str(c)+"'",
484 templateToken,
485 e);
486 }
487 chars[2] = c;
488 consume();
489 if ( !isUnicodeLetter(c) ) {
490 NoViableAltException e = new NoViableAltException("", 0, 0, input);
491 errMgr.lexerError(input.getSourceName(),
492 "invalid unicode char: '"+str(c)+"'",
493 templateToken,
494 e);
495 }
496 chars[3] = c;
497 // ESCAPE kills >
498 char uc = (char)Integer.parseInt(new String(chars), 16);
499 Token t = newToken(TEXT, String.valueOf(uc), input.getCharPositionInLine()-6);
500 consume();
501 match(delimiterStopChar);
502 return t;
503 }
504
505 Token mTEXT() {
506 boolean modifiedText = false;

Callers 1

ESCAPEMethod · 0.95

Calls 9

consumeMethod · 0.95
isUnicodeLetterMethod · 0.95
strMethod · 0.95
newTokenMethod · 0.95
matchMethod · 0.95
getCharPositionInLineMethod · 0.80
lexerErrorMethod · 0.45
getSourceNameMethod · 0.45
valueOfMethod · 0.45

Tested by

no test coverage detected