antlr.collections.impl.BitSet类的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(9.2k)|赞(0)|评价(0)|浏览(66)

本文整理了Java中antlr.collections.impl.BitSet类的一些代码示例,展示了BitSet类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BitSet类的具体详情如下:
包路径:antlr.collections.impl.BitSet
类名称:BitSet

BitSet介绍

[英]A BitSet to replace java.util.BitSet. Primary differences are that most set operators return new sets as opposed to oring and anding "in place". Further, a number of operations were added. I cannot contain a BitSet because there is no way to access the internal bits (which I need for speed) and, because it is final, I cannot subclass to add functionality. Consider defining set degree. Without access to the bits, I must call a method n times to test the ith bit...ack! Also seems like or() from util is wrong when size of incoming set is bigger than this.bits.length.
[中]替换java的位集。util。比特集。主要区别在于大多数集合运算符返回新集合,而不是“就地”进行oring和anding。此外,还增加了一些操作。我不能包含位集,因为无法访问内部位(这是我需要的速度),并且因为它是最终的,所以我不能子类化以添加功能。考虑定义集合度。在无法访问位的情况下,我必须调用一个方法n次来测试第I位。。。啊!当传入集的大小大于此值时,似乎util中的or()是错误的。位。长

代码示例

代码示例来源:origin: jenkinsci/jenkins

public final void mATOM(boolean _createToken) throws RecognitionException, CharStreamException, TokenStreamException {
  int _ttype; Token _token=null; int _begin=text.length();
  _ttype = ATOM;
  int _saveIndex;
  
  {
  int _cnt26=0;
  _loop26:
  do {
    if ((_tokenSet_0.member(LA(1)))) {
      mIDENTIFIER_PART(false);
    }
    else {
      if ( _cnt26>=1 ) { break _loop26; } else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
    }
    
    _cnt26++;
  } while (true);
  }
  if ( _createToken && _token==null && _ttype!=Token.SKIP ) {
    _token = makeToken(_ttype);
    _token.setText(new String(text.getBuffer(), _begin, text.length()-_begin));
  }
  _returnToken = _token;
}

代码示例来源:origin: jenkinsci/jenkins

