Package com.antlersoft.parser.lex

Examples of com.antlersoft.parser.lex.LexState


  /* (non-Javadoc)
   * @see com.antlersoft.analyzecxx.LexState#nextCharacter(char)
   */
  public LexState nextCharacter(char c) throws IOException,
      RuleActionException, LexException {
    LexState result;
    if ( CharClass.isHexDigit(c))
    {
      m_sb.append( c);
      result=this;
    }
View Full Code Here


  /* (non-Javadoc)
   * @see com.antlersoft.analyzecxx.LexState#nextCharacter(char)
   */
  public LexState nextCharacter(char c) throws IOException,
      RuleActionException, LexException {
    LexState result;
    if ( CharClass.isIDStart(c))
    {
      result=new IdentifierState( m_parent, m_reader);
      result=result.nextCharacter('.');
      result=result.nextCharacter(c);
    }
    else if ( CharClass.isDigit(c))
    {
      result=new FloatState(m_parent, m_reader, "0.");
      result=result.nextCharacter(c);
    }
    else
    {
      result=new PunctuationState( m_parent, m_reader);
      result=result.nextCharacter('.');
      result=result.nextCharacter(c);
    }
    return result;
  }
View Full Code Here

    else
    {
      try
      {
        InitialMacroReader reader = new InitialMacroReader();
        LexState initial_tokens = new PreprocessorTokens(reader, this);
        for (int i = 0; i < len; ++i) {
          initial_tokens = initial_tokens.nextCharacter(value.charAt(
            i));
        }
        initial_tokens=initial_tokens.endOfFile();
        m_macros.put(name, new ObjectMacro(name, reader.getTokens()));
      }
      catch ( Exception e)
      {
System.err.println( "Exception parsing initial define macro "+name+": "+value);
View Full Code Here

    (b.value==null ? b.symbol.toString() : b.value);
      int len=value.length();
    try
    {
      InitialMacroReader reader = new InitialMacroReader();
      LexState initial_tokens = new PreprocessorTokens(reader, this);
      for (int i = 0; i < len; ++i) {
        initial_tokens = initial_tokens.nextCharacter(value.charAt(
          i));
      }
      initial_tokens=initial_tokens.endOfFile();
      ArrayList result=reader.getTokens();
      if ( result.size()==1)
        return (LexToken)result.get(0);
    }
    catch ( Exception e)
View Full Code Here

  /* (non-Javadoc)
   * @see com.antlersoft.analyzecxx.LexState#nextCharacter(char)
   */
  public LexState nextCharacter(char c) throws IOException, RuleActionException, LexException {
    LexState result=this;
    if ( CharClass.isDigit(c) || ( c=='-' && m_sb.length()==0))
    {
      m_sb.append(c);
    }
    else if ( c=='.' || c=='E' || c=='e')
View Full Code Here

    return null;
  }

  public LexState nextCharacter(char c) throws IOException,
      RuleActionException, LexException {
    LexState result=null;
    switch ( c)
    {
    case '\'' :
    case '"' :
      result=new QuoteString( this, m_reader, c);
      break;
    case '/' :
      result=new InitialSlash( this, m_reader);
      break;
    case '.' :
      result=new InitialPeriod( this, m_reader);
      break;
    case '-' :
      result=new InitialMinus( this, m_reader);
      break;
    default :
      if ( CharClass.isWhiteSpace(c) || c=='\032' || c=='\000')
        result=this;
      else if ( CharClass.isHexDigit(c) && m_reader.expectedReserved(IldasmParser.t_HEXBYTE.toString())!=null)
        result=new HexByteState( this, m_reader, c);
      else if ( c=='0')
        result=new InitialZero( this, m_reader);
      else if ( CharClass.isDigit(c))
      {
        result=new NumberState( this, m_reader);
        result=result.nextCharacter(c);
      }
      else if ( CharClass.isIDStart(c))
      {
        result=new IdentifierState( this, m_reader);
        result=result.nextCharacter(c);
      }
      else
      {
        result=new PunctuationState( this, m_reader);
        result=result.nextCharacter(c);
      }
    }
    return result;
  }
View Full Code Here

    switch ( c)
    {
      case '/' : return new LineComment( m_reader, m_caller);
      case '*' : return new DelimitedComment( m_reader, m_caller);
    }
    LexState result=new LexPunctuation( m_reader, m_caller, '/');
    return result.nextCharacter( c);
    }
View Full Code Here

    }
    LexState result=new LexPunctuation( m_reader, m_caller, '/');
    return result.nextCharacter( c);
    }
    public LexState endOfFile() throws IOException, RuleActionException, LexException {
    LexState result=new LexPunctuation( m_reader, m_caller, '/');
    return result.endOfFile();
    }
View Full Code Here

   * @see com.antlersoft.parser.lex.LexWithSymbolTree#nextCharacter(char)
   */
  public LexState nextCharacter(char c) throws IOException, RuleActionException, LexException {
    m_period_exception=false;
    m_minus_exception=false;
    LexState result=super.nextCharacter(c);
    if ( m_period_exception)
      result=new InitialPeriod( m_caller, m_reader).nextCharacter(c);
    if ( m_minus_exception)
      result=new InitialMinus( m_caller, m_reader);
    else if ( c=='{' && m_reader.expectedReserved(".permissionContents")!=null)
View Full Code Here

    m_caller=caller;
    m_finder=new SymbolFinder( m_tree);
    addCharacter( initial);
  }
    public LexState nextCharacter(char c) throws IOException, RuleActionException, LexException {
    LexState result=this;
    if ( CharClass.isIdentifierPart( c))
    {
      addCharacter( c);
    }
    else
View Full Code Here

TOP

Related Classes of com.antlersoft.parser.lex.LexState

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.