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

Method UNICODE

output/java/1.4.13/STLexer.java:453–485  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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