Package com.antlersoft.parser.lex

Examples of com.antlersoft.parser.lex.LexException


  /* (non-Javadoc)
   * @see com.antlersoft.ilanalyze.parseildasm.LexStateBase#endOfFile()
   */
  public LexState endOfFile() throws IOException, RuleActionException, LexException {
    throw new LexException( "End-of-file in hex byte");
  }
View Full Code Here


          break;
        default :
          if ( CharClass.isDigit( comp_c))
          {
            if ( ! CharClass.isOctalDigit( comp_c))
              throw new LexException( "Bad octal number!");
            m_token.setType( NumericLiteral.OCTAL);
            m_state=OCTAL_DIGITS;
          }
          else
          {
            finish();
            return m_caller.nextCharacter( c);
          }
        }
        m_buffer.append( comp_c);
        break;
      case FLOAT_FRACTION :
        switch ( comp_c)
        {
          case 'L' :
          case 'F' :
            m_buffer.append( comp_c);
            m_token.setFlag( comp_c);
            finish();
            return m_caller;
          case 'E' :
            m_state=EXPONENT_SIGN;
            break;
          default :
            if ( ! CharClass.isDigit( comp_c))
            {
              finish();
              return m_caller.nextCharacter(c);
            }
        }
        m_buffer.append( comp_c);
        break;
      case EXPONENT_SIGN :
        if ( c=='+' || c=='-' || CharClass.isDigit(c))
        {
          m_buffer.append( c);
          m_state=EXPONENT_DIGITS;
          break;
        }
        else
          throw new LexException( "Improperly formatted exponent");
      case EXPONENT_DIGITS :
        switch ( comp_c)
        {
          case 'L' :
          case 'F' :
            m_token.setFlag( comp_c);
            m_buffer.append( comp_c);
            finish();
            return m_caller;
          default :
            if ( ! CharClass.isDigit( c))
            {
              finish();
              return m_caller.nextCharacter( c);
            }
        }
        m_buffer.append( c);
        break;
      case HEX_DIGITS :
        switch ( comp_c)
        {
          case 'U' :
          case 'L' :
            m_token.setFlag( comp_c);
            m_state=INT_SUFFIX;
            break;
          default :
            if ( ! CharClass.isHexDigit( comp_c))
            {
              finish();
              return m_caller.nextCharacter( c);
            }
        }
        m_buffer.append( c);
        break;
      case OCTAL_DIGITS :
        switch ( comp_c)
        {
          case 'U' :
          case 'L' :
            m_token.setFlag( comp_c);
            m_state=INT_SUFFIX;
            break;
          default :
            if ( ! CharClass.isOctalDigit( comp_c))
            {
              finish();
              return m_caller.nextCharacter( c);
            }
        }
        m_buffer.append( c);
        break;
      case INT_SUFFIX :
        if ( comp_c=='U' || comp_c=='L')
       {
         m_token.setFlag( comp_c);
         m_buffer.append( comp_c);
        }
        else
        {
          finish();
          return m_caller.nextCharacter(c);
        }
        break;
      default :
        throw new LexException ( "Bad number parsing state");
      }
    return this;
    }
View Full Code Here

            StringBuilder hex_buffer = new StringBuilder();
            ++i;
            for (; i < len && isHexDigit(s.charAt(i)); ++i)
              hex_buffer.append(ch);
            if (hex_buffer.length() == 0)
              throw new LexException("Empty hex escape in " + s);
            --i;
            sb.append( (char) Integer.parseInt(hex_buffer.
              toString(), 16));
          }
          break;
          default :
          if ( isOctalDigit( ch))
          {
            StringBuilder octal_buffer=new StringBuilder();
            for ( ; i<len && isOctalDigit( s.charAt(i)); ++i)
              octal_buffer.append(ch);
            --i;
            sb.append( (char)Integer.parseInt( octal_buffer.toString(), 8));
          }
          else
            throw new LexException( "Bad character escape in "+s);
        }
      }
      else
      {
        if ( ch=='\\')
View Full Code Here

      m_reader.processToken( m_token_to_send);
      result=m_caller;
    }
    else if ( c=='\n')
    {
      throw new LexException( "new-line in literal");
    }
    else
    {
      result=this;
      if ( m_is_escaped)
View Full Code Here

    }
    StringBuilder excep_builder=new StringBuilder( "bad escaped character in string: \"");
    excep_builder.append( m_sb.toString());
    excep_builder.append( "\":");
    excep_builder.append( (int)c);
    throw new LexException( excep_builder.toString());
  }
View Full Code Here

      double value=Double.parseDouble( m_sb.toString());
      m_reader.processToken( IldasmParser.t_FLOAT64, new Double(value));
    }
    catch ( NumberFormatException nfe)
    {
      throw new LexException( "Bad float format: "+nfe.getMessage());
    }
  }
View Full Code Here

   * @see com.antlersoft.analyzecxx.LexState#nextCharacter(char)
   */
  public LexState nextCharacter(char c) throws IOException,
      RuleActionException, LexException {
    if ( ! CharClass.isOctalDigit(c))
      throw new LexException( "Bad digit in Octal string escape");
    m_digits+=1;
    m_value*=8;
    m_value+=c-'0';
    if ( m_digits==3)
    {
View Full Code Here

TOP

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

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.