Note that there are some explanatory texts on larger screens.

plurals
  1. POApache Cayenne - I cannot find code defining the constants for Token.kind field
    primarykey
    data
    text
    <p>I'm using Cayenne to parse SQL conditions, through <code>org.apache.cayenne.exp.parser.ExpressionParser</code>, which produces a series of <code>org.apache.cayenne.exp.parser.Token</code>s, and I want to determine the type of each Token (like identifier, equal sign, number, string etc.).</p> <p>The token type is definitely identified by the ExpressionParser, and it seems to me that it is stored in the <code>int</code> field <code>Token.kind</code>. The values that this field shows in my parsing tests are definitely consistent (for ex. <code>=</code> is always <code>5</code>, literal strings are always <code>42</code>, <code>and</code> operators are always <code>2</code> etc.).</p> <p>My problem is just that I cannot find the Java class containing the constants to compare <code>Token.kind</code> values with.</p> <p>The Javadoc for field <a href="http://cayenne.apache.org/docs/3.0/api/org/apache/cayenne/exp/parser/Token.html#kind" rel="nofollow"><code>Token.kind</code></a> says:</p> <blockquote> <p>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.</p> </blockquote> <p>It does not specify the full name of the file, so I downloaded JavaCCParser and I checked several <code>*Constants.*</code> files found in <code>javacc-5.0src.zip</code>, <code>javacc-6.0.zip</code>, the two <code>javacc.jar</code> contained in those two zip, and <code>cayenne-3.0.2-src.tar.gz</code>.</p> <p>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 <code>org.apache.cayenne.exp.parser.ExpressionParserConstants</code> which for ex. contains <code>int PROPERTY_PATH = 34</code> and <code>int SINGLE_QUOTED_STRING = 42</code> which definitely match the actual tokens of my test expressions, but other tokens have no corresponding constant in that class, for ex. the <code>=</code> sign (<code>kind</code> = 5) and the <code>and</code> operator (<code>kind</code> = 2).</p> <p>So my question is if anyone knows in which Java class are those constants defined. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload