Package antlr.collections.impl

Examples of antlr.collections.impl.BitSet


   */
  protected void genBitsets( Vector bitsetList, int maxVocabulary ) {
    println("");
    for (int i = 0; i < bitsetList.size(); i++)
    {
      BitSet p = (BitSet)bitsetList.elementAt(i);
      // Ensure that generated BitSet is large enough for vocabulary
      p.growToInclude(maxVocabulary);
            genBitSet(p, i);
        }
    }
View Full Code Here


    StringBuffer e = new StringBuffer(100);
    boolean first = true;

    e.append("(");
    for (int i = 1; i <= k; i++) {
      BitSet p = look[i].fset;
      if (!first) {
        e.append(") && (");
      }
      first = false;
View Full Code Here

    int depth = alt.lookaheadDepth;
    if ( depth == GrammarAnalyzer.NONDETERMINISTIC ) {
      depth = grammar.maxk;
    }
    for (int i=1; i<=depth && i<=maxDepth; i++) {
      BitSet p = alt.cache[i].fset;
      if (p.degree() != 0) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    /** The input stream */
    protected TokenStream input;

    public TokenStreamBasicFilter(TokenStream input) {
        this.input = input;
        discardMask = new BitSet();
    }
View Full Code Here

    println("");

    for (int i = 0; i < bitsetList.size(); i++)
    {
      BitSet p = (BitSet)bitsetList.elementAt(i);
      // Ensure that generated BitSet is large enough for vocabulary
      p.growToInclude(maxVocabulary);

      // initialization data
      println(
        "const unsigned long " + prefix + getBitsetName(i) + "_data_" + "[] = { " +
        p.toStringOfHalfWords() +
        " };"
      );

      // Dump the contents of the bitset in readable format...
      String t = "// ";

      for( int j = 0; j < tm.getVocabulary().size(); j++ )
      {
        if ( p.member( j ) )
        {
          if ( (grammar instanceof LexerGrammar) )
          {
            // only dump out for pure printable ascii.
            if( ( 0x20 <= j ) && ( j < 0x7F ) && (j != '\\') )
              t += charFormatter.escapeChar(j,true)+" ";
            else
              t += "0x"+Integer.toString(j,16)+" ";
          }
          else
            t += tm.getTokenStringAt(j)+" ";

          if( t.length() > 70 )
          {
            println(t);
            t = "// ";
          }
        }
      }
      if ( t != "// " )
        println(t);

      // BitSet object
      println(
        "const "+namespaceAntlr+"BitSet " + prefix + getBitsetName(i) + "(" +
        getBitsetName(i) + "_data_," + p.size()/32 +
        ");"
      );
    }
  }
View Full Code Here

    int maxVocabulary
  ) {
    println("");
    for (int i = 0; i < bitsetList.size(); i++)
    {
      BitSet p = (BitSet)bitsetList.elementAt(i);
      // Ensure that generated BitSet is large enough for vocabulary
      p.growToInclude(maxVocabulary);
      // initialization data
      println("static const unsigned long " + getBitsetName(i) + "_data_" + "[];");
      // BitSet object
      println("static const "+namespaceAntlr+"BitSet " + getBitsetName(i) + ";");
    }
View Full Code Here

    StringBuffer e = new StringBuffer(100);
    boolean first = true;

    e.append("(");
    for (int i = 1; i <= k; i++) {
      BitSet p = look[i].fset;
      if (!first) {
        e.append(") && (");
      }
      first = false;
View Full Code Here

    int depth = alt.lookaheadDepth;
    if ( depth == GrammarAnalyzer.NONDETERMINISTIC ) {
      depth = grammar.maxk;
    }
    for (int i=1; i<=depth && i<=maxDepth; i++) {
      BitSet p = alt.cache[i].fset;
      if (p.degree() != 0) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    protected String filterRule = null;

    LexerGrammar(String className_, Tool tool_, String superClass) {
        super(className_, tool_, superClass);
    // by default, use 0..127 for ASCII char vocabulary
    BitSet cv = new BitSet();
    for (int i = 0; i <= 127; i++) {
      cv.add(i);
    }
    setCharVocabulary(cv);

        // Lexer usually has no default error handling
        defaultErrorHandler = false;
View Full Code Here

     *  conflicts with parsing binary files.
     */
    boolean hasEpsilon = false;

    public Lookahead() {
        fset = new BitSet();
    }
View Full Code Here

TOP

Related Classes of antlr.collections.impl.BitSet

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.