当前位置: 首页>>代码示例>>Java>>正文


Java BitSet类代码示例

本文整理汇总了Java中org.antlr.runtime.BitSet的典型用法代码示例。如果您正苦于以下问题:Java BitSet类的具体用法?Java BitSet怎么用?Java BitSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BitSet类属于org.antlr.runtime包,在下文中一共展示了BitSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: matches

import org.antlr.runtime.BitSet; //导入依赖的package包/类
boolean matches(BitSet bitSet) {
	long[] array = bitSet.toPackedArray();
	int len = array.length;
	if (len < 3 || array[0] != 0L) {
		return false;
	}
	long leftBits = array[1];
	long rightBits = array[2];
	if (rightBits == semicolonRecoverySetRight
			&& (leftBits == semicolonRecoverySetLeft || leftBits == semicolonRecoverySetWithComma)) {
		for (int i = 3; i < len; i++) {
			if (array[i] != 0L) {
				return false;
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:20,代码来源:SemicolonInjectionHelper.java

示例2: followedBySemicolon

import org.antlr.runtime.BitSet; //导入依赖的package包/类
/**
 * Returns {@code true} if the set of expected follow-states includes an implicit or explicit semicolon.
 */
private static boolean followedBySemicolon(RecognizerSharedState state, Callback.RecoverySets recoverySets,
		int currentIndex) {
	int top = state._fsp;
	if (currentIndex != state.lastErrorIndex) {
		long[] array = state.following[top].toPackedArray();
		if (array.length == 1 && array[0] == (1L << Token.EOR_TOKEN_TYPE)) {
			return false;
		}
	}
	for (int i = top; i >= 0; i--) {
		BitSet localFollowSet = state.following[i];
		if (recoverySets.matches(localFollowSet)) {
			return true;
		}

	}
	return false;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:22,代码来源:SemicolonInjectionHelper.java

示例3: consumeUntil

import org.antlr.runtime.BitSet; //导入依赖的package包/类
/** Consume tokens until one matches the given token set */
    @Override
    public void consumeUntil(IntStream i, BitSet set) {
//        System.out.println("consumeUntil(" + set.toString(getTokenNames()) + ")");
        Token ttype;
        List<Token> skipped = new ArrayList<>();
        beginResync();
        try {
            while ((ttype = input.LT(1)) != null && ttype.getType() != Token.EOF && !set.member(ttype.getType())) {
//            System.out.println("consume during recover LA(1)=" + getTokenNames()[input.LA(1)]);
                input.consume();
                skipped.add(ttype);
            }
        } finally {
            endResync();
        }
        ((NbParseTreeBuilder) dbg).consumeSkippedTokens(skipped);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ExtCss3Parser.java

示例4: bitsetName

import org.antlr.runtime.BitSet; //导入依赖的package包/类
/** Added for debugging purposes only. */
@SuppressWarnings("unused")
private String bitsetName(BitSet bitset) {
	Optional<Field> findField = Stream.of(InternalN4JSParser.class.getDeclaredFields())
			.filter(f -> Modifier.isStatic(f.getModifiers())).filter(f -> {
				try {
					return bitset == f.get(null);
				} catch (Exception ex) {
					//
				}
				return false;
			}).findFirst();
	return findField.map(Field::getName).orElse("NN");
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:15,代码来源:InternalSemicolonInjectingParser.java

示例5: computeRecoverySets

import org.antlr.runtime.BitSet; //导入依赖的package包/类
/**
 * Computes the ASI recovery sets.
 */
default RecoverySets computeRecoverySets() {
	BitSet followSet = getSemicolonFollowSet();
	long[] array = followSet.toPackedArray();
	if (array.length != 3 || array[0] != 0L) {
		throw new RuntimeException("Internal token types changed. Need to rework ASI.");
	}
	int commaBit = getCommaBit() - Long.SIZE;
	if (commaBit < 0 || commaBit > Long.SIZE) {
		throw new RuntimeException("Internal token types changed. Need to rework ASI.");
	}
	RecoverySets result = new RecoverySets(array, commaBit);

	return result;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:18,代码来源:SemicolonInjectionHelper.java

示例6: testBug326509

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Test public void testBug326509() {
	for(int i = 0; i <= 200; i++) {
		testMe.pushFollow(new BitSet());
	}
	BitSet[] following = testMe.getFollowing();
	for(int i = 0; i < following.length && i <= 200; i++) {
		assertNotNull(Integer.toString(i), following[i]);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:10,代码来源:Bug326509Test.java

示例7: recoverFromMismatchedToken

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Override
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
	try {
		mismatch = true;
		return super.recoverFromMismatchedToken(input, ttype, follow);
	} finally {
		mismatch = false;
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:10,代码来源:BaseInternalContentAssistParser.java

示例8: recoverFromMismatchedToken

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Override
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
	try {
		mismatch = true;
		return super.recoverFromMismatchedToken(input, ttype, follow);
	}
	finally {
		mismatch = false;
	}
}
 
开发者ID:cplutte,项目名称:bts,代码行数:11,代码来源:AbstractInternalContentAssistParser.java

示例9: recoverFromMismatchedToken

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Override
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException
{
	throw new MismatchedTokenException(ttype, input);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:6,代码来源:Cql_Parser.java

示例10: recoverFromMismatchedToken

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Override
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException
{
    throw new MismatchedTokenException(ttype, input);
}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:6,代码来源:CqlParser.java

示例11: getSemicolonFollowSet

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Override
public BitSet getSemicolonFollowSet() {
	return FOLLOW_ruleExpression_in_ruleExpressionStatement;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:5,代码来源:InternalHighlightingParser.java

示例12: recoverFromMismatchedToken

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Override
protected Object recoverFromMismatchedToken(IntStream input, int ttype, BitSet follow) throws RecognitionException {
    //disable the default token auto-insertion/deletion recovery
    throw new MismatchedTokenException(ttype, input);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ExtCss3Parser.java

示例13: getFollowing

import org.antlr.runtime.BitSet; //导入依赖的package包/类
public BitSet[] getFollowing() {
	return state.following;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:Bug326509Test.java

示例14: pushFollow

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Override
public void pushFollow(BitSet bitSet) {
	super.pushFollow(bitSet);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:Bug326509Test.java

示例15: mismatchIsMissingToken

import org.antlr.runtime.BitSet; //导入依赖的package包/类
@Override
public boolean mismatchIsMissingToken(IntStream input, BitSet follow) {
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:BaseInternalContentAssistParser.java


注:本文中的org.antlr.runtime.BitSet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。