javacc-7.0.3.src.main.resources.templates.DumpDebugMethods.template Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javacc Show documentation
Show all versions of javacc Show documentation
JavaCC is a parser/scanner generator for java.
${STATIC?static :}int kindCnt = 0;
protected ${STATIC?static :}final String jjKindsForBitVector(int i, long vec)
{
String retVal = "";
if (i == 0)
kindCnt = 0;
for (int j = 0; j < 64; j++)
{
if ((vec & (1L << j)) != 0L)
{
if (kindCnt++ > 0)
retVal += ", ";
if (kindCnt % 5 == 0)
retVal += "\n ";
retVal += tokenImage[i * 64 + j];
}
}
return retVal;
}
protected ${STATIC?static :}final String jjKindsForStateVector(int lexState, int[] vec, int start, int end)
{
boolean[] kindDone = new boolean[${maxOrdinal}];
String retVal = "";
int cnt = 0;
for (int i = start; i < end; i++)
{
if (vec[i] == -1)
continue;
int[] stateSet = statesForState[curLexState][vec[i]];
for (int j = 0; j < stateSet.length; j++)
{
int state = stateSet[j];
if (!kindDone[kindForState[lexState][state]])
{
kindDone[kindForState[lexState][state]] = true;
if (cnt++ > 0)
retVal += ", ";
if (cnt % 5 == 0)
retVal += "\n ";
retVal += tokenImage[kindForState[lexState][state]];
}
}
}
if (cnt == 0)
return "{ }";
else
return "{ " + retVal + " }";
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy