Package com.antlersoft.parser

Examples of com.antlersoft.parser.RuleActionException


    {
      m_pattern=Pattern.compile(to_match);
    }
    catch ( PatternSyntaxException pse)
    {
      RuleActionException rae=new RuleActionException( pse.getMessage(), pse);
      throw rae;
    }
  }
View Full Code Here


    if ( parse(s,v))
    {
      String message=getRuleMessage();
      if ( message==null)
        message="Syntax error";
      throw new RuleActionException( message+m_reader.getLocation());
    }
  }
View Full Code Here

      return "";
    ArrayList error_tokens=expandToArray( tokens);
    StringBuffer sb=new StringBuffer( "Error: ");
    for ( Iterator i=error_tokens.iterator(); i.hasNext();)
      sb.append( ((LexToken)i.next()).value);
    throw new RuleActionException( sb.toString());
  }
View Full Code Here

      m_reader.m_driver.includeFile(m_reader, include_file, with_current,
                      m_reader.getLineNumber());
    }
    catch ( IOException ioe)
    {
      throw new RuleActionException( "Failed to find include file: "+include_file, ioe);
    }
    return "";
  }
View Full Code Here

      {
        try {
          line = ( (NumericLiteral) o).intValue();
        }
        catch (LexException le) {
          throw new RuleActionException("Bad numeric literal: " +
                          le.getMessage(), le);
        }
        o = line_tokens.get(line_tokens.size() - 1);
        if (o instanceof StringLiteral)
          file = ( (StringLiteral) o).value;
View Full Code Here

      if ( macro instanceof ObjectMacro)
      {
        ObjectMacro om=(ObjectMacro)macro;
        if ( om.getTokens().equals( replacement_list))
          return "";
        throw new RuleActionException( "Redefining macro "+name+" to different value.");
      }
      else
        throw new RuleActionException( "Redefining function macro "+name+" as object macro.");
    }
    normalizeReplacementTokens( replacement_list);
    replaceConcat( replacement_list,
             new ConcatenatedTokenPairReplacer() {
      public LexToken replacePair( LexToken a, LexToken b)
View Full Code Here

    for ( Iterator i=identifier_list.iterator(); i.hasNext();)
    {
      identifier_names.put( ((LexToken)i.next()).value, new Integer( identifier_count++));
    }
    if ( identifier_names.size()!=identifier_list.size())
      throw new RuleActionException( "Error defining macro: "+name+".  Duplicate parameter names.");
    normalizeReplacementTokens( replacement_list);
    int len=replacement_list.size();
    // Look for parameters and stringized parameters in the replacement list
    for ( int i=0; i<len; ++i)
    {
View Full Code Here

      StringBuilder sb=new StringBuilder();
      for ( int i=1; i<tokens.size()-1; i++)
        sb.append( ((LexToken)tokens.get(i)).value);
      return new LexToken( PreprocessParser.lex_include_header, sb.toString());
    }
    throw new RuleActionException( "Tokens can not convert to include header");
  }
View Full Code Here

  {
    if ( token instanceof PunctuationToken)
    {
      if ( ((PunctuationToken)token).m_alt_symbol==
        PreprocessParser.pp_token_concat)
         throw new RuleActionException( "## must not be the first or last token in a replacement list");
    }
  }
View Full Code Here

  void expandTo( LexToken orig_token, MacroExpander reader, ArrayList arguments, ArrayList expanded_arguments)
  throws RuleActionException
  {
    HashSet new_no_expand=orig_token.setWithNewMember( getIdentifier());
    if ( arguments.size()!=m_arguments || expanded_arguments.size()!=m_arguments)
      throw new RuleActionException( "Bad argument count for macro "+getIdentifier());
    for ( Iterator i=m_replacement_list.iterator(); i.hasNext();)
    {
      LexToken token=(LexToken)i.next();
      if ( token instanceof SpecialExpander)
        ((SpecialExpander)token).expandTo( reader, new_no_expand, arguments, expanded_arguments);
View Full Code Here

TOP

Related Classes of com.antlersoft.parser.RuleActionException

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.