Package antlr.collections.impl

Examples of antlr.collections.impl.BitSet


    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 CommonHiddenStreamToken firstHidden = null;

    public TokenStreamHiddenTokenFilter(TokenStream input) {
        super(input);
        hideMask = new BitSet();
    }
View Full Code Here

    protected void genBitsets(Vector bitsetList,
                              int maxVocabulary
                              ) {
        println("", NO_MAPPING);
        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

     * @return The position of the bitset in the list.
     */
    protected int markBitsetForGen(BitSet p) {
        // Is the bitset (or an identical one) already marked for gen?
        for (int i = 0; i < bitsetsUsed.size(); i++) {
            BitSet set = (BitSet)bitsetsUsed.elementAt(i);
            if (p.equals(set)) {
                // Use the identical one already stored
                return i;
            }
        }
View Full Code Here

  protected int markBitsetForGen(BitSet paramBitSet)
  {
    for (int i = 0; i < this.bitsetsUsed.size(); i++)
    {
      BitSet localBitSet = (BitSet)this.bitsetsUsed.elementAt(i);
      if (paramBitSet.equals(localBitSet))
        return i;
    }
    this.bitsetsUsed.appendElement(paramBitSet.clone());
    return this.bitsetsUsed.size() - 1;
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.