org.antlr.runtime.BitSet.or()方法的使用及代码示例

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

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

BitSet.or介绍

[英]return this | a in a new set
[中]将此| a换成新的一组

代码示例

代码示例来源:origin: antlr/antlr3

public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  if ( follow==null ) {
    // we have no information about the follow; we can only consume
    // a single token and hope for the best
    return false;
  }
  // compute what can follow this grammar element reference
  if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
    BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
    follow = follow.or(viableTokensFollowingThisRule);
    if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
      follow.remove(Token.EOR_TOKEN_TYPE);
    }
  }
  // if current token is consistent with what could come after set
  // then we know we're missing a token; error recovery is free to
  // "insert" the missing token
  //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  // in follow set to indicate that the fall of the start symbol is
  // in the set (EOF can follow).
  if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
    //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
    return true;
  }
  return false;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  if ( follow==null ) {
    // we have no information about the follow; we can only consume
    // a single token and hope for the best
    return false;
  }
  // compute what can follow this grammar element reference
  if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
    BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
    follow = follow.or(viableTokensFollowingThisRule);
    if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
      follow.remove(Token.EOR_TOKEN_TYPE);
    }
  }
  // if current token is consistent with what could come after set
  // then we know we're missing a token; error recovery is free to
  // "insert" the missing token
  //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  // in follow set to indicate that the fall of the start symbol is
  // in the set (EOF can follow).
  if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
    //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
    return true;
  }
  return false;
}

代码示例来源:origin: antlr/antlr3

public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  if ( follow==null ) {
    // we have no information about the follow; we can only consume
    // a single token and hope for the best
    return false;
  }
  // compute what can follow this grammar element reference
  if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
    BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
    follow = follow.or(viableTokensFollowingThisRule);
    if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
      follow.remove(Token.EOR_TOKEN_TYPE);
    }
  }
  // if current token is consistent with what could come after set
  // then we know we're missing a token; error recovery is free to
  // "insert" the missing token
  //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  // in follow set to indicate that the fall of the start symbol is
  // in the set (EOF can follow).
  if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
    //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
    return true;
  }
  return false;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  if ( follow==null ) {
    // we have no information about the follow; we can only consume
    // a single token and hope for the best
    return false;
  }
  // compute what can follow this grammar element reference
  if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
    BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
    follow = follow.or(viableTokensFollowingThisRule);
    if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
      follow.remove(Token.EOR_TOKEN_TYPE);
    }
  }
  // if current token is consistent with what could come after set
  // then we know we're missing a token; error recovery is free to
  // "insert" the missing token
  //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  // in follow set to indicate that the fall of the start symbol is
  // in the set (EOF can follow).
  if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
    //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
    return true;
  }
  return false;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.antlr-runtime

public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  if ( follow==null ) {
    // we have no information about the follow; we can only consume
    // a single token and hope for the best
    return false;
  }
  // compute what can follow this grammar element reference
  if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
    BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
    follow = follow.or(viableTokensFollowingThisRule);
    if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
      follow.remove(Token.EOR_TOKEN_TYPE);
    }
  }
  // if current token is consistent with what could come after set
  // then we know we're missing a token; error recovery is free to
  // "insert" the missing token
  //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  // in follow set to indicate that the fall of the start symbol is
  // in the set (EOF can follow).
  if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
    //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
    return true;
  }
  return false;
}

代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded

public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  if ( follow==null ) {
    // we have no information about the follow; we can only consume
    // a single token and hope for the best
    return false;
  }
  // compute what can follow this grammar element reference
  if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
    BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
    follow = follow.or(viableTokensFollowingThisRule);
    if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
      follow.remove(Token.EOR_TOKEN_TYPE);
    }
  }
  // if current token is consistent with what could come after set
  // then we know we're missing a token; error recovery is free to
  // "insert" the missing token
  //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  // in follow set to indicate that the fall of the start symbol is
  // in the set (EOF can follow).
  if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
    //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
    return true;
  }
  return false;
}

相关文章