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

Method reportMessageAndThrowSTException

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

Source from the content-addressed store, hash-verified

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

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