I'm using Cayenne to parse SQL conditions, through org.apache.cayenne.exp.parser.ExpressionParser
, which produces a series of org.apache.cayenne.exp.parser.Token
s, and I want to determine the type of each Token (like identifier, equal sign, number, string etc.).
The token type is definitely identified by the ExpressionParser, and it seems to me that it is stored in the int
field Token.kind
. The values that this field shows in my parsing tests are definitely consistent (for ex. =
is always 5
, literal strings are always 42
, and
operators are always 2
etc.).
My problem is just that I cannot find the Java class containing the constants to compare Token.kind
values with.
The Javadoc for field Token.kind
says:
An integer that describes the kind of this token. This numbering system is determined by JavaCCParser, and a table of these numbers is stored in the file ...Constants.java.
It does not specify the full name of the file, so I downloaded JavaCCParser and I checked several *Constants.*
files found in javacc-5.0src.zip
, javacc-6.0.zip
, the two javacc.jar
contained in those two zip, and cayenne-3.0.2-src.tar.gz
.
None of the classes I found there seems to me to have constants that consistently match the values I see in my tests.
The closest I was able to get to that was with class org.apache.cayenne.exp.parser.ExpressionParserConstants
which for ex. contains int PROPERTY_PATH = 34
and int SINGLE_QUOTED_STRING = 42
which definitely match the actual tokens of my test expressions, but other tokens have no corresponding constant in that class, for ex. the =
sign (kind
= 5) and the and
operator (kind
= 2).
So my question is if anyone knows in which Java class are those constants defined.