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

Method toString

output/java8/1.4.12/STCompiletimeMessage.java:65–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

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