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

Method mSTRING

output/java8/1.4.17/STLexer.java:566–607  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

564 */
565
566 Token mSTRING() {
567 //{setText(getText().substring(1, getText().length()-1));}
568 boolean sawEscape = false;
569 StringBuilder buf = new StringBuilder();
570 buf.append(c);
571 consume();
572 while ( c!='"' ) {
573 if ( c=='\\' ) {
574 sawEscape = true;
575 consume();
576 switch (c) {
577 case 'n':
578 buf.append('\n');
579 break;
580 case 'r':
581 buf.append('\r');
582 break;
583 case 't':
584 buf.append('\t');
585 break;
586 default:
587 buf.append(c);
588 break;
589 }
590 consume();
591 continue;
592 }
593 buf.append(c);
594 consume();
595 if ( c==EOF ) {
596 RecognitionException re = new MismatchedTokenException((int)'"', input);
597 re.line = input.getLine();
598 re.charPositionInLine = input.getCharPositionInLine();
599 errMgr.lexerError(input.getSourceName(), "EOF in string", templateToken, re);
600 break;
601 }
602 }
603 buf.append(c);
604 consume();
605 if ( sawEscape ) return newToken(STRING, buf.toString());
606 else return newToken(STRING);
607 }
608
609 void WS() {
610 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