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

Method reportMessageAndThrowSTException

output/java/1.4.17/Compiler.java:187–211  ·  view source on GitHub ↗
(TokenStream tokens, Token templateToken, Parser parser, RecognitionException re)

Source from the content-addressed store, hash-verified

185 }
186
187 protected void reportMessageAndThrowSTException(TokenStream tokens, Token templateToken, Parser parser, RecognitionException re) {
188 if ( re.token.getType()== STLexer.EOF_TYPE ) {
189 String msg = "premature EOF";
190 group.errMgr.compileTimeError(ErrorType.SYNTAX_ERROR, templateToken, re.token, msg);
191 }
192 else if ( re instanceof NoViableAltException ) {
193 String msg = "'"+re.token.getText()+"' came as a complete surprise to me";
194 group.errMgr.compileTimeError(ErrorType.SYNTAX_ERROR, templateToken, re.token, msg);
195 }
196 else if ( tokens.index()==0 ) { // couldn't parse anything
197 String msg =
198 "this doesn't look like a template: \"" +
199 tokens+"\"";
200 group.errMgr.compileTimeError(ErrorType.SYNTAX_ERROR, templateToken, re.token, msg);
201 }
202 else if ( tokens.LA(1)== STLexer.LDELIM ) { // couldn't parse expr
203 String msg = "doesn't look like an expression";
204 group.errMgr.compileTimeError(ErrorType.SYNTAX_ERROR, templateToken, re.token, msg);
205 }
206 else {
207 String msg = parser.getErrorMessage(re, parser.getTokenNames());
208 group.errMgr.compileTimeError(ErrorType.SYNTAX_ERROR, templateToken, re.token, msg);
209 }
210 throw new STException(); // we have reported the error, so just blast out
211 }
212}

Callers 1

compileMethod · 0.95

Calls 5

getTokenNamesMethod · 0.80
compileTimeErrorMethod · 0.65
getTextMethod · 0.65
indexMethod · 0.65
getTypeMethod · 0.45

Tested by

no test coverage detected