Package org.hibernate.hql.internal.antlr

Source Code of org.hibernate.hql.internal.antlr.HqlBaseLexer

// $ANTLR 2.7.7 (20060906): "hql.g" -> "HqlBaseLexer.java"$

package org.hibernate.hql.internal.antlr;

import org.hibernate.hql.internal.ast.*;
import org.hibernate.hql.internal.ast.util.*;


import java.io.InputStream;
import antlr.TokenStreamException;
import antlr.TokenStreamIOException;
import antlr.TokenStreamRecognitionException;
import antlr.CharStreamException;
import antlr.CharStreamIOException;
import antlr.ANTLRException;
import java.io.Reader;
import java.util.Hashtable;
import antlr.CharScanner;
import antlr.InputBuffer;
import antlr.ByteBuffer;
import antlr.CharBuffer;
import antlr.Token;
import antlr.CommonToken;
import antlr.RecognitionException;
import antlr.NoViableAltForCharException;
import antlr.MismatchedCharException;
import antlr.TokenStream;
import antlr.ANTLRHashString;
import antlr.LexerSharedInputState;
import antlr.collections.impl.BitSet;
import antlr.SemanticException;

/**
* Hibernate Query Language Lexer
* <br>
* This lexer provides the HQL parser with tokens.
* @author Joshua Davis (pgmjsd@sourceforge.net)
*/
public class HqlBaseLexer extends antlr.CharScanner implements HqlTokenTypes, TokenStream
{

