@Override public void firstPathTokenWeakKeywords() throws TokenStreamException { int t = LA( 1 ); switch ( t ){ case DOT: LT(0).setType( IDENT ); } }
@Override public void handleDotIdent() throws TokenStreamException { // This handles HHH-354, where there is a strange property name in a where clause. // If the lookahead contains a DOT then something that isn't an IDENT... if ( LA( 1 ) == DOT && LA( 2 ) != IDENT ) { // See if the second lookahead token can be an identifier. HqlToken t = (HqlToken) LT( 2 ); if ( t.isPossibleID() ) { // Set it! LT( 2 ).setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "handleDotIdent() : new LT(2) token - %s", LT( 1 ) ); } } } }
@Override public void handlePrimaryExpressionDotIdent() throws TokenStreamException { if ( LA( 2 ) == DOT && LA( 3 ) != IDENT ) { // See if the second lookahead token can be an identifier. HqlToken t = (HqlToken) LT( 3 ); if ( t.isPossibleID() ) { // Set it! t.setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "handleDotIdent() : new LT(3) token - %s", LT( 1 ) ); } } } }
@Override public void weakKeywords() throws TokenStreamException { int t = LA( 1 ); switch ( t ) { case ORDER: case GROUP: // Case 1: Multi token keywords GROUP BY and ORDER BY // The next token ( LT(2) ) should be 'by'... otherwise, this is just an ident. if ( LA( 2 ) != LITERAL_by ) { LT( 1 ).setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "weakKeywords() : new LT(1) token - %s", LT( 1 ) ); } } break; default: // Case 2: The current token is after FROM and before '.'. if ( LA( 0 ) == FROM && t != IDENT && LA( 2 ) == DOT ) { HqlToken hqlToken = (HqlToken) LT( 1 ); if ( hqlToken.isPossibleID() ) { hqlToken.setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "weakKeywords() : new LT(1) token - %s", LT( 1 ) ); } } } break; } }
@Override public void expectNamedParameterName() throws TokenStreamException { // we expect the token following a COLON (':') to be the name of a named parameter. // if the following token is anything other than IDENT we convert its type if possible. // NOTE : the LT() call is more expensive than the LA() call; so we // use LA() first to see if LT() is needed. if ( LA( 1 ) != IDENT ) { final HqlToken nextToken = (HqlToken) LT( 1 ); if ( nextToken.isPossibleID() ) { LOG.debugf( "Converting keyword [%s] following COLON to IDENT as an expected parameter name", nextToken.getText() ); nextToken.setType( IDENT ); } } }
@Override public void handleDotIdent() throws TokenStreamException { // This handles HHH-354, where there is a strange property name in a where clause. // If the lookahead contains a DOT then something that isn't an IDENT... if ( LA( 1 ) == DOT && LA( 2 ) != IDENT ) { // See if the second lookahead token can be an identifier. HqlToken t = (HqlToken) LT( 2 ); if ( t.isPossibleID() ) { // Set it! LT( 2 ).setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "handleDotIdent() : new LT(2) token - %s", LT( 1 ) ); } } } }
@Override public void handleDotIdent() throws TokenStreamException { // This handles HHH-354, where there is a strange property name in a where clause. // If the lookahead contains a DOT then something that isn't an IDENT... if ( LA( 1 ) == DOT && LA( 2 ) != IDENT ) { // See if the second lookahead token can be an identifier. HqlToken t = (HqlToken) LT( 2 ); if ( t.isPossibleID() ) { // Set it! LT( 2 ).setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "handleDotIdent() : new LT(2) token - %s", LT( 1 ) ); } } } }
@Override public void weakKeywords() throws TokenStreamException { int t = LA( 1 ); switch ( t ) { case ORDER: case GROUP: // Case 1: Multi token keywords GROUP BY and ORDER BY // The next token ( LT(2) ) should be 'by'... otherwise, this is just an ident. if ( LA( 2 ) != LITERAL_by ) { LT( 1 ).setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "weakKeywords() : new LT(1) token - %s", LT( 1 ) ); } } break; default: // Case 2: The current token is after FROM and before '.'. if ( LA( 0 ) == FROM && t != IDENT && LA( 2 ) == DOT ) { HqlToken hqlToken = (HqlToken) LT( 1 ); if ( hqlToken.isPossibleID() ) { hqlToken.setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "weakKeywords() : new LT(1) token - %s", LT( 1 ) ); } } } break; } }
@Override public void weakKeywords() throws TokenStreamException { int t = LA( 1 ); switch ( t ) { case ORDER: case GROUP: // Case 1: Multi token keywords GROUP BY and ORDER BY // The next token ( LT(2) ) should be 'by'... otherwise, this is just an ident. if ( LA( 2 ) != LITERAL_by ) { LT( 1 ).setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "weakKeywords() : new LT(1) token - %s", LT( 1 ) ); } } break; default: // Case 2: The current token is after FROM and before '.'. if ( LA( 0 ) == FROM && t != IDENT && LA( 2 ) == DOT ) { HqlToken hqlToken = (HqlToken) LT( 1 ); if ( hqlToken.isPossibleID() ) { hqlToken.setType( IDENT ); if ( LOG.isDebugEnabled() ) { LOG.debugf( "weakKeywords() : new LT(1) token - %s", LT( 1 ) ); } } } break; } }