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

Method ESCAPE

output/java/1.4.17/STLexer.java:422–454  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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