本文整理汇总了Java中antlr.collections.impl.BitSet.member方法的典型用法代码示例。如果您正苦于以下问题:Java BitSet.member方法的具体用法?Java BitSet.member怎么用?Java BitSet.member使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类antlr.collections.impl.BitSet
的用法示例。
在下文中一共展示了BitSet.member方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: match
import antlr.collections.impl.BitSet; //导入方法依赖的package包/类
public void match(BitSet b) throws MismatchedCharException, CharStreamException {
if (!b.member(LA(1))) {
throw new MismatchedCharException(LA(1), b, false, this);
}
else {
consume();
}
}
示例2: checkForInvalidArguments
import antlr.collections.impl.BitSet; //导入方法依赖的package包/类
protected void checkForInvalidArguments(String[] args, BitSet cmdLineArgValid) {
// check for invalid command line args
for (int a = 0; a < args.length; a++) {
if (!cmdLineArgValid.member(a)) {
warning("invalid command-line argument: " + args[a] + "; ignored");
}
}
}
示例3: match
import antlr.collections.impl.BitSet; //导入方法依赖的package包/类
/**Make sure current lookahead symbol matches the given set
* Throw an exception upon mismatch, which is catch by either the
* error handler or by the syntactic predicate.
*/
public void match(BitSet b) throws MismatchedTokenException, TokenStreamException {
if (!b.member(LA(1)))
throw new MismatchedTokenException(tokenNames, LT(1), b, false, getFilename());
else
// mark token as consumed -- fetch next token deferred until LA/LT
consume();
}
示例4: match
import antlr.collections.impl.BitSet; //导入方法依赖的package包/类
/**Make sure current lookahead symbol matches the given set
* Throw an exception upon mismatch, which is catch by either the
* error handler or by the syntactic predicate.
*/
public void match(AST t, BitSet b) throws MismatchedTokenException {
if (t == null || t == ASTNULL || !b.member(t.getType())) {
throw new MismatchedTokenException(getTokenNames(), t, b, false);
}
}
示例5: consumeUntil
import antlr.collections.impl.BitSet; //导入方法依赖的package包/类
/** Consume chars until one matches the given set */
public void consumeUntil(BitSet set) throws CharStreamException {
while (LA(1) != EOF_CHAR && !set.member(LA(1))) {
consume();
}
}
示例6: genBitsets
import antlr.collections.impl.BitSet; //导入方法依赖的package包/类
/** Generate all the bitsets to be used in the parser or lexer
* Generate the raw bitset data like "long _tokenSet1_data[] = {...};"
* and the BitSet object declarations like "BitSet _tokenSet1 = new BitSet(_tokenSet1_data);"
* Note that most languages do not support object initialization inside a
* class definition, so other code-generators may have to separate the
* bitset declarations from the initializations (e.g., put the initializations
* in the generated constructor instead).
* @param bitsetList The list of bitsets to generate.
* @param maxVocabulary Ensure that each generated bitset can contain at least this value.
* @param dumpSets Dump out the token definitions of the contents of the bitset
* only for grammars/parsers.
*/
protected void genBitsets(
Vector bitsetList,
int maxVocabulary,
String prefix
)
{
TokenManager tm = grammar.tokenManager;
println("");
for (int i = 0; i < bitsetList.size(); i++)
{
BitSet p = (BitSet)bitsetList.elementAt(i);
// Ensure that generated BitSet is large enough for vocabulary
p.growToInclude(maxVocabulary);
// initialization data
println(
"const unsigned long " + prefix + getBitsetName(i) + "_data_" + "[] = { " +
p.toStringOfHalfWords() +
" };"
);
// Dump the contents of the bitset in readable format...
String t = "// ";
for( int j = 0; j < tm.getVocabulary().size(); j++ )
{
if ( p.member( j ) )
{
if ( (grammar instanceof LexerGrammar) )
t += tm.getVocabulary().elementAt(j)+" ";
else
t += tm.getTokenStringAt(j)+" ";
if( t.length() > 70 )
{
println(t);
t = "// ";
}
}
}
if ( t != "// " )
println(t);
// BitSet object
println(
"const "+namespaceAntlr+"BitSet " + prefix + getBitsetName(i) + "(" +
getBitsetName(i) + "_data_," + p.size()/32 +
");"
);
}
}
示例7: consumeUntil
import antlr.collections.impl.BitSet; //导入方法依赖的package包/类
/** Consume tokens until one matches the given token set */
public void consumeUntil(BitSet set) throws TokenStreamException {
while (LA(1) != Token.EOF_TYPE && !set.member(LA(1))) {
consume();
}
}