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

Method ESCAPE

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

Source from the content-addressed store, hash-verified

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