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

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

本文整理了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

  1. public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  2. if ( follow==null ) {
  3. // we have no information about the follow; we can only consume
  4. // a single token and hope for the best
  5. return false;
  6. }
  7. // compute what can follow this grammar element reference
  8. if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
  9. BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
  10. follow = follow.or(viableTokensFollowingThisRule);
  11. if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
  12. follow.remove(Token.EOR_TOKEN_TYPE);
  13. }
  14. }
  15. // if current token is consistent with what could come after set
  16. // then we know we're missing a token; error recovery is free to
  17. // "insert" the missing token
  18. //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  19. //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  20. // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  21. // in follow set to indicate that the fall of the start symbol is
  22. // in the set (EOF can follow).
  23. if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
  24. //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
  25. return true;
  26. }
  27. return false;
  28. }

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

  1. public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  2. if ( follow==null ) {
  3. // we have no information about the follow; we can only consume
  4. // a single token and hope for the best
  5. return false;
  6. }
  7. // compute what can follow this grammar element reference
  8. if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
  9. BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
  10. follow = follow.or(viableTokensFollowingThisRule);
  11. if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
  12. follow.remove(Token.EOR_TOKEN_TYPE);
  13. }
  14. }
  15. // if current token is consistent with what could come after set
  16. // then we know we're missing a token; error recovery is free to
  17. // "insert" the missing token
  18. //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  19. //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  20. // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  21. // in follow set to indicate that the fall of the start symbol is
  22. // in the set (EOF can follow).
  23. if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
  24. //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
  25. return true;
  26. }
  27. return false;
  28. }

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

  1. public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  2. if ( follow==null ) {
  3. // we have no information about the follow; we can only consume
  4. // a single token and hope for the best
  5. return false;
  6. }
  7. // compute what can follow this grammar element reference
  8. if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
  9. BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
  10. follow = follow.or(viableTokensFollowingThisRule);
  11. if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
  12. follow.remove(Token.EOR_TOKEN_TYPE);
  13. }
  14. }
  15. // if current token is consistent with what could come after set
  16. // then we know we're missing a token; error recovery is free to
  17. // "insert" the missing token
  18. //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  19. //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  20. // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  21. // in follow set to indicate that the fall of the start symbol is
  22. // in the set (EOF can follow).
  23. if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
  24. //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
  25. return true;
  26. }
  27. return false;
  28. }

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

  1. public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  2. if ( follow==null ) {
  3. // we have no information about the follow; we can only consume
  4. // a single token and hope for the best
  5. return false;
  6. }
  7. // compute what can follow this grammar element reference
  8. if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
  9. BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
  10. follow = follow.or(viableTokensFollowingThisRule);
  11. if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
  12. follow.remove(Token.EOR_TOKEN_TYPE);
  13. }
  14. }
  15. // if current token is consistent with what could come after set
  16. // then we know we're missing a token; error recovery is free to
  17. // "insert" the missing token
  18. //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  19. //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  20. // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  21. // in follow set to indicate that the fall of the start symbol is
  22. // in the set (EOF can follow).
  23. if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
  24. //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
  25. return true;
  26. }
  27. return false;
  28. }

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

  1. public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  2. if ( follow==null ) {
  3. // we have no information about the follow; we can only consume
  4. // a single token and hope for the best
  5. return false;
  6. }
  7. // compute what can follow this grammar element reference
  8. if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
  9. BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
  10. follow = follow.or(viableTokensFollowingThisRule);
  11. if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
  12. follow.remove(Token.EOR_TOKEN_TYPE);
  13. }
  14. }
  15. // if current token is consistent with what could come after set
  16. // then we know we're missing a token; error recovery is free to
  17. // "insert" the missing token
  18. //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  19. //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  20. // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  21. // in follow set to indicate that the fall of the start symbol is
  22. // in the set (EOF can follow).
  23. if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
  24. //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
  25. return true;
  26. }
  27. return false;
  28. }

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

  1. public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
  2. if ( follow==null ) {
  3. // we have no information about the follow; we can only consume
  4. // a single token and hope for the best
  5. return false;
  6. }
  7. // compute what can follow this grammar element reference
  8. if ( follow.member(Token.EOR_TOKEN_TYPE) ) {
  9. BitSet viableTokensFollowingThisRule = computeContextSensitiveRuleFOLLOW();
  10. follow = follow.or(viableTokensFollowingThisRule);
  11. if ( state._fsp>=0 ) { // remove EOR if we're not the start symbol
  12. follow.remove(Token.EOR_TOKEN_TYPE);
  13. }
  14. }
  15. // if current token is consistent with what could come after set
  16. // then we know we're missing a token; error recovery is free to
  17. // "insert" the missing token
  18. //System.out.println("viable tokens="+follow.toString(getTokenNames()));
  19. //System.out.println("LT(1)="+((TokenStream)input).LT(1));
  20. // BitSet cannot handle negative numbers like -1 (EOF) so I leave EOR
  21. // in follow set to indicate that the fall of the start symbol is
  22. // in the set (EOF can follow).
  23. if ( follow.member(input.LA(1)) || follow.member(Token.EOR_TOKEN_TYPE) ) {
  24. //System.out.println("LT(1)=="+((TokenStream)input).LT(1)+" is consistent with what follows; inserting...");
  25. return true;
  26. }
  27. return false;
  28. }

相关文章