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

Class STGroupCompiletimeMessage

output/java8/1.4.17/STGroupCompiletimeMessage.java:37–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35
36
37public class STGroupCompiletimeMessage extends STMessage {
38 /** token inside group file */
39 public Token token;
40
41 public String srcName;
42
43 public STGroupCompiletimeMessage(ErrorType error, String srcName, Token t, Throwable cause) {
44 this(error, srcName, t, cause, null);
45 }
46 public STGroupCompiletimeMessage(ErrorType error, String srcName, Token t, Throwable cause, Object arg) {
47 this(error, srcName, t, cause, arg, null);
48 }
49 public STGroupCompiletimeMessage(ErrorType error, String srcName, Token t, Throwable cause, Object arg, Object arg2) {
50 super(error, null, cause, arg, arg2);
51 this.token = t;
52 this.srcName = srcName;
53 }
54
55 @Override
56 public String toString() {
57 RecognitionException re = (RecognitionException)cause;
58 int line = 0;
59 int charPos = -1;
60 if ( token!=null ) {
61 line = token.getLine();
62 charPos = token.getCharPositionInLine();
63 }
64 else if ( re!=null ) {
65 line = re.line;
66 charPos = re.charPositionInLine;
67 }
68 String filepos = line+":"+charPos;
69 if ( srcName!=null ) {
70 return srcName+" "+filepos+": "+String.format(error.message, arg, arg2);
71 }
72 return filepos+": "+String.format(error.message, arg, arg2);
73 }
74}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected