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

Method ESCAPE

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

Source from the content-addressed store, hash-verified

422 }
423
424 Token ESCAPE() {
425 startCharIndex = input.index();
426 startCharPositionInLine = input.getCharPositionInLine();
427 consume(); // kill \\
428 if ( c=='u' ) return UNICODE();
429 String text;
430 switch ( c ) {
431 case '\\':
432 LINEBREAK();
433 return SKIP;
434 case 'n':
435 text = "\n";
436 break;
437 case 't':
438 text = "\t";
439 break;
440 case ' ':
441 text = " ";
442 break;
443 default:
444 NoViableAltException e = new NoViableAltException("", 0, 0, input);
445 errMgr.lexerError(input.getSourceName(),
446 "invalid escaped char: '"+str(c)+"'",
447 templateToken,
448 e);
449 consume();
450 match(delimiterStopChar);
451 return SKIP;
452 }
453 consume();
454 Token t = newToken(TEXT, text, input.getCharPositionInLine()-2);
455 match(delimiterStopChar);
456 return t;
457 }
458
459 Token UNICODE() {
460 consume();

Callers 1

outsideMethod · 0.95

Calls 10

consumeMethod · 0.95
UNICODEMethod · 0.95
LINEBREAKMethod · 0.95
strMethod · 0.95
matchMethod · 0.95
newTokenMethod · 0.95
getCharPositionInLineMethod · 0.80
indexMethod · 0.65
lexerErrorMethod · 0.45
getSourceNameMethod · 0.45

Tested by

no test coverage detected