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

Method toString

output/java8/1.4.14/STCompiletimeMessage.java:70–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 }
69
70 @Override
71 public String toString() {
72 int line = 0;
73 int charPos = -1;
74 if ( token!=null ) {
75 line = token.getLine();
76 charPos = token.getCharPositionInLine();
77 // check the input streams - if different then token is embedded in templateToken and we need to adjust the offset
78 if ( templateToken!=null && !templateToken.getInputStream().equals(token.getInputStream()) ) {
79 int templateDelimiterSize = 1;
80 if ( templateToken.getType()==GroupParser.BIGSTRING || templateToken.getType()==GroupParser.BIGSTRING_NO_NL ) {
81 templateDelimiterSize = 2;
82 }
83 line += templateToken.getLine()-1;
84 charPos += templateToken.getCharPositionInLine()+templateDelimiterSize;
85 }
86 }
87 String filepos = line+":"+charPos;
88 if ( srcName!=null ) {
89 return srcName+" "+filepos+": "+String.format(error.message, arg, arg2);
90 }
91 return filepos+": "+String.format(error.message, arg, arg2);
92 }
93}

Callers

nothing calls this directly

Calls 5

getCharPositionInLineMethod · 0.80
equalsMethod · 0.65
getLineMethod · 0.45
getTypeMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected