Package com.sun.jdo.spi.persistence.support.ejb.ejbqlc

Source Code of com.sun.jdo.spi.persistence.support.ejb.ejbqlc.EJBQLLexer

// $ANTLR 2.7.6 (2005-12-22): "EJBQL.g" -> "EJBQLLexer.java"$

    package com.sun.jdo.spi.persistence.support.ejb.ejbqlc;

    import antlr.MismatchedTokenException;
    import antlr.MismatchedCharException;
    import antlr.NoViableAltException;
    import antlr.NoViableAltForCharException;
    import antlr.TokenStreamRecognitionException;
   
    import java.util.ResourceBundle;
    import org.glassfish.persistence.common.I18NHelper;

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;

/**
* This class defines the lexical analysis for the EJBQL compiler.
*
* @author  Michael Bouschen
* @author  Shing Wai Chan
*/
public class EJBQLLexer extends antlr.CharScanner implements EJBQLTokenTypes, TokenStream
{

    /**
     * The width of a tab stop.
     * This value is used to calculate the correct column in a line
     * conatining a tab character.
     */
    protected static final int TABSIZE = 4;

    /** */
    protected static final int EOF_CHAR = 65535; // = (char) -1 = EOF

    /** I18N support. */
    protected final static ResourceBundle msgs =
        I18NHelper.loadBundle(EJBQLLexer.class);
   
    /**
     *
     */
    public void tab()
    {
        int column = getColumn();
        int newColumn = (((column-1)/TABSIZE)+1)*TABSIZE+1;
        setColumn(newColumn);
    }

    /** */
    public void reportError(int line, int column, String s)
    {
        ErrorMsg.error(line, column, s);
    }

    /** Report lexer exception errors caught in nextToken(). */
    public void reportError(RecognitionException e)
    {
        handleANTLRException(e);
    }

    /** Lexer error-reporting function. */
    public void reportError(String s)
    {
        ErrorMsg.error(0, 0, s);
    }

    /** Lexer warning-reporting function. */
    public void reportWarning(String s)
    {
        throw new EJBQLException(s);
    }

