if ( token instanceof HqlToken ) {
HqlToken hqlToken = ( HqlToken ) token;
// ... and the token could be an identifer and the error is
// a mismatched token error ...
if ( hqlToken.isPossibleID() && ( ex instanceof MismatchedTokenException ) ) {
MismatchedTokenException mte = ( MismatchedTokenException ) ex;
// ... and the expected token type was an identifier, then:
if ( mte.expecting == HqlTokenTypes.IDENT ) {
// Use the token as an identifier.
reportWarning( "Keyword '"
+ token.getText()
+ "' is being interpreted as an identifier due to: " + mte.getMessage() );
// Add the token to the AST.
ASTPair currentAST = new ASTPair();
token.setType( HqlTokenTypes.WEIRD_IDENT );
astFactory.addASTChild( currentAST, astFactory.create( token ) );
consume();