Package

Source Code of PascalLexer

// $ANTLR 2.7.2: "pascal.g" -> "PascalLexer.java"$

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;

public class PascalLexer extends antlr.CharScanner implements PascalTokenTypes, TokenStream
{
public PascalLexer(InputStream in) {
  this(new ByteBuffer(in));
}
public PascalLexer(Reader in) {
  this(new CharBuffer(in));
}
public PascalLexer(InputBuffer ib) {
  this(new LexerSharedInputState(ib));
}
public PascalLexer(LexerSharedInputState state) {
  super(state);
  caseSensitiveLiterals = false;
  setCaseSensitive(false);
  literals = new Hashtable();
  literals.put(new ANTLRHashString("type", this), new Integer(42));
  literals.put(new ANTLRHashString("case", this), new Integer(61));
  literals.put(new ANTLRHashString("while", this), new Integer(87));
  literals.put(new ANTLRHashString("repeat", this), new Integer(89));
  literals.put(new ANTLRHashString("end", this), new Integer(60));
  literals.put(new ANTLRHashString("integer", this), new Integer(49));
  literals.put(new ANTLRHashString("then", this), new Integer(85));
  literals.put(new ANTLRHashString("program", this), new Integer(24));
  literals.put(new ANTLRHashString("implementation", this), new Integer(30));
  literals.put(new ANTLRHashString("until", this), new Integer(90));
  literals.put(new ANTLRHashString("to", this), new Integer(92));
  literals.put(new ANTLRHashString("and", this), new Integer(79));
  literals.put(new ANTLRHashString("const", this), new Integer(34));
  literals.put(new ANTLRHashString("not", this), new Integer(80));
  literals.put(new ANTLRHashString("var", this), new Integer(65));
  literals.put(new ANTLRHashString("real", this), new Integer(50));
  literals.put(new ANTLRHashString("mod", this), new Integer(78));
  literals.put(new ANTLRHashString("packed", this), new Integer(52));
  literals.put(new ANTLRHashString("do", this), new Integer(88));
  literals.put(new ANTLRHashString("function", this), new Integer(43));
  literals.put(new ANTLRHashString("with", this), new Integer(94));
  literals.put(new ANTLRHashString("set", this), new Integer(62));
  literals.put(new ANTLRHashString("interface", this), new Integer(22));
  literals.put(new ANTLRHashString("of", this), new Integer(56));
  literals.put(new ANTLRHashString("array", this), new Integer(55));
  literals.put(new ANTLRHashString("file", this), new Integer(63));
  literals.put(new ANTLRHashString("or", this), new Integer(74));
  literals.put(new ANTLRHashString("if", this), new Integer(84));
  literals.put(new ANTLRHashString("record", this), new Integer(59));
  literals.put(new ANTLRHashString("chr", this), new Integer(36));
  literals.put(new ANTLRHashString("goto", this), new Integer(82));
  literals.put(new ANTLRHashString("for", this), new Integer(91));
  literals.put(new ANTLRHashString("unit", this), new Integer(28));
  literals.put(new ANTLRHashString("boolean", this), new Integer(48));
  literals.put(new ANTLRHashString("label", this), new Integer(32));
  literals.put(new ANTLRHashString("char", this), new Integer(47));
  literals.put(new ANTLRHashString("string", this), new Integer(51));
  literals.put(new ANTLRHashString("downto", this), new Integer(93));
  literals.put(new ANTLRHashString("begin", this), new Integer(83));
  literals.put(new ANTLRHashString("else", this), new Integer(86));
  literals.put(new ANTLRHashString("uses", this), new Integer(31));
  literals.put(new ANTLRHashString("in", this), new Integer(73));
  literals.put(new ANTLRHashString("procedure", this), new Integer(45));
  literals.put(new ANTLRHashString("nil", this), new Integer(81));
  literals.put(new ANTLRHashString("div", this), new Integer(77));
}

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 '+':
        {
          mPLUS(true);
          theRetToken=_returnToken;
          break;
        }
        case '-':
        {
          mMINUS(true);
          theRetToken=_returnToken;
          break;
        }
        case '*':
        {
          mSTAR(true);
          theRetToken=_returnToken;
          break;
        }
        case '/':
        {
          mSLASH(true);
          theRetToken=_returnToken;
          break;
        }
        case ',':
        {
          mCOMMA(true);
          theRetToken=_returnToken;
          break;
        }
        case ';':
        {
          mSEMI(true);
          theRetToken=_returnToken;
          break;
        }
        case '=':
        {
          mEQUAL(true);
          theRetToken=_returnToken;
          break;
        }
        case ')':
        {
          mRPAREN(true);
          theRetToken=_returnToken;
          break;
        }
        case '[':
        {
          mLBRACK(true);
          theRetToken=_returnToken;
          break;
        }
        case ']':
        {
          mRBRACK(true);
          theRetToken=_returnToken;
          break;
        }
        case '^':
        {
          mPOINTER(true);
          theRetToken=_returnToken;
          break;
        }
        case '@':
        {
          mAT(true);
          theRetToken=_returnToken;
          break;
        }
        case '}':
        {
          mRCURLY(true);
          theRetToken=_returnToken;
          break;
        }
        case '\t'case '\n'case '\u000c'case '\r':
        case ' ':
        {
          mWS(true);
          theRetToken=_returnToken;
          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':
        {
          mIDENT(true);
          theRetToken=_returnToken;
          break;
        }
        case '\'':
        {
          mSTRING_LITERAL(true);
          theRetToken=_returnToken;
          break;
        }
        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)=='=')) {
            mASSIGN(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='<') && (LA(2)=='>')) {
            mNOT_EQUAL(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)=='(') && (LA(2)=='.')) {
            mLBRACK2(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='.') && (LA(2)==')')) {
            mRBRACK2(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='(') && (LA(2)=='*')) {
            mCOMMENT_1(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='{') && ((LA(2) >= '\u0000' && LA(2) <= '\u00ff'))) {
            mCOMMENT_2(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)==':') && (true)) {
            mCOLON(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='<') && (true)) {
            mLT(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='>') && (true)) {
            mGT(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='(') && (true)) {
            mLPAREN(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='.') && (true)) {
            mDOT(true);
            theRetToken=_returnToken;
          }
          else if ((LA(1)=='{') && (true)) {
            mLCURLY(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 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 mSLASH(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = SLASH;
    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 mASSIGN(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = ASSIGN;
    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 mSEMI(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = SEMI;
    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 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 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 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 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 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 mLBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = LBRACK;
    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 mLBRACK2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = LBRACK2;
    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 mRBRACK(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = RBRACK;
    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 mRBRACK2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = RBRACK2;
    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 mPOINTER(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = POINTER;
    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 mAT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = AT;
    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 mDOT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = DOT;
    int _saveIndex;
   
    match('.');
    {
    if ((LA(1)=='.')) {
      match('.');
      _ttype = DOTDOT;
    }
    else {
    }
   
    }
    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 mLCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = LCURLY;
    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 mRCURLY(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = RCURLY;
    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;
    }
    case '\n'case '\r':
    {
      {
      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();
      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 mCOMMENT_1(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = COMMENT_1;
    int _saveIndex;
   
    match("(*");
    {
    _loop188:
    do {
      if ((LA(1)=='\r') && (LA(2)=='\n') && ((LA(3) >= '\u0000' && LA(3) <= '\u00ff')) && ((LA(4) >= '\u0000' && LA(4) <= '\u00ff'))) {
        match('\r');
        match('\n');
        newline();
      }
      else if (((LA(1)=='*') && ((LA(2) >= '\u0000' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0000' && LA(3) <= '\u00ff')))&&( LA(2) != ')' )) {
        match('*');
      }
      else if ((LA(1)=='\r') && ((LA(2) >= '\u0000' && LA(2) <= '\u00ff')) && ((LA(3) >= '\u0000' && LA(3) <= '\u00ff')) && (true)) {
        match('\r');
        newline();
      }
      else if ((LA(1)=='\n')) {
        match('\n');
        newline();
      }
      else if ((_tokenSet_0.member(LA(1)))) {
        {
        match(_tokenSet_0);
        }
      }
      else {
        break _loop188;
      }
     
    } while (true);
    }
    match("*)");
    _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 mCOMMENT_2(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = COMMENT_2;
    int _saveIndex;
   
    match('{');
    {
    _loop192:
    do {
      if ((LA(1)=='\r') && (LA(2)=='\n') && ((LA(3) >= '\u0000' && LA(3) <= '\u00ff')) && (true)) {
        match('\r');
        match('\n');
        newline();
      }
      else if ((LA(1)=='\r') && ((LA(2) >= '\u0000' && LA(2) <= '\u00ff')) && (true) && (true)) {
        match('\r');
        newline();
      }
      else if ((LA(1)=='\n')) {
        match('\n');
        newline();
      }
      else if ((_tokenSet_1.member(LA(1)))) {
        {
        match(_tokenSet_1);
        }
      }
      else {
        break _loop192;
      }
     
    } while (true);
    }
    match('}');
    _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 mIDENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = IDENT;
    int _saveIndex;
   
    {
    matchRange('a','z');
    }
    {
    _loop196:
    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 '0'case '1'case '2'case '3':
      case '4'case '5'case '6'case '7':
      case '8'case '9':
      {
        matchRange('0','9');
        break;
      }
      case '_':
      {
        match('_');
        break;
      }
      default:
      {
        break _loop196;
      }
      }
    } 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;
  }
 
  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('\'');
    {
    _loop200:
    do {
      if ((LA(1)=='\'') && (LA(2)=='\'')) {
        match("\'\'");
      }
      else if ((_tokenSet_2.member(LA(1)))) {
        {
        match(_tokenSet_2);
        }
      }
      else {
        break _loop200;
      }
     
    } 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;
  }
 
/** a numeric literal.  Form is (from Wirth)
*  digits
*  digits . digits
*  digits . digits exponent
*  digits exponent
*/
  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;
   
    {
    int _cnt203=0;
    _loop203:
    do {
      if (((LA(1) >= '0' && LA(1) <= '9'))) {
        matchRange('0','9');
      }
      else {
        if ( _cnt203>=1 ) { break _loop203; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
      }
     
      _cnt203++;
    } while (true);
    }
    {
    if ((LA(1)=='e')) {
      mEXPONENT(false);
      _ttype = NUM_REAL;
    }
    else {
      {
      if (((LA(1)=='.'))&&((LA(2)!='.')&&(LA(2)!=')'))) {
        match('.');
        _ttype = NUM_REAL;
        {
        int _cnt207=0;
        _loop207:
        do {
          if (((LA(1) >= '0' && LA(1) <= '9'))) {
            matchRange('0','9');
          }
          else {
            if ( _cnt207>=1 ) { break _loop207; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
          }
         
          _cnt207++;
        } while (true);
        }
        {
        if ((LA(1)=='e')) {
          mEXPONENT(false);
        }
        else {
        }
       
        }
      }
      else {
      }
     
      }
    }
   
    }
    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 _cnt213=0;
    _loop213:
    do {
      if (((LA(1) >= '0' && LA(1) <= '9'))) {
        matchRange('0','9');
      }
      else {
        if ( _cnt213>=1 ) { break _loop213; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
      }
     
      _cnt213++;
    } while (true);
    }
    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[8];
    data[0]=-4398046520321L;
    for (int i = 1; i<=3; i++) { data[i]=-1L; }
    return data;
  }
  public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
  private static final long[] mk_tokenSet_1() {
    long[] data = new long[8];
    data[0]=-9217L;
    data[1]=-2305843009213693953L;
    for (int i = 2; i<=3; i++) { data[i]=-1L; }
    return data;
  }
  public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
  private static final long[] mk_tokenSet_2() {
    long[] data = new long[8];
    data[0]=-549755813889L;
    for (int i = 1; i<=3; i++) { data[i]=-1L; }
    return data;
  }
  public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
 
  }
TOP

Related Classes of PascalLexer

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.