本文整理汇总了Java中antlr.collections.impl.BitSet.growToInclude方法的典型用法代码示例。如果您正苦于以下问题:Java BitSet.growToInclude方法的具体用法?Java BitSet.growToInclude怎么用?Java BitSet.growToInclude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类antlr.collections.impl.BitSet
的用法示例。
在下文中一共展示了BitSet.growToInclude方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: genBitsetsHeader
import antlr.collections.impl.BitSet; //导入方法依赖的package包/类
protected void genBitsetsHeader(
Vector bitsetList,
int maxVocabulary
) {
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("static const unsigned long " + getBitsetName(i) + "_data_" + "[];");
// BitSet object
println("static const "+namespaceAntlr+"BitSet " + getBitsetName(i) + ";");
}
}
示例2: 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.
*/
protected void genBitsets(Vector bitsetList,
int maxVocabulary
) {
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);
genBitSet(p, i);
}
}
示例3: 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.
*/
protected void genBitsets( Vector bitsetList, int maxVocabulary ) {
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);
genBitSet(p, i);
}
}
示例4: 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 +
");"
);
}
}