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

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

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

BitSet.remove介绍

暂无

代码示例

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

protected BitSet combineFollows(boolean exact) {
  int top = state._fsp;
  BitSet followSet = new BitSet();
  for (int i=top; i>=0; i--) {
    BitSet localFollowSet = state.following[i];
    /*
    System.out.println("local follow depth "+i+"="+
              localFollowSet.toString(getTokenNames())+")");
     */
    followSet.orInPlace(localFollowSet);
    if ( exact ) {
      // can we see end of rule?
      if ( localFollowSet.member(Token.EOR_TOKEN_TYPE) ) {
        // Only leave EOR in set if at top (start rule); this lets
        // us know if have to include follow(start rule); i.e., EOF
        if ( i>0 ) {
          followSet.remove(Token.EOR_TOKEN_TYPE);
        }
      }
      else { // can't see end of rule, quit
        break;
      }
    }
  }
  return followSet;
}

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

protected BitSet combineFollows(boolean exact) {
  int top = state._fsp;
  BitSet followSet = new BitSet();
  for (int i=top; i>=0; i--) {
    BitSet localFollowSet = state.following[i];
    /*
    System.out.println("local follow depth "+i+"="+
              localFollowSet.toString(getTokenNames())+")");
     */
    followSet.orInPlace(localFollowSet);
    if ( exact ) {
      // can we see end of rule?
      if ( localFollowSet.member(Token.EOR_TOKEN_TYPE) ) {
        // Only leave EOR in set if at top (start rule); this lets
        // us know if have to include follow(start rule); i.e., EOF
        if ( i>0 ) {
          followSet.remove(Token.EOR_TOKEN_TYPE);
        }
      }
      else { // can't see end of rule, quit
        break;
      }
    }
  }
  return followSet;
}

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

protected BitSet combineFollows(boolean exact) {
  int top = state._fsp;
  BitSet followSet = new BitSet();
  for (int i=top; i>=0; i--) {
    BitSet localFollowSet = state.following[i];
    /*
    System.out.println("local follow depth "+i+"="+
              localFollowSet.toString(getTokenNames())+")");
     */
    followSet.orInPlace(localFollowSet);
    if ( exact ) {
      // can we see end of rule?
      if ( localFollowSet.member(Token.EOR_TOKEN_TYPE) ) {
        // Only leave EOR in set if at top (start rule); this lets
        // us know if have to include follow(start rule); i.e., EOF
        if ( i>0 ) {
          followSet.remove(Token.EOR_TOKEN_TYPE);
        }
      }
      else { // can't see end of rule, quit
        break;
      }
    }
  }
  return followSet;
}

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

protected BitSet combineFollows(boolean exact) {
  int top = state._fsp;
  BitSet followSet = new BitSet();
  for (int i=top; i>=0; i--) {
    BitSet localFollowSet = state.following[i];
    /*
    System.out.println("local follow depth "+i+"="+
              localFollowSet.toString(getTokenNames())+")");
     */
    followSet.orInPlace(localFollowSet);
    if ( exact ) {
      // can we see end of rule?
      if ( localFollowSet.member(Token.EOR_TOKEN_TYPE) ) {
        // Only leave EOR in set if at top (start rule); this lets
        // us know if have to include follow(start rule); i.e., EOF
        if ( i>0 ) {
          followSet.remove(Token.EOR_TOKEN_TYPE);
        }
      }
      else { // can't see end of rule, quit
        break;
      }
    }
  }
  return followSet;
}

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

protected BitSet combineFollows(boolean exact) {
  int top = state._fsp;
  BitSet followSet = new BitSet();
  for (int i=top; i>=0; i--) {
    BitSet localFollowSet = state.following[i];
    /*
    System.out.println("local follow depth "+i+"="+
              localFollowSet.toString(getTokenNames())+")");
     */
    followSet.orInPlace(localFollowSet);
    if ( exact ) {
      // can we see end of rule?
      if ( localFollowSet.member(Token.EOR_TOKEN_TYPE) ) {
        // Only leave EOR in set if at top (start rule); this lets
        // us know if have to include follow(start rule); i.e., EOF
        if ( i>0 ) {
          followSet.remove(Token.EOR_TOKEN_TYPE);
        }
      }
      else { // can't see end of rule, quit
        break;
      }
    }
  }
  return followSet;
}

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

protected BitSet combineFollows(boolean exact) {
  int top = state._fsp;
  BitSet followSet = new BitSet();
  for (int i=top; i>=0; i--) {
    BitSet localFollowSet = (BitSet)state.following[i];
    /*
    System.out.println("local follow depth "+i+"="+
              localFollowSet.toString(getTokenNames())+")");
     */
    followSet.orInPlace(localFollowSet);
    if ( exact ) {
      // can we see end of rule?
      if ( localFollowSet.member(Token.EOR_TOKEN_TYPE) ) {
        // Only leave EOR in set if at top (start rule); this lets
        // us know if have to include follow(start rule); i.e., EOF
        if ( i>0 ) {
          followSet.remove(Token.EOR_TOKEN_TYPE);
        }
      }
      else { // can't see end of rule, quit
        break;
      }
    }
  }
  return followSet;
}

代码示例来源: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;
}

代码示例来源: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;
}

相关文章