theRetToken=_returnToken;
  else if ((_tokenSet_0.member(LA(1)))) {
    mATOM(true);
    theRetToken=_returnToken;
else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
_ttype = _returnToken.getType();
_ttype = testLiteralsTable(_ttype);
_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: checkstyle/checkstyle

_loop239:
do {
  if ((LA(1)==LITERAL_case||LA(1)==LITERAL_default) && (_tokenSet_58.member(LA(2)))) {
    aCase();
    astFactory.addASTChild(currentAST, returnAST);
if ((_tokenSet_36.member(LA(1))) && (_tokenSet_59.member(LA(2)))) {
  caseSList();
  astFactory.addASTChild(currentAST, returnAST);
else if ((_tokenSet_60.member(LA(1))) && (_tokenSet_49.member(LA(2)))) {
  casesGroup_AST = (AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(CASE_GROUP,"CASE_GROUP")).add(casesGroup_AST));
  currentAST.root = casesGroup_AST;
  currentAST.child = casesGroup_AST!=null &&casesGroup_AST.getFirstChild()!=null ?

代码示例来源:origin: checkstyle/checkstyle

lc_AST = astFactory.create(lc);
astFactory.makeASTRoot(currentAST, lc_AST);
match(LCURLY);
if ( inputState.guessing==0 ) {
  if ((_tokenSet_36.member(LA(1)))) {
    statement();
    astFactory.addASTChild(currentAST, returnAST);

代码示例来源:origin: checkstyle/checkstyle

public final void lambdaBody() throws RecognitionException, TokenStreamException {
  
  returnAST = null;
  ASTPair currentAST = new ASTPair();
  AST lambdaBody_AST = null;
  
  {
  if ((_tokenSet_12.member(LA(1))) && (_tokenSet_69.member(LA(2)))) {
    expression();
    astFactory.addASTChild(currentAST, returnAST);
  }
  else if ((_tokenSet_36.member(LA(1))) && (_tokenSet_69.member(LA(2)))) {
    statement();
    astFactory.addASTChild(currentAST, returnAST);
  }
  else {
    throw new NoViableAltException(LT(1), getFilename());
  }
  
  }
  lambdaBody_AST = (AST)currentAST.root;
  returnAST = lambdaBody_AST;
}

代码示例来源:origin: checkstyle/checkstyle

tmp243_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp243_AST);
match(IDENT);
lambdaParameters_AST = (AST)currentAST.root;
tmp244_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp244_AST);
match(LPAREN);
if ((_tokenSet_67.member(LA(1))) && (_tokenSet_68.member(LA(2)))) {
  parameterDeclarationList();
  astFactory.addASTChild(currentAST, returnAST);

代码示例来源:origin: checkstyle/checkstyle

pm_AST = (AST)returnAST;
if ((_tokenSet_9.member(LA(1))) && (_tokenSet_47.member(LA(2)))) {
  typeSpec(false);
  t_AST = (AST)returnAST;
else if ((LA(1)==IDENT||LA(1)==LITERAL_this) && (_tokenSet_48.member(LA(2)))) {
if ( inputState.guessing==0 ) {
  parameterDeclaration_AST = (AST)currentAST.root;
  parameterDeclaration_AST = (AST)astFactory.make( (new ASTArray(4)).add(astFactory.create(PARAMETER_DEF,"PARAMETER_DEF")).add(pm_AST).add((AST)astFactory.make( (new ASTArray(2)).add(astFactory.create(TYPE,"TYPE")).add(pd_AST))).add(id_AST));
  currentAST.root = parameterDeclaration_AST;
  currentAST.child = parameterDeclaration_AST!=null &&parameterDeclaration_AST.getFirstChild()!=null ?

代码示例来源:origin: org.glassfish.external/antlr

public CharLiteralElement(LexerGrammar g, Token t, boolean inverted, int autoGenType) {
  super(g, t, AUTO_GEN_NONE);
  tokenType = ANTLRLexer.tokenTypeForCharLiteral(t.getText());
  g.charVocabulary.add(tokenType);
  line = t.getLine();
  not = inverted;
  this.autoGenType = autoGenType;
}

代码示例来源:origin: hibernate/hibernate-orm

do {
  if (_t==null) _t=ASTNULL;
  if ((_tokenSet_4.member(_t.getType()))) {
    if ( inputState.guessing==0 ) {
      betweenFunctionArguments();

代码示例来源:origin: org.glassfish.external/antlr

public Lookahead look(int k, WildcardElement wc) {
  if (DEBUG_ANALYZER) System.out.println("look(" + k + "," + wc + ")");
  // Skip until analysis hits k==1
  if (k > 1) {
    return wc.next.look(k - 1);
  }
  BitSet b;
  if (lexicalAnalysis) {
    // Copy the character vocabulary
    b = (BitSet)((LexerGrammar)grammar).charVocabulary.clone();
  }
  else {
    b = new BitSet(1);
    // Invert the lookahead set against the token vocabulary
    int maxToken = grammar.tokenManager.maxTokenType();
    b.notInPlace(Token.MIN_USER_TYPE, maxToken);
    if (DEBUG_ANALYZER) System.out.println("look(" + k + "," + wc + ") after not: " + b);
  }
  // Remove prediction sets from competing alternatives
  // removeCompetingPredictionSets(b, wc);
  return new Lookahead(b);
}

代码示例来源:origin: org.glassfish.external/antlr

public static BitSet of(int el) {
  BitSet s = new BitSet(el + 1);
  s.add(el);
  return s;
}

代码示例来源:origin: org.glassfish.external/antlr

public Lookahead look(int k, TokenRangeElement r) {
  if (DEBUG_ANALYZER) System.out.println("lookTokenRange(" + k + "," + r + ")");
  // Skip until analysis hits k==1
  if (k > 1) {
    return r.next.look(k - 1);
  }
  BitSet p = BitSet.of(r.begin);
  for (int i = r.begin + 1; i <= r.end; i++) {
    p.add(i);
  }
  return new Lookahead(p);
}

代码示例来源:origin: org.glassfish.external/antlr

public void hide(int m) {
  hideMask.add(m);
}

代码示例来源:origin: org.glassfish.external/antlr

public TokenStreamHiddenTokenFilter(TokenStream input) {
  super(input);
  hideMask = new BitSet();
}

代码示例来源:origin: hibernate/hibernate-orm

if ((_tokenSet_0.member(LA(1)))) {
    mIDENT(true);
    theRetToken=_returnToken;
else {throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());}
_ttype = _returnToken.getType();
_returnToken.setType(_ttype);
return _returnToken;

代码示例来源:origin: checkstyle/checkstyle

astFactory.addASTChild(currentAST, returnAST);
  if ((LA(1)==SEMI) && (_tokenSet_51.member(LA(2)))) {
    AST tmp175_AST = null;
    tmp175_AST = astFactory.create(LT(1));
    astFactory.addASTChild(currentAST, tmp175_AST);
    match(SEMI);
    resource();

代码示例来源:origin: checkstyle/checkstyle

f_AST = astFactory.create(f);
astFactory.makeASTRoot(currentAST, f_AST);
match(LITERAL_for);
AST tmp158_AST = null;
tmp158_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp158_AST);
match(LPAREN);
if (((_tokenSet_56.member(LA(1))) && (_tokenSet_57.member(LA(2))))) {
  int _m232 = mark();
  synPredMatched232 = true;
  astFactory.addASTChild(currentAST, returnAST);
else if ((_tokenSet_51.member(LA(1))) && (_tokenSet_52.member(LA(2)))) {
  forEachClause();
  astFactory.addASTChild(currentAST, returnAST);

代码示例来源:origin: checkstyle/checkstyle

public final void annotationArguments() throws RecognitionException, TokenStreamException {
  
  returnAST = null;
  ASTPair currentAST = new ASTPair();
  AST annotationArguments_AST = null;
  
  if ((_tokenSet_10.member(LA(1))) && (_tokenSet_11.member(LA(2)))) {
    annotationMemberValueInitializer();
    astFactory.addASTChild(currentAST, returnAST);
    annotationArguments_AST = (AST)currentAST.root;
  }
  else if ((LA(1)==IDENT) && (LA(2)==ASSIGN)) {
    annotationMemberValuePairs();
    astFactory.addASTChild(currentAST, returnAST);
    annotationArguments_AST = (AST)currentAST.root;
  }
  else {
    throw new NoViableAltException(LT(1), getFilename());
  }
  
  returnAST = annotationArguments_AST;
}

代码示例来源:origin: checkstyle/checkstyle

public final void argList() throws RecognitionException, TokenStreamException {
  
  returnAST = null;
  ASTPair currentAST = new ASTPair();
  AST argList_AST = null;
  
  {
  if (((_tokenSet_12.member(LA(1))))&&(LA(1)!=RPAREN)) {
    expressionList();
    astFactory.addASTChild(currentAST, returnAST);
  }
  else if ((LA(1)==RPAREN)) {
    if ( inputState.guessing==0 ) {
      argList_AST = (AST)currentAST.root;
      argList_AST = astFactory.create(ELIST,"ELIST");
      currentAST.root = argList_AST;
      currentAST.child = argList_AST!=null &&argList_AST.getFirstChild()!=null ?
        argList_AST.getFirstChild() : argList_AST;
      currentAST.advanceChildToEnd();
    }
  }
  else {
    throw new NoViableAltException(LT(1), getFilename());
  }
  
  }
  argList_AST = (AST)currentAST.root;
  returnAST = argList_AST;
}

代码示例来源:origin: org.glassfish.external/antlr

public CharRangeElement(LexerGrammar g, Token t1, Token t2, int autoGenType) {
  super(g);
  begin = (char)ANTLRLexer.tokenTypeForCharLiteral(t1.getText());
  beginText = t1.getText();
  end = (char)ANTLRLexer.tokenTypeForCharLiteral(t2.getText());
  endText = t2.getText();
  line = t1.getLine();
  // track which characters are referenced in the grammar
  for (int i = begin; i <= end; i++) {
    g.charVocabulary.add(i);
  }
  this.autoGenType = autoGenType;
}

相关文章

BitSet类方法