  // NOTE: The real implementations are in the subclass.
  protected void setPossibleID(boolean possibleID) {}
public HqlBaseLexer(InputStream in) {
  this(new ByteBuffer(in));
}
public HqlBaseLexer(Reader in) {
  this(new CharBuffer(in));
}
public HqlBaseLexer(InputBuffer ib) {
  this(new LexerSharedInputState(ib));
}
public HqlBaseLexer(LexerSharedInputState state) {
  super(state);
  caseSensitiveLiterals = false;
  setCaseSensitive(false);
  literals = new Hashtable();
  literals.put(new ANTLRHashString("between", this), new Integer(10));
  literals.put(new ANTLRHashString("case", this), new Integer(57));
  literals.put(new ANTLRHashString("delete", this), new Integer(13));
  literals.put(new ANTLRHashString("new", this), new Integer(37));
  literals.put(new ANTLRHashString("end", this), new Integer(58));
  literals.put(new ANTLRHashString("object", this), new Integer(68));
  literals.put(new ANTLRHashString("insert", this), new Integer(29));
  literals.put(new ANTLRHashString("distinct", this), new Integer(16));
  literals.put(new ANTLRHashString("where", this), new Integer(53));
  literals.put(new ANTLRHashString("trailing", this), new Integer(70));
  literals.put(new ANTLRHashString("then", this), new Integer(60));
  literals.put(new ANTLRHashString("select", this), new Integer(45));
  literals.put(new ANTLRHashString("and", this), new Integer(6));
  literals.put(new ANTLRHashString("outer", this), new Integer(42));
  literals.put(new ANTLRHashString("not", this), new Integer(38));
  literals.put(new ANTLRHashString("fetch", this), new Integer(21));
  literals.put(new ANTLRHashString("from", this), new Integer(22));
  literals.put(new ANTLRHashString("null", this), new Integer(39));
  literals.put(new ANTLRHashString("count", this), new Integer(12));
  literals.put(new ANTLRHashString("like", this), new Integer(34));
  literals.put(new ANTLRHashString("when", this), new Integer(61));
  literals.put(new ANTLRHashString("class", this), new Integer(11));
  literals.put(new ANTLRHashString("inner", this), new Integer(28));
  literals.put(new ANTLRHashString("leading", this), new Integer(66));
  literals.put(new ANTLRHashString("with", this), new Integer(63));
  literals.put(new ANTLRHashString("set", this), new Integer(46));
  literals.put(new ANTLRHashString("escape", this), new Integer(18));
  literals.put(new ANTLRHashString("join", this), new Integer(32));
  literals.put(new ANTLRHashString("elements", this), new Integer(17));
  literals.put(new ANTLRHashString("of", this), new Integer(69));
  literals.put(new ANTLRHashString("is", this), new Integer(31));
  literals.put(new ANTLRHashString("member", this), new Integer(67));
  literals.put(new ANTLRHashString("or", this), new Integer(40));
  literals.put(new ANTLRHashString("any", this), new Integer(5));
  literals.put(new ANTLRHashString("full", this), new Integer(23));
  literals.put(new ANTLRHashString("min", this), new Integer(36));
  literals.put(new ANTLRHashString("as", this), new Integer(7));
  literals.put(new ANTLRHashString("by", this), new Integer(109));
  literals.put(new ANTLRHashString("nulls", this), new Integer(54));
  literals.put(new ANTLRHashString("all", this), new Integer(4));
  literals.put(new ANTLRHashString("union", this), new Integer(50));
  literals.put(new ANTLRHashString("order", this), new Integer(41));
  literals.put(new ANTLRHashString("both", this), new Integer(64));
  literals.put(new ANTLRHashString("some", this), new Integer(47));
  literals.put(new ANTLRHashString("properties", this), new Integer(43));
  literals.put(new ANTLRHashString("ascending", this), new Integer(110));
  literals.put(new ANTLRHashString("descending", this), new Integer(111));
  literals.put(new ANTLRHashString("false", this), new Integer(20));
  literals.put(new ANTLRHashString("exists", this), new Integer(19));
  literals.put(new ANTLRHashString("asc", this), new Integer(8));
  literals.put(new ANTLRHashString("left", this), new Integer(33));
  literals.put(new ANTLRHashString("desc", this), new Integer(14));
  literals.put(new ANTLRHashString("max", this), new Integer(35));
  literals.put(new ANTLRHashString("empty", this), new Integer(65));
  literals.put(new ANTLRHashString("sum", this), new Integer(48));
  literals.put(new ANTLRHashString("on", this), new Integer(62));
  literals.put(new ANTLRHashString("into", this), new Integer(30));
  literals.put(new ANTLRHashString("else", this), new Integer(59));
  literals.put(new ANTLRHashString("right", this), new Integer(44));
  literals.put(new ANTLRHashString("versioned", this), new Integer(52));
  literals.put(new ANTLRHashString("in", this), new Integer(26));
  literals.put(new ANTLRHashString("avg", this), new Integer(9));
  literals.put(new ANTLRHashString("update", this), new Integer(51));
  literals.put(new ANTLRHashString("true", this), new Integer(49));
  literals.put(new ANTLRHashString("group", this), new Integer(24));
  literals.put(new ANTLRHashString("having", this), new Integer(25));
  literals.put(new ANTLRHashString("indices", this), new Integer(27));
}

public Token nextToken() throws TokenStreamException {
  Token theRetToken=null;
tryAgain:
  for (;;) {
    Token _token = null;
    int _ttype = Token.INVALID_TYPE;
    resetText();
    try {   // for char stream error handling
      try {   // for lexical error handling
        switch ( LA(1)) {
        case '=':
        {
          mEQ(true);
          theRetToken=_returnToken;
          break;
        }
        case '!'case '^':
        {
          mNE(true);
          theRetToken=_returnToken;
          break;
        }
        case ',':
        {
          mCOMMA(true);
          theRetToken=_returnToken;
          break;
        }
        case '(':
        {
          mOPEN(true);
          theRetToken=_returnToken;
          break;
        }
        case ')':
        {
          mCLOSE(true);
          theRetToken=_returnToken;
          break;
        }
        case '[':
        {
          mOPEN_BRACKET(true);
          theRetToken=_returnToken;
          break;
        }
        case ']':
        {
          mCLOSE_BRACKET(true);
          theRetToken=_returnToken;
          break;
        }
        case '|':
        {
          mCONCAT(true);
          theRetToken=_returnToken;
          break;
        }
        case '+':
        {
          mPLUS(true);
          theRetToken=_returnToken;
          break;
        }
        case '-':
        {
          mMINUS(true);
          theRetToken=_returnToken;
          break;
        }
        case '*':
        {
          mSTAR(true);
          theRetToken=_returnToken;
          break;
        }
        case '/':
        {
          mDIV(true);
          theRetToken=_returnToken;
          break;
        }
        case '%':
        {
          mMOD(true);
          theRetToken=_returnToken;
          break;
        }
        case ':':
        {
          mCOLON(true);
          theRetToken=_returnToken;
          break;
        }
        case '?':
        {
          mPARAM(true);
          theRetToken=_returnToken;
          break;
        }
        case '\'':
        {
          mQUOTED_STRING(true);
          theRetToken=_returnToken;
          break;
        }
        case '\t'case '\n'case '\r'case ' ':
        {
          mWS(true);
          theRetToken=_returnToken;
          break;
        }
        case '.'case '0'case '1'case '2':
        case '3'case '4'case '5'case '6':
        case '7'case '8'case '9':
        {
          mNUM_INT(true);
          theRetToken=_returnToken;
          break;
        }
        default:
          if ((LA(1)=='<') && (LA(2)=='>')) {
            mSQL_NE(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='<') && (LA(2)=='=')) {
            mLE(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='>') && (LA(2)=='=')) {
            mGE(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='<') && (true)) {
            mLT(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='>') && (true)) {
            mGT(true);
            theRetToken=_returnToken;
          }
          else if ((_tokenSet_0.member(LA(1)))) {
            mIDENT(true);
            theRetToken=_returnToken;
          }
        else {
          if (LA(1)==EOF_CHAR) {uponEOF(); _returnToken = makeToken(Token.EOF_TYPE);}
        else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
        }
        }
        if ( _returnToken==null ) continue tryAgain; // found SKIP token
        _ttype = _returnToken.getType();
        _returnToken.setType(_ttype);
        return _returnToken;
      }
      catch (RecognitionException e) {
        throw new TokenStreamRecognitionException(e);
      }
    }
    catch (CharStreamException cse) {
      if ( cse instanceof CharStreamIOException ) {
        throw new TokenStreamIOException(((CharStreamIOException)cse).io);
      }
      else {
        throw new TokenStreamException(cse.getMessage());
      }
    }
  }
}

