Package persistence.antlr.collections.impl

Examples of persistence.antlr.collections.impl.BitSet


     *  lookahead analysis is equivalent to full lookahead analysis.
     */
    public static boolean lookaheadEquivForApproxAndFullAnalysis(Lookahead[] bset, int k) {
        // first k-1 sets degree 1?
        for (int i = 1; i <= k - 1; i++) {
            BitSet look = bset[i].fset;
            if (look.degree() > 1) {
                return false;
            }
        }
        return true;
    }
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

    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

    match(RCURLY);
  }
 
  public final void lexerOptionsSpec() throws RecognitionException, TokenStreamException {
   
    Token idTok; Token value; BitSet b;
   
    match(OPTIONS);
    {
    _loop27:
    do {
View Full Code Here

    }
    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

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

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

    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

TOP

Related Classes of persistence.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.