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

Method UNICODE

output/java/1.4.14/STLexer.java:456–496  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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