  public final void mEQ(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = EQ;
    int _saveIndex;
   
    match('=');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mLT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = LT;
    int _saveIndex;
   
    match('<');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mGT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = GT;
    int _saveIndex;
   
    match('>');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mSQL_NE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = SQL_NE;
    int _saveIndex;
   
    match("<>");
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mNE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = NE;
    int _saveIndex;
   
    switch ( LA(1)) {
    case '!':
    {
      match("!=");
      break;
    }
    case '^':
    {
      match("^=");
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mLE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = LE;
    int _saveIndex;
   
    match("<=");
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mGE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = GE;
    int _saveIndex;
   
    match(">=");
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mCOMMA(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = COMMA;
    int _saveIndex;
   
    match(',');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mOPEN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = OPEN;
    int _saveIndex;
   
    match('(');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mCLOSE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = CLOSE;
    int _saveIndex;
   
    match(')');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mOPEN_BRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = OPEN_BRACKET;
    int _saveIndex;
   
    match('[');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mCLOSE_BRACKET(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = CLOSE_BRACKET;
    int _saveIndex;
   
    match(']');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mCONCAT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = CONCAT;
    int _saveIndex;
   
    match("||");
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mPLUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = PLUS;
    int _saveIndex;
   
    match('+');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mMINUS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = MINUS;
    int _saveIndex;
   
    match('-');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mSTAR(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = STAR;
    int _saveIndex;
   
    match('*');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mDIV(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = DIV;
    int _saveIndex;
   
    match('/');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mMOD(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = MOD;
    int _saveIndex;
   
    match('%');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mCOLON(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = COLON;
    int _saveIndex;
   
    match(':');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mPARAM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = PARAM;
    int _saveIndex;
   
    match('?');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = IDENT;
    int _saveIndex;
   
    mID_START_LETTER(false);
    {
    _loop223:
    do {
      if ((_tokenSet_1.member(LA(1)))) {
        mID_LETTER(false);
      }
      else {
        break _loop223;
      }
     
    } while (true);
    }
    if ( inputState.guessing==0 ) {
     
          // Setting this flag allows the grammar to use keywords as identifiers, if necessary.
            setPossibleID(true);
         
    }
    _ttype = testLiteralsTable(_ttype);
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  protected final void mID_START_LETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = ID_START_LETTER;
    int _saveIndex;
   
    switch ( LA(1)) {
    case '_':
    {
      match('_');
      break;
    }
    case '$':
    {
      match('$');
      break;
    }
    case 'a'case 'b'case 'c'case 'd':
    case 'e'case 'f'case 'g'case 'h':
    case 'i'case 'j'case 'k'case 'l':
    case 'm'case 'n'case 'o'case 'p':
    case 'q'case 'r'case 's'case 't':
    case 'u'case 'v'case 'w'case 'x':
    case 'y'case 'z':
    {
      matchRange('a','z');
      break;
    }
    default:
      if (((LA(1) >= '\u0080' && LA(1) <= '\ufffe'))) {
        matchRange('\u0080','\ufffe');
      }
    else {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  protected final void mID_LETTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = ID_LETTER;
    int _saveIndex;
   
    if ((_tokenSet_0.member(LA(1)))) {
      mID_START_LETTER(false);
    }
    else if (((LA(1) >= '0' && LA(1) <= '9'))) {
      matchRange('0','9');
    }
    else {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
   
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mQUOTED_STRING(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = QUOTED_STRING;
    int _saveIndex;
   
    match('\'');
    {
    _loop230:
    do {
      boolean synPredMatched229 = false;
      if (((LA(1)=='\'') && (LA(2)=='\''))) {
        int _m229 = mark();
        synPredMatched229 = true;
        inputState.guessing++;
        try {
          {
          mESCqs(false);
          }
        }
        catch (RecognitionException pe) {
          synPredMatched229 = false;
        }
        rewind(_m229);
inputState.guessing--;
      }
      if ( synPredMatched229 ) {
        mESCqs(false);
      }
      else if ((_tokenSet_2.member(LA(1)))) {
        matchNot('\'');
      }
      else {
        break _loop230;
      }
     
    } while (true);
    }
    match('\'');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  protected final void mESCqs(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = ESCqs;
    int _saveIndex;
   
    match('\'');
    match('\'');
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mWS(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = WS;
    int _saveIndex;
   
    {
    switch ( LA(1)) {
    case ' ':
    {
      match(' ');
      break;
    }
    case '\t':
    {
      match('\t');
      break;
    }
    case '\n':
    {
      match('\n');
      if ( inputState.guessing==0 ) {
        newline();
      }
      break;
    }
    default:
      if ((LA(1)=='\r') && (LA(2)=='\n')) {
        match('\r');
        match('\n');
        if ( inputState.guessing==0 ) {
          newline();
        }
      }
      else if ((LA(1)=='\r') && (true)) {
        match('\r');
        if ( inputState.guessing==0 ) {
          newline();
        }
      }
    else {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    if ( inputState.guessing==0 ) {
      _ttype = Token.SKIP;
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  public final void mNUM_INT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = NUM_INT;
    int _saveIndex;
    Token f1=null;
    Token f2=null;
    Token f3=null;
    Token f4=null;
    boolean isDecimal=false; Token t=null;
   
    switch ( LA(1)) {
    case '.':
    {
      match('.');
      if ( inputState.guessing==0 ) {
        _ttype = DOT;
      }
      {
      if (((LA(1) >= '0' && LA(1) <= '9'))) {
        {
        int _cnt237=0;
        _loop237:
        do {
          if (((LA(1) >= '0' && LA(1) <= '9'))) {
            matchRange('0','9');
          }
          else {
            if ( _cnt237>=1 ) { break _loop237; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
          }
         
          _cnt237++;
        } while (true);
        }
        {
        if ((LA(1)=='e')) {
          mEXPONENT(false);
        }
        else {
        }
       
        }
        {
        if ((LA(1)=='b'||LA(1)=='d'||LA(1)=='f')) {
          mFLOAT_SUFFIX(true);
          f1=_returnToken;
          if ( inputState.guessing==0 ) {
            t=f1;
          }
        }
        else {
        }
       
        }
        if ( inputState.guessing==0 ) {
         
                    if ( t != null && t.getText().toUpperCase().indexOf("BD")>=0) {
                      _ttype = NUM_BIG_DECIMAL;
                    }
                    else if (t != null && t.getText().toUpperCase().indexOf('F')>=0) {
                      _ttype = NUM_FLOAT;
                    }
                    else {
                      _ttype = NUM_DOUBLE; // assume double
                    }
                 
        }
      }
      else {
      }
     
      }
      break;
    }
    case '0'case '1'case '2'case '3':
    case '4'case '5'case '6'case '7':
    case '8'case '9':
    {
      {
      switch ( LA(1)) {
      case '0':
      {
        match('0');
        if ( inputState.guessing==0 ) {
          isDecimal = true;
        }
        {
        switch ( LA(1)) {
        case 'x':
        {
          {
          match('x');
          }
          {
          int _cnt244=0;
          _loop244:
          do {
            if ((_tokenSet_3.member(LA(1))) && (true)) {
              mHEX_DIGIT(false);
            }
            else {
              if ( _cnt244>=1 ) { break _loop244; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
            }
           
            _cnt244++;
          } while (true);
          }
          break;
        }
        case '0'case '1'case '2'case '3':
        case '4'case '5'case '6'case '7':
        {
          {
          int _cnt246=0;
          _loop246:
          do {
            if (((LA(1) >= '0' && LA(1) <= '7'))) {
              matchRange('0','7');
            }
            else {
              if ( _cnt246>=1 ) { break _loop246; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
            }
           
            _cnt246++;
          } while (true);
          }
          break;
        }
        default:
          {
          }
        }
        }
        break;
      }
      case '1'case '2'case '3'case '4':
      case '5'case '6'case '7'case '8':
      case '9':
      {
        {
        matchRange('1','9');
        }
        {
        _loop249:
        do {
          if (((LA(1) >= '0' && LA(1) <= '9'))) {
            matchRange('0','9');
          }
          else {
            break _loop249;
          }
         
        } while (true);
        }
        if ( inputState.guessing==0 ) {
          isDecimal=true;
        }
        break;
      }
      default:
      {
        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
      }
      }
      }
      {
      if ((LA(1)=='b') && (LA(2)=='i')) {
        {
        match('b');
        match('i');
        }
        if ( inputState.guessing==0 ) {
          _ttype = NUM_BIG_INTEGER;
        }
      }
      else if ((LA(1)=='l')) {
        {
        match('l');
        }
        if ( inputState.guessing==0 ) {
          _ttype = NUM_LONG;
        }
      }
      else if (((_tokenSet_4.member(LA(1))) && (true))&&(isDecimal)) {
        {
        switch ( LA(1)) {
        case '.':
        {
          match('.');
          {
          _loop255:
          do {
            if (((LA(1) >= '0' && LA(1) <= '9'))) {
              matchRange('0','9');
            }
            else {
              break _loop255;
            }
           
          } while (true);
          }
          {
          if ((LA(1)=='e')) {
            mEXPONENT(false);
          }
          else {
          }
         
          }
          {
          if ((LA(1)=='b'||LA(1)=='d'||LA(1)=='f')) {
            mFLOAT_SUFFIX(true);
            f2=_returnToken;
            if ( inputState.guessing==0 ) {
              t=f2;
            }
          }
          else {
          }
         
          }
          break;
        }
        case 'e':
        {
          mEXPONENT(false);
          {
          if ((LA(1)=='b'||LA(1)=='d'||LA(1)=='f')) {
            mFLOAT_SUFFIX(true);
            f3=_returnToken;
            if ( inputState.guessing==0 ) {
              t=f3;
            }
          }
          else {
          }
         
          }
          break;
        }
        case 'b'case 'd'case 'f':
        {
          mFLOAT_SUFFIX(true);
          f4=_returnToken;
          if ( inputState.guessing==0 ) {
            t=f4;
          }
          break;
        }
        default:
        {
          throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
        }
        }
        }
        if ( inputState.guessing==0 ) {
         
                  if ( t != null && t.getText().toUpperCase().indexOf("BD")>=0) {
                    _ttype = NUM_BIG_DECIMAL;
                  }
                  else if (t != null && t.getText().toUpperCase() .indexOf('F') >= 0) {
                    _ttype = NUM_FLOAT;
                  }
                  else {
                    _ttype = NUM_DOUBLE; // assume double
                  }
               
        }
      }
      else {
      }
     
      }
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  protected final void mEXPONENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = EXPONENT;
    int _saveIndex;
   
    {
    match('e');
    }
    {
    switch ( LA(1)) {
    case '+':
    {
      match('+');
      break;
    }
    case '-':
    {
      match('-');
      break;
    }
    case '0'case '1'case '2'case '3':
    case '4'case '5'case '6'case '7':
    case '8'case '9':
    {
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    {
    int _cnt265=0;
    _loop265:
    do {
      if (((LA(1) >= '0' && LA(1) <= '9'))) {
        matchRange('0','9');
      }
      else {
        if ( _cnt265>=1 ) { break _loop265; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
      }
     
      _cnt265++;
    } while (true);
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  protected final void mFLOAT_SUFFIX(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = FLOAT_SUFFIX;
    int _saveIndex;
   
    switch ( LA(1)) {
    case 'f':
    {
      match('f');
      break;
    }
    case 'd':
    {
      match('d');
      break;
    }
    case 'b':
    {
      match('b');
      match('d');
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
  protected final void mHEX_DIGIT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = HEX_DIGIT;
    int _saveIndex;
   
    {
    switch ( LA(1)) {
    case '0'case '1'case '2'case '3':
    case '4'case '5'case '6'case '7':
    case '8'case '9':
    {
      matchRange('0','9');
      break;
    }
    case 'a'case 'b'case 'c'case 'd':
    case 'e'case 'f':
    {
      matchRange('a','f');
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
 
 
  private static final long[] mk_tokenSet_0() {
    long[] data = new long[3072];
    data[0]=68719476736L;
    data[1]=576460745860972544L;
    for (int i = 2; i<=1022; i++) { data[i]=-1L; }
    data[1023]=9223372036854775807L;
    return data;
  }
  public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
  private static final long[] mk_tokenSet_1() {
    long[] data = new long[3072];
    data[0]=287948969894477824L;
    data[1]=576460745860972544L;
    for (int i = 2; i<=1022; i++) { data[i]=-1L; }
    data[1023]=9223372036854775807L;
    return data;
  }
  public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
  private static final long[] mk_tokenSet_2() {
    long[] data = new long[2048];
    data[0]=-549755813889L;
    for (int i = 1; i<=1022; i++) { data[i]=-1L; }
    data[1023]=9223372036854775807L;
    return data;
  }
  public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
  private static final long[] mk_tokenSet_3() {
    long[] data = new long[1025];
    data[0]=287948901175001088L;
    data[1]=541165879296L;
    return data;
  }
  public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
  private static final long[] mk_tokenSet_4() {
    long[] data = new long[1025];
    data[0]=70368744177664L;
    data[1]=498216206336L;
    return data;
  }
  public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
 
  }
TOP

Related Classes of org.hibernate.hql.internal.antlr.HqlBaseLexer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.