Package org.jostraca.comp.antlr

Examples of org.jostraca.comp.antlr.Token


    }
    _returnToken = _token;
  }
 
  protected final void mWS_OPT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = WS_OPT;
    int _saveIndex;
   
    {
    if ((_tokenSet_5.member(LA(1)))) {
      mWS(false);
    }
    else {
    }
   
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
View Full Code Here


  setCaseSensitive(true);
  literals = new Hashtable();
}

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
        if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))) {
View Full Code Here

    }
  }
}

  public final void mACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = ACTION;
    int _saveIndex;
   
    {
    int _cnt382=0;
    _loop382:
    do {
      switch ( LA(1)) {
      case '#':
      {
        mAST_ITEM(false);
        break;
      }
      case '$':
      {
        mTEXT_ITEM(false);
        break;
      }
      default:
        if ((_tokenSet_0.member(LA(1)))) {
          mSTUFF(false);
        }
      else {
        if ( _cnt382>=1 ) { break _loop382; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
      }
      }
      _cnt382++;
    } while (true);
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
View Full Code Here

    }
    _returnToken = _token;
  }
 
  protected final void mSTUFF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = STUFF;
    int _saveIndex;
   
    switch ( LA(1)) {
    case '"':
    {
      mSTRING(false);
      break;
    }
    case '\'':
    {
      mCHAR(false);
      break;
    }
    case '\n':
    {
      match('\n');
      newline();
      break;
    }
    default:
      if ((LA(1)=='/') && (LA(2)=='*'||LA(2)=='/')) {
        mCOMMENT(false);
      }
      else if ((LA(1)=='\r') && (LA(2)=='\n') && (true)) {
        match("\r\n");
        newline();
      }
      else if ((LA(1)=='/') && (_tokenSet_1.member(LA(2)))) {
        match('/');
        {
        match(_tokenSet_1);
        }
      }
      else if ((LA(1)=='\r') && (true) && (true)) {
        match('\r');
        newline();
      }
      else if ((_tokenSet_2.member(LA(1)))) {
        {
        match(_tokenSet_2);
        }
      }
    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;
  }
View Full Code Here

    }
    _returnToken = _token;
  }
 
  protected final void mAST_ITEM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = AST_ITEM;
    int _saveIndex;
    Token t=null;
    Token id=null;
    Token ctor=null;
   
    if ((LA(1)=='#') && (LA(2)=='(')) {
      _saveIndex=text.length();
      match('#');
      text.setLength(_saveIndex);
View Full Code Here

    }
    _returnToken = _token;
  }
 
  protected final void mTEXT_ITEM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = TEXT_ITEM;
    int _saveIndex;
    Token a1=null;
    Token a2=null;
    Token a3=null;
    Token a4=null;
    Token a5=null;
    Token a6=null;
   
    if ((LA(1)=='$') && (LA(2)=='F') && (LA(3)=='O')) {
      match("$FOLLOW");
      {
      if ((_tokenSet_5.member(LA(1))) && (_tokenSet_6.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
        {
        switch ( LA(1)) {
        case '\t'case '\n'case '\r'case ' ':
        {
          mWS(false);
          break;
        }
        case '(':
        {
          break;
        }
        default:
        {
          throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
        }
        }
        }
        match('(');
        mTEXT_ARG(true);
        a5=_returnToken;
        match(')');
      }
      else {
      }
     
      }
     
            String rule = currentRule.getRuleName();
            if ( a5!=null ) {
              rule = a5.getText();
            }
            String setName = generator.getFOLLOWBitSet(rule, 1);
            // System.out.println("FOLLOW("+rule+")="+setName);
            if ( setName==null ) {
              reportError("$FOLLOW("+rule+")"+
                    ": unknown rule or bad lookahead computation");
            }
            else {
              text.setLength(_begin); text.append(setName);
            }
         
    }
    else if ((LA(1)=='$') && (LA(2)=='F') && (LA(3)=='I')) {
      match("$FIRST");
      {
      if ((_tokenSet_5.member(LA(1))) && (_tokenSet_6.member(LA(2))) && ((LA(3) >= '\u0003' && LA(3) <= '\u00ff'))) {
        {
        switch ( LA(1)) {
        case '\t'case '\n'case '\r'case ' ':
        {
          mWS(false);
          break;
        }
        case '(':
        {
          break;
        }
        default:
        {
          throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
        }
        }
        }
        match('(');
        mTEXT_ARG(true);
        a6=_returnToken;
        match(')');
      }
      else {
      }
     
      }
     
            String rule = currentRule.getRuleName();
            if ( a6!=null ) {
              rule = a6.getText();
            }
            String setName = generator.getFIRSTBitSet(rule, 1);
            // System.out.println("FIRST("+rule+")="+setName);
            if ( setName==null ) {
              reportError("$FIRST("+rule+")"+
View Full Code Here

  setCaseSensitive(true);
  literals = new Hashtable();
}

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
        if (((LA(1) >= '\u0003' && LA(1) <= '\u00ff'))) {
View Full Code Here

    }
  }
}

  public final void mACTION(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = ACTION;
    int _saveIndex;
   
    {
    int _cnt623=0;
    _loop623:
    do {
      switch ( LA(1)) {
      case '#':
      {
        mAST_ITEM(false);
        break;
      }
      case '$':
      {
        mTEXT_ITEM(false);
        break;
      }
      default:
        if ((_tokenSet_0.member(LA(1)))) {
          mSTUFF(false);
        }
      else {
        if ( _cnt623>=1 ) { break _loop623; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
      }
      }
      _cnt623++;
    } while (true);
    }
    if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
      _token = makeToken(_ttype);
      _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
    }
    _returnToken = _token;
  }
View Full Code Here

    }
    _returnToken = _token;
  }
 
  protected final void mCOMMENT(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = COMMENT;
    int _saveIndex;
   
    if ((LA(1)=='/') && (LA(2)=='/')) {
      mSL_COMMENT(false);
    }
    else if ((LA(1)=='/') && (LA(2)=='*')) {
      mML_COMMENT(false);
    }
    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;
  }
View Full Code Here

 
/** stuff in between #(...) and #id items
* Allow the escaping of the # for C# preprocessor stuff.
*/
  protected final void mSTUFF(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
    int _ttype; Token _token=null; int _begin=text.length();
    _ttype = STUFF;
    int _saveIndex;
   
    switch ( LA(1)) {
    case '"':
    {
      mSTRING(false);
      break;
    }
    case '\'':
    {
      mCHAR(false);
      break;
    }
    case '\n':
    {
      match('\n');
      newline();
      break;
    }
    default:
      if ((LA(1)=='/') && (LA(2)=='*'||LA(2)=='/')) {
        mCOMMENT(false);
      }
      else if ((LA(1)=='\r') && (LA(2)=='\n') && (true)) {
        match("\r\n");
        newline();
      }
      else if ((LA(1)=='\\') && (LA(2)=='#') && (true)) {
        match('\\');
        match('#');
        text.setLength(_begin); text.append("#");
      }
      else if ((LA(1)=='/') && (_tokenSet_1.member(LA(2)))) {
        match('/');
        {
        match(_tokenSet_1);
        }
      }
      else if ((LA(1)=='\r') && (true) && (true)) {
        match('\r');
        newline();
      }
      else if ((_tokenSet_2.member(LA(1))) && (true) && (true)) {
        {
        match(_tokenSet_2);
        }
      }
    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;
  }
View Full Code Here

TOP

Related Classes of org.jostraca.comp.antlr.Token

Copyright © 2018 www.massapicom. 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.