MCPcopy Index your code
hub / github.com/antlr/codebuff / mSTRING

Method mSTRING

output/java8/1.4.12/STLexer.java:542–583  ·  view source on GitHub ↗

STRING : '"' ( '\\' '"' | '\\' ~'"' | ~('\\'|'"') ) '"' ;

()

Source from the content-addressed store, hash-verified

540 */
541
542 Token mSTRING() {
543 //{setText(getText().substring(1, getText().length()-1));}
544 boolean sawEscape = false;
545 StringBuilder buf = new StringBuilder();
546 buf.append(c);
547 consume();
548 while ( c!='"' ) {
549 if ( c=='\\' ) {
550 sawEscape = true;
551 consume();
552 switch (c) {
553 case 'n' :
554 buf.append('\n');
555 break;
556 case 'r' :
557 buf.append('\r');
558 break;
559 case 't' :
560 buf.append('\t');
561 break;
562 default:
563 buf.append(c);
564 break;
565 }
566 consume();
567 continue;
568 }
569 buf.append(c);
570 consume();
571 if ( c==EOF ) {
572 RecognitionException re = new MismatchedTokenException((int)'"', input);
573 re.line = input.getLine();
574 re.charPositionInLine = input.getCharPositionInLine();
575 errMgr.lexerError(input.getSourceName(), "EOF in string", templateToken, re);
576 break;
577 }
578 }
579 buf.append(c);
580 consume();
581 if ( sawEscape ) return newToken(STRING, buf.toString());
582 else return newToken(STRING);
583 }
584
585 void WS() {
586 while ( c==' ' || c=='\t' || c=='\n' || c=='\r' ) consume();

Callers 1

insideMethod · 0.95

Calls 8

consumeMethod · 0.95
newTokenMethod · 0.95
getCharPositionInLineMethod · 0.80
toStringMethod · 0.65
appendMethod · 0.45
getLineMethod · 0.45
lexerErrorMethod · 0.45
getSourceNameMethod · 0.45

Tested by

no test coverage detected