    /**
     *
     */
    public static void handleANTLRException(ANTLRException ex)
    {
        if (ex instanceof MismatchedCharException) {
            MismatchedCharException mismatched = (MismatchedCharException)ex;
            if (mismatched.mismatchType == MismatchedCharException.CHAR) {
                if (mismatched.foundChar == EOF_CHAR) {
                    ErrorMsg.error(mismatched.getLine(), mismatched.getColumn(),
                        //TBD: bundle key
                        I18NHelper.getMessage(msgs, "EXC_UnexpectedEOF")); //NOI18N
                }
                else {
                    ErrorMsg.error(mismatched.getLine(), mismatched.getColumn(),
                        I18NHelper.getMessage(msgs, "EXC_ExpectedCharFound", //NOI18N
                            String.valueOf((char)mismatched.expecting),
                            String.valueOf((char)mismatched.foundChar)));
                }
                return;
            }
        }
        else if (ex instanceof MismatchedTokenException) {
            MismatchedTokenException mismatched = (MismatchedTokenException)ex;
            Token token = mismatched.token;
            if ((mismatched.mismatchType == MismatchedTokenException.TOKEN) &&
                (token != null)) {
                if (token.getType() == Token.EOF_TYPE) {
                    ErrorMsg.error(token.getLine(), token.getColumn(),
                        //TBD: bundle key
                        I18NHelper.getMessage(msgs, "EXC_UnexpectedEOF")); //NOI18N
                }
                else {
                    ErrorMsg.error(token.getLine(), token.getColumn(),
                        I18NHelper.getMessage(msgs, "EXC_SyntaxErrorAt", token.getText())); //NOI18N
                }
                return;
            }
        }
        else if (ex instanceof NoViableAltException) {
            Token token = ((NoViableAltException)ex).token;
            if (token != null) {
                if (token.getType() == Token.EOF_TYPE) {
                    ErrorMsg.error(token.getLine(), token.getColumn(),
                        //TBD: bundle key
                        I18NHelper.getMessage(msgs, "EXC_UnexpectedEOF")); //NOI18N
                }
                else {
                    ErrorMsg.error(token.getLine(), token.getColumn(),
                        I18NHelper.getMessage(msgs, "EXC_UnexpectedToken", token.getText())); //NOI18N
                }
                return;
            }
        }
        else if (ex instanceof NoViableAltForCharException) {
            NoViableAltForCharException noViableAlt = (NoViableAltForCharException)ex;
            ErrorMsg.error(noViableAlt.getLine(), noViableAlt.getColumn(),
                I18NHelper.getMessage(msgs, "EXC_UnexpectedChar", new Character(noViableAlt.foundChar)));//NOI18N
        }
        else if (ex instanceof TokenStreamRecognitionException) {
            handleANTLRException(((TokenStreamRecognitionException)ex).recog);
        }

        // no special handling from aboves matches the exception if this line is reached =>
        // make it a syntax error
        int line = 0;
        int column = 0;
        if (ex instanceof RecognitionException) {
            line = ((RecognitionException)ex).getLine();
            column = ((RecognitionException)ex).getColumn();
        }
        ErrorMsg.error(line, column, I18NHelper.getMessage(msgs, "EXC_SyntaxError")); //NOI18N
    }
public EJBQLLexer(InputStream in) {
  this(new ByteBuffer(in));
}
public EJBQLLexer(Reader in) {
  this(new CharBuffer(in));
}
public EJBQLLexer(InputBuffer ib) {
  this(new LexerSharedInputState(ib));
}
public EJBQLLexer(LexerSharedInputState state) {
  super(state);
  caseSensitiveLiterals = false;
  setCaseSensitive(true);
  literals = new Hashtable();
  literals.put(new ANTLRHashString("sqrt", this), new Integer(30));
  literals.put(new ANTLRHashString("count", this), new Integer(36));
  literals.put(new ANTLRHashString("sum", this), new Integer(35));
  literals.put(new ANTLRHashString("min", this), new Integer(34));
  literals.put(new ANTLRHashString("false", this), new Integer(11));
  literals.put(new ANTLRHashString("abs", this), new Integer(29));
  literals.put(new ANTLRHashString("true", this), new Integer(10));
  literals.put(new ANTLRHashString("substring", this), new Integer(26));
  literals.put(new ANTLRHashString("and", this), new Integer(13));
  literals.put(new ANTLRHashString("concat", this), new Integer(25));
  literals.put(new ANTLRHashString("asc", this), new Integer(39));
  literals.put(new ANTLRHashString("desc", this), new Integer(40));
  literals.put(new ANTLRHashString("select", this), new Integer(4));
  literals.put(new ANTLRHashString("member", this), new Integer(21));
  literals.put(new ANTLRHashString("distinct", this), new Integer(7));
  literals.put(new ANTLRHashString("where", this), new Integer(6));
  literals.put(new ANTLRHashString("avg", this), new Integer(32));
  literals.put(new ANTLRHashString("order", this), new Integer(37));
  literals.put(new ANTLRHashString("mod", this), new Integer(31));
  literals.put(new ANTLRHashString("in", this), new Integer(17));
  literals.put(new ANTLRHashString("null", this), new Integer(9));
  literals.put(new ANTLRHashString("locate", this), new Integer(27));
  literals.put(new ANTLRHashString("empty", this), new Integer(20));
  literals.put(new ANTLRHashString("escape", this), new Integer(24));
  literals.put(new ANTLRHashString("length", this), new Integer(28));
  literals.put(new ANTLRHashString("of", this), new Integer(22));
  literals.put(new ANTLRHashString("or", this), new Integer(14));
  literals.put(new ANTLRHashString("between", this), new Integer(15));
  literals.put(new ANTLRHashString("max", this), new Integer(33));
  literals.put(new ANTLRHashString("from", this), new Integer(5));
  literals.put(new ANTLRHashString("is", this), new Integer(23));
  literals.put(new ANTLRHashString("like", this), new Integer(16));
  literals.put(new ANTLRHashString("object", this), new Integer(8));
  literals.put(new ANTLRHashString("not", this), new Integer(12));
  literals.put(new ANTLRHashString("unknown", this), new Integer(19));
  literals.put(new ANTLRHashString("by", this), new Integer(38));
  literals.put(new ANTLRHashString("as", this), new Integer(18));
}

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 '(':
        {
          mLPAREN(true);
          theRetToken=_returnToken;
          break;
        }
        case ')':
        {
          mRPAREN(true);
          theRetToken=_returnToken;
          break;
        }
        case ',':
        {
          mCOMMA(true);
          theRetToken=_returnToken;
          break;
        }
        case '=':
        {
          mEQUAL(true);
          theRetToken=_returnToken;
          break;
        }
        case '+':
        {
          mPLUS(true);
          theRetToken=_returnToken;
          break;
        }
        case '/':
        {
          mDIV(true);
          theRetToken=_returnToken;
          break;
        }
        case '-':
        {
          mMINUS(true);
          theRetToken=_returnToken;
          break;
        }
        case '*':
        {
          mSTAR(true);
          theRetToken=_returnToken;
          break;
        }
        case '\t'case '\u000c'case ' ':
        {
          mWS(true);
          theRetToken=_returnToken;
          break;
        }
        case '\n'case '\r':
        {
          mNEWLINE(true);
          theRetToken=_returnToken;
          break;
        }
        case '?':
        {
          mINPUT_PARAMETER(true);
          theRetToken=_returnToken;
          break;
        }
        case '\'':
        {
          mSTRING_LITERAL(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':
        {
          mINT_LITERAL(true);
          theRetToken=_returnToken;
          break;
        }
        default:
          if ((LA(1)=='<') && (LA(2)=='>')) {
            mNOT_EQUAL(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='>') && (LA(2)=='=')) {
            mGE(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='<') && (LA(2)=='=')) {
            mLE(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='>') && (true)) {
            mGT(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='<') && (true)) {
            mLT(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();
        _ttype = testLiteralsTable(_ttype);
        _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 mLPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = LPAREN;
    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 mRPAREN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = RPAREN;
    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 mEQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = EQUAL;
    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 mNOT_EQUAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = NOT_EQUAL;
    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 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 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 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 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 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 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 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 '\u000c':
    {
      match('\f');
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    _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 mNEWLINE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = NEWLINE;
    int _saveIndex;
   
    {
    if ((LA(1)=='\r') && (LA(2)=='\n')) {
      match("\r\n");
    }
    else if ((LA(1)=='\r') && (true)) {
      match('\r');
    }
    else if ((LA(1)=='\n')) {
      match('\n');
    }
    else {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
   
    }
   
    newline();
    _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 mINPUT_PARAMETER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = INPUT_PARAMETER;
    int _saveIndex;
   
    match('?');
    {
    matchRange('1','9');
    }
    {
    _loop21:
    do {
      if (((LA(1) >= '0' && LA(1) <= '9'))) {
        matchRange('0','9');
      }
      else {
        break _loop21;
      }
     
    } while (true);
    }
    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 mSTRING_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = STRING_LITERAL;
    int _saveIndex;
   
    match('\'');
    {
    _loop24:
    do {
      if ((LA(1)=='\'') && (LA(2)=='\'')) {
        match("''");
      }
      else if ((LA(1)=='\\')) {
        mESC(false);
      }
      else if ((_tokenSet_1.member(LA(1)))) {
        matchNot('\'');
      }
      else {
        break _loop24;
      }
     
    } 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 mESC(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = ESC;
    int _saveIndex;
   
    match('\\');
    {
    if ((LA(1)=='n') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      match('n');
    }
    else if ((LA(1)=='r') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      match('r');
    }
    else if ((LA(1)=='t') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      match('t');
    }
    else if ((LA(1)=='b') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      match('b');
    }
    else if ((LA(1)=='f') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      match('f');
    }
    else if ((LA(1)=='"') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      match('"');
    }
    else if ((LA(1)=='\\') && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      match('\\');
    }
    else if ((LA(1)=='u') && (_tokenSet_2.member(LA(2)))) {
      {
      int _cnt28=0;
      _loop28:
      do {
        if ((LA(1)=='u')) {
          match('u');
        }
        else {
          if ( _cnt28>=1 ) { break _loop28; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
        }
       
        _cnt28++;
      } while (true);
      }
      mHEX_DIGIT(false);
      mHEX_DIGIT(false);
      mHEX_DIGIT(false);
      mHEX_DIGIT(false);
    }
    else if (((LA(1) >= '0' && LA(1) <= '3')) && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      {
      matchRange('0','3');
      }
      {
      if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
        {
        matchRange('0','7');
        }
        {
        if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
          matchRange('0','7');
        }
        else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe')) && (true)) {
        }
        else {
          throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
        }
       
        }
      }
      else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe')) && (true)) {
      }
      else {
        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
      }
     
      }
    }
    else if (((LA(1) >= '4' && LA(1) <= '7')) && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
      {
      matchRange('4','7');
      }
      {
      if (((LA(1) >= '0' && LA(1) <= '7')) && ((LA(2) >= '\u0000' && LA(2) <= '\ufffe'))) {
        {
        matchRange('0','7');
        }
      }
      else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe')) && (true)) {
      }
      else {
        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
      }
     
      }
    }
    else if (((LA(1) >= '\u0000' && LA(1) <= '\ufffe')) && (true)) {
    }
    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 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;
    }
    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;
  }
 
  public final void mINT_LITERAL(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = INT_LITERAL;
    int _saveIndex;
   
    boolean isDecimal=false;
    int tokenType = DOUBLE_LITERAL;
   
   
    switch ( LA(1)) {
    case '.':
    {
      match('.');
      _ttype = DOT;
      {
      if (((LA(1) >= '0' && LA(1) <= '9'))) {
        {
        int _cnt41=0;
        _loop41:
        do {
          if (((LA(1) >= '0' && LA(1) <= '9'))) {
            matchRange('0','9');
          }
          else {
            if ( _cnt41>=1 ) { break _loop41; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
          }
         
          _cnt41++;
        } while (true);
        }
        tokenType = DOUBLE_LITERAL;
        {
        if ((LA(1)=='E'||LA(1)=='e')) {
          mEXPONENT(false);
        }
        else {
        }
       
        }
        {
        if ((_tokenSet_3.member(LA(1)))) {
          tokenType=mFLOATINGPOINT_SUFFIX(false);
        }
        else {
        }
       
        }
        _ttype = tokenType;
      }
      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');
        isDecimal = true;
        {
        switch ( LA(1)) {
        case 'X'case 'x':
        {
          {
          switch ( LA(1)) {
          case 'x':
          {
            match('x');
            break;
          }
          case 'X':
          {
            match('X');
            break;
          }
          default:
          {
            throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
          }
          }
          }
          {
          int _cnt48=0;
          _loop48:
          do {
            if ((_tokenSet_4.member(LA(1))) && (true)) {
              mHEX_DIGIT(false);
            }
            else {
              if ( _cnt48>=1 ) { break _loop48; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
            }
           
            _cnt48++;
          } while (true);
          }
          break;
        }
        case '0'case '1'case '2'case '3':
        case '4'case '5'case '6'case '7':
        {
          {
          int _cnt50=0;
          _loop50:
          do {
            if (((LA(1) >= '0' && LA(1) <= '7'))) {
              matchRange('0','7');
            }
            else {
              if ( _cnt50>=1 ) { break _loop50; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
            }
           
            _cnt50++;
          } 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');
        }
        {
        _loop53:
        do {
          if (((LA(1) >= '0' && LA(1) <= '9'))) {
            matchRange('0','9');
          }
          else {
            break _loop53;
          }
         
        } while (true);
        }
        isDecimal=true;
        break;
      }
      default:
      {
        throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
      }
      }
      }
      {
      if ((LA(1)=='L'||LA(1)=='l')) {
        {
        switch ( LA(1)) {
        case 'l':
        {
          match('l');
          break;
        }
        case 'L':
        {
          match('L');
          break;
        }
        default:
        {
          throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
        }
        }
        }
        _ttype = LONG_LITERAL;
      }
      else if (((_tokenSet_5.member(LA(1))))&&(isDecimal)) {
        tokenType = DOUBLE_LITERAL;
        {
        switch ( LA(1)) {
        case '.':
        {
          match('.');
          {
          _loop58:
          do {
            if (((LA(1) >= '0' && LA(1) <= '9'))) {
              matchRange('0','9');
            }
            else {
              break _loop58;
            }
           
          } while (true);
          }
          {
          if ((LA(1)=='E'||LA(1)=='e')) {
            mEXPONENT(false);
          }
          else {
          }
         
          }
          {
          if ((_tokenSet_3.member(LA(1)))) {
            tokenType=mFLOATINGPOINT_SUFFIX(false);
          }
          else {
          }
         
          }
          break;
        }
        case 'E'case 'e':
        {
          mEXPONENT(false);
          {
          if ((_tokenSet_3.member(LA(1)))) {
            tokenType=mFLOATINGPOINT_SUFFIX(false);
          }
          else {
          }
         
          }
          break;
        }
        case 'D'case 'F'case 'd'case 'f':
        {
          tokenType=mFLOATINGPOINT_SUFFIX(false);
          break;
        }
        default:
        {
          throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
        }
        }
        }
        _ttype = tokenType;
      }
      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;
   
    {
    switch ( LA(1)) {
    case 'e':
    {
      match('e');
      break;
    }
    case 'E':
    {
      match('E');
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    {
    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 _cnt66=0;
    _loop66:
    do {
      if (((LA(1) >= '0' && LA(1) <= '9'))) {
        matchRange('0','9');
      }
      else {
        if ( _cnt66>=1 ) { break _loop66; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
      }
     
      _cnt66++;
    } 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 int  mFLOATINGPOINT_SUFFIX(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int tokenType;
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = FLOATINGPOINT_SUFFIX;
    int _saveIndex;
   
    switch ( LA(1)) {
    case 'f':
    {
      match('f');
      tokenType = FLOAT_LITERAL;
      break;
    }
    case 'F':
    {
      match('F');
      tokenType = FLOAT_LITERAL;
      break;
    }
    case 'd':
    {
      match('d');
      tokenType = DOUBLE_LITERAL;
      break;
    }
    case 'D':
    {
      match('D');
      tokenType = DOUBLE_LITERAL;
      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;
    return tokenType;
  }
 
  public final void mIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = IDENT;
    int _saveIndex;
    char  c1 = '\0';
    char  c2 = '\0';
   
    {
    switch ( LA(1)) {
    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;
    }
    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;
    }
    case '_':
    {
      match('_');
      break;
    }
    case '$':
    {
      match('$');
      break;
    }
    case '\\':
    {
      mUNICODE_ESCAPE(false);
      break;
    }
    default:
      if (((LA(1) >= '\u0080' && LA(1) <= '\ufffe'))) {
        c1 = LA(1);
        matchRange('\u0080','\uFFFE');
       
        if (!Character.isJavaIdentifierStart(c1)) {
        ErrorMsg.error(getLine(), getColumn(),
        I18NHelper.getMessage(msgs, "EXC_UnexpectedChar", String.valueOf(c1)));//NOI18N
        }
       
      }
    else {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    {
    _loop71:
    do {
      switch ( LA(1)) {
      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;
      }
      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;
      }
      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':
      {
        matchRange('0','9');
        break;
      }
      case '\\':
      {
        mUNICODE_ESCAPE(false);
        break;
      }
      default:
        if (((LA(1) >= '\u0080' && LA(1) <= '\ufffe'))) {
          c2 = LA(1);
          matchRange('\u0080','\uFFFE');
         
          if (!Character.isJavaIdentifierPart(c2)) {
          ErrorMsg.error(getLine(), getColumn(),
          I18NHelper.getMessage(msgs, "EXC_UnexpectedChar", String.valueOf(c2)));//NOI18N
          }
         
        }
      else {
        break _loop71;
      }
      }
    } while (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 mUNICODE_ESCAPE(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = UNICODE_ESCAPE;
    int _saveIndex;
   
    match('\\');
    {
    int _cnt74=0;
    _loop74:
    do {
      if ((LA(1)=='u')) {
        match('u');
      }
      else {
        if ( _cnt74>=1 ) { break _loop74; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
      }
     
      _cnt74++;
    } while (true);
    }
    mHEX_DIGIT(false);
    mHEX_DIGIT(false);
    mHEX_DIGIT(false);
    mHEX_DIGIT(false);
   
    try {
    String tmp = text.toString();
    char c  = (char)Integer.parseInt(tmp.substring(tmp.length() - 4,
    tmp.length()), 16);
    // problems using ANTLR feature $setText => use generated code
    text.setLength(_begin);
    text.append(new Character(c).toString());
    }
    catch (NumberFormatException ex) {
    ErrorMsg.fatal(I18NHelper.getMessage(msgs,
    "ERR_UnexpectedExceptionUnicode"), ex); //NOI18N
    }
   
    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]=576460746263625726L;
    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[2048];
    data[0]=-549755813889L;
    data[1]=-268435457L;
    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[1025];
    data[0]=287948901175001088L;
    data[1]=9007740420620414L;
    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[1]=343597383760L;
    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]=287948901175001088L;
    data[1]=541165879422L;
    return data;
  }
  public static final BitSet _tokenSet_4 = new BitSet(mk_tokenSet_4());
  private static final long[] mk_tokenSet_5() {
    long[] data = new long[1025];
    data[0]=70368744177664L;
    data[1]=481036337264L;
    return data;
  }
  public static final BitSet _tokenSet_5 = new BitSet(mk_tokenSet_5());
 
  }
TOP

Related Classes of com.sun.jdo.spi.persistence.support.ejb.ejbqlc.EJBQLLexer

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.