Package antlr.collections.impl

Examples of antlr.collections.impl.BitSet


    }
    match(RCURLY);
  }
 
  public final  BitSet  charSet() throws RecognitionException, TokenStreamException {
     BitSet b ;
   
   
      b = null;
      BitSet tmpSet = null;
   
   
    b=setBlockElement();
    {
    _loop34:
View Full Code Here


    }
    return qidTok;
  }
 
  public final  BitSet  setBlockElement() throws RecognitionException, TokenStreamException {
     BitSet b ;
   
    Token  c1 = null;
    Token  c2 = null;
   
      b = null;
      int rangeMin = 0;
   
   
    c1 = LT(1);
    match(CHAR_LITERAL);
    if ( inputState.guessing==0 ) {
     
          rangeMin = ANTLRLexer.tokenTypeForCharLiteral(c1.getText());
          b = BitSet.of(rangeMin);
       
    }
    {
    switch ( LA(1)) {
    case RANGE:
    {
      match(RANGE);
      c2 = LT(1);
      match(CHAR_LITERAL);
      if ( inputState.guessing==0 ) {
       
              int rangeMax = ANTLRLexer.tokenTypeForCharLiteral(c2.getText());
              if (rangeMax < rangeMin) {
                antlrTool.error("Malformed range line ", getFilename(), c1.getLine(), c1.getColumn());
              }
              for (int i = rangeMin+1; i <= rangeMax; i++) {
                b.add(i);
              }
           
      }
      break;
    }
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 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

    protected CommonHiddenStreamToken firstHidden = null;

    public TokenStreamHiddenTokenFilter(TokenStream input) {
        super(input);
        hideMask = 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) )
            t += tm.getVocabulary().elementAt(j)+" ";
          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

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.