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

Method toString

output/java/1.4.19/STCompiletimeMessage.java:74–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

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