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

Method toString

output/java/1.4.13/STCompiletimeMessage.java:63–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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