Commit cac6601c611fd300b075447ee1eb8299e5bffc90

Authored by Matthijs Brouwer
1 parent ca49b0d7

update

Too many changes to show.

To preserve performance only 11 of 29 files are displayed.

1 1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2 2 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3 3 <properties>
4   - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  4 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  5 + <currentDevelopmentVersion>6.1.0</currentDevelopmentVersion>
  6 + <currentDevelopmentRelease>20160802</currentDevelopmentRelease>
5 7 </properties>
6 8 <modelVersion>4.0.0</modelVersion>
7 9 <groupId>dev.meertens.mtas</groupId>
... ... @@ -23,11 +25,11 @@
23 25 <developers>
24 26 <developer>
25 27 <name>Matthijs Brouwer</name>
26   - <url>https://www.meertens.knaw.nl/cms/nl/medewerkers/144373-matthijsb</url>
  28 + <url>https://nl.linkedin.com/in/brouwermatthijs/</url>
27 29 </developer>
28 30 <developer>
29 31 <name>Marc Kemps-Snijders</name>
30   - <url>https://www.meertens.knaw.nl/cms/nl/medewerkers/143329-marck</url>
  32 + <url>https://nl.linkedin.com/in/marc-kemps-snijders-1b33753</url>
31 33 </developer>
32 34 </developers>
33 35 <build>
... ... @@ -64,7 +66,7 @@
64 66 <addMavenDescriptor>false</addMavenDescriptor>
65 67 </archive>
66 68 </configuration>
67   - </plugin>
  69 + </plugin>
68 70 </plugins>
69 71 </build>
70 72 <reporting>
... ...
src/mtas/analysis/parser/MtasCRMParser.java
... ... @@ -18,6 +18,9 @@ import mtas.analysis.util.MtasConfigException;
18 18 import mtas.analysis.util.MtasConfiguration;
19 19 import mtas.analysis.util.MtasParserException;
20 20  
  21 +/**
  22 + * The Class MtasCRMParser.
  23 + */
21 24 public class MtasCRMParser extends MtasBasicParser {
22 25  
23 26 /** The word type. */
... ... @@ -26,8 +29,14 @@ public class MtasCRMParser extends MtasBasicParser {
26 29 /** The word annotation types. */
27 30 private HashMap<String, MtasParserType> wordAnnotationTypes = new HashMap<String, MtasParserType>();
28 31  
  32 + /** The functions. */
29 33 private HashMap<String, MtasCRMParserFunction> functions = new HashMap<String, MtasCRMParserFunction>();
30 34  
  35 + /**
  36 + * Instantiates a new mtas crm parser.
  37 + *
  38 + * @param config the config
  39 + */
31 40 public MtasCRMParser(MtasConfiguration config) {
32 41 super(config);
33 42 try {
... ... @@ -38,6 +47,9 @@ public class MtasCRMParser extends MtasBasicParser {
38 47 }
39 48 }
40 49  
  50 + /* (non-Javadoc)
  51 + * @see mtas.analysis.parser.MtasParser#initParser()
  52 + */
41 53 @Override
42 54 protected void initParser() throws MtasConfigException {
43 55 super.initParser();
... ... @@ -128,6 +140,9 @@ public class MtasCRMParser extends MtasBasicParser {
128 140 }
129 141 }
130 142  
  143 + /* (non-Javadoc)
  144 + * @see mtas.analysis.parser.MtasParser#createTokenCollection(java.io.Reader)
  145 + */
131 146 @Override
132 147 public MtasTokenCollection createTokenCollection(Reader reader)
133 148 throws MtasParserException, MtasConfigException {
... ... @@ -252,6 +267,22 @@ public class MtasCRMParser extends MtasBasicParser {
252 267  
253 268 }
254 269  
  270 + /**
  271 + * Process word annotation.
  272 + *
  273 + * @param name the name
  274 + * @param text the text
  275 + * @param previousOffset the previous offset
  276 + * @param currentOffset the current offset
  277 + * @param functionOutputList the function output list
  278 + * @param unknownAncestors the unknown ancestors
  279 + * @param currentList the current list
  280 + * @param updateList the update list
  281 + * @param idPositions the id positions
  282 + * @param idOffsets the id offsets
  283 + * @throws MtasParserException the mtas parser exception
  284 + * @throws MtasConfigException the mtas config exception
  285 + */
255 286 private void processWordAnnotation(String name, String text,
256 287 Integer previousOffset, Integer currentOffset,
257 288 ArrayList<MtasCRMParserFunctionOutput> functionOutputList,
... ... @@ -318,6 +349,9 @@ public class MtasCRMParser extends MtasBasicParser {
318 349 }
319 350 }
320 351  
  352 + /* (non-Javadoc)
  353 + * @see mtas.analysis.parser.MtasParser#printConfig()
  354 + */
321 355 @Override
322 356 public String printConfig() {
323 357 String text = "";
... ... @@ -328,6 +362,12 @@ public class MtasCRMParser extends MtasBasicParser {
328 362 return text;
329 363 }
330 364  
  365 + /**
  366 + * Prints the config types.
  367 + *
  368 + * @param types the types
  369 + * @return the string
  370 + */
331 371 private String printConfigTypes(HashMap<?, MtasParserType> types) {
332 372 String text = "";
333 373 for (Entry<?, MtasParserType> entry : types.entrySet()) {
... ... @@ -340,12 +380,25 @@ public class MtasCRMParser extends MtasBasicParser {
340 380 return text;
341 381 }
342 382  
  383 + /**
  384 + * The Class MtasCRMParserFunction.
  385 + */
343 386 private class MtasCRMParserFunction {
344 387  
  388 + /** The type. */
345 389 public String type;
  390 +
  391 + /** The split. */
346 392 public String split;
  393 +
  394 + /** The output. */
347 395 public HashMap<String, ArrayList<MtasCRMParserFunctionOutput>> output;
348 396  
  397 + /**
  398 + * Instantiates a new mtas crm parser function.
  399 + *
  400 + * @param split the split
  401 + */
349 402 public MtasCRMParserFunction(String split) {
350 403 this.split = split;
351 404 output = new HashMap<String, ArrayList<MtasCRMParserFunctionOutput>>();
... ... @@ -353,21 +406,37 @@ public class MtasCRMParser extends MtasBasicParser {
353 406  
354 407 }
355 408  
  409 + /**
  410 + * The Class MtasCRMParserFunctionOutput.
  411 + */
356 412 private class MtasCRMParserFunctionOutput {
  413 +
  414 + /** The name. */
357 415 public String name;
  416 +
  417 + /** The value. */
358 418 public String value;
359 419  
  420 + /**
  421 + * Instantiates a new mtas crm parser function output.
  422 + *
  423 + * @param name the name
  424 + * @param value the value
  425 + */
360 426 public MtasCRMParserFunctionOutput(String name, String value) {
361 427 this.name = name;
362 428 this.value = value;
363 429 }
364 430 }
365 431  
  432 + /**
  433 + * The Class MtasCRMParserMappingWordAnnotation.
  434 + */
366 435 private class MtasCRMParserMappingWordAnnotation
367 436 extends MtasParserMapping<MtasCRMParserMappingWordAnnotation> {
368 437  
369 438 /**
370   - * Instantiates a new mtas sketch parser mapping word annotation.
  439 + * Instantiates a new mtas crm parser mapping word annotation.
371 440 */
372 441 public MtasCRMParserMappingWordAnnotation() {
373 442 super();
... ...
src/mtas/codec/MtasFieldsConsumer.java
... ... @@ -45,277 +45,6 @@ import org.apache.solr.update.processor.LogUpdateProcessorFactory;
45 45  
46 46 /**
47 47 * The Class MtasFieldsConsumer.
48   - *
49   - *
50   - * The Class MtasFieldsConsumer constructs several temporal and permanent files
51   - * to provide a forward index
52   - *
53   - * <ul>
54   - * <li><b>Temporary files</b><br>
55   - * <ul>
56   - * <li><b>Temporary file {@link #mtasTmpFieldFileName} with extension
57   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_TMP_FIELD_EXTENSION} </b><br>
58   - * Contains for each field a reference to the list of documents. Structure of
59   - * content:
60   - * <ul>
61   - * <li><b>String</b>: field</li>
62   - * <li><b>VLong</b>: reference to {@link #mtasDocFileName}</li>
63   - * <li><b>VInt</b>: number of documents</li>
64   - * <li><b>VLong</b>: reference to {@link #mtasTermFileName}</li>
65   - * <li><b>VInt</b>: number of terms</li>
66   - * <li><b>VLong</b>: reference to {@link #mtasPrefixFileName}</li>
67   - * <li><b>VInt</b>: number of prefixes</li>
68   - * </ul>
69   - * </li>
70   - * <li><b>Temporary file {@link #mtasTmpObjectFileName} with extension
71   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_TMP_OBJECT_EXTENSION}</b><br>
72   - * Contains for a specific field all objects constructed by
73   - * {@link createObjectAndRegisterPrefix}. For all fields, the objects are later
74   - * on copied to {@link #mtasObjectFileName} while statistics are collected.
75   - * Structure of content identical to {@link #mtasObjectFileName}.</li>
76   - * <li><b>Temporary file {@link #mtasTmpDocsFileName} with extension
77   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_TMP_DOCS_EXTENSION}</b> <br>
78   - * Contains for a specific field for each doc multiple fragments. Each occurring
79   - * term results in a fragment. Structure of content:
80   - * <ul>
81   - * <li><b>VInt</b>: docId</li>
82   - * <li><b>VInt</b>: number of objects in this fragment</li>
83   - * <li><b>VLong</b>: offset references to {@link #mtasTmpObjectFileName}</li>
84   - * <li><b>VInt</b>,<b>VLong</b>: mtasId object, reference temporary object in
85   - * {@link #mtasTmpObjectFileName} minus offset</li>
86   - * <li><b>VInt</b>,<b>VLong</b>: ...</li>
87   - * </ul>
88   - * </li>
89   - * <li><b>Temporary file {@link #mtasTmpDocsChainedFileName} with extension
90   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_TMP_DOCS_CHAINED_EXTENSION}
91   - * </b><br>
92   - * Contains for a specific field for each doc multiple chained fragments.
93   - * Structure of content:
94   - * <ul>
95   - * <li><b>VInt</b>: docId</li>
96   - * <li><b>VInt</b>: number of objects in this fragment</li>
97   - * <li><b>VLong</b>: offset references to {@link #mtasTmpObjectFileName}</li>
98   - * <li><b>VInt</b>,<b>VLong</b>: mtasId object, reference temporary object in
99   - * {@link #mtasTmpObjectFileName} minus offset</li>
100   - * <li><b>VInt</b>,<b>VLong</b>: ...</li>
101   - * <li><b>VLong</b>: reference to next fragment in
102   - * {@link #mtasTmpDocsChainedFileName}, self reference indicates end of chain
103   - * </ul>
104   - * </li>
105   - * <li><b>Temporary file {@link #mtasTmpDocFileName} with extension
106   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_TMP_DOC_EXTENSION}</b><br>
107   - * For each document
108   - * <ul>
109   - * <li><b>VInt</b>: docId</li>
110   - * <li><b>VLong</b>: reference to {@link #mtasIndexObjectIdFileName}</li>
111   - * <li><b>VLong</b>: reference first object, used as offset for tree index
112   - * <li><b>VInt</b>: slope used in approximation reference objects index on id
113   - * </li>
114   - * <li><b>ZLong</b>: offset used in approximation reference objects index on id
115   - * </li>
116   - * <li><b>Byte</b>: flag indicating how corrections on the approximation
117   - * references objects for the index on id are stored:
118   - * {@link MtasCodecPostingsFormat#MTAS_STORAGE_BYTE},
119   - * {@link MtasCodecPostingsFormat#MTAS_STORAGE_SHORT},
120   - * {@link MtasCodecPostingsFormat#MTAS_STORAGE_INTEGER} or
121   - * {@link MtasCodecPostingsFormat#MTAS_STORAGE_LONG}</li>
122   - * <li><b>VInt</b>: number of objects in this document</li>
123   - * <li><b>VInt</b>: first position</li>
124   - * <li><b>VInt</b>: last position</li>
125   - * </ul>
126   - * </li>
127   - * </ul>
128   - * </li>
129   - * <li><b>Final files</b><br>
130   - * <ul>
131   - * <li><b>File {@link #mtasIndexFieldFileName} with extension
132   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_FIELD_EXTENSION}</b><br>
133   - * Contains for each field a reference to the list of documents and the
134   - * prefixes. Structure of content:
135   - * <ul>
136   - * <li><b>String</b>: field</li>
137   - * <li><b>VLong</b>: reference to {@link #mtasDocFileName}</li>
138   - * <li><b>VLong</b>: reference to {@link #mtasIndexDocIdFileName}</li>
139   - * <li><b>VInt</b>: number of documents</li>
140   - * <li><b>VLong</b>: reference to {@link #mtasTermFileName}</li>
141   - * <li><b>VInt</b>: number of terms</li>
142   - * <li><b>VLong</b>: reference to {@link #mtasPrefixFileName}</li>
143   - * <li><b>VInt</b>: number of prefixes</li>
144   - * </ul>
145   - * </li>
146   - * <li><b>File {@link #mtasTermFileName} with extension
147   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_TERM_EXTENSION}</b><br>
148   - * For each field, all unique terms are stored here. Structure of content:
149   - * <ul>
150   - * <li><b>String</b>: term</li>
151   - * </ul>
152   - * </li>
153   - * <li><b>File {@link #mtasPrefixFileName} with extension
154   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_PREFIX_EXTENSION}</b><br>
155   - * For each field, all unique prefixes are stored here. Structure of content:
156   - * <ul>
157   - * <li><b>String</b>: prefix</li>
158   - * </ul>
159   - * </li>
160   - * <li><b>File {@link #mtasObjectFileName} with extension
161   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_OBJECT_EXTENSION}</b><br>
162   - * Contains all objects for all fields. Structure of content:
163   - * <ul>
164   - * <li><b>VInt</b>: mtasId</li>
165   - * <li><b>VInt</b>: objectFlags
166   - * <ul>
167   - * <li>{@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_PARENT}</li>
168   - * <li>{@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_POSITION_RANGE}</li>
169   - * <li>{@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_POSITION_SET}</li>
170   - * <li>{@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_OFFSET}</li>
171   - * <li>{@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_REALOFFSET}</li>
172   - * <li>{@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_PAYLOAD}</li>
173   - * </ul>
174   - * </li>
175   - * <li>Only if {@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_PARENT}<br>
176   - * <b>VInt</b>: parentId
177   - * <li>Only if
178   - * {@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_POSITION_RANGE}<br>
179   - * <b>VInt</b>,<b>VInt</b>: startPosition and (endPosition-startPosition)
180   - * <li>Only if {@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_POSITION_SET}<br>
181   - * <b>VInt</b>,<b>VInt</b>,<b>VInt</b>,...: number of positions, firstPosition,
182   - * (position-previousPosition),...
183   - * <li>Only if no {@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_POSITION_RANGE}
184   - * or {@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_POSITION_SET}<br>
185   - * <b>VInt</b>: position
186   - * <li>Only if {@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_OFFSET}<br>
187   - * <b>VInt</b>,<b>VInt</b>: startOffset, (endOffset-startOffset)
188   - * <li>Only if {@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_REALOFFSET}<br>
189   - * <b>VInt</b>,<b>VInt</b>: startRealOffset, (endRealOffset-startRealOffset)
190   - * <li>Only if {@link MtasCodecPostingsFormat#MTAS_OBJECT_HAS_PAYLOAD}<br>
191   - * <b>VInt</b>,<b>Bytes</b>: number of bytes, payload
192   - * <li><b>VLong</b>: reference to Term in {@link #mtasTermFileName}</li>
193   - * </ul>
194   - * </li>
195   - * <li><b>File {@link #mtasIndexDocIdFileName} with extension
196   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_INDEX_DOC_ID_EXTENSION}
197   - * </b><br>
198   - * Contains for each field a tree structure {@link MtasTree} to search reference
199   - * to {@link #mtasDocFileName} by id. Structure of content for each node:
200   - * <ul>
201   - * <li><b>VLong</b>: offset references to {@link #mtasIndexDocIdFileName}, only
202   - * available in root node</li>
203   - * <li><b>Byte</b>: flag, should be zero for this tree, only available in root
204   - * node</li>
205   - * <li><b>VInt</b>: left</li>
206   - * <li><b>VInt</b>: right</li>
207   - * <li><b>VInt</b>: max</li>
208   - * <li><b>VLong</b>: left reference to {@link #mtasIndexDocIdFileName} minus the
209   - * offset stored in the root node</li>
210   - * <li><b>VLong</b>: right reference to {@link #mtasIndexDocIdFileName} minus
211   - * the offset stored in the root node</li>
212   - * <li><b>VInt</b>: number of objects on this node (always 1 for this tree)</li>
213   - * <li><b>VLong</b>: reference to {@link #mtasDocFileName} minus offset</li>
214   - * </ul>
215   - * </li>
216   - * <li><b>File {@link #mtasDocFileName} with extension
217   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_DOC_EXTENSION}</b><br>
218   - * For each document
219   - * <ul>
220   - * <li><b>VInt</b>: docId</li>
221   - * <li><b>VLong</b>: reference to {@link #mtasIndexObjectIdFileName}</li>
222   - * <li><b>VLong</b>: reference to {@link #mtasIndexObjectPositionFileName}</li>
223   - * <li><b>VLong</b>: reference to {@link #mtasIndexObjectParentFileName}</li>
224   - * <li><b>VLong</b>: reference first object, used as offset for tree index
225   - * <li><b>VInt</b>: slope used in approximation reference objects index on id
226   - * </li>
227   - * <li><b>ZLong</b>: offset used in approximation reference objects index on id
228   - * </li>
229   - * <li><b>Byte</b>: flag indicating how corrections on the approximation
230   - * references objects for the index on id are stored:
231   - * {@link MtasCodecPostingsFormat#MTAS_STORAGE_BYTE},
232   - * {@link MtasCodecPostingsFormat#MTAS_STORAGE_SHORT},
233   - * {@link MtasCodecPostingsFormat#MTAS_STORAGE_INTEGER} or
234   - * {@link MtasCodecPostingsFormat#MTAS_STORAGE_LONG}</li>
235   - * <li><b>VInt</b>: number of objects</li>
236   - * <li><b>VInt</b>: first position</li>
237   - * <li><b>VInt</b>: last position</li>
238   - * </ul>
239   - * </li>
240   - * <li><b>File {@link #mtasIndexObjectIdFileName} with extension
241   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_INDEX_OBJECT_ID_EXTENSION}
242   - * </b><br>
243   - * Provides for each mtasId the reference to {@link #mtasObjectFileName}. These
244   - * references are grouped by document, sorted by mtasId, and because the
245   - * mtasId's for each document will always start with 0 and are sequential
246   - * without gaps, a reference can be computed if the position of the first
247   - * reference for a document is known from {@link #mtasDocFileName}. The
248   - * reference is approximated by the reference to the first object plus the
249   - * mtasId times a slope. Only a correction to this approximation is stored.
250   - * Structure of content:
251   - * <ul>
252   - * <li><b>Byte</b>/<b>Short</b>/<b>Int</b>/<b>Long</b>: correction reference to
253   - * {@link #mtasObjectFileName}</li>
254   - * </ul>
255   - * </li>
256   - * <li><b>File {@link #mtasIndexObjectPositionFileName} with extension
257   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_INDEX_OBJECT_POSITION_EXTENSION}
258   - * </b><br>
259   - * Contains for each document a tree structure {@link MtasTree} to search
260   - * objects by position. Structure of content for each node:
261   - * <ul>
262   - * <li><b>VLong</b>: offset references to
263   - * {@link #mtasIndexObjectPositionFileName}, only available in root node</li>
264   - * <li><b>Byte</b>: flag, should be zero for this tree, only available in root
265   - * node</li>
266   - * <li><b>VInt</b>: left</li>
267   - * <li><b>VInt</b>: right</li>
268   - * <li><b>VInt</b>: max</li>
269   - * <li><b>VLong</b>: left reference to {@link #mtasIndexObjectPositionFileName}
270   - * minus the offset stored in the root node</li>
271   - * <li><b>VLong</b>: right reference to {@link #mtasIndexObjectPositionFileName}
272   - * minus the offset stored in the root node</li>
273   - * <li><b>VInt</b>: number of objects on this node</li>
274   - * <li><b>VLong</b>,<b>VInt</b>,<b>VLong</b>: set of the first reference to
275   - * {@link #mtasObjectFileName} minus offset, the prefixId referring to the
276   - * position the prefix in {@link #mtasPrefixFileName} and the reference to
277   - * {@link #mtasTermFileName} minus offset</li>
278   - * <li><b>VLong</b>,<b>VInt</b>,<b>VLong</b>,...: for optional other sets of
279   - * reference to {@link #mtasObjectFileName}, position of the prefix in
280   - * {@link #mtasPrefixFileName} and the reference to {@link #mtasTermFileName};
281   - * for the first item the difference between this reference minus the previous
282   - * reference is stored</li>
283   - * </ul>
284   - * </li>
285   - * <li><b>File {@link #mtasIndexObjectParentFileName} with extension
286   - * {@value mtas.codec.MtasCodecPostingsFormat#MTAS_INDEX_OBJECT_PARENT_EXTENSION}
287   - * </b><br>
288   - * Contains for each document a tree structure {@link MtasTree} to search
289   - * objects by parent. Structure of content for each node:
290   - * <ul>
291   - * <li><b>VLong</b>: offset references to {@link #mtasIndexObjectParentFileName}
292   - * , only available in root node</li>
293   - * <li><b>Byte</b>: flag, for this tree equal to
294   - * {@link mtas.codec.tree.MtasTree#SINGLE_POSITION_TREE} indicating a tree with
295   - * exactly one point at each node, only available in root node</li>
296   - * <li><b>VInt</b>: left</li>
297   - * <li><b>VInt</b>: right</li>
298   - * <li><b>VInt</b>: max</li>
299   - * <li><b>VLong</b>: left reference to {@link #mtasIndexObjectParentFileName}
300   - * minus the offset stored in the root node</li>
301   - * <li><b>VLong</b>: right reference to {@link #mtasIndexObjectParentFileName}
302   - * minus the offset stored in the root node</li>
303   - * <li><b>VInt</b>: number of objects on this node</li>
304   - * <li><b>VLong</b>,<b>VInt</b>,<b>VLong</b>: set of the first reference to
305   - * {@link #mtasObjectFileName} minus offset, the prefixId referring to the
306   - * position the prefix in {@link #mtasPrefixFileName} and the reference to
307   - * {@link #mtasTermFileName} minus offset</li>
308   - * <li><b>VLong</b>,<b>VInt</b>,<b>VLong</b>,...: for optional other sets of
309   - * reference to {@link #mtasObjectFileName}, position of the prefix in
310   - * {@link #mtasPrefixFileName} and the reference to {@link #mtasTermFileName};
311   - * for the first item the difference between this reference minus the previous
312   - * reference is stored</li>
313   - * </ul>
314   - * </li>
315   - * </ul>
316   - * </li>
317   - * </ul>
318   - *
319 48 */
320 49  
321 50 public class MtasFieldsConsumer extends FieldsConsumer {
... ... @@ -366,14 +95,10 @@ public class MtasFieldsConsumer extends FieldsConsumer {
366 95 /**
367 96 * Instantiates a new mtas fields consumer.
368 97 *
369   - * @param fieldsConsumer
370   - * the fields consumer
371   - * @param state
372   - * the state
373   - * @param name
374   - * the name
375   - * @param delegatePostingsFormatName
376   - * the delegate postings format name
  98 + * @param fieldsConsumer the fields consumer
  99 + * @param state the state
  100 + * @param name the name
  101 + * @param delegatePostingsFormatName the delegate postings format name
377 102 */
378 103 public MtasFieldsConsumer(FieldsConsumer fieldsConsumer,
379 104 SegmentWriteState state, String name, String delegatePostingsFormatName) {
... ... @@ -430,14 +155,10 @@ public class MtasFieldsConsumer extends FieldsConsumer {
430 155 /**
431 156 * Register prefix.
432 157 *
433   - * @param field
434   - * the field
435   - * @param prefix
436   - * the prefix
437   - * @param outPrefix
438   - * the out prefix
439   - * @throws IOException
440   - * Signals that an I/O exception has occurred.
  158 + * @param field the field
  159 + * @param prefix the prefix
  160 + * @param outPrefix the out prefix
  161 + * @throws IOException Signals that an I/O exception has occurred.
441 162 */
442 163 private void registerPrefix(String field, String prefix,
443 164 IndexOutput outPrefix) throws IOException {
... ... @@ -456,14 +177,10 @@ public class MtasFieldsConsumer extends FieldsConsumer {
456 177 /**
457 178 * Register prefix stats single position value.
458 179 *
459   - * @param field
460   - * the field
461   - * @param value
462   - * the value
463   - * @param outPrefix
464   - * the out prefix
465   - * @throws IOException
466   - * Signals that an I/O exception has occurred.
  180 + * @param field the field
  181 + * @param value the value
  182 + * @param outPrefix the out prefix
  183 + * @throws IOException Signals that an I/O exception has occurred.
467 184 */
468 185 public void registerPrefixStatsSinglePositionValue(String field, String value,
469 186 IndexOutput outPrefix) throws IOException {
... ... @@ -478,14 +195,10 @@ public class MtasFieldsConsumer extends FieldsConsumer {
478 195 /**
479 196 * Register prefix stats range position value.
480 197 *
481   - * @param field
482   - * the field
483   - * @param value
484   - * the value
485   - * @param outPrefix
486   - * the out prefix
487   - * @throws IOException
488   - * Signals that an I/O exception has occurred.
  198 + * @param field the field
  199 + * @param value the value
  200 + * @param outPrefix the out prefix
  201 + * @throws IOException Signals that an I/O exception has occurred.
489 202 */
490 203 public void registerPrefixStatsRangePositionValue(String field, String value,
491 204 IndexOutput outPrefix) throws IOException {
... ... @@ -499,14 +212,10 @@ public class MtasFieldsConsumer extends FieldsConsumer {
499 212 /**
500 213 * Register prefix stats set position value.
501 214 *
502   - * @param field
503   - * the field
504   - * @param value
505   - * the value
506   - * @param outPrefix
507   - * the out prefix
508   - * @throws IOException
509   - * Signals that an I/O exception has occurred.
  215 + * @param field the field
  216 + * @param value the value
  217 + * @param outPrefix the out prefix
  218 + * @throws IOException Signals that an I/O exception has occurred.
510 219 */
511 220 public void registerPrefixStatsSetPositionValue(String field, String value,
512 221 IndexOutput outPrefix) throws IOException {
... ... @@ -521,8 +230,7 @@ public class MtasFieldsConsumer extends FieldsConsumer {
521 230 /**
522 231 * Inits the prefix stats field.
523 232 *
524   - * @param field
525   - * the field
  233 + * @param field the field
526 234 */
527 235 private void initPrefixStatsField(String field) {
528 236 if (!singlePositionPrefix.containsKey(field)) {
... ... @@ -539,8 +247,7 @@ public class MtasFieldsConsumer extends FieldsConsumer {
539 247 /**
540 248 * Gets the prefix stats single position prefix attribute.
541 249 *
542   - * @param field
543   - * the field
  250 + * @param field the field
544 251 * @return the prefix stats single position prefix attribute
545 252 */
546 253 public String getPrefixStatsSinglePositionPrefixAttribute(String field) {
... ... @@ -551,8 +258,7 @@ public class MtasFieldsConsumer extends FieldsConsumer {
551 258 /**
552 259 * Gets the prefix stats multiple position prefix attribute.
553 260 *
554   - * @param field
555   - * the field
  261 + * @param field the field
556 262 * @return the prefix stats multiple position prefix attribute
557 263 */
558 264 public String getPrefixStatsMultiplePositionPrefixAttribute(String field) {
... ... @@ -563,8 +269,7 @@ public class MtasFieldsConsumer extends FieldsConsumer {
563 269 /**
564 270 * Gets the prefix stats set position prefix attribute.
565 271 *
566   - * @param field
567   - * the field
  272 + * @param field the field
568 273 * @return the prefix stats set position prefix attribute
569 274 */
570 275 public String getPrefixStatsSetPositionPrefixAttribute(String field) {
... ... @@ -589,6 +294,9 @@ public class MtasFieldsConsumer extends FieldsConsumer {
589 294 return text;
590 295 }
591 296  
  297 + /* (non-Javadoc)
  298 + * @see org.apache.lucene.codecs.FieldsConsumer#merge(org.apache.lucene.index.MergeState)
  299 + */
592 300 @Override
593 301 public void merge(MergeState mergeState) throws IOException {
594 302 delegateFieldsConsumer.merge(mergeState);
... ... @@ -609,12 +317,9 @@ public class MtasFieldsConsumer extends FieldsConsumer {
609 317 /**
610 318 * Write.
611 319 *
612   - * @param fieldInfos
613   - * the field infos
614   - * @param fields
615   - * the fields
616   - * @throws IOException
617   - * Signals that an I/O exception has occurred.
  320 + * @param fieldInfos the field infos
  321 + * @param fields the fields
  322 + * @throws IOException Signals that an I/O exception has occurred.
618 323 */
619 324 private void write(FieldInfos fieldInfos, Fields fields) throws IOException {
620 325 IndexOutput outField, outDoc, outIndexDocId, outIndexObjectId,
... ... @@ -1204,23 +909,15 @@ public class MtasFieldsConsumer extends FieldsConsumer {
1204 909 /**
1205 910 * Creates the object and register prefix.
1206 911 *
1207   - * @param field
1208   - * the field
1209   - * @param out
1210   - * the out
1211   - * @param term
1212   - * the term
1213   - * @param termRef
1214   - * the term ref
1215   - * @param startPosition
1216   - * the start position
1217   - * @param payload
1218   - * the payload
1219   - * @param outPrefix
1220   - * the out prefix
  912 + * @param field the field
  913 + * @param out the out
  914 + * @param term the term
  915 + * @param termRef the term ref
  916 + * @param startPosition the start position
  917 + * @param payload the payload
  918 + * @param outPrefix the out prefix
1221 919 * @return the integer
1222   - * @throws IOException
1223   - * Signals that an I/O exception has occurred.
  920 + * @throws IOException Signals that an I/O exception has occurred.
1224 921 */
1225 922 private Integer createObjectAndRegisterPrefix(String field, IndexOutput out,
1226 923 BytesRef term, Long termRef, int startPosition, BytesRef payload,
... ... @@ -1232,27 +929,17 @@ public class MtasFieldsConsumer extends FieldsConsumer {
1232 929 /**
1233 930 * Creates the object and register prefix.
1234 931 *
1235   - * @param field
1236   - * the field
1237   - * @param out
1238   - * the out
1239   - * @param term
1240   - * the term
1241   - * @param termRef
1242   - * the term ref
1243   - * @param startPosition
1244   - * the start position
1245   - * @param payload
1246   - * the payload
1247   - * @param startOffset
1248   - * the start offset
1249   - * @param endOffset
1250   - * the end offset
1251   - * @param outPrefix
1252   - * the out prefix
  932 + * @param field the field
  933 + * @param out the out
  934 + * @param term the term
  935 + * @param termRef the term ref
  936 + * @param startPosition the start position
  937 + * @param payload the payload
  938 + * @param startOffset the start offset
  939 + * @param endOffset the end offset
  940 + * @param outPrefix the out prefix
1253 941 * @return the integer
1254   - * @throws IOException
1255   - * Signals that an I/O exception has occurred.
  942 + * @throws IOException Signals that an I/O exception has occurred.
1256 943 */
1257 944 private Integer createObjectAndRegisterPrefix(String field, IndexOutput out,
1258 945 BytesRef term, Long termRef, int startPosition, BytesRef payload,
... ... @@ -1363,15 +1050,11 @@ public class MtasFieldsConsumer extends FieldsConsumer {
1363 1050 /**
1364 1051 * Store tree.
1365 1052 *
1366   - * @param tree
1367   - * the tree
1368   - * @param out
1369   - * the out
1370   - * @param refApproxOffset
1371   - * the ref approx offset
  1053 + * @param tree the tree
  1054 + * @param out the out
  1055 + * @param refApproxOffset the ref approx offset
1372 1056 * @return the long
1373   - * @throws IOException
1374   - * Signals that an I/O exception has occurred.
  1057 + * @throws IOException Signals that an I/O exception has occurred.
1375 1058 */
1376 1059 private Long storeTree(MtasTree<?> tree, IndexOutput out,
1377 1060 long refApproxOffset) throws IOException {
... ... @@ -1382,21 +1065,14 @@ public class MtasFieldsConsumer extends FieldsConsumer {
1382 1065 /**
1383 1066 * Store tree.
1384 1067 *
1385   - * @param node
1386   - * the node
1387   - * @param isSinglePoint
1388   - * the is single point
1389   - * @param storeAdditionalInformation
1390   - * the store additional information
1391   - * @param out
1392   - * the out
1393   - * @param nodeRefApproxOffset
1394   - * the node ref approx offset
1395   - * @param refApproxOffset
1396   - * the ref approx offset
  1068 + * @param node the node
  1069 + * @param isSinglePoint the is single point
  1070 + * @param storeAdditionalInformation the store additional information
  1071 + * @param out the out
  1072 + * @param nodeRefApproxOffset the node ref approx offset
  1073 + * @param refApproxOffset the ref approx offset
1397 1074 * @return the long
1398   - * @throws IOException
1399   - * Signals that an I/O exception has occurred.
  1075 + * @throws IOException Signals that an I/O exception has occurred.
1400 1076 */
1401 1077 private Long storeTree(MtasTreeNode<?> node, boolean isSinglePoint,
1402 1078 boolean storeAdditionalInformation, IndexOutput out,
... ... @@ -1481,10 +1157,8 @@ public class MtasFieldsConsumer extends FieldsConsumer {
1481 1157 /**
1482 1158 * Token stats add.
1483 1159 *
1484   - * @param min
1485   - * the min
1486   - * @param max
1487   - * the max
  1160 + * @param min the min
  1161 + * @param max the max
1488 1162 */
1489 1163 private void tokenStatsAdd(int min, int max) {
1490 1164 tokenStatsNumber++;
... ... @@ -1503,16 +1177,11 @@ public class MtasFieldsConsumer extends FieldsConsumer {
1503 1177 /**
1504 1178 * Copy object and update stats.
1505 1179 *
1506   - * @param id
1507   - * the id
1508   - * @param in
1509   - * the in
1510   - * @param inRef
1511   - * the in ref
1512   - * @param out
1513   - * the out
1514   - * @throws IOException
1515   - * Signals that an I/O exception has occurred.
  1180 + * @param id the id
  1181 + * @param in the in
  1182 + * @param inRef the in ref
  1183 + * @param out the out
  1184 + * @throws IOException Signals that an I/O exception has occurred.
1516 1185 */
1517 1186 private void copyObjectAndUpdateStats(int id, IndexInput in, Long inRef,
1518 1187 IndexOutput out) throws IOException {
... ...
src/mtas/parser/cql/MtasCQLParser.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. MtasCQLParser.java */
  2 +package mtas.parser.cql;
  3 +import mtas.analysis.token.MtasToken;
  4 +import mtas.parser.cql.util.MtasCQLParserGroupCondition;
  5 +import mtas.parser.cql.util.MtasCQLParserGroupFullCondition;
  6 +import mtas.parser.cql.util.MtasCQLParserWordCondition;
  7 +import mtas.parser.cql.util.MtasCQLParserWordPositionQuery;
  8 +import mtas.parser.cql.util.MtasCQLParserWordFullCondition;
  9 +import mtas.parser.cql.util.MtasCQLParserBasicSentenceCondition;
  10 +import mtas.parser.cql.util.MtasCQLParserSentenceCondition;
  11 +import mtas.parser.cql.util.MtasCQLParserSentencePartCondition;
  12 +import mtas.parser.cql.util.MtasCQLParserGroupQuery;
  13 +import mtas.parser.cql.util.MtasCQLParserWordQuery;
  14 +import mtas.parser.cql.util.MtasCQLParserDefaultPrefixCondition;
  15 +import org.apache.lucene.search.spans.SpanContainingQuery;
  16 +import org.apache.lucene.search.spans.SpanNotQuery;
  17 +import org.apache.lucene.search.spans.SpanQuery;
  18 +import org.apache.lucene.search.spans.SpanWithinQuery;
  19 +import org.apache.lucene.index.Term;
  20 +import mtas.search.spans.MtasSpanSequenceItem;
  21 +import mtas.search.spans.MtasSpanSequenceQuery;
  22 +import java.util.ArrayList;
  23 +import java.util.regex.Matcher;
  24 +import java.util.regex.Pattern;
  25 +
  26 +public class MtasCQLParser implements MtasCQLParserConstants {
  27 + public SpanQuery parse(String field, String defaultPrefix) throws ParseException
  28 + {
  29 + return cql(field, defaultPrefix);
  30 + }
  31 +
  32 + private String unquoteString(String unfiltered)
  33 + {
  34 + if (unfiltered.startsWith("\u005c"") && unfiltered.endsWith("\u005c""))
  35 + {
  36 + unfiltered = unfiltered.substring(1, unfiltered.length());
  37 + unfiltered = unfiltered.substring(0, unfiltered.length() - 1);
  38 + }
  39 + return unfiltered;
  40 + }
  41 +
  42 + final private SpanQuery cql(String field, String defaultPrefix) throws ParseException, ParseException {
  43 + SpanQuery q;
  44 + ArrayList < MtasSpanSequenceItem > itemList = new ArrayList < MtasSpanSequenceItem > ();
  45 + q = cqlBlock(field, defaultPrefix);
  46 + itemList.add(new MtasSpanSequenceItem(q, false));
  47 + label_1:
  48 + while (true) {
  49 + if (jj_2_1(1000)) {
  50 + ;
  51 + } else {
  52 + break label_1;
  53 + }
  54 + q = cqlBlock(field, defaultPrefix);
  55 + itemList.add(new MtasSpanSequenceItem(q, false));
  56 + }
  57 + jj_consume_token(0);
  58 + if (itemList.size() > 1)
  59 + {
  60 + {if (true) return new MtasSpanSequenceQuery(itemList);}
  61 + }
  62 + else
  63 + {
  64 + {if (true) return itemList.get(0).getQuery();}
  65 + }
  66 + throw new Error("Missing return statement in function");
  67 + }
  68 +
  69 + final private SpanQuery cqlBlock(String field, String defaultPrefix) throws ParseException, ParseException {
  70 + MtasCQLParserSentenceCondition s1 = null, s2 = null;
  71 + SpanQuery q1 = null, q2 = null;
  72 + Token end = null;
  73 + String operator = null;
  74 + String OPERATOR_CONTAINING = "containing";
  75 + String OPERATOR_NOT_CONTAINING = "not_containing";
  76 + String OPERATOR_WITHIN = "within";
  77 + String OPERATOR_NOT_WITHIN = "not_within";
  78 + if (jj_2_2(1000)) {
  79 + s1 = sentence(field, defaultPrefix);
  80 + } else if (jj_2_3(1000)) {
  81 + jj_consume_token(BRACKET_START);
  82 + q1 = cqlBlock(field, defaultPrefix);
  83 + jj_consume_token(BRACKET_END);
  84 + } else {
  85 + jj_consume_token(-1);
  86 + throw new ParseException();
  87 + }
  88 + if (jj_2_10(1000)) {
  89 + if (jj_2_4(1000)) {
  90 + jj_consume_token(CONTAINING);
  91 + operator = OPERATOR_CONTAINING;
  92 + } else if (jj_2_5(1000)) {
  93 + jj_consume_token(NOT_CONTAINING);
  94 + operator = OPERATOR_NOT_CONTAINING;
  95 + } else if (jj_2_6(1000)) {
  96 + jj_consume_token(WITHIN);
  97 + operator = OPERATOR_WITHIN;
  98 + } else if (jj_2_7(1000)) {
  99 + jj_consume_token(NOT_WITHIN);
  100 + operator = OPERATOR_NOT_WITHIN;
  101 + } else {
  102 + jj_consume_token(-1);
  103 + throw new ParseException();
  104 + }
  105 + if (jj_2_8(1000)) {
  106 + s2 = sentence(field, defaultPrefix);
  107 + } else if (jj_2_9(1000)) {
  108 + jj_consume_token(BRACKET_START);
  109 + q2 = cqlBlock(field, defaultPrefix);
  110 + jj_consume_token(BRACKET_END);
  111 + } else {
  112 + jj_consume_token(-1);
  113 + throw new ParseException();
  114 + }
  115 + } else {
  116 + ;
  117 + }
  118 + if (s1 != null)
  119 + {
  120 + q1 = s1.getQuery();
  121 + }
  122 + if (operator != null)
  123 + {
  124 + if (s2 != null)
  125 + {
  126 + q2 = s2.getQuery();
  127 + }
  128 + if (operator.equals(OPERATOR_CONTAINING))
  129 + {
  130 + {if (true) return new SpanContainingQuery(q1, q2);}
  131 + }
  132 + else if (operator.equals(OPERATOR_NOT_CONTAINING))
  133 + {
  134 + {if (true) return new SpanNotQuery(q1, new SpanContainingQuery(q1, q2));}
  135 + }
  136 + else if (operator.equals(OPERATOR_WITHIN))
  137 + {
  138 + {if (true) return new SpanWithinQuery(q2, q1);}
  139 + }
  140 + else if (operator.equals(OPERATOR_NOT_WITHIN))
  141 + {
  142 + {if (true) return new SpanNotQuery(q1, new SpanWithinQuery(q2, q1));}
  143 + }
  144 + else
  145 + {
  146 + {if (true) throw new ParseException("unexpected operator " + operator);}
  147 + }
  148 + }
  149 + else
  150 + {
  151 + {if (true) return q1;}
  152 + }
  153 + throw new Error("Missing return statement in function");
  154 + }
  155 +
  156 + final private MtasCQLParserSentenceCondition sentence(String field, String defaultPrefix) throws ParseException, ParseException {
  157 + MtasCQLParserSentenceCondition sentenceCondition;
  158 + MtasCQLParserSentencePartCondition condition;
  159 + Token questionMark = null;
  160 + Token minValue = null;
  161 + Token maxValue = null;
  162 + int minimumOccurence = 1;
  163 + int maximumOccurence = 1;
  164 + condition = sentencePart(field, defaultPrefix);
  165 + sentenceCondition = condition.createFullSentence();
  166 + {if (true) return sentenceCondition;}
  167 + throw new Error("Missing return statement in function");
  168 + }
  169 +
  170 + final private MtasCQLParserSentencePartCondition sentencePart(String field, String defaultPrefix) throws ParseException, ParseException {
  171 + Token operator;
  172 + MtasCQLParserSentencePartCondition condition, sentencePart;
  173 + MtasCQLParserBasicSentenceCondition basicSentence;
  174 + Token questionMark = null;
  175 + Token minValue = null;
  176 + Token maxValue = null;
  177 + int minimumOccurence = 1;
  178 + int maximumOccurence = 1;
  179 + if (jj_2_15(1000)) {
  180 + basicSentence = basicSentence(field, defaultPrefix);
  181 + condition = new MtasCQLParserSentencePartCondition(basicSentence);
  182 + } else if (jj_2_16(1000)) {
  183 + jj_consume_token(BRACKET_START);
  184 + sentencePart = sentencePart(field, defaultPrefix);
  185 + jj_consume_token(BRACKET_END);
  186 + if (jj_2_14(1000)) {
  187 + questionMark = null;
  188 + if (jj_2_11(1000)) {
  189 + jj_consume_token(CURLY_BRACKET_START);
  190 + minValue = jj_consume_token(NUMBER);
  191 + jj_consume_token(KOMMA);
  192 + maxValue = jj_consume_token(NUMBER);
  193 + jj_consume_token(CURLY_BRACKET_END);
  194 + } else if (jj_2_12(1000)) {
  195 + jj_consume_token(CURLY_BRACKET_START);
  196 + minValue = jj_consume_token(NUMBER);
  197 + jj_consume_token(CURLY_BRACKET_END);
  198 + } else if (jj_2_13(1000)) {
  199 + questionMark = jj_consume_token(QUESTION_MARK);
  200 + } else {
  201 + jj_consume_token(-1);
  202 + throw new ParseException();
  203 + }
  204 + } else {
  205 + ;
  206 + }
  207 + condition = new MtasCQLParserSentencePartCondition(sentencePart.createFullSentence());
  208 + if (questionMark != null)
  209 + {
  210 + minimumOccurence = 0;
  211 + maximumOccurence = 1;
  212 + }
  213 + else if (minValue != null)
  214 + {
  215 + minimumOccurence = Integer.parseInt(minValue.image);
  216 + if (maxValue != null)
  217 + {
  218 + maximumOccurence = Integer.parseInt(maxValue.image);
  219 + }
  220 + else
  221 + {
  222 + maximumOccurence = minimumOccurence;
  223 + }
  224 + }
  225 + condition.setFirstOccurence(minimumOccurence, maximumOccurence);
  226 + } else {
  227 + jj_consume_token(-1);
  228 + throw new ParseException();
  229 + }
  230 + if (jj_2_18(1000)) {
  231 + operator = null;
  232 + if (jj_2_17(1000)) {
  233 + operator = jj_consume_token(OR);
  234 + } else {
  235 + ;
  236 + }
  237 + sentencePart = sentencePart(field, defaultPrefix);
  238 + if (operator == null)
  239 + {
  240 + condition.setOr(false);
  241 + }
  242 + else
  243 + {
  244 + condition.setOr(true);
  245 + }
  246 + condition.setSecondPart(sentencePart);
  247 + } else {
  248 + ;
  249 + }
  250 + {if (true) return condition;}
  251 + throw new Error("Missing return statement in function");
  252 + }
  253 +
  254 + final private MtasCQLParserBasicSentenceCondition basicSentence(String field, String defaultPrefix) throws ParseException, ParseException {
  255 + MtasCQLParserWordFullCondition subWordCondition;
  256 + MtasCQLParserGroupFullCondition subGroupCondition;
  257 + MtasCQLParserBasicSentenceCondition condition = new MtasCQLParserBasicSentenceCondition();
  258 + if (jj_2_19(1000)) {
  259 + subWordCondition = word(field, defaultPrefix);
  260 + condition.addWord(subWordCondition);
  261 + } else if (jj_2_20(1000)) {
  262 + subGroupCondition = group(field);
  263 + condition.addGroup(subGroupCondition);
  264 + } else {
  265 + jj_consume_token(-1);
  266 + throw new ParseException();
  267 + }
  268 + label_2:
  269 + while (true) {
  270 + if (jj_2_21(1000)) {
  271 + ;
  272 + } else {
  273 + break label_2;
  274 + }
  275 + if (jj_2_22(1000)) {
  276 + subWordCondition = word(field, defaultPrefix);
  277 + condition.addWord(subWordCondition);
  278 + } else if (jj_2_23(1000)) {
  279 + subGroupCondition = group(field);
  280 + condition.addGroup(subGroupCondition);
  281 + } else {
  282 + jj_consume_token(-1);
  283 + throw new ParseException();
  284 + }
  285 + }
  286 + {if (true) return condition;}
  287 + throw new Error("Missing return statement in function");
  288 + }
  289 +
  290 + final private MtasCQLParserGroupFullCondition group(String field) throws ParseException, ParseException {
  291 + Token questionMark = null;
  292 + MtasCQLParserGroupFullCondition groupCondition;
  293 + MtasCQLParserGroupCondition condition;
  294 + Boolean startGroup, endGroup;
  295 + Token minValue = null;
  296 + Token maxValue = null;
  297 + Token slash = null;
  298 + int minimumOccurence = 1;
  299 + int maximumOccurence = 1;
  300 + jj_consume_token(GROUP_START);
  301 + if (jj_2_25(1000)) {
  302 + condition = groupCondition(field);
  303 + if (jj_2_24(1000)) {
  304 + slash = jj_consume_token(SLASH);
  305 + } else {
  306 + ;
  307 + }
  308 + if (slash == null)
  309 + {
  310 + startGroup = true;
  311 + }
  312 + else
  313 + {
  314 + startGroup = false;
  315 + }
  316 + endGroup = false;
  317 + } else if (jj_2_26(1000)) {
  318 + jj_consume_token(SLASH);
  319 + condition = groupCondition(field);
  320 + startGroup = true;
  321 + endGroup = false;
  322 + } else {
  323 + jj_consume_token(-1);
  324 + throw new ParseException();
  325 + }
  326 + jj_consume_token(GROUP_END);
  327 + if (jj_2_30(1000)) {
  328 + questionMark = null;
  329 + if (jj_2_27(1000)) {
  330 + jj_consume_token(CURLY_BRACKET_START);
  331 + minValue = jj_consume_token(NUMBER);
  332 + jj_consume_token(KOMMA);
  333 + maxValue = jj_consume_token(NUMBER);
  334 + jj_consume_token(CURLY_BRACKET_END);
  335 + } else if (jj_2_28(1000)) {
  336 + jj_consume_token(CURLY_BRACKET_START);
  337 + minValue = jj_consume_token(NUMBER);
  338 + jj_consume_token(CURLY_BRACKET_END);
  339 + } else if (jj_2_29(1000)) {
  340 + questionMark = jj_consume_token(QUESTION_MARK);
  341 + } else {
  342 + jj_consume_token(-1);
  343 + throw new ParseException();
  344 + }
  345 + } else {
  346 + ;
  347 + }
  348 + if (startGroup)
  349 + {
  350 + groupCondition = new MtasCQLParserGroupFullCondition(condition, MtasCQLParserGroupFullCondition.GROUP_START);
  351 + }
  352 + else if (endGroup)
  353 + {
  354 + groupCondition = new MtasCQLParserGroupFullCondition(condition, MtasCQLParserGroupFullCondition.GROUP_END);
  355 + }
  356 + else
  357 + {
  358 + groupCondition = new MtasCQLParserGroupFullCondition(condition, MtasCQLParserGroupFullCondition.GROUP_FULL);
  359 + }
  360 + if (questionMark != null)
  361 + {
  362 + minimumOccurence = 0;
  363 + maximumOccurence = 1;
  364 + }
  365 + else if (minValue != null)
  366 + {
  367 + minimumOccurence = Integer.parseInt(minValue.image);
  368 + if (maxValue != null)
  369 + {
  370 + maximumOccurence = Integer.parseInt(maxValue.image);
  371 + }
  372 + else
  373 + {
  374 + maximumOccurence = minimumOccurence;
  375 + }
  376 + }
  377 + groupCondition.setOccurence(minimumOccurence, maximumOccurence);
  378 + {if (true) return groupCondition;}
  379 + throw new Error("Missing return statement in function");
  380 + }
  381 +
  382 + final private MtasCQLParserGroupCondition groupCondition(String field) throws ParseException, ParseException {
  383 + Token prefix;
  384 + Token value = null;
  385 + if (jj_2_31(1000)) {
  386 + prefix = jj_consume_token(UNQUOTED_VALUE);
  387 + jj_consume_token(TOKEN_EQUALS);
  388 + value = jj_consume_token(QUOTED_VALUE);
  389 + } else if (jj_2_32(1000)) {
  390 + prefix = jj_consume_token(UNQUOTED_VALUE);
  391 + value = null;
  392 + } else {
  393 + jj_consume_token(-1);
  394 + throw new ParseException();
  395 + }
  396 + if (value != null)
  397 + {
  398 + SpanQuery q = new MtasCQLParserGroupQuery(field, prefix.image, unquoteString(value.image));
  399 + MtasCQLParserGroupCondition condition = new MtasCQLParserGroupCondition(field, q);
  400 + {if (true) return condition;}
  401 + }
  402 + else
  403 + {
  404 + SpanQuery q = new MtasCQLParserGroupQuery(field, prefix.image, null);
  405 + MtasCQLParserGroupCondition condition = new MtasCQLParserGroupCondition(field, q);
  406 + {if (true) return condition;}
  407 + }
  408 + throw new Error("Missing return statement in function");
  409 + }
  410 +
  411 + final private MtasCQLParserWordFullCondition word(String field, String defaultPrefix) throws ParseException, ParseException {
  412 + Token questionMark = null;
  413 + Token value;
  414 + MtasCQLParserWordFullCondition wordCondition;
  415 + MtasCQLParserWordCondition condition, subCondition;
  416 + Token minValue = null;
  417 + Token maxValue = null;
  418 + int minimumOccurence = 1;
  419 + int maximumOccurence = 1;
  420 + if (jj_2_39(1000)) {
  421 + value = jj_consume_token(QUOTED_VALUE);
  422 + condition = new MtasCQLParserDefaultPrefixCondition(field, defaultPrefix, unquoteString(value.image));
  423 + } else if (jj_2_40(1000)) {
  424 + jj_consume_token(WORD_START);
  425 + if (jj_2_37(1000)) {
  426 + subCondition = wordCondition(field);
  427 + if (jj_2_35(1000)) {
  428 + jj_consume_token(AND);
  429 + condition = new MtasCQLParserWordCondition(field, MtasCQLParserWordCondition.TYPE_AND);
  430 + condition.addCondition(subCondition);
  431 + subCondition = wordCondition(field);
  432 + condition.addCondition(subCondition);
  433 + label_3:
  434 + while (true) {
  435 + if (jj_2_33(1000)) {
  436 + ;
  437 + } else {
  438 + break label_3;
  439 + }
  440 + jj_consume_token(AND);
  441 + subCondition = wordCondition(field);
  442 + condition.addCondition(subCondition);
  443 + }
  444 + } else if (jj_2_36(1000)) {
  445 + jj_consume_token(OR);
  446 + condition = new MtasCQLParserWordCondition(field, MtasCQLParserWordCondition.TYPE_OR);
  447 + condition.addCondition(subCondition);
  448 + subCondition = wordCondition(field);
  449 + condition.addCondition(subCondition);
  450 + label_4:
  451 + while (true) {
  452 + if (jj_2_34(1000)) {
  453 + ;
  454 + } else {
  455 + break label_4;
  456 + }
  457 + jj_consume_token(OR);
  458 + subCondition = wordCondition(field);
  459 + condition.addCondition(subCondition);
  460 + }
  461 + } else {
  462 + jj_consume_token(-1);
  463 + throw new ParseException();
  464 + }
  465 + } else if (jj_2_38(1000)) {
  466 + condition = wordCondition(field);
  467 + } else {
  468 + jj_consume_token(-1);
  469 + throw new ParseException();
  470 + }
  471 + jj_consume_token(WORD_END);
  472 + } else if (jj_2_41(1000)) {
  473 + condition = new MtasCQLParserWordCondition(field, MtasCQLParserWordCondition.TYPE_AND);
  474 + jj_consume_token(WORD_START);
  475 + jj_consume_token(WORD_END);
  476 + } else {
  477 + jj_consume_token(-1);
  478 + throw new ParseException();
  479 + }
  480 + if (jj_2_45(1000)) {
  481 + questionMark = null;
  482 + if (jj_2_42(1000)) {
  483 + jj_consume_token(CURLY_BRACKET_START);
  484 + minValue = jj_consume_token(NUMBER);
  485 + jj_consume_token(KOMMA);
  486 + maxValue = jj_consume_token(NUMBER);
  487 + jj_consume_token(CURLY_BRACKET_END);
  488 + } else if (jj_2_43(1000)) {
  489 + jj_consume_token(CURLY_BRACKET_START);
  490 + minValue = jj_consume_token(NUMBER);
  491 + jj_consume_token(CURLY_BRACKET_END);
  492 + } else if (jj_2_44(1000)) {
  493 + questionMark = jj_consume_token(QUESTION_MARK);
  494 + } else {
  495 + jj_consume_token(-1);
  496 + throw new ParseException();
  497 + }
  498 + } else {
  499 + ;
  500 + }
  501 + condition.simplify();
  502 + wordCondition = new MtasCQLParserWordFullCondition(condition);
  503 + if (questionMark != null)
  504 + {
  505 + minimumOccurence = 0;
  506 + maximumOccurence = 1;
  507 + }
  508 + else if (minValue != null)
  509 + {
  510 + minimumOccurence = Integer.parseInt(minValue.image);
  511 + if (maxValue != null)
  512 + {
  513 + maximumOccurence = Integer.parseInt(maxValue.image);
  514 + }
  515 + else
  516 + {
  517 + maximumOccurence = minimumOccurence;
  518 + }
  519 + }
  520 + wordCondition.setOccurence(minimumOccurence, maximumOccurence);
  521 + //System.out.println(wordCondition + "\n");
  522 + {if (true) return wordCondition;}
  523 + throw new Error("Missing return statement in function");
  524 + }
  525 +
  526 + final private MtasCQLParserWordCondition wordCondition(String field) throws ParseException, ParseException {
  527 + Token negation = null;
  528 + MtasCQLParserWordCondition condition, subCondition;
  529 + if (jj_2_66(1000)) {
  530 + if (jj_2_46(1000)) {
  531 + negation = jj_consume_token(NEGATION);
  532 + } else {
  533 + ;
  534 + }
  535 + jj_consume_token(BRACKET_START);
  536 + if (jj_2_63(1000)) {
  537 + condition = new MtasCQLParserWordCondition(field, MtasCQLParserWordCondition.TYPE_AND);
  538 + if (jj_2_47(1000)) {
  539 + subCondition = wordAtomCondition(field);
  540 + } else if (jj_2_48(1000)) {
  541 + subCondition = wordCondition(field);
  542 + } else {
  543 + jj_consume_token(-1);
  544 + throw new ParseException();
  545 + }
  546 + condition.addCondition(subCondition);
  547 + jj_consume_token(AND);
  548 + if (jj_2_49(1000)) {
  549 + subCondition = wordAtomCondition(field);
  550 + } else if (jj_2_50(1000)) {
  551 + subCondition = wordCondition(field);
  552 + } else {
  553 + jj_consume_token(-1);
  554 + throw new ParseException();
  555 + }
  556 + condition.addCondition(subCondition);
  557 + label_5:
  558 + while (true) {
  559 + if (jj_2_51(1000)) {
  560 + ;
  561 + } else {
  562 + break label_5;
  563 + }
  564 + jj_consume_token(AND);
  565 + if (jj_2_52(1000)) {
  566 + subCondition = wordAtomCondition(field);
  567 + } else if (jj_2_53(1000)) {
  568 + subCondition = wordCondition(field);
  569 + } else {
  570 + jj_consume_token(-1);
  571 + throw new ParseException();
  572 + }
  573 + condition.addCondition(subCondition);
  574 + }
  575 + } else if (jj_2_64(1000)) {
  576 + condition = new MtasCQLParserWordCondition(field, MtasCQLParserWordCondition.TYPE_OR);
  577 + if (jj_2_54(1000)) {
  578 + subCondition = wordAtomCondition(field);
  579 + } else if (jj_2_55(1000)) {
  580 + subCondition = wordCondition(field);
  581 + } else {
  582 + jj_consume_token(-1);
  583 + throw new ParseException();
  584 + }
  585 + condition.addCondition(subCondition);
  586 + jj_consume_token(OR);
  587 + if (jj_2_56(1000)) {
  588 + subCondition = wordAtomCondition(field);
  589 + } else if (jj_2_57(1000)) {
  590 + subCondition = wordCondition(field);
  591 + } else {
  592 + jj_consume_token(-1);
  593 + throw new ParseException();
  594 + }
  595 + condition.addCondition(subCondition);
  596 + label_6:
  597 + while (true) {
  598 + if (jj_2_58(1000)) {
  599 + ;
  600 + } else {
  601 + break label_6;
  602 + }
  603 + jj_consume_token(OR);
  604 + if (jj_2_59(1000)) {
  605 + subCondition = wordAtomCondition(field);
  606 + } else if (jj_2_60(1000)) {
  607 + subCondition = wordCondition(field);
  608 + } else {
  609 + jj_consume_token(-1);
  610 + throw new ParseException();
  611 + }
  612 + condition.addCondition(subCondition);
  613 + }
  614 + } else if (jj_2_65(1000)) {
  615 + if (jj_2_61(1000)) {
  616 + condition = wordAtomCondition(field);
  617 + } else if (jj_2_62(1000)) {
  618 + condition = wordCondition(field);
  619 + } else {
  620 + jj_consume_token(-1);
  621 + throw new ParseException();
  622 + }
  623 + } else {
  624 + jj_consume_token(-1);
  625 + throw new ParseException();
  626 + }
  627 + jj_consume_token(BRACKET_END);
  628 + if (negation != null)
  629 + {
  630 + condition.swapNot();
  631 + }
  632 + //System.out.println("=== wordCondition ===\n" + condition + "\n");
  633 + {if (true) return condition;}
  634 + } else if (jj_2_67(1000)) {
  635 + //plain atom is a valid condition
  636 + subCondition = wordAtomCondition(field);
  637 + //System.out.println("=== wordCondition ===\n" + subCondition + "\n");
  638 + {if (true) return subCondition;}
  639 + } else {
  640 + jj_consume_token(-1);
  641 + throw new ParseException();
  642 + }
  643 + //System.out.println("=== wordCondition ===\n" + condition + "\n");
  644 + {if (true) return null;}
  645 + throw new Error("Missing return statement in function");
  646 + }
  647 +
  648 + final private MtasCQLParserWordCondition wordAtomCondition(String field) throws ParseException, ParseException {
  649 + Token negation = null;
  650 + Token nequals = null;
  651 + Token prefix;
  652 + Token value;
  653 + if (jj_2_68(1000)) {
  654 + negation = jj_consume_token(NEGATION);
  655 + } else {
  656 + ;
  657 + }
  658 + if (jj_2_73(1000)) {
  659 + jj_consume_token(OCTOTHORPE);
  660 + if (jj_2_69(1000)) {
  661 + value = jj_consume_token(NUMBER);
  662 + } else if (jj_2_70(1000)) {
  663 + value = jj_consume_token(UNQUOTED_VALUE);
  664 + } else {
  665 + jj_consume_token(-1);
  666 + throw new ParseException();
  667 + }
  668 + Integer startPosition = null;
  669 + Integer endPosition = null;
  670 + Pattern range = Pattern.compile("([0-9]+)(\u005c\u005c-([0-9]+))?");
  671 + Matcher m = range.matcher(value.image);
  672 + if (m.find())
  673 + {
  674 + startPosition = m.group(1) != null ? Integer.parseInt(m.group(1)) : null;
  675 + endPosition = m.group(3) != null ? Integer.parseInt(m.group(3)) : null;
  676 + }
  677 + else
  678 + {
  679 + {if (true) throw new ParseException("invalid range '" + value.image + "'");}
  680 + }
  681 + MtasCQLParserWordCondition condition = new MtasCQLParserWordCondition(field, MtasCQLParserWordCondition.TYPE_AND);
  682 + if (startPosition != null && endPosition != null)
  683 + {
  684 + SpanQuery q = new MtasCQLParserWordPositionQuery(field, startPosition, endPosition);
  685 + condition.addPositiveQuery(q);
  686 + }
  687 + else if (startPosition != null)
  688 + {
  689 + SpanQuery q = new MtasCQLParserWordPositionQuery(field, startPosition, startPosition);
  690 + condition.addPositiveQuery(q);
  691 + }
  692 + else
  693 + {
  694 + //should not happen
  695 + {if (true) throw new ParseException("invalid range");}
  696 + }
  697 + {if (true) return condition;}
  698 + } else if (jj_2_74(1000)) {
  699 + prefix = jj_consume_token(UNQUOTED_VALUE);
  700 + if (jj_2_71(1000)) {
  701 + nequals = jj_consume_token(TOKEN_NOTEQUALS);
  702 + } else if (jj_2_72(1000)) {
  703 + jj_consume_token(TOKEN_EQUALS);
  704 + } else {
  705 + jj_consume_token(-1);
  706 + throw new ParseException();
  707 + }
  708 + value = jj_consume_token(QUOTED_VALUE);
  709 + if (nequals != null)
  710 + {
  711 + //use RegexpQuery combined with SpanMultiTermQueryWrapper
  712 + {if (true) throw new ParseException("TODO: not implemented '" + prefix.image + nequals.image + value.image + "'");}
  713 + }
  714 + else
  715 + {
  716 + MtasCQLParserWordCondition condition = new MtasCQLParserWordCondition(field, MtasCQLParserWordCondition.TYPE_AND);
  717 + Term term = new Term(field, prefix.image + MtasToken.DELIMITER + unquoteString(value.image));
  718 + SpanQuery q = new MtasCQLParserWordQuery(field, prefix.image, unquoteString(value.image), MtasCQLParserWordQuery.MTAS_CQL_REGEXP_QUERY);
  719 + if (negation != null)
  720 + {
  721 + condition.swapNot();
  722 + }
  723 + condition.addPositiveQuery(q);
  724 + //System.out.println("=== wordAtomCondition ===\n" + condition + "\n");
  725 + {if (true) return condition;}
  726 + }
  727 + } else {
  728 + jj_consume_token(-1);
  729 + throw new ParseException();
  730 + }
  731 + throw new Error("Missing return statement in function");
  732 + }
  733 +
  734 + private boolean jj_2_1(int xla) {
  735 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  736 + try { return !jj_3_1(); }
  737 + catch(LookaheadSuccess ls) { return true; }
  738 + finally { jj_save(0, xla); }
  739 + }
  740 +
  741 + private boolean jj_2_2(int xla) {
  742 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  743 + try { return !jj_3_2(); }
  744 + catch(LookaheadSuccess ls) { return true; }
  745 + finally { jj_save(1, xla); }
  746 + }
  747 +
  748 + private boolean jj_2_3(int xla) {
  749 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  750 + try { return !jj_3_3(); }
  751 + catch(LookaheadSuccess ls) { return true; }
  752 + finally { jj_save(2, xla); }
  753 + }
  754 +
  755 + private boolean jj_2_4(int xla) {
  756 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  757 + try { return !jj_3_4(); }
  758 + catch(LookaheadSuccess ls) { return true; }
  759 + finally { jj_save(3, xla); }
  760 + }
  761 +
  762 + private boolean jj_2_5(int xla) {
  763 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  764 + try { return !jj_3_5(); }
  765 + catch(LookaheadSuccess ls) { return true; }
  766 + finally { jj_save(4, xla); }
  767 + }
  768 +
  769 + private boolean jj_2_6(int xla) {
  770 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  771 + try { return !jj_3_6(); }
  772 + catch(LookaheadSuccess ls) { return true; }
  773 + finally { jj_save(5, xla); }
  774 + }
  775 +
  776 + private boolean jj_2_7(int xla) {
  777 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  778 + try { return !jj_3_7(); }
  779 + catch(LookaheadSuccess ls) { return true; }
  780 + finally { jj_save(6, xla); }
  781 + }
  782 +
  783 + private boolean jj_2_8(int xla) {
  784 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  785 + try { return !jj_3_8(); }
  786 + catch(LookaheadSuccess ls) { return true; }
  787 + finally { jj_save(7, xla); }
  788 + }
  789 +
  790 + private boolean jj_2_9(int xla) {
  791 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  792 + try { return !jj_3_9(); }
  793 + catch(LookaheadSuccess ls) { return true; }
  794 + finally { jj_save(8, xla); }
  795 + }
  796 +
  797 + private boolean jj_2_10(int xla) {
  798 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  799 + try { return !jj_3_10(); }
  800 + catch(LookaheadSuccess ls) { return true; }
  801 + finally { jj_save(9, xla); }
  802 + }
  803 +
  804 + private boolean jj_2_11(int xla) {
  805 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  806 + try { return !jj_3_11(); }
  807 + catch(LookaheadSuccess ls) { return true; }
  808 + finally { jj_save(10, xla); }
  809 + }
  810 +
  811 + private boolean jj_2_12(int xla) {
  812 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  813 + try { return !jj_3_12(); }
  814 + catch(LookaheadSuccess ls) { return true; }
  815 + finally { jj_save(11, xla); }
  816 + }
  817 +
  818 + private boolean jj_2_13(int xla) {
  819 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  820 + try { return !jj_3_13(); }
  821 + catch(LookaheadSuccess ls) { return true; }
  822 + finally { jj_save(12, xla); }
  823 + }
  824 +
  825 + private boolean jj_2_14(int xla) {
  826 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  827 + try { return !jj_3_14(); }
  828 + catch(LookaheadSuccess ls) { return true; }
  829 + finally { jj_save(13, xla); }
  830 + }
  831 +
  832 + private boolean jj_2_15(int xla) {
  833 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  834 + try { return !jj_3_15(); }
  835 + catch(LookaheadSuccess ls) { return true; }
  836 + finally { jj_save(14, xla); }
  837 + }
  838 +
  839 + private boolean jj_2_16(int xla) {
  840 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  841 + try { return !jj_3_16(); }
  842 + catch(LookaheadSuccess ls) { return true; }
  843 + finally { jj_save(15, xla); }
  844 + }
  845 +
  846 + private boolean jj_2_17(int xla) {
  847 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  848 + try { return !jj_3_17(); }
  849 + catch(LookaheadSuccess ls) { return true; }
  850 + finally { jj_save(16, xla); }
  851 + }
  852 +
  853 + private boolean jj_2_18(int xla) {
  854 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  855 + try { return !jj_3_18(); }
  856 + catch(LookaheadSuccess ls) { return true; }
  857 + finally { jj_save(17, xla); }
  858 + }
  859 +
  860 + private boolean jj_2_19(int xla) {
  861 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  862 + try { return !jj_3_19(); }
  863 + catch(LookaheadSuccess ls) { return true; }
  864 + finally { jj_save(18, xla); }
  865 + }
  866 +
  867 + private boolean jj_2_20(int xla) {
  868 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  869 + try { return !jj_3_20(); }
  870 + catch(LookaheadSuccess ls) { return true; }
  871 + finally { jj_save(19, xla); }
  872 + }
  873 +
  874 + private boolean jj_2_21(int xla) {
  875 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  876 + try { return !jj_3_21(); }
  877 + catch(LookaheadSuccess ls) { return true; }
  878 + finally { jj_save(20, xla); }
  879 + }
  880 +
  881 + private boolean jj_2_22(int xla) {
  882 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  883 + try { return !jj_3_22(); }
  884 + catch(LookaheadSuccess ls) { return true; }
  885 + finally { jj_save(21, xla); }
  886 + }
  887 +
  888 + private boolean jj_2_23(int xla) {
  889 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  890 + try { return !jj_3_23(); }
  891 + catch(LookaheadSuccess ls) { return true; }
  892 + finally { jj_save(22, xla); }
  893 + }
  894 +
  895 + private boolean jj_2_24(int xla) {
  896 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  897 + try { return !jj_3_24(); }
  898 + catch(LookaheadSuccess ls) { return true; }
  899 + finally { jj_save(23, xla); }
  900 + }
  901 +
  902 + private boolean jj_2_25(int xla) {
  903 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  904 + try { return !jj_3_25(); }
  905 + catch(LookaheadSuccess ls) { return true; }
  906 + finally { jj_save(24, xla); }
  907 + }
  908 +
  909 + private boolean jj_2_26(int xla) {
  910 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  911 + try { return !jj_3_26(); }
  912 + catch(LookaheadSuccess ls) { return true; }
  913 + finally { jj_save(25, xla); }
  914 + }
  915 +
  916 + private boolean jj_2_27(int xla) {
  917 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  918 + try { return !jj_3_27(); }
  919 + catch(LookaheadSuccess ls) { return true; }
  920 + finally { jj_save(26, xla); }
  921 + }
  922 +
  923 + private boolean jj_2_28(int xla) {
  924 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  925 + try { return !jj_3_28(); }
  926 + catch(LookaheadSuccess ls) { return true; }
  927 + finally { jj_save(27, xla); }
  928 + }
  929 +
  930 + private boolean jj_2_29(int xla) {
  931 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  932 + try { return !jj_3_29(); }
  933 + catch(LookaheadSuccess ls) { return true; }
  934 + finally { jj_save(28, xla); }
  935 + }
  936 +
  937 + private boolean jj_2_30(int xla) {
  938 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  939 + try { return !jj_3_30(); }
  940 + catch(LookaheadSuccess ls) { return true; }
  941 + finally { jj_save(29, xla); }
  942 + }
  943 +
  944 + private boolean jj_2_31(int xla) {
  945 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  946 + try { return !jj_3_31(); }
  947 + catch(LookaheadSuccess ls) { return true; }
  948 + finally { jj_save(30, xla); }
  949 + }
  950 +
  951 + private boolean jj_2_32(int xla) {
  952 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  953 + try { return !jj_3_32(); }
  954 + catch(LookaheadSuccess ls) { return true; }
  955 + finally { jj_save(31, xla); }
  956 + }
  957 +
  958 + private boolean jj_2_33(int xla) {
  959 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  960 + try { return !jj_3_33(); }
  961 + catch(LookaheadSuccess ls) { return true; }
  962 + finally { jj_save(32, xla); }
  963 + }
  964 +
  965 + private boolean jj_2_34(int xla) {
  966 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  967 + try { return !jj_3_34(); }
  968 + catch(LookaheadSuccess ls) { return true; }
  969 + finally { jj_save(33, xla); }
  970 + }
  971 +
  972 + private boolean jj_2_35(int xla) {
  973 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  974 + try { return !jj_3_35(); }
  975 + catch(LookaheadSuccess ls) { return true; }
  976 + finally { jj_save(34, xla); }
  977 + }
  978 +
  979 + private boolean jj_2_36(int xla) {
  980 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  981 + try { return !jj_3_36(); }
  982 + catch(LookaheadSuccess ls) { return true; }
  983 + finally { jj_save(35, xla); }
  984 + }
  985 +
  986 + private boolean jj_2_37(int xla) {
  987 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  988 + try { return !jj_3_37(); }
  989 + catch(LookaheadSuccess ls) { return true; }
  990 + finally { jj_save(36, xla); }
  991 + }
  992 +
  993 + private boolean jj_2_38(int xla) {
  994 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  995 + try { return !jj_3_38(); }
  996 + catch(LookaheadSuccess ls) { return true; }
  997 + finally { jj_save(37, xla); }
  998 + }
  999 +
  1000 + private boolean jj_2_39(int xla) {
  1001 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1002 + try { return !jj_3_39(); }
  1003 + catch(LookaheadSuccess ls) { return true; }
  1004 + finally { jj_save(38, xla); }
  1005 + }
  1006 +
  1007 + private boolean jj_2_40(int xla) {
  1008 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1009 + try { return !jj_3_40(); }
  1010 + catch(LookaheadSuccess ls) { return true; }
  1011 + finally { jj_save(39, xla); }
  1012 + }
  1013 +
  1014 + private boolean jj_2_41(int xla) {
  1015 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1016 + try { return !jj_3_41(); }
  1017 + catch(LookaheadSuccess ls) { return true; }
  1018 + finally { jj_save(40, xla); }
  1019 + }
  1020 +
  1021 + private boolean jj_2_42(int xla) {
  1022 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1023 + try { return !jj_3_42(); }
  1024 + catch(LookaheadSuccess ls) { return true; }
  1025 + finally { jj_save(41, xla); }
  1026 + }
  1027 +
  1028 + private boolean jj_2_43(int xla) {
  1029 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1030 + try { return !jj_3_43(); }
  1031 + catch(LookaheadSuccess ls) { return true; }
  1032 + finally { jj_save(42, xla); }
  1033 + }
  1034 +
  1035 + private boolean jj_2_44(int xla) {
  1036 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1037 + try { return !jj_3_44(); }
  1038 + catch(LookaheadSuccess ls) { return true; }
  1039 + finally { jj_save(43, xla); }
  1040 + }
  1041 +
  1042 + private boolean jj_2_45(int xla) {
  1043 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1044 + try { return !jj_3_45(); }
  1045 + catch(LookaheadSuccess ls) { return true; }
  1046 + finally { jj_save(44, xla); }
  1047 + }
  1048 +
  1049 + private boolean jj_2_46(int xla) {
  1050 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1051 + try { return !jj_3_46(); }
  1052 + catch(LookaheadSuccess ls) { return true; }
  1053 + finally { jj_save(45, xla); }
  1054 + }
  1055 +
  1056 + private boolean jj_2_47(int xla) {
  1057 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1058 + try { return !jj_3_47(); }
  1059 + catch(LookaheadSuccess ls) { return true; }
  1060 + finally { jj_save(46, xla); }
  1061 + }
  1062 +
  1063 + private boolean jj_2_48(int xla) {
  1064 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1065 + try { return !jj_3_48(); }
  1066 + catch(LookaheadSuccess ls) { return true; }
  1067 + finally { jj_save(47, xla); }
  1068 + }
  1069 +
  1070 + private boolean jj_2_49(int xla) {
  1071 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1072 + try { return !jj_3_49(); }
  1073 + catch(LookaheadSuccess ls) { return true; }
  1074 + finally { jj_save(48, xla); }
  1075 + }
  1076 +
  1077 + private boolean jj_2_50(int xla) {
  1078 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1079 + try { return !jj_3_50(); }
  1080 + catch(LookaheadSuccess ls) { return true; }
  1081 + finally { jj_save(49, xla); }
  1082 + }
  1083 +
  1084 + private boolean jj_2_51(int xla) {
  1085 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1086 + try { return !jj_3_51(); }
  1087 + catch(LookaheadSuccess ls) { return true; }
  1088 + finally { jj_save(50, xla); }
  1089 + }
  1090 +
  1091 + private boolean jj_2_52(int xla) {
  1092 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1093 + try { return !jj_3_52(); }
  1094 + catch(LookaheadSuccess ls) { return true; }
  1095 + finally { jj_save(51, xla); }
  1096 + }
  1097 +
  1098 + private boolean jj_2_53(int xla) {
  1099 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1100 + try { return !jj_3_53(); }
  1101 + catch(LookaheadSuccess ls) { return true; }
  1102 + finally { jj_save(52, xla); }
  1103 + }
  1104 +
  1105 + private boolean jj_2_54(int xla) {
  1106 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1107 + try { return !jj_3_54(); }
  1108 + catch(LookaheadSuccess ls) { return true; }
  1109 + finally { jj_save(53, xla); }
  1110 + }
  1111 +
  1112 + private boolean jj_2_55(int xla) {
  1113 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1114 + try { return !jj_3_55(); }
  1115 + catch(LookaheadSuccess ls) { return true; }
  1116 + finally { jj_save(54, xla); }
  1117 + }
  1118 +
  1119 + private boolean jj_2_56(int xla) {
  1120 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1121 + try { return !jj_3_56(); }
  1122 + catch(LookaheadSuccess ls) { return true; }
  1123 + finally { jj_save(55, xla); }
  1124 + }
  1125 +
  1126 + private boolean jj_2_57(int xla) {
  1127 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1128 + try { return !jj_3_57(); }
  1129 + catch(LookaheadSuccess ls) { return true; }
  1130 + finally { jj_save(56, xla); }
  1131 + }
  1132 +
  1133 + private boolean jj_2_58(int xla) {
  1134 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1135 + try { return !jj_3_58(); }
  1136 + catch(LookaheadSuccess ls) { return true; }
  1137 + finally { jj_save(57, xla); }
  1138 + }
  1139 +
  1140 + private boolean jj_2_59(int xla) {
  1141 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1142 + try { return !jj_3_59(); }
  1143 + catch(LookaheadSuccess ls) { return true; }
  1144 + finally { jj_save(58, xla); }
  1145 + }
  1146 +
  1147 + private boolean jj_2_60(int xla) {
  1148 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1149 + try { return !jj_3_60(); }
  1150 + catch(LookaheadSuccess ls) { return true; }
  1151 + finally { jj_save(59, xla); }
  1152 + }
  1153 +
  1154 + private boolean jj_2_61(int xla) {
  1155 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1156 + try { return !jj_3_61(); }
  1157 + catch(LookaheadSuccess ls) { return true; }
  1158 + finally { jj_save(60, xla); }
  1159 + }
  1160 +
  1161 + private boolean jj_2_62(int xla) {
  1162 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1163 + try { return !jj_3_62(); }
  1164 + catch(LookaheadSuccess ls) { return true; }
  1165 + finally { jj_save(61, xla); }
  1166 + }
  1167 +
  1168 + private boolean jj_2_63(int xla) {
  1169 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1170 + try { return !jj_3_63(); }
  1171 + catch(LookaheadSuccess ls) { return true; }
  1172 + finally { jj_save(62, xla); }
  1173 + }
  1174 +
  1175 + private boolean jj_2_64(int xla) {
  1176 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1177 + try { return !jj_3_64(); }
  1178 + catch(LookaheadSuccess ls) { return true; }
  1179 + finally { jj_save(63, xla); }
  1180 + }
  1181 +
  1182 + private boolean jj_2_65(int xla) {
  1183 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1184 + try { return !jj_3_65(); }
  1185 + catch(LookaheadSuccess ls) { return true; }
  1186 + finally { jj_save(64, xla); }
  1187 + }
  1188 +
  1189 + private boolean jj_2_66(int xla) {
  1190 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1191 + try { return !jj_3_66(); }
  1192 + catch(LookaheadSuccess ls) { return true; }
  1193 + finally { jj_save(65, xla); }
  1194 + }
  1195 +
  1196 + private boolean jj_2_67(int xla) {
  1197 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1198 + try { return !jj_3_67(); }
  1199 + catch(LookaheadSuccess ls) { return true; }
  1200 + finally { jj_save(66, xla); }
  1201 + }
  1202 +
  1203 + private boolean jj_2_68(int xla) {
  1204 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1205 + try { return !jj_3_68(); }
  1206 + catch(LookaheadSuccess ls) { return true; }
  1207 + finally { jj_save(67, xla); }
  1208 + }
  1209 +
  1210 + private boolean jj_2_69(int xla) {
  1211 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1212 + try { return !jj_3_69(); }
  1213 + catch(LookaheadSuccess ls) { return true; }
  1214 + finally { jj_save(68, xla); }
  1215 + }
  1216 +
  1217 + private boolean jj_2_70(int xla) {
  1218 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1219 + try { return !jj_3_70(); }
  1220 + catch(LookaheadSuccess ls) { return true; }
  1221 + finally { jj_save(69, xla); }
  1222 + }
  1223 +
  1224 + private boolean jj_2_71(int xla) {
  1225 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1226 + try { return !jj_3_71(); }
  1227 + catch(LookaheadSuccess ls) { return true; }
  1228 + finally { jj_save(70, xla); }
  1229 + }
  1230 +
  1231 + private boolean jj_2_72(int xla) {
  1232 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1233 + try { return !jj_3_72(); }
  1234 + catch(LookaheadSuccess ls) { return true; }
  1235 + finally { jj_save(71, xla); }
  1236 + }
  1237 +
  1238 + private boolean jj_2_73(int xla) {
  1239 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1240 + try { return !jj_3_73(); }
  1241 + catch(LookaheadSuccess ls) { return true; }
  1242 + finally { jj_save(72, xla); }
  1243 + }
  1244 +
  1245 + private boolean jj_2_74(int xla) {
  1246 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  1247 + try { return !jj_3_74(); }
  1248 + catch(LookaheadSuccess ls) { return true; }
  1249 + finally { jj_save(73, xla); }
  1250 + }
  1251 +
  1252 + private boolean jj_3R_11() {
  1253 + Token xsp;
  1254 + xsp = jj_scanpos;
  1255 + if (jj_3_39()) {
  1256 + jj_scanpos = xsp;
  1257 + if (jj_3_40()) {
  1258 + jj_scanpos = xsp;
  1259 + if (jj_3_41()) return true;
  1260 + }
  1261 + }
  1262 + xsp = jj_scanpos;
  1263 + if (jj_3_45()) jj_scanpos = xsp;
  1264 + return false;
  1265 + }
  1266 +
  1267 + private boolean jj_3_68() {
  1268 + if (jj_scan_token(NEGATION)) return true;
  1269 + return false;
  1270 + }
  1271 +
  1272 + private boolean jj_3R_15() {
  1273 + Token xsp;
  1274 + xsp = jj_scanpos;
  1275 + if (jj_3_68()) jj_scanpos = xsp;
  1276 + xsp = jj_scanpos;
  1277 + if (jj_3_73()) {
  1278 + jj_scanpos = xsp;
  1279 + if (jj_3_74()) return true;
  1280 + }
  1281 + return false;
  1282 + }
  1283 +
  1284 + private boolean jj_3_13() {
  1285 + if (jj_scan_token(QUESTION_MARK)) return true;
  1286 + return false;
  1287 + }
  1288 +
  1289 + private boolean jj_3_12() {
  1290 + if (jj_scan_token(CURLY_BRACKET_START)) return true;
  1291 + if (jj_scan_token(NUMBER)) return true;
  1292 + if (jj_scan_token(CURLY_BRACKET_END)) return true;
  1293 + return false;
  1294 + }
  1295 +
  1296 + private boolean jj_3_11() {
  1297 + if (jj_scan_token(CURLY_BRACKET_START)) return true;
  1298 + if (jj_scan_token(NUMBER)) return true;
  1299 + if (jj_scan_token(KOMMA)) return true;
  1300 + if (jj_scan_token(NUMBER)) return true;
  1301 + if (jj_scan_token(CURLY_BRACKET_END)) return true;
  1302 + return false;
  1303 + }
  1304 +
  1305 + private boolean jj_3_14() {
  1306 + Token xsp;
  1307 + xsp = jj_scanpos;
  1308 + if (jj_3_11()) {
  1309 + jj_scanpos = xsp;
  1310 + if (jj_3_12()) {
  1311 + jj_scanpos = xsp;
  1312 + if (jj_3_13()) return true;
  1313 + }
  1314 + }
  1315 + return false;
  1316 + }
  1317 +
  1318 + private boolean jj_3_67() {
  1319 + if (jj_3R_15()) return true;
  1320 + return false;
  1321 + }
  1322 +
  1323 + private boolean jj_3_16() {
  1324 + if (jj_scan_token(BRACKET_START)) return true;
  1325 + if (jj_3R_10()) return true;
  1326 + if (jj_scan_token(BRACKET_END)) return true;
  1327 + Token xsp;
  1328 + xsp = jj_scanpos;
  1329 + if (jj_3_14()) jj_scanpos = xsp;
  1330 + return false;
  1331 + }
  1332 +
  1333 + private boolean jj_3_15() {
  1334 + if (jj_3R_9()) return true;
  1335 + return false;
  1336 + }
  1337 +
  1338 + private boolean jj_3R_10() {
  1339 + Token xsp;
  1340 + xsp = jj_scanpos;
  1341 + if (jj_3_15()) {
  1342 + jj_scanpos = xsp;
  1343 + if (jj_3_16()) return true;
  1344 + }
  1345 + xsp = jj_scanpos;
  1346 + if (jj_3_18()) jj_scanpos = xsp;
  1347 + return false;
  1348 + }
  1349 +
  1350 + private boolean jj_3_62() {
  1351 + if (jj_3R_14()) return true;
  1352 + return false;
  1353 + }
  1354 +
  1355 + private boolean jj_3_61() {
  1356 + if (jj_3R_15()) return true;
  1357 + return false;
  1358 + }
  1359 +
  1360 + private boolean jj_3_32() {
  1361 + if (jj_scan_token(UNQUOTED_VALUE)) return true;
  1362 + return false;
  1363 + }
  1364 +
  1365 + private boolean jj_3_31() {
  1366 + if (jj_scan_token(UNQUOTED_VALUE)) return true;
  1367 + if (jj_scan_token(TOKEN_EQUALS)) return true;
  1368 + if (jj_scan_token(QUOTED_VALUE)) return true;
  1369 + return false;
  1370 + }
  1371 +
  1372 + private boolean jj_3_65() {
  1373 + Token xsp;
  1374 + xsp = jj_scanpos;
  1375 + if (jj_3_61()) {
  1376 + jj_scanpos = xsp;
  1377 + if (jj_3_62()) return true;
  1378 + }
  1379 + return false;
  1380 + }
  1381 +
  1382 + private boolean jj_3R_13() {
  1383 + Token xsp;
  1384 + xsp = jj_scanpos;
  1385 + if (jj_3_31()) {
  1386 + jj_scanpos = xsp;
  1387 + if (jj_3_32()) return true;
  1388 + }
  1389 + return false;
  1390 + }
  1391 +
  1392 + private boolean jj_3_60() {
  1393 + if (jj_3R_14()) return true;
  1394 + return false;
  1395 + }
  1396 +
  1397 + private boolean jj_3_59() {
  1398 + if (jj_3R_15()) return true;
  1399 + return false;
  1400 + }
  1401 +
  1402 + private boolean jj_3_58() {
  1403 + if (jj_scan_token(OR)) return true;
  1404 + Token xsp;
  1405 + xsp = jj_scanpos;
  1406 + if (jj_3_59()) {
  1407 + jj_scanpos = xsp;
  1408 + if (jj_3_60()) return true;
  1409 + }
  1410 + return false;
  1411 + }
  1412 +
  1413 + private boolean jj_3_57() {
  1414 + if (jj_3R_14()) return true;
  1415 + return false;
  1416 + }
  1417 +
  1418 + private boolean jj_3R_8() {
  1419 + if (jj_3R_10()) return true;
  1420 + return false;
  1421 + }
  1422 +
  1423 + private boolean jj_3_56() {
  1424 + if (jj_3R_15()) return true;
  1425 + return false;
  1426 + }
  1427 +
  1428 + private boolean jj_3_55() {
  1429 + if (jj_3R_14()) return true;
  1430 + return false;
  1431 + }
  1432 +
  1433 + private boolean jj_3_54() {
  1434 + if (jj_3R_15()) return true;
  1435 + return false;
  1436 + }
  1437 +
  1438 + private boolean jj_3_64() {
  1439 + Token xsp;
  1440 + xsp = jj_scanpos;
  1441 + if (jj_3_54()) {
  1442 + jj_scanpos = xsp;
  1443 + if (jj_3_55()) return true;
  1444 + }
  1445 + if (jj_scan_token(OR)) return true;
  1446 + xsp = jj_scanpos;
  1447 + if (jj_3_56()) {
  1448 + jj_scanpos = xsp;
  1449 + if (jj_3_57()) return true;
  1450 + }
  1451 + while (true) {
  1452 + xsp = jj_scanpos;
  1453 + if (jj_3_58()) { jj_scanpos = xsp; break; }
  1454 + }
  1455 + return false;
  1456 + }
  1457 +
  1458 + private boolean jj_3_53() {
  1459 + if (jj_3R_14()) return true;
  1460 + return false;
  1461 + }
  1462 +
  1463 + private boolean jj_3_52() {
  1464 + if (jj_3R_15()) return true;
  1465 + return false;
  1466 + }
  1467 +
  1468 + private boolean jj_3_24() {
  1469 + if (jj_scan_token(SLASH)) return true;
  1470 + return false;
  1471 + }
  1472 +
  1473 + private boolean jj_3_51() {
  1474 + if (jj_scan_token(AND)) return true;
  1475 + Token xsp;
  1476 + xsp = jj_scanpos;
  1477 + if (jj_3_52()) {
  1478 + jj_scanpos = xsp;
  1479 + if (jj_3_53()) return true;
  1480 + }
  1481 + return false;
  1482 + }
  1483 +
  1484 + private boolean jj_3_29() {
  1485 + if (jj_scan_token(QUESTION_MARK)) return true;
  1486 + return false;
  1487 + }
  1488 +
  1489 + private boolean jj_3_28() {
  1490 + if (jj_scan_token(CURLY_BRACKET_START)) return true;
  1491 + if (jj_scan_token(NUMBER)) return true;
  1492 + if (jj_scan_token(CURLY_BRACKET_END)) return true;
  1493 + return false;
  1494 + }
  1495 +
  1496 + private boolean jj_3_50() {
  1497 + if (jj_3R_14()) return true;
  1498 + return false;
  1499 + }
  1500 +
  1501 + private boolean jj_3_27() {
  1502 + if (jj_scan_token(CURLY_BRACKET_START)) return true;
  1503 + if (jj_scan_token(NUMBER)) return true;
  1504 + if (jj_scan_token(KOMMA)) return true;
  1505 + if (jj_scan_token(NUMBER)) return true;
  1506 + if (jj_scan_token(CURLY_BRACKET_END)) return true;
  1507 + return false;
  1508 + }
  1509 +
  1510 + private boolean jj_3_49() {
  1511 + if (jj_3R_15()) return true;
  1512 + return false;
  1513 + }
  1514 +
  1515 + private boolean jj_3_30() {
  1516 + Token xsp;
  1517 + xsp = jj_scanpos;
  1518 + if (jj_3_27()) {
  1519 + jj_scanpos = xsp;
  1520 + if (jj_3_28()) {
  1521 + jj_scanpos = xsp;
  1522 + if (jj_3_29()) return true;
  1523 + }
  1524 + }
  1525 + return false;
  1526 + }
  1527 +
  1528 + private boolean jj_3_48() {
  1529 + if (jj_3R_14()) return true;
  1530 + return false;
  1531 + }
  1532 +
  1533 + private boolean jj_3_47() {
  1534 + if (jj_3R_15()) return true;
  1535 + return false;
  1536 + }
  1537 +
  1538 + private boolean jj_3_26() {
  1539 + if (jj_scan_token(SLASH)) return true;
  1540 + if (jj_3R_13()) return true;
  1541 + return false;
  1542 + }
  1543 +
  1544 + private boolean jj_3_63() {
  1545 + Token xsp;
  1546 + xsp = jj_scanpos;
  1547 + if (jj_3_47()) {
  1548 + jj_scanpos = xsp;
  1549 + if (jj_3_48()) return true;
  1550 + }
  1551 + if (jj_scan_token(AND)) return true;
  1552 + xsp = jj_scanpos;
  1553 + if (jj_3_49()) {
  1554 + jj_scanpos = xsp;
  1555 + if (jj_3_50()) return true;
  1556 + }
  1557 + while (true) {
  1558 + xsp = jj_scanpos;
  1559 + if (jj_3_51()) { jj_scanpos = xsp; break; }
  1560 + }
  1561 + return false;
  1562 + }
  1563 +
  1564 + private boolean jj_3_46() {
  1565 + if (jj_scan_token(NEGATION)) return true;
  1566 + return false;
  1567 + }
  1568 +
  1569 + private boolean jj_3_66() {
  1570 + Token xsp;
  1571 + xsp = jj_scanpos;
  1572 + if (jj_3_46()) jj_scanpos = xsp;
  1573 + if (jj_scan_token(BRACKET_START)) return true;
  1574 + xsp = jj_scanpos;
  1575 + if (jj_3_63()) {
  1576 + jj_scanpos = xsp;
  1577 + if (jj_3_64()) {
  1578 + jj_scanpos = xsp;
  1579 + if (jj_3_65()) return true;
  1580 + }
  1581 + }
  1582 + if (jj_scan_token(BRACKET_END)) return true;
  1583 + return false;
  1584 + }
  1585 +
  1586 + private boolean jj_3_9() {
  1587 + if (jj_scan_token(BRACKET_START)) return true;
  1588 + if (jj_3R_7()) return true;
  1589 + if (jj_scan_token(BRACKET_END)) return true;
  1590 + return false;
  1591 + }
  1592 +
  1593 + private boolean jj_3_8() {
  1594 + if (jj_3R_8()) return true;
  1595 + return false;
  1596 + }
  1597 +
  1598 + private boolean jj_3R_14() {
  1599 + Token xsp;
  1600 + xsp = jj_scanpos;
  1601 + if (jj_3_66()) {
  1602 + jj_scanpos = xsp;
  1603 + if (jj_3_67()) return true;
  1604 + }
  1605 + return false;
  1606 + }
  1607 +
  1608 + private boolean jj_3_25() {
  1609 + if (jj_3R_13()) return true;
  1610 + Token xsp;
  1611 + xsp = jj_scanpos;
  1612 + if (jj_3_24()) jj_scanpos = xsp;
  1613 + return false;
  1614 + }
  1615 +
  1616 + private boolean jj_3_7() {
  1617 + if (jj_scan_token(NOT_WITHIN)) return true;
  1618 + return false;
  1619 + }
  1620 +
  1621 + private boolean jj_3R_12() {
  1622 + if (jj_scan_token(GROUP_START)) return true;
  1623 + Token xsp;
  1624 + xsp = jj_scanpos;
  1625 + if (jj_3_25()) {
  1626 + jj_scanpos = xsp;
  1627 + if (jj_3_26()) return true;
  1628 + }
  1629 + if (jj_scan_token(GROUP_END)) return true;
  1630 + xsp = jj_scanpos;
  1631 + if (jj_3_30()) jj_scanpos = xsp;
  1632 + return false;
  1633 + }
  1634 +
  1635 + private boolean jj_3_6() {
  1636 + if (jj_scan_token(WITHIN)) return true;
  1637 + return false;
  1638 + }
  1639 +
  1640 + private boolean jj_3_5() {
  1641 + if (jj_scan_token(NOT_CONTAINING)) return true;
  1642 + return false;
  1643 + }
  1644 +
  1645 + private boolean jj_3_4() {
  1646 + if (jj_scan_token(CONTAINING)) return true;
  1647 + return false;
  1648 + }
  1649 +
  1650 + private boolean jj_3_10() {
  1651 + Token xsp;
  1652 + xsp = jj_scanpos;
  1653 + if (jj_3_4()) {
  1654 + jj_scanpos = xsp;
  1655 + if (jj_3_5()) {
  1656 + jj_scanpos = xsp;
  1657 + if (jj_3_6()) {
  1658 + jj_scanpos = xsp;
  1659 + if (jj_3_7()) return true;
  1660 + }
  1661 + }
  1662 + }
  1663 + xsp = jj_scanpos;
  1664 + if (jj_3_8()) {
  1665 + jj_scanpos = xsp;
  1666 + if (jj_3_9()) return true;
  1667 + }
  1668 + return false;
  1669 + }
  1670 +
  1671 + private boolean jj_3_3() {
  1672 + if (jj_scan_token(BRACKET_START)) return true;
  1673 + if (jj_3R_7()) return true;
  1674 + if (jj_scan_token(BRACKET_END)) return true;
  1675 + return false;
  1676 + }
  1677 +
  1678 + private boolean jj_3_2() {
  1679 + if (jj_3R_8()) return true;
  1680 + return false;
  1681 + }
  1682 +
  1683 + private boolean jj_3R_7() {
  1684 + Token xsp;
  1685 + xsp = jj_scanpos;
  1686 + if (jj_3_2()) {
  1687 + jj_scanpos = xsp;
  1688 + if (jj_3_3()) return true;
  1689 + }
  1690 + xsp = jj_scanpos;
  1691 + if (jj_3_10()) jj_scanpos = xsp;
  1692 + return false;
  1693 + }
  1694 +
  1695 + private boolean jj_3_23() {
  1696 + if (jj_3R_12()) return true;
  1697 + return false;
  1698 + }
  1699 +
  1700 + private boolean jj_3_44() {
  1701 + if (jj_scan_token(QUESTION_MARK)) return true;
  1702 + return false;
  1703 + }
  1704 +
  1705 + private boolean jj_3_22() {
  1706 + if (jj_3R_11()) return true;
  1707 + return false;
  1708 + }
  1709 +
  1710 + private boolean jj_3_43() {
  1711 + if (jj_scan_token(CURLY_BRACKET_START)) return true;
  1712 + if (jj_scan_token(NUMBER)) return true;
  1713 + if (jj_scan_token(CURLY_BRACKET_END)) return true;
  1714 + return false;
  1715 + }
  1716 +
  1717 + private boolean jj_3_42() {
  1718 + if (jj_scan_token(CURLY_BRACKET_START)) return true;
  1719 + if (jj_scan_token(NUMBER)) return true;
  1720 + if (jj_scan_token(KOMMA)) return true;
  1721 + if (jj_scan_token(NUMBER)) return true;
  1722 + if (jj_scan_token(CURLY_BRACKET_END)) return true;
  1723 + return false;
  1724 + }
  1725 +
  1726 + private boolean jj_3_21() {
  1727 + Token xsp;
  1728 + xsp = jj_scanpos;
  1729 + if (jj_3_22()) {
  1730 + jj_scanpos = xsp;
  1731 + if (jj_3_23()) return true;
  1732 + }
  1733 + return false;
  1734 + }
  1735 +
  1736 + private boolean jj_3_45() {
  1737 + Token xsp;
  1738 + xsp = jj_scanpos;
  1739 + if (jj_3_42()) {
  1740 + jj_scanpos = xsp;
  1741 + if (jj_3_43()) {
  1742 + jj_scanpos = xsp;
  1743 + if (jj_3_44()) return true;
  1744 + }
  1745 + }
  1746 + return false;
  1747 + }
  1748 +
  1749 + private boolean jj_3_72() {
  1750 + if (jj_scan_token(TOKEN_EQUALS)) return true;
  1751 + return false;
  1752 + }
  1753 +
  1754 + private boolean jj_3_20() {
  1755 + if (jj_3R_12()) return true;
  1756 + return false;
  1757 + }
  1758 +
  1759 + private boolean jj_3_71() {
  1760 + if (jj_scan_token(TOKEN_NOTEQUALS)) return true;
  1761 + return false;
  1762 + }
  1763 +
  1764 + private boolean jj_3_19() {
  1765 + if (jj_3R_11()) return true;
  1766 + return false;
  1767 + }
  1768 +
  1769 + private boolean jj_3_41() {
  1770 + if (jj_scan_token(WORD_START)) return true;
  1771 + if (jj_scan_token(WORD_END)) return true;
  1772 + return false;
  1773 + }
  1774 +
  1775 + private boolean jj_3_38() {
  1776 + if (jj_3R_14()) return true;
  1777 + return false;
  1778 + }
  1779 +
  1780 + private boolean jj_3R_9() {
  1781 + Token xsp;
  1782 + xsp = jj_scanpos;
  1783 + if (jj_3_19()) {
  1784 + jj_scanpos = xsp;
  1785 + if (jj_3_20()) return true;
  1786 + }
  1787 + while (true) {
  1788 + xsp = jj_scanpos;
  1789 + if (jj_3_21()) { jj_scanpos = xsp; break; }
  1790 + }
  1791 + return false;
  1792 + }
  1793 +
  1794 + private boolean jj_3_74() {
  1795 + if (jj_scan_token(UNQUOTED_VALUE)) return true;
  1796 + Token xsp;
  1797 + xsp = jj_scanpos;
  1798 + if (jj_3_71()) {
  1799 + jj_scanpos = xsp;
  1800 + if (jj_3_72()) return true;
  1801 + }
  1802 + if (jj_scan_token(QUOTED_VALUE)) return true;
  1803 + return false;
  1804 + }
  1805 +
  1806 + private boolean jj_3_34() {
  1807 + if (jj_scan_token(OR)) return true;
  1808 + if (jj_3R_14()) return true;
  1809 + return false;
  1810 + }
  1811 +
  1812 + private boolean jj_3_1() {
  1813 + if (jj_3R_7()) return true;
  1814 + return false;
  1815 + }
  1816 +
  1817 + private boolean jj_3_36() {
  1818 + if (jj_scan_token(OR)) return true;
  1819 + if (jj_3R_14()) return true;
  1820 + Token xsp;
  1821 + while (true) {
  1822 + xsp = jj_scanpos;
  1823 + if (jj_3_34()) { jj_scanpos = xsp; break; }
  1824 + }
  1825 + return false;
  1826 + }
  1827 +
  1828 + private boolean jj_3_33() {
  1829 + if (jj_scan_token(AND)) return true;
  1830 + if (jj_3R_14()) return true;
  1831 + return false;
  1832 + }
  1833 +
  1834 + private boolean jj_3_17() {
  1835 + if (jj_scan_token(OR)) return true;
  1836 + return false;
  1837 + }
  1838 +
  1839 + private boolean jj_3_35() {
  1840 + if (jj_scan_token(AND)) return true;
  1841 + if (jj_3R_14()) return true;
  1842 + Token xsp;
  1843 + while (true) {
  1844 + xsp = jj_scanpos;
  1845 + if (jj_3_33()) { jj_scanpos = xsp; break; }
  1846 + }
  1847 + return false;
  1848 + }
  1849 +
  1850 + private boolean jj_3_18() {
  1851 + Token xsp;
  1852 + xsp = jj_scanpos;
  1853 + if (jj_3_17()) jj_scanpos = xsp;
  1854 + if (jj_3R_10()) return true;
  1855 + return false;
  1856 + }
  1857 +
  1858 + private boolean jj_3_37() {
  1859 + if (jj_3R_14()) return true;
  1860 + Token xsp;
  1861 + xsp = jj_scanpos;
  1862 + if (jj_3_35()) {
  1863 + jj_scanpos = xsp;
  1864 + if (jj_3_36()) return true;
  1865 + }
  1866 + return false;
  1867 + }
  1868 +
  1869 + private boolean jj_3_70() {
  1870 + if (jj_scan_token(UNQUOTED_VALUE)) return true;
  1871 + return false;
  1872 + }
  1873 +
  1874 + private boolean jj_3_69() {
  1875 + if (jj_scan_token(NUMBER)) return true;
  1876 + return false;
  1877 + }
  1878 +
  1879 + private boolean jj_3_40() {
  1880 + if (jj_scan_token(WORD_START)) return true;
  1881 + Token xsp;
  1882 + xsp = jj_scanpos;
  1883 + if (jj_3_37()) {
  1884 + jj_scanpos = xsp;
  1885 + if (jj_3_38()) return true;
  1886 + }
  1887 + if (jj_scan_token(WORD_END)) return true;
  1888 + return false;
  1889 + }
  1890 +
  1891 + private boolean jj_3_39() {
  1892 + if (jj_scan_token(QUOTED_VALUE)) return true;
  1893 + return false;
  1894 + }
  1895 +
  1896 + private boolean jj_3_73() {
  1897 + if (jj_scan_token(OCTOTHORPE)) return true;
  1898 + Token xsp;
  1899 + xsp = jj_scanpos;
  1900 + if (jj_3_69()) {
  1901 + jj_scanpos = xsp;
  1902 + if (jj_3_70()) return true;
  1903 + }
  1904 + return false;
  1905 + }
  1906 +
  1907 + /** Generated Token Manager. */
  1908 + public MtasCQLParserTokenManager token_source;
  1909 + SimpleCharStream jj_input_stream;
  1910 + /** Current token. */
  1911 + public Token token;
  1912 + /** Next token. */
  1913 + public Token jj_nt;
  1914 + private int jj_ntk;
  1915 + private Token jj_scanpos, jj_lastpos;
  1916 + private int jj_la;
  1917 + private int jj_gen;
  1918 + final private int[] jj_la1 = new int[0];
  1919 + static private int[] jj_la1_0;
  1920 + static {
  1921 + jj_la1_init_0();
  1922 + }
  1923 + private static void jj_la1_init_0() {
  1924 + jj_la1_0 = new int[] {};
  1925 + }
  1926 + final private JJCalls[] jj_2_rtns = new JJCalls[74];
  1927 + private boolean jj_rescan = false;
  1928 + private int jj_gc = 0;
  1929 +
  1930 + /** Constructor with InputStream. */
  1931 + public MtasCQLParser(java.io.InputStream stream) {
  1932 + this(stream, null);
  1933 + }
  1934 + /** Constructor with InputStream and supplied encoding */
  1935 + public MtasCQLParser(java.io.InputStream stream, String encoding) {
  1936 + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
  1937 + token_source = new MtasCQLParserTokenManager(jj_input_stream);
  1938 + token = new Token();
  1939 + jj_ntk = -1;
  1940 + jj_gen = 0;
  1941 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  1942 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  1943 + }
  1944 +
  1945 + /** Reinitialise. */
  1946 + public void ReInit(java.io.InputStream stream) {
  1947 + ReInit(stream, null);
  1948 + }
  1949 + /** Reinitialise. */
  1950 + public void ReInit(java.io.InputStream stream, String encoding) {
  1951 + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
  1952 + token_source.ReInit(jj_input_stream);
  1953 + token = new Token();
  1954 + jj_ntk = -1;
  1955 + jj_gen = 0;
  1956 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  1957 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  1958 + }
  1959 +
  1960 + /** Constructor. */
  1961 + public MtasCQLParser(java.io.Reader stream) {
  1962 + jj_input_stream = new SimpleCharStream(stream, 1, 1);
  1963 + token_source = new MtasCQLParserTokenManager(jj_input_stream);
  1964 + token = new Token();
  1965 + jj_ntk = -1;
  1966 + jj_gen = 0;
  1967 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  1968 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  1969 + }
  1970 +
  1971 + /** Reinitialise. */
  1972 + public void ReInit(java.io.Reader stream) {
  1973 + jj_input_stream.ReInit(stream, 1, 1);
  1974 + token_source.ReInit(jj_input_stream);
  1975 + token = new Token();
  1976 + jj_ntk = -1;
  1977 + jj_gen = 0;
  1978 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  1979 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  1980 + }
  1981 +
  1982 + /** Constructor with generated Token Manager. */
  1983 + public MtasCQLParser(MtasCQLParserTokenManager tm) {
  1984 + token_source = tm;
  1985 + token = new Token();
  1986 + jj_ntk = -1;
  1987 + jj_gen = 0;
  1988 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  1989 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  1990 + }
  1991 +
  1992 + /** Reinitialise. */
  1993 + public void ReInit(MtasCQLParserTokenManager tm) {
  1994 + token_source = tm;
  1995 + token = new Token();
  1996 + jj_ntk = -1;
  1997 + jj_gen = 0;
  1998 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  1999 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  2000 + }
  2001 +
  2002 + private Token jj_consume_token(int kind) throws ParseException {
  2003 + Token oldToken;
  2004 + if ((oldToken = token).next != null) token = token.next;
  2005 + else token = token.next = token_source.getNextToken();
  2006 + jj_ntk = -1;
  2007 + if (token.kind == kind) {
  2008 + jj_gen++;
  2009 + if (++jj_gc > 100) {
  2010 + jj_gc = 0;
  2011 + for (int i = 0; i < jj_2_rtns.length; i++) {
  2012 + JJCalls c = jj_2_rtns[i];
  2013 + while (c != null) {
  2014 + if (c.gen < jj_gen) c.first = null;
  2015 + c = c.next;
  2016 + }
  2017 + }
  2018 + }
  2019 + return token;
  2020 + }
  2021 + token = oldToken;
  2022 + jj_kind = kind;
  2023 + throw generateParseException();
  2024 + }
  2025 +
  2026 + static private final class LookaheadSuccess extends java.lang.Error { }
  2027 + final private LookaheadSuccess jj_ls = new LookaheadSuccess();
  2028 + private boolean jj_scan_token(int kind) {
  2029 + if (jj_scanpos == jj_lastpos) {
  2030 + jj_la--;
  2031 + if (jj_scanpos.next == null) {
  2032 + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
  2033 + } else {
  2034 + jj_lastpos = jj_scanpos = jj_scanpos.next;
  2035 + }
  2036 + } else {
  2037 + jj_scanpos = jj_scanpos.next;
  2038 + }
  2039 + if (jj_rescan) {
  2040 + int i = 0; Token tok = token;
  2041 + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
  2042 + if (tok != null) jj_add_error_token(kind, i);
  2043 + }
  2044 + if (jj_scanpos.kind != kind) return true;
  2045 + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
  2046 + return false;
  2047 + }
  2048 +
  2049 +
  2050 +/** Get the next Token. */
  2051 + final public Token getNextToken() {
  2052 + if (token.next != null) token = token.next;
  2053 + else token = token.next = token_source.getNextToken();
  2054 + jj_ntk = -1;
  2055 + jj_gen++;
  2056 + return token;
  2057 + }
  2058 +
  2059 +/** Get the specific Token. */
  2060 + final public Token getToken(int index) {
  2061 + Token t = token;
  2062 + for (int i = 0; i < index; i++) {
  2063 + if (t.next != null) t = t.next;
  2064 + else t = t.next = token_source.getNextToken();
  2065 + }
  2066 + return t;
  2067 + }
  2068 +
  2069 + private int jj_ntk() {
  2070 + if ((jj_nt=token.next) == null)
  2071 + return (jj_ntk = (token.next=token_source.getNextToken()).kind);
  2072 + else
  2073 + return (jj_ntk = jj_nt.kind);
  2074 + }
  2075 +
  2076 + private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
  2077 + private int[] jj_expentry;
  2078 + private int jj_kind = -1;
  2079 + private int[] jj_lasttokens = new int[100];
  2080 + private int jj_endpos;
  2081 +
  2082 + private void jj_add_error_token(int kind, int pos) {
  2083 + if (pos >= 100) return;
  2084 + if (pos == jj_endpos + 1) {
  2085 + jj_lasttokens[jj_endpos++] = kind;
  2086 + } else if (jj_endpos != 0) {
  2087 + jj_expentry = new int[jj_endpos];
  2088 + for (int i = 0; i < jj_endpos; i++) {
  2089 + jj_expentry[i] = jj_lasttokens[i];
  2090 + }
  2091 + jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
  2092 + int[] oldentry = (int[])(it.next());
  2093 + if (oldentry.length == jj_expentry.length) {
  2094 + for (int i = 0; i < jj_expentry.length; i++) {
  2095 + if (oldentry[i] != jj_expentry[i]) {
  2096 + continue jj_entries_loop;
  2097 + }
  2098 + }
  2099 + jj_expentries.add(jj_expentry);
  2100 + break jj_entries_loop;
  2101 + }
  2102 + }
  2103 + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
  2104 + }
  2105 + }
  2106 +
  2107 + /** Generate ParseException. */
  2108 + public ParseException generateParseException() {
  2109 + jj_expentries.clear();
  2110 + boolean[] la1tokens = new boolean[31];
  2111 + if (jj_kind >= 0) {
  2112 + la1tokens[jj_kind] = true;
  2113 + jj_kind = -1;
  2114 + }
  2115 + for (int i = 0; i < 0; i++) {
  2116 + if (jj_la1[i] == jj_gen) {
  2117 + for (int j = 0; j < 32; j++) {
  2118 + if ((jj_la1_0[i] & (1<<j)) != 0) {
  2119 + la1tokens[j] = true;
  2120 + }
  2121 + }
  2122 + }
  2123 + }
  2124 + for (int i = 0; i < 31; i++) {
  2125 + if (la1tokens[i]) {
  2126 + jj_expentry = new int[1];
  2127 + jj_expentry[0] = i;
  2128 + jj_expentries.add(jj_expentry);
  2129 + }
  2130 + }
  2131 + jj_endpos = 0;
  2132 + jj_rescan_token();
  2133 + jj_add_error_token(0, 0);
  2134 + int[][] exptokseq = new int[jj_expentries.size()][];
  2135 + for (int i = 0; i < jj_expentries.size(); i++) {
  2136 + exptokseq[i] = jj_expentries.get(i);
  2137 + }
  2138 + return new ParseException(token, exptokseq, tokenImage);
  2139 + }
  2140 +
  2141 + /** Enable tracing. */
  2142 + final public void enable_tracing() {
  2143 + }
  2144 +
  2145 + /** Disable tracing. */
  2146 + final public void disable_tracing() {
  2147 + }
  2148 +
  2149 + private void jj_rescan_token() {
  2150 + jj_rescan = true;
  2151 + for (int i = 0; i < 74; i++) {
  2152 + try {
  2153 + JJCalls p = jj_2_rtns[i];
  2154 + do {
  2155 + if (p.gen > jj_gen) {
  2156 + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
  2157 + switch (i) {
  2158 + case 0: jj_3_1(); break;
  2159 + case 1: jj_3_2(); break;
  2160 + case 2: jj_3_3(); break;
  2161 + case 3: jj_3_4(); break;
  2162 + case 4: jj_3_5(); break;
  2163 + case 5: jj_3_6(); break;
  2164 + case 6: jj_3_7(); break;
  2165 + case 7: jj_3_8(); break;
  2166 + case 8: jj_3_9(); break;
  2167 + case 9: jj_3_10(); break;
  2168 + case 10: jj_3_11(); break;
  2169 + case 11: jj_3_12(); break;
  2170 + case 12: jj_3_13(); break;
  2171 + case 13: jj_3_14(); break;
  2172 + case 14: jj_3_15(); break;
  2173 + case 15: jj_3_16(); break;
  2174 + case 16: jj_3_17(); break;
  2175 + case 17: jj_3_18(); break;
  2176 + case 18: jj_3_19(); break;
  2177 + case 19: jj_3_20(); break;
  2178 + case 20: jj_3_21(); break;
  2179 + case 21: jj_3_22(); break;
  2180 + case 22: jj_3_23(); break;
  2181 + case 23: jj_3_24(); break;
  2182 + case 24: jj_3_25(); break;
  2183 + case 25: jj_3_26(); break;
  2184 + case 26: jj_3_27(); break;
  2185 + case 27: jj_3_28(); break;
  2186 + case 28: jj_3_29(); break;
  2187 + case 29: jj_3_30(); break;
  2188 + case 30: jj_3_31(); break;
  2189 + case 31: jj_3_32(); break;
  2190 + case 32: jj_3_33(); break;
  2191 + case 33: jj_3_34(); break;
  2192 + case 34: jj_3_35(); break;
  2193 + case 35: jj_3_36(); break;
  2194 + case 36: jj_3_37(); break;
  2195 + case 37: jj_3_38(); break;
  2196 + case 38: jj_3_39(); break;
  2197 + case 39: jj_3_40(); break;
  2198 + case 40: jj_3_41(); break;
  2199 + case 41: jj_3_42(); break;
  2200 + case 42: jj_3_43(); break;
  2201 + case 43: jj_3_44(); break;
  2202 + case 44: jj_3_45(); break;
  2203 + case 45: jj_3_46(); break;
  2204 + case 46: jj_3_47(); break;
  2205 + case 47: jj_3_48(); break;
  2206 + case 48: jj_3_49(); break;
  2207 + case 49: jj_3_50(); break;
  2208 + case 50: jj_3_51(); break;
  2209 + case 51: jj_3_52(); break;
  2210 + case 52: jj_3_53(); break;
  2211 + case 53: jj_3_54(); break;
  2212 + case 54: jj_3_55(); break;
  2213 + case 55: jj_3_56(); break;
  2214 + case 56: jj_3_57(); break;
  2215 + case 57: jj_3_58(); break;
  2216 + case 58: jj_3_59(); break;
  2217 + case 59: jj_3_60(); break;
  2218 + case 60: jj_3_61(); break;
  2219 + case 61: jj_3_62(); break;
  2220 + case 62: jj_3_63(); break;
  2221 + case 63: jj_3_64(); break;
  2222 + case 64: jj_3_65(); break;
  2223 + case 65: jj_3_66(); break;
  2224 + case 66: jj_3_67(); break;
  2225 + case 67: jj_3_68(); break;
  2226 + case 68: jj_3_69(); break;
  2227 + case 69: jj_3_70(); break;
  2228 + case 70: jj_3_71(); break;
  2229 + case 71: jj_3_72(); break;
  2230 + case 72: jj_3_73(); break;
  2231 + case 73: jj_3_74(); break;
  2232 + }
  2233 + }
  2234 + p = p.next;
  2235 + } while (p != null);
  2236 + } catch(LookaheadSuccess ls) { }
  2237 + }
  2238 + jj_rescan = false;
  2239 + }
  2240 +
  2241 + private void jj_save(int index, int xla) {
  2242 + JJCalls p = jj_2_rtns[index];
  2243 + while (p.gen > jj_gen) {
  2244 + if (p.next == null) { p = p.next = new JJCalls(); break; }
  2245 + p = p.next;
  2246 + }
  2247 + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
  2248 + }
  2249 +
  2250 + static final class JJCalls {
  2251 + int gen;
  2252 + Token first;
  2253 + int arg;
  2254 + JJCalls next;
  2255 + }
  2256 +
  2257 +}
... ...
src/mtas/parser/cql/MtasCQLParser.jj
... ... @@ -8,8 +8,8 @@ options
8 8 DEBUG_TOKEN_MANAGER = false;
9 9  
10 10 LOOKAHEAD= 1000;
11   -}
12   -
  11 +}
  12 +
13 13 PARSER_BEGIN(MtasCQLParser)
14 14 package mtas.parser.cql;
15 15 import mtas.analysis.token.MtasToken;
... ...
src/mtas/parser/cql/MtasCQLParserConstants.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. MtasCQLParserConstants.java */
  2 +package mtas.parser.cql;
  3 +
  4 +
  5 +/**
  6 + * Token literal values and constants.
  7 + * Generated by org.javacc.parser.OtherFilesGen#start()
  8 + */
  9 +public interface MtasCQLParserConstants {
  10 +
  11 + /** End of File. */
  12 + int EOF = 0;
  13 + /** RegularExpression Id. */
  14 + int CONTAINING = 5;
  15 + /** RegularExpression Id. */
  16 + int NOT_CONTAINING = 6;
  17 + /** RegularExpression Id. */
  18 + int WITHIN = 7;
  19 + /** RegularExpression Id. */
  20 + int NOT_WITHIN = 8;
  21 + /** RegularExpression Id. */
  22 + int GROUP_START = 9;
  23 + /** RegularExpression Id. */
  24 + int GROUP_END = 10;
  25 + /** RegularExpression Id. */
  26 + int WORD_START = 11;
  27 + /** RegularExpression Id. */
  28 + int WORD_END = 12;
  29 + /** RegularExpression Id. */
  30 + int BRACKET_START = 13;
  31 + /** RegularExpression Id. */
  32 + int BRACKET_END = 14;
  33 + /** RegularExpression Id. */
  34 + int CURLY_BRACKET_START = 15;
  35 + /** RegularExpression Id. */
  36 + int CURLY_BRACKET_END = 16;
  37 + /** RegularExpression Id. */
  38 + int SLASH = 17;
  39 + /** RegularExpression Id. */
  40 + int QUESTION_MARK = 18;
  41 + /** RegularExpression Id. */
  42 + int NEGATION = 19;
  43 + /** RegularExpression Id. */
  44 + int AND = 20;
  45 + /** RegularExpression Id. */
  46 + int OR = 21;
  47 + /** RegularExpression Id. */
  48 + int KOMMA = 22;
  49 + /** RegularExpression Id. */
  50 + int TOKEN_NOTEQUALS = 23;
  51 + /** RegularExpression Id. */
  52 + int TOKEN_EQUALS = 24;
  53 + /** RegularExpression Id. */
  54 + int NUMBER = 25;
  55 + /** RegularExpression Id. */
  56 + int QUOTED_VALUE = 26;
  57 + /** RegularExpression Id. */
  58 + int UNQUOTED_VALUE = 27;
  59 + /** RegularExpression Id. */
  60 + int OCTOTHORPE = 28;
  61 + /** RegularExpression Id. */
  62 + int DIGIT = 29;
  63 + /** RegularExpression Id. */
  64 + int ALLOWED_UNQUOTED_CHARACTER = 30;
  65 +
  66 + /** Lexical state. */
  67 + int DEFAULT = 0;
  68 +
  69 + /** Literal token values. */
  70 + String[] tokenImage = {
  71 + "<EOF>",
  72 + "\" \"",
  73 + "\"\\r\"",
  74 + "\"\\t\"",
  75 + "\"\\n\"",
  76 + "\"containing\"",
  77 + "\"!containing\"",
  78 + "\"within\"",
  79 + "\"!within\"",
  80 + "\"<\"",
  81 + "\">\"",
  82 + "\"[\"",
  83 + "\"]\"",
  84 + "\"(\"",
  85 + "\")\"",
  86 + "\"{\"",
  87 + "\"}\"",
  88 + "\"/\"",
  89 + "\"?\"",
  90 + "\"!\"",
  91 + "\"&\"",
  92 + "\"|\"",
  93 + "\",\"",
  94 + "\"!=\"",
  95 + "\"=\"",
  96 + "<NUMBER>",
  97 + "<QUOTED_VALUE>",
  98 + "<UNQUOTED_VALUE>",
  99 + "<OCTOTHORPE>",
  100 + "<DIGIT>",
  101 + "<ALLOWED_UNQUOTED_CHARACTER>",
  102 + };
  103 +
  104 +}
... ...
src/mtas/parser/cql/MtasCQLParserTokenManager.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. MtasCQLParserTokenManager.java */
  2 +package mtas.parser.cql;
  3 +import mtas.analysis.token.MtasToken;
  4 +import mtas.parser.cql.util.MtasCQLParserGroupCondition;
  5 +import mtas.parser.cql.util.MtasCQLParserGroupFullCondition;
  6 +import mtas.parser.cql.util.MtasCQLParserWordCondition;
  7 +import mtas.parser.cql.util.MtasCQLParserWordPositionQuery;
  8 +import mtas.parser.cql.util.MtasCQLParserWordFullCondition;
  9 +import mtas.parser.cql.util.MtasCQLParserBasicSentenceCondition;
  10 +import mtas.parser.cql.util.MtasCQLParserSentenceCondition;
  11 +import mtas.parser.cql.util.MtasCQLParserSentencePartCondition;
  12 +import mtas.parser.cql.util.MtasCQLParserGroupQuery;
  13 +import mtas.parser.cql.util.MtasCQLParserWordQuery;
  14 +import mtas.parser.cql.util.MtasCQLParserDefaultPrefixCondition;
  15 +import org.apache.lucene.search.spans.SpanContainingQuery;
  16 +import org.apache.lucene.search.spans.SpanNotQuery;
  17 +import org.apache.lucene.search.spans.SpanQuery;
  18 +import org.apache.lucene.search.spans.SpanWithinQuery;
  19 +import org.apache.lucene.index.Term;
  20 +import mtas.search.spans.MtasSpanSequenceItem;
  21 +import mtas.search.spans.MtasSpanSequenceQuery;
  22 +import java.util.ArrayList;
  23 +import java.util.regex.Matcher;
  24 +import java.util.regex.Pattern;
  25 +
  26 +/** Token Manager. */
  27 +public class MtasCQLParserTokenManager implements MtasCQLParserConstants
  28 +{
  29 +
  30 + /** Debug output. */
  31 + public java.io.PrintStream debugStream = System.out;
  32 + /** Set debug output. */
  33 + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
  34 +private final int jjStopStringLiteralDfa_0(int pos, long active0)
  35 +{
  36 + switch (pos)
  37 + {
  38 + case 0:
  39 + if ((active0 & 0xa0L) != 0L)
  40 + {
  41 + jjmatchedKind = 27;
  42 + return 6;
  43 + }
  44 + return -1;
  45 + case 1:
  46 + if ((active0 & 0xa0L) != 0L)
  47 + {
  48 + jjmatchedKind = 27;
  49 + jjmatchedPos = 1;
  50 + return 6;
  51 + }
  52 + return -1;
  53 + case 2:
  54 + if ((active0 & 0xa0L) != 0L)
  55 + {
  56 + jjmatchedKind = 27;
  57 + jjmatchedPos = 2;
  58 + return 6;
  59 + }
  60 + return -1;
  61 + case 3:
  62 + if ((active0 & 0xa0L) != 0L)
  63 + {
  64 + jjmatchedKind = 27;
  65 + jjmatchedPos = 3;
  66 + return 6;
  67 + }
  68 + return -1;
  69 + case 4:
  70 + if ((active0 & 0xa0L) != 0L)
  71 + {
  72 + jjmatchedKind = 27;
  73 + jjmatchedPos = 4;
  74 + return 6;
  75 + }
  76 + return -1;
  77 + case 5:
  78 + if ((active0 & 0x80L) != 0L)
  79 + return 6;
  80 + if ((active0 & 0x20L) != 0L)
  81 + {
  82 + jjmatchedKind = 27;
  83 + jjmatchedPos = 5;
  84 + return 6;
  85 + }
  86 + return -1;
  87 + case 6:
  88 + if ((active0 & 0x20L) != 0L)
  89 + {
  90 + jjmatchedKind = 27;
  91 + jjmatchedPos = 6;
  92 + return 6;
  93 + }
  94 + return -1;
  95 + case 7:
  96 + if ((active0 & 0x20L) != 0L)
  97 + {
  98 + jjmatchedKind = 27;
  99 + jjmatchedPos = 7;
  100 + return 6;
  101 + }
  102 + return -1;
  103 + case 8:
  104 + if ((active0 & 0x20L) != 0L)
  105 + {
  106 + jjmatchedKind = 27;
  107 + jjmatchedPos = 8;
  108 + return 6;
  109 + }
  110 + return -1;
  111 + case 9:
  112 + if ((active0 & 0x20L) != 0L)
  113 + return 6;
  114 + return -1;
  115 + default :
  116 + return -1;
  117 + }
  118 +}
  119 +private final int jjStartNfa_0(int pos, long active0)
  120 +{
  121 + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
  122 +}
  123 +private int jjStopAtPos(int pos, int kind)
  124 +{
  125 + jjmatchedKind = kind;
  126 + jjmatchedPos = pos;
  127 + return pos + 1;
  128 +}
  129 +private int jjMoveStringLiteralDfa0_0()
  130 +{
  131 + switch(curChar)
  132 + {
  133 + case 33:
  134 + jjmatchedKind = 19;
  135 + return jjMoveStringLiteralDfa1_0(0x800140L);
  136 + case 38:
  137 + return jjStopAtPos(0, 20);
  138 + case 40:
  139 + return jjStopAtPos(0, 13);
  140 + case 41:
  141 + return jjStopAtPos(0, 14);
  142 + case 44:
  143 + return jjStopAtPos(0, 22);
  144 + case 47:
  145 + return jjStopAtPos(0, 17);
  146 + case 60:
  147 + return jjStopAtPos(0, 9);
  148 + case 61:
  149 + return jjStopAtPos(0, 24);
  150 + case 62:
  151 + return jjStopAtPos(0, 10);
  152 + case 63:
  153 + return jjStopAtPos(0, 18);
  154 + case 91:
  155 + return jjStopAtPos(0, 11);
  156 + case 93:
  157 + return jjStopAtPos(0, 12);
  158 + case 99:
  159 + return jjMoveStringLiteralDfa1_0(0x20L);
  160 + case 119:
  161 + return jjMoveStringLiteralDfa1_0(0x80L);
  162 + case 123:
  163 + return jjStopAtPos(0, 15);
  164 + case 124:
  165 + return jjStopAtPos(0, 21);
  166 + case 125:
  167 + return jjStopAtPos(0, 16);
  168 + default :
  169 + return jjMoveNfa_0(1, 0);
  170 + }
  171 +}
  172 +private int jjMoveStringLiteralDfa1_0(long active0)
  173 +{
  174 + try { curChar = input_stream.readChar(); }
  175 + catch(java.io.IOException e) {
  176 + jjStopStringLiteralDfa_0(0, active0);
  177 + return 1;
  178 + }
  179 + switch(curChar)
  180 + {
  181 + case 61:
  182 + if ((active0 & 0x800000L) != 0L)
  183 + return jjStopAtPos(1, 23);
  184 + break;
  185 + case 99:
  186 + return jjMoveStringLiteralDfa2_0(active0, 0x40L);
  187 + case 105:
  188 + return jjMoveStringLiteralDfa2_0(active0, 0x80L);
  189 + case 111:
  190 + return jjMoveStringLiteralDfa2_0(active0, 0x20L);
  191 + case 119:
  192 + return jjMoveStringLiteralDfa2_0(active0, 0x100L);
  193 + default :
  194 + break;
  195 + }
  196 + return jjStartNfa_0(0, active0);
  197 +}
  198 +private int jjMoveStringLiteralDfa2_0(long old0, long active0)
  199 +{
  200 + if (((active0 &= old0)) == 0L)
  201 + return jjStartNfa_0(0, old0);
  202 + try { curChar = input_stream.readChar(); }
  203 + catch(java.io.IOException e) {
  204 + jjStopStringLiteralDfa_0(1, active0);
  205 + return 2;
  206 + }
  207 + switch(curChar)
  208 + {
  209 + case 105:
  210 + return jjMoveStringLiteralDfa3_0(active0, 0x100L);
  211 + case 110:
  212 + return jjMoveStringLiteralDfa3_0(active0, 0x20L);
  213 + case 111:
  214 + return jjMoveStringLiteralDfa3_0(active0, 0x40L);
  215 + case 116:
  216 + return jjMoveStringLiteralDfa3_0(active0, 0x80L);
  217 + default :
  218 + break;
  219 + }
  220 + return jjStartNfa_0(1, active0);
  221 +}
  222 +private int jjMoveStringLiteralDfa3_0(long old0, long active0)
  223 +{
  224 + if (((active0 &= old0)) == 0L)
  225 + return jjStartNfa_0(1, old0);
  226 + try { curChar = input_stream.readChar(); }
  227 + catch(java.io.IOException e) {
  228 + jjStopStringLiteralDfa_0(2, active0);
  229 + return 3;
  230 + }
  231 + switch(curChar)
  232 + {
  233 + case 104:
  234 + return jjMoveStringLiteralDfa4_0(active0, 0x80L);
  235 + case 110:
  236 + return jjMoveStringLiteralDfa4_0(active0, 0x40L);
  237 + case 116:
  238 + return jjMoveStringLiteralDfa4_0(active0, 0x120L);
  239 + default :
  240 + break;
  241 + }
  242 + return jjStartNfa_0(2, active0);
  243 +}
  244 +private int jjMoveStringLiteralDfa4_0(long old0, long active0)
  245 +{
  246 + if (((active0 &= old0)) == 0L)
  247 + return jjStartNfa_0(2, old0);
  248 + try { curChar = input_stream.readChar(); }
  249 + catch(java.io.IOException e) {
  250 + jjStopStringLiteralDfa_0(3, active0);
  251 + return 4;
  252 + }
  253 + switch(curChar)
  254 + {
  255 + case 97:
  256 + return jjMoveStringLiteralDfa5_0(active0, 0x20L);
  257 + case 104:
  258 + return jjMoveStringLiteralDfa5_0(active0, 0x100L);
  259 + case 105:
  260 + return jjMoveStringLiteralDfa5_0(active0, 0x80L);
  261 + case 116:
  262 + return jjMoveStringLiteralDfa5_0(active0, 0x40L);
  263 + default :
  264 + break;
  265 + }
  266 + return jjStartNfa_0(3, active0);
  267 +}
  268 +private int jjMoveStringLiteralDfa5_0(long old0, long active0)
  269 +{
  270 + if (((active0 &= old0)) == 0L)
  271 + return jjStartNfa_0(3, old0);
  272 + try { curChar = input_stream.readChar(); }
  273 + catch(java.io.IOException e) {
  274 + jjStopStringLiteralDfa_0(4, active0);
  275 + return 5;
  276 + }
  277 + switch(curChar)
  278 + {
  279 + case 97:
  280 + return jjMoveStringLiteralDfa6_0(active0, 0x40L);
  281 + case 105:
  282 + return jjMoveStringLiteralDfa6_0(active0, 0x120L);
  283 + case 110:
  284 + if ((active0 & 0x80L) != 0L)
  285 + return jjStartNfaWithStates_0(5, 7, 6);
  286 + break;
  287 + default :
  288 + break;
  289 + }
  290 + return jjStartNfa_0(4, active0);
  291 +}
  292 +private int jjMoveStringLiteralDfa6_0(long old0, long active0)
  293 +{
  294 + if (((active0 &= old0)) == 0L)
  295 + return jjStartNfa_0(4, old0);
  296 + try { curChar = input_stream.readChar(); }
  297 + catch(java.io.IOException e) {
  298 + jjStopStringLiteralDfa_0(5, active0);
  299 + return 6;
  300 + }
  301 + switch(curChar)
  302 + {
  303 + case 105:
  304 + return jjMoveStringLiteralDfa7_0(active0, 0x40L);
  305 + case 110:
  306 + if ((active0 & 0x100L) != 0L)
  307 + return jjStopAtPos(6, 8);
  308 + return jjMoveStringLiteralDfa7_0(active0, 0x20L);
  309 + default :
  310 + break;
  311 + }
  312 + return jjStartNfa_0(5, active0);
  313 +}
  314 +private int jjMoveStringLiteralDfa7_0(long old0, long active0)
  315 +{
  316 + if (((active0 &= old0)) == 0L)
  317 + return jjStartNfa_0(5, old0);
  318 + try { curChar = input_stream.readChar(); }
  319 + catch(java.io.IOException e) {
  320 + jjStopStringLiteralDfa_0(6, active0);
  321 + return 7;
  322 + }
  323 + switch(curChar)
  324 + {
  325 + case 105:
  326 + return jjMoveStringLiteralDfa8_0(active0, 0x20L);
  327 + case 110:
  328 + return jjMoveStringLiteralDfa8_0(active0, 0x40L);
  329 + default :
  330 + break;
  331 + }
  332 + return jjStartNfa_0(6, active0);
  333 +}
  334 +private int jjMoveStringLiteralDfa8_0(long old0, long active0)
  335 +{
  336 + if (((active0 &= old0)) == 0L)
  337 + return jjStartNfa_0(6, old0);
  338 + try { curChar = input_stream.readChar(); }
  339 + catch(java.io.IOException e) {
  340 + jjStopStringLiteralDfa_0(7, active0);
  341 + return 8;
  342 + }
  343 + switch(curChar)
  344 + {
  345 + case 105:
  346 + return jjMoveStringLiteralDfa9_0(active0, 0x40L);
  347 + case 110:
  348 + return jjMoveStringLiteralDfa9_0(active0, 0x20L);
  349 + default :
  350 + break;
  351 + }
  352 + return jjStartNfa_0(7, active0);
  353 +}
  354 +private int jjMoveStringLiteralDfa9_0(long old0, long active0)
  355 +{
  356 + if (((active0 &= old0)) == 0L)
  357 + return jjStartNfa_0(7, old0);
  358 + try { curChar = input_stream.readChar(); }
  359 + catch(java.io.IOException e) {
  360 + jjStopStringLiteralDfa_0(8, active0);
  361 + return 9;
  362 + }
  363 + switch(curChar)
  364 + {
  365 + case 103:
  366 + if ((active0 & 0x20L) != 0L)
  367 + return jjStartNfaWithStates_0(9, 5, 6);
  368 + break;
  369 + case 110:
  370 + return jjMoveStringLiteralDfa10_0(active0, 0x40L);
  371 + default :
  372 + break;
  373 + }
  374 + return jjStartNfa_0(8, active0);
  375 +}
  376 +private int jjMoveStringLiteralDfa10_0(long old0, long active0)
  377 +{
  378 + if (((active0 &= old0)) == 0L)
  379 + return jjStartNfa_0(8, old0);
  380 + try { curChar = input_stream.readChar(); }
  381 + catch(java.io.IOException e) {
  382 + jjStopStringLiteralDfa_0(9, active0);
  383 + return 10;
  384 + }
  385 + switch(curChar)
  386 + {
  387 + case 103:
  388 + if ((active0 & 0x40L) != 0L)
  389 + return jjStopAtPos(10, 6);
  390 + break;
  391 + default :
  392 + break;
  393 + }
  394 + return jjStartNfa_0(9, active0);
  395 +}
  396 +private int jjStartNfaWithStates_0(int pos, int kind, int state)
  397 +{
  398 + jjmatchedKind = kind;
  399 + jjmatchedPos = pos;
  400 + try { curChar = input_stream.readChar(); }
  401 + catch(java.io.IOException e) { return pos + 1; }
  402 + return jjMoveNfa_0(state, pos + 1);
  403 +}
  404 +static final long[] jjbitVec0 = {
  405 + 0xfffffffffffffffeL, 0xffffffffffffffffL, 0xffffffffffffffffL, 0xffffffffffffffffL
  406 +};
  407 +static final long[] jjbitVec2 = {
  408 + 0x0L, 0x0L, 0xffffffffffffffffL, 0xffffffffffffffffL
  409 +};
  410 +private int jjMoveNfa_0(int startState, int curPos)
  411 +{
  412 + int startsAt = 0;
  413 + jjnewStateCnt = 8;
  414 + int i = 1;
  415 + jjstateSet[0] = startState;
  416 + int kind = 0x7fffffff;
  417 + for (;;)
  418 + {
  419 + if (++jjround == 0x7fffffff)
  420 + ReInitRounds();
  421 + if (curChar < 64)
  422 + {
  423 + long l = 1L << curChar;
  424 + do
  425 + {
  426 + switch(jjstateSet[--i])
  427 + {
  428 + case 1:
  429 + if ((0x3ff600000000000L & l) != 0L)
  430 + {
  431 + if (kind > 27)
  432 + kind = 27;
  433 + jjCheckNAdd(6);
  434 + }
  435 + else if (curChar == 35)
  436 + {
  437 + if (kind > 28)
  438 + kind = 28;
  439 + }
  440 + else if (curChar == 34)
  441 + jjCheckNAddStates(0, 2);
  442 + if ((0x3ff000000000000L & l) != 0L)
  443 + {
  444 + if (kind > 25)
  445 + kind = 25;
  446 + jjCheckNAdd(0);
  447 + }
  448 + break;
  449 + case 0:
  450 + if ((0x3ff000000000000L & l) == 0L)
  451 + break;
  452 + if (kind > 25)
  453 + kind = 25;
  454 + jjCheckNAdd(0);
  455 + break;
  456 + case 3:
  457 + jjCheckNAddStates(0, 2);
  458 + break;
  459 + case 4:
  460 + if ((0xfffffffbffffffffL & l) != 0L)
  461 + jjCheckNAddStates(0, 2);
  462 + break;
  463 + case 5:
  464 + if (curChar == 34 && kind > 26)
  465 + kind = 26;
  466 + break;
  467 + case 6:
  468 + if ((0x3ff600000000000L & l) == 0L)
  469 + break;
  470 + if (kind > 27)
  471 + kind = 27;
  472 + jjCheckNAdd(6);
  473 + break;
  474 + case 7:
  475 + if (curChar == 35 && kind > 28)
  476 + kind = 28;
  477 + break;
  478 + default : break;
  479 + }
  480 + } while(i != startsAt);
  481 + }
  482 + else if (curChar < 128)
  483 + {
  484 + long l = 1L << (curChar & 077);
  485 + do
  486 + {
  487 + switch(jjstateSet[--i])
  488 + {
  489 + case 1:
  490 + case 6:
  491 + if ((0x7fffffe87fffffeL & l) == 0L)
  492 + break;
  493 + if (kind > 27)
  494 + kind = 27;
  495 + jjCheckNAdd(6);
  496 + break;
  497 + case 2:
  498 + if (curChar == 92)
  499 + jjstateSet[jjnewStateCnt++] = 3;
  500 + break;
  501 + case 3:
  502 + jjCheckNAddStates(0, 2);
  503 + break;
  504 + case 4:
  505 + if ((0xffffffffefffffffL & l) != 0L)
  506 + jjCheckNAddStates(0, 2);
  507 + break;
  508 + default : break;
  509 + }
  510 + } while(i != startsAt);
  511 + }
  512 + else
  513 + {
  514 + int hiByte = (int)(curChar >> 8);
  515 + int i1 = hiByte >> 6;
  516 + long l1 = 1L << (hiByte & 077);
  517 + int i2 = (curChar & 0xff) >> 6;
  518 + long l2 = 1L << (curChar & 077);
  519 + do
  520 + {
  521 + switch(jjstateSet[--i])
  522 + {
  523 + case 3:
  524 + case 4:
  525 + if (jjCanMove_0(hiByte, i1, i2, l1, l2))
  526 + jjCheckNAddStates(0, 2);
  527 + break;
  528 + default : break;
  529 + }
  530 + } while(i != startsAt);
  531 + }
  532 + if (kind != 0x7fffffff)
  533 + {
  534 + jjmatchedKind = kind;
  535 + jjmatchedPos = curPos;
  536 + kind = 0x7fffffff;
  537 + }
  538 + ++curPos;
  539 + if ((i = jjnewStateCnt) == (startsAt = 8 - (jjnewStateCnt = startsAt)))
  540 + return curPos;
  541 + try { curChar = input_stream.readChar(); }
  542 + catch(java.io.IOException e) { return curPos; }
  543 + }
  544 +}
  545 +static final int[] jjnextStates = {
  546 + 2, 4, 5,
  547 +};
  548 +private static final boolean jjCanMove_0(int hiByte, int i1, int i2, long l1, long l2)
  549 +{
  550 + switch(hiByte)
  551 + {
  552 + case 0:
  553 + return ((jjbitVec2[i2] & l2) != 0L);
  554 + default :
  555 + if ((jjbitVec0[i1] & l1) != 0L)
  556 + return true;
  557 + return false;
  558 + }
  559 +}
  560 +
  561 +/** Token literal values. */
  562 +public static final String[] jjstrLiteralImages = {
  563 +"", null, null, null, null, "\143\157\156\164\141\151\156\151\156\147",
  564 +"\41\143\157\156\164\141\151\156\151\156\147", "\167\151\164\150\151\156", "\41\167\151\164\150\151\156", "\74", "\76",
  565 +"\133", "\135", "\50", "\51", "\173", "\175", "\57", "\77", "\41", "\46", "\174",
  566 +"\54", "\41\75", "\75", null, null, null, null, null, null, };
  567 +
  568 +/** Lexer state names. */
  569 +public static final String[] lexStateNames = {
  570 + "DEFAULT",
  571 +};
  572 +static final long[] jjtoToken = {
  573 + 0x1fffffe1L,
  574 +};
  575 +static final long[] jjtoSkip = {
  576 + 0x1eL,
  577 +};
  578 +protected SimpleCharStream input_stream;
  579 +private final int[] jjrounds = new int[8];
  580 +private final int[] jjstateSet = new int[16];
  581 +protected char curChar;
  582 +/** Constructor. */
  583 +public MtasCQLParserTokenManager(SimpleCharStream stream){
  584 + if (SimpleCharStream.staticFlag)
  585 + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
  586 + input_stream = stream;
  587 +}
  588 +
  589 +/** Constructor. */
  590 +public MtasCQLParserTokenManager(SimpleCharStream stream, int lexState){
  591 + this(stream);
  592 + SwitchTo(lexState);
  593 +}
  594 +
  595 +/** Reinitialise parser. */
  596 +public void ReInit(SimpleCharStream stream)
  597 +{
  598 + jjmatchedPos = jjnewStateCnt = 0;
  599 + curLexState = defaultLexState;
  600 + input_stream = stream;
  601 + ReInitRounds();
  602 +}
  603 +private void ReInitRounds()
  604 +{
  605 + int i;
  606 + jjround = 0x80000001;
  607 + for (i = 8; i-- > 0;)
  608 + jjrounds[i] = 0x80000000;
  609 +}
  610 +
  611 +/** Reinitialise parser. */
  612 +public void ReInit(SimpleCharStream stream, int lexState)
  613 +{
  614 + ReInit(stream);
  615 + SwitchTo(lexState);
  616 +}
  617 +
  618 +/** Switch to specified lex state. */
  619 +public void SwitchTo(int lexState)
  620 +{
  621 + if (lexState >= 1 || lexState < 0)
  622 + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
  623 + else
  624 + curLexState = lexState;
  625 +}
  626 +
  627 +protected Token jjFillToken()
  628 +{
  629 + final Token t;
  630 + final String curTokenImage;
  631 + final int beginLine;
  632 + final int endLine;
  633 + final int beginColumn;
  634 + final int endColumn;
  635 + String im = jjstrLiteralImages[jjmatchedKind];
  636 + curTokenImage = (im == null) ? input_stream.GetImage() : im;
  637 + beginLine = input_stream.getBeginLine();
  638 + beginColumn = input_stream.getBeginColumn();
  639 + endLine = input_stream.getEndLine();
  640 + endColumn = input_stream.getEndColumn();
  641 + t = Token.newToken(jjmatchedKind, curTokenImage);
  642 +
  643 + t.beginLine = beginLine;
  644 + t.endLine = endLine;
  645 + t.beginColumn = beginColumn;
  646 + t.endColumn = endColumn;
  647 +
  648 + return t;
  649 +}
  650 +
  651 +int curLexState = 0;
  652 +int defaultLexState = 0;
  653 +int jjnewStateCnt;
  654 +int jjround;
  655 +int jjmatchedPos;
  656 +int jjmatchedKind;
  657 +
  658 +/** Get the next Token. */
  659 +public Token getNextToken()
  660 +{
  661 + Token matchedToken;
  662 + int curPos = 0;
  663 +
  664 + EOFLoop :
  665 + for (;;)
  666 + {
  667 + try
  668 + {
  669 + curChar = input_stream.BeginToken();
  670 + }
  671 + catch(java.io.IOException e)
  672 + {
  673 + jjmatchedKind = 0;
  674 + matchedToken = jjFillToken();
  675 + return matchedToken;
  676 + }
  677 +
  678 + try { input_stream.backup(0);
  679 + while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
  680 + curChar = input_stream.BeginToken();
  681 + }
  682 + catch (java.io.IOException e1) { continue EOFLoop; }
  683 + jjmatchedKind = 0x7fffffff;
  684 + jjmatchedPos = 0;
  685 + curPos = jjMoveStringLiteralDfa0_0();
  686 + if (jjmatchedKind != 0x7fffffff)
  687 + {
  688 + if (jjmatchedPos + 1 < curPos)
  689 + input_stream.backup(curPos - jjmatchedPos - 1);
  690 + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
  691 + {
  692 + matchedToken = jjFillToken();
  693 + return matchedToken;
  694 + }
  695 + else
  696 + {
  697 + continue EOFLoop;
  698 + }
  699 + }
  700 + int error_line = input_stream.getEndLine();
  701 + int error_column = input_stream.getEndColumn();
  702 + String error_after = null;
  703 + boolean EOFSeen = false;
  704 + try { input_stream.readChar(); input_stream.backup(1); }
  705 + catch (java.io.IOException e1) {
  706 + EOFSeen = true;
  707 + error_after = curPos <= 1 ? "" : input_stream.GetImage();
  708 + if (curChar == '\n' || curChar == '\r') {
  709 + error_line++;
  710 + error_column = 0;
  711 + }
  712 + else
  713 + error_column++;
  714 + }
  715 + if (!EOFSeen) {
  716 + input_stream.backup(1);
  717 + error_after = curPos <= 1 ? "" : input_stream.GetImage();
  718 + }
  719 + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
  720 + }
  721 +}
  722 +
  723 +private void jjCheckNAdd(int state)
  724 +{
  725 + if (jjrounds[state] != jjround)
  726 + {
  727 + jjstateSet[jjnewStateCnt++] = state;
  728 + jjrounds[state] = jjround;
  729 + }
  730 +}
  731 +private void jjAddStates(int start, int end)
  732 +{
  733 + do {
  734 + jjstateSet[jjnewStateCnt++] = jjnextStates[start];
  735 + } while (start++ != end);
  736 +}
  737 +private void jjCheckNAddTwoStates(int state1, int state2)
  738 +{
  739 + jjCheckNAdd(state1);
  740 + jjCheckNAdd(state2);
  741 +}
  742 +
  743 +private void jjCheckNAddStates(int start, int end)
  744 +{
  745 + do {
  746 + jjCheckNAdd(jjnextStates[start]);
  747 + } while (start++ != end);
  748 +}
  749 +
  750 +}
... ...
src/mtas/parser/cql/ParseException.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. ParseException.java Version 5.0 */
  2 +/* JavaCCOptions:KEEP_LINE_COL=null */
  3 +package mtas.parser.cql;
  4 +
  5 +/**
  6 + * This exception is thrown when parse errors are encountered.
  7 + * You can explicitly create objects of this exception type by
  8 + * calling the method generateParseException in the generated
  9 + * parser.
  10 + *
  11 + * You can modify this class to customize your error reporting
  12 + * mechanisms so long as you retain the public fields.
  13 + */
  14 +public class ParseException extends Exception {
  15 +
  16 + /**
  17 + * The version identifier for this Serializable class.
  18 + * Increment only if the <i>serialized</i> form of the
  19 + * class changes.
  20 + */
  21 + private static final long serialVersionUID = 1L;
  22 +
  23 + /**
  24 + * This constructor is used by the method "generateParseException"
  25 + * in the generated parser. Calling this constructor generates
  26 + * a new object of this type with the fields "currentToken",
  27 + * "expectedTokenSequences", and "tokenImage" set.
  28 + */
  29 + public ParseException(Token currentTokenVal,
  30 + int[][] expectedTokenSequencesVal,
  31 + String[] tokenImageVal
  32 + )
  33 + {
  34 + super(initialise(currentTokenVal, expectedTokenSequencesVal, tokenImageVal));
  35 + currentToken = currentTokenVal;
  36 + expectedTokenSequences = expectedTokenSequencesVal;
  37 + tokenImage = tokenImageVal;
  38 + }
  39 +
  40 + /**
  41 + * The following constructors are for use by you for whatever
  42 + * purpose you can think of. Constructing the exception in this
  43 + * manner makes the exception behave in the normal way - i.e., as
  44 + * documented in the class "Throwable". The fields "errorToken",
  45 + * "expectedTokenSequences", and "tokenImage" do not contain
  46 + * relevant information. The JavaCC generated code does not use
  47 + * these constructors.
  48 + */
  49 +
  50 + public ParseException() {
  51 + super();
  52 + }
  53 +
  54 + /** Constructor with message. */
  55 + public ParseException(String message) {
  56 + super(message);
  57 + }
  58 +
  59 +
  60 + /**
  61 + * This is the last token that has been consumed successfully. If
  62 + * this object has been created due to a parse error, the token
  63 + * followng this token will (therefore) be the first error token.
  64 + */
  65 + public Token currentToken;
  66 +
  67 + /**
  68 + * Each entry in this array is an array of integers. Each array
  69 + * of integers represents a sequence of tokens (by their ordinal
  70 + * values) that is expected at this point of the parse.
  71 + */
  72 + public int[][] expectedTokenSequences;
  73 +
  74 + /**
  75 + * This is a reference to the "tokenImage" array of the generated
  76 + * parser within which the parse error occurred. This array is
  77 + * defined in the generated ...Constants interface.
  78 + */
  79 + public String[] tokenImage;
  80 +
  81 + /**
  82 + * It uses "currentToken" and "expectedTokenSequences" to generate a parse
  83 + * error message and returns it. If this object has been created
  84 + * due to a parse error, and you do not catch it (it gets thrown
  85 + * from the parser) the correct error message
  86 + * gets displayed.
  87 + */
  88 + private static String initialise(Token currentToken,
  89 + int[][] expectedTokenSequences,
  90 + String[] tokenImage) {
  91 + String eol = System.getProperty("line.separator", "\n");
  92 + StringBuffer expected = new StringBuffer();
  93 + int maxSize = 0;
  94 + for (int i = 0; i < expectedTokenSequences.length; i++) {
  95 + if (maxSize < expectedTokenSequences[i].length) {
  96 + maxSize = expectedTokenSequences[i].length;
  97 + }
  98 + for (int j = 0; j < expectedTokenSequences[i].length; j++) {
  99 + expected.append(tokenImage[expectedTokenSequences[i][j]]).append(' ');
  100 + }
  101 + if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
  102 + expected.append("...");
  103 + }
  104 + expected.append(eol).append(" ");
  105 + }
  106 + String retval = "Encountered \"";
  107 + Token tok = currentToken.next;
  108 + for (int i = 0; i < maxSize; i++) {
  109 + if (i != 0) retval += " ";
  110 + if (tok.kind == 0) {
  111 + retval += tokenImage[0];
  112 + break;
  113 + }
  114 + retval += " " + tokenImage[tok.kind];
  115 + retval += " \"";
  116 + retval += add_escapes(tok.image);
  117 + retval += " \"";
  118 + tok = tok.next;
  119 + }
  120 + retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
  121 + retval += "." + eol;
  122 + if (expectedTokenSequences.length == 1) {
  123 + retval += "Was expecting:" + eol + " ";
  124 + } else {
  125 + retval += "Was expecting one of:" + eol + " ";
  126 + }
  127 + retval += expected.toString();
  128 + return retval;
  129 + }
  130 +
  131 + /**
  132 + * The end of line string for this machine.
  133 + */
  134 + protected String eol = System.getProperty("line.separator", "\n");
  135 +
  136 + /**
  137 + * Used to convert raw characters to their escaped version
  138 + * when these raw version cannot be used as part of an ASCII
  139 + * string literal.
  140 + */
  141 + static String add_escapes(String str) {
  142 + StringBuffer retval = new StringBuffer();
  143 + char ch;
  144 + for (int i = 0; i < str.length(); i++) {
  145 + switch (str.charAt(i))
  146 + {
  147 + case 0 :
  148 + continue;
  149 + case '\b':
  150 + retval.append("\\b");
  151 + continue;
  152 + case '\t':
  153 + retval.append("\\t");
  154 + continue;
  155 + case '\n':
  156 + retval.append("\\n");
  157 + continue;
  158 + case '\f':
  159 + retval.append("\\f");
  160 + continue;
  161 + case '\r':
  162 + retval.append("\\r");
  163 + continue;
  164 + case '\"':
  165 + retval.append("\\\"");
  166 + continue;
  167 + case '\'':
  168 + retval.append("\\\'");
  169 + continue;
  170 + case '\\':
  171 + retval.append("\\\\");
  172 + continue;
  173 + default:
  174 + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
  175 + String s = "0000" + Integer.toString(ch, 16);
  176 + retval.append("\\u" + s.substring(s.length() - 4, s.length()));
  177 + } else {
  178 + retval.append(ch);
  179 + }
  180 + continue;
  181 + }
  182 + }
  183 + return retval.toString();
  184 + }
  185 +
  186 +}
  187 +/* JavaCC - OriginalChecksum=a5744d0f598c98bc282befd42ee797ff (do not edit this line) */
... ...
src/mtas/parser/cql/SimpleCharStream.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. SimpleCharStream.java Version 5.0 */
  2 +/* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
  3 +package mtas.parser.cql;
  4 +
  5 +/**
  6 + * An implementation of interface CharStream, where the stream is assumed to
  7 + * contain only ASCII characters (without unicode processing).
  8 + */
  9 +
  10 +public class SimpleCharStream
  11 +{
  12 +/** Whether parser is static. */
  13 + public static final boolean staticFlag = false;
  14 + int bufsize;
  15 + int available;
  16 + int tokenBegin;
  17 +/** Position in buffer. */
  18 + public int bufpos = -1;
  19 + protected int bufline[];
  20 + protected int bufcolumn[];
  21 +
  22 + protected int column = 0;
  23 + protected int line = 1;
  24 +
  25 + protected boolean prevCharIsCR = false;
  26 + protected boolean prevCharIsLF = false;
  27 +
  28 + protected java.io.Reader inputStream;
  29 +
  30 + protected char[] buffer;
  31 + protected int maxNextCharInd = 0;
  32 + protected int inBuf = 0;
  33 + protected int tabSize = 8;
  34 +
  35 + protected void setTabSize(int i) { tabSize = i; }
  36 + protected int getTabSize(int i) { return tabSize; }
  37 +
  38 +
  39 + protected void ExpandBuff(boolean wrapAround)
  40 + {
  41 + char[] newbuffer = new char[bufsize + 2048];
  42 + int newbufline[] = new int[bufsize + 2048];
  43 + int newbufcolumn[] = new int[bufsize + 2048];
  44 +
  45 + try
  46 + {
  47 + if (wrapAround)
  48 + {
  49 + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
  50 + System.arraycopy(buffer, 0, newbuffer, bufsize - tokenBegin, bufpos);
  51 + buffer = newbuffer;
  52 +
  53 + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
  54 + System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
  55 + bufline = newbufline;
  56 +
  57 + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
  58 + System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
  59 + bufcolumn = newbufcolumn;
  60 +
  61 + maxNextCharInd = (bufpos += (bufsize - tokenBegin));
  62 + }
  63 + else
  64 + {
  65 + System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
  66 + buffer = newbuffer;
  67 +
  68 + System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
  69 + bufline = newbufline;
  70 +
  71 + System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
  72 + bufcolumn = newbufcolumn;
  73 +
  74 + maxNextCharInd = (bufpos -= tokenBegin);
  75 + }
  76 + }
  77 + catch (Throwable t)
  78 + {
  79 + throw new Error(t.getMessage());
  80 + }
  81 +
  82 +
  83 + bufsize += 2048;
  84 + available = bufsize;
  85 + tokenBegin = 0;
  86 + }
  87 +
  88 + protected void FillBuff() throws java.io.IOException
  89 + {
  90 + if (maxNextCharInd == available)
  91 + {
  92 + if (available == bufsize)
  93 + {
  94 + if (tokenBegin > 2048)
  95 + {
  96 + bufpos = maxNextCharInd = 0;
  97 + available = tokenBegin;
  98 + }
  99 + else if (tokenBegin < 0)
  100 + bufpos = maxNextCharInd = 0;
  101 + else
  102 + ExpandBuff(false);
  103 + }
  104 + else if (available > tokenBegin)
  105 + available = bufsize;
  106 + else if ((tokenBegin - available) < 2048)
  107 + ExpandBuff(true);
  108 + else
  109 + available = tokenBegin;
  110 + }
  111 +
  112 + int i;
  113 + try {
  114 + if ((i = inputStream.read(buffer, maxNextCharInd, available - maxNextCharInd)) == -1)
  115 + {
  116 + inputStream.close();
  117 + throw new java.io.IOException();
  118 + }
  119 + else
  120 + maxNextCharInd += i;
  121 + return;
  122 + }
  123 + catch(java.io.IOException e) {
  124 + --bufpos;
  125 + backup(0);
  126 + if (tokenBegin == -1)
  127 + tokenBegin = bufpos;
  128 + throw e;
  129 + }
  130 + }
  131 +
  132 +/** Start. */
  133 + public char BeginToken() throws java.io.IOException
  134 + {
  135 + tokenBegin = -1;
  136 + char c = readChar();
  137 + tokenBegin = bufpos;
  138 +
  139 + return c;
  140 + }
  141 +
  142 + protected void UpdateLineColumn(char c)
  143 + {
  144 + column++;
  145 +
  146 + if (prevCharIsLF)
  147 + {
  148 + prevCharIsLF = false;
  149 + line += (column = 1);
  150 + }
  151 + else if (prevCharIsCR)
  152 + {
  153 + prevCharIsCR = false;
  154 + if (c == '\n')
  155 + {
  156 + prevCharIsLF = true;
  157 + }
  158 + else
  159 + line += (column = 1);
  160 + }
  161 +
  162 + switch (c)
  163 + {
  164 + case '\r' :
  165 + prevCharIsCR = true;
  166 + break;
  167 + case '\n' :
  168 + prevCharIsLF = true;
  169 + break;
  170 + case '\t' :
  171 + column--;
  172 + column += (tabSize - (column % tabSize));
  173 + break;
  174 + default :
  175 + break;
  176 + }
  177 +
  178 + bufline[bufpos] = line;
  179 + bufcolumn[bufpos] = column;
  180 + }
  181 +
  182 +/** Read a character. */
  183 + public char readChar() throws java.io.IOException
  184 + {
  185 + if (inBuf > 0)
  186 + {
  187 + --inBuf;
  188 +
  189 + if (++bufpos == bufsize)
  190 + bufpos = 0;
  191 +
  192 + return buffer[bufpos];
  193 + }
  194 +
  195 + if (++bufpos >= maxNextCharInd)
  196 + FillBuff();
  197 +
  198 + char c = buffer[bufpos];
  199 +
  200 + UpdateLineColumn(c);
  201 + return c;
  202 + }
  203 +
  204 + @Deprecated
  205 + /**
  206 + * @deprecated
  207 + * @see #getEndColumn
  208 + */
  209 +
  210 + public int getColumn() {
  211 + return bufcolumn[bufpos];
  212 + }
  213 +
  214 + @Deprecated
  215 + /**
  216 + * @deprecated
  217 + * @see #getEndLine
  218 + */
  219 +
  220 + public int getLine() {
  221 + return bufline[bufpos];
  222 + }
  223 +
  224 + /** Get token end column number. */
  225 + public int getEndColumn() {
  226 + return bufcolumn[bufpos];
  227 + }
  228 +
  229 + /** Get token end line number. */
  230 + public int getEndLine() {
  231 + return bufline[bufpos];
  232 + }
  233 +
  234 + /** Get token beginning column number. */
  235 + public int getBeginColumn() {
  236 + return bufcolumn[tokenBegin];
  237 + }
  238 +
  239 + /** Get token beginning line number. */
  240 + public int getBeginLine() {
  241 + return bufline[tokenBegin];
  242 + }
  243 +
  244 +/** Backup a number of characters. */
  245 + public void backup(int amount) {
  246 +
  247 + inBuf += amount;
  248 + if ((bufpos -= amount) < 0)
  249 + bufpos += bufsize;
  250 + }
  251 +
  252 + /** Constructor. */
  253 + public SimpleCharStream(java.io.Reader dstream, int startline,
  254 + int startcolumn, int buffersize)
  255 + {
  256 + inputStream = dstream;
  257 + line = startline;
  258 + column = startcolumn - 1;
  259 +
  260 + available = bufsize = buffersize;
  261 + buffer = new char[buffersize];
  262 + bufline = new int[buffersize];
  263 + bufcolumn = new int[buffersize];
  264 + }
  265 +
  266 + /** Constructor. */
  267 + public SimpleCharStream(java.io.Reader dstream, int startline,
  268 + int startcolumn)
  269 + {
  270 + this(dstream, startline, startcolumn, 4096);
  271 + }
  272 +
  273 + /** Constructor. */
  274 + public SimpleCharStream(java.io.Reader dstream)
  275 + {
  276 + this(dstream, 1, 1, 4096);
  277 + }
  278 +
  279 + /** Reinitialise. */
  280 + public void ReInit(java.io.Reader dstream, int startline,
  281 + int startcolumn, int buffersize)
  282 + {
  283 + inputStream = dstream;
  284 + line = startline;
  285 + column = startcolumn - 1;
  286 +
  287 + if (buffer == null || buffersize != buffer.length)
  288 + {
  289 + available = bufsize = buffersize;
  290 + buffer = new char[buffersize];
  291 + bufline = new int[buffersize];
  292 + bufcolumn = new int[buffersize];
  293 + }
  294 + prevCharIsLF = prevCharIsCR = false;
  295 + tokenBegin = inBuf = maxNextCharInd = 0;
  296 + bufpos = -1;
  297 + }
  298 +
  299 + /** Reinitialise. */
  300 + public void ReInit(java.io.Reader dstream, int startline,
  301 + int startcolumn)
  302 + {
  303 + ReInit(dstream, startline, startcolumn, 4096);
  304 + }
  305 +
  306 + /** Reinitialise. */
  307 + public void ReInit(java.io.Reader dstream)
  308 + {
  309 + ReInit(dstream, 1, 1, 4096);
  310 + }
  311 + /** Constructor. */
  312 + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
  313 + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
  314 + {
  315 + this(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
  316 + }
  317 +
  318 + /** Constructor. */
  319 + public SimpleCharStream(java.io.InputStream dstream, int startline,
  320 + int startcolumn, int buffersize)
  321 + {
  322 + this(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
  323 + }
  324 +
  325 + /** Constructor. */
  326 + public SimpleCharStream(java.io.InputStream dstream, String encoding, int startline,
  327 + int startcolumn) throws java.io.UnsupportedEncodingException
  328 + {
  329 + this(dstream, encoding, startline, startcolumn, 4096);
  330 + }
  331 +
  332 + /** Constructor. */
  333 + public SimpleCharStream(java.io.InputStream dstream, int startline,
  334 + int startcolumn)
  335 + {
  336 + this(dstream, startline, startcolumn, 4096);
  337 + }
  338 +
  339 + /** Constructor. */
  340 + public SimpleCharStream(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
  341 + {
  342 + this(dstream, encoding, 1, 1, 4096);
  343 + }
  344 +
  345 + /** Constructor. */
  346 + public SimpleCharStream(java.io.InputStream dstream)
  347 + {
  348 + this(dstream, 1, 1, 4096);
  349 + }
  350 +
  351 + /** Reinitialise. */
  352 + public void ReInit(java.io.InputStream dstream, String encoding, int startline,
  353 + int startcolumn, int buffersize) throws java.io.UnsupportedEncodingException
  354 + {
  355 + ReInit(encoding == null ? new java.io.InputStreamReader(dstream) : new java.io.InputStreamReader(dstream, encoding), startline, startcolumn, buffersize);
  356 + }
  357 +
  358 + /** Reinitialise. */
  359 + public void ReInit(java.io.InputStream dstream, int startline,
  360 + int startcolumn, int buffersize)
  361 + {
  362 + ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, buffersize);
  363 + }
  364 +
  365 + /** Reinitialise. */
  366 + public void ReInit(java.io.InputStream dstream, String encoding) throws java.io.UnsupportedEncodingException
  367 + {
  368 + ReInit(dstream, encoding, 1, 1, 4096);
  369 + }
  370 +
  371 + /** Reinitialise. */
  372 + public void ReInit(java.io.InputStream dstream)
  373 + {
  374 + ReInit(dstream, 1, 1, 4096);
  375 + }
  376 + /** Reinitialise. */
  377 + public void ReInit(java.io.InputStream dstream, String encoding, int startline,
  378 + int startcolumn) throws java.io.UnsupportedEncodingException
  379 + {
  380 + ReInit(dstream, encoding, startline, startcolumn, 4096);
  381 + }
  382 + /** Reinitialise. */
  383 + public void ReInit(java.io.InputStream dstream, int startline,
  384 + int startcolumn)
  385 + {
  386 + ReInit(dstream, startline, startcolumn, 4096);
  387 + }
  388 + /** Get token literal value. */
  389 + public String GetImage()
  390 + {
  391 + if (bufpos >= tokenBegin)
  392 + return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
  393 + else
  394 + return new String(buffer, tokenBegin, bufsize - tokenBegin) +
  395 + new String(buffer, 0, bufpos + 1);
  396 + }
  397 +
  398 + /** Get the suffix. */
  399 + public char[] GetSuffix(int len)
  400 + {
  401 + char[] ret = new char[len];
  402 +
  403 + if ((bufpos + 1) >= len)
  404 + System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
  405 + else
  406 + {
  407 + System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
  408 + len - bufpos - 1);
  409 + System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
  410 + }
  411 +
  412 + return ret;
  413 + }
  414 +
  415 + /** Reset buffer when finished. */
  416 + public void Done()
  417 + {
  418 + buffer = null;
  419 + bufline = null;
  420 + bufcolumn = null;
  421 + }
  422 +
  423 + /**
  424 + * Method to adjust line and column numbers for the start of a token.
  425 + */
  426 + public void adjustBeginLineColumn(int newLine, int newCol)
  427 + {
  428 + int start = tokenBegin;
  429 + int len;
  430 +
  431 + if (bufpos >= tokenBegin)
  432 + {
  433 + len = bufpos - tokenBegin + inBuf + 1;
  434 + }
  435 + else
  436 + {
  437 + len = bufsize - tokenBegin + bufpos + 1 + inBuf;
  438 + }
  439 +
  440 + int i = 0, j = 0, k = 0;
  441 + int nextColDiff = 0, columnDiff = 0;
  442 +
  443 + while (i < len && bufline[j = start % bufsize] == bufline[k = ++start % bufsize])
  444 + {
  445 + bufline[j] = newLine;
  446 + nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
  447 + bufcolumn[j] = newCol + columnDiff;
  448 + columnDiff = nextColDiff;
  449 + i++;
  450 + }
  451 +
  452 + if (i < len)
  453 + {
  454 + bufline[j] = newLine++;
  455 + bufcolumn[j] = newCol + columnDiff;
  456 +
  457 + while (i++ < len)
  458 + {
  459 + if (bufline[j = start % bufsize] != bufline[++start % bufsize])
  460 + bufline[j] = newLine++;
  461 + else
  462 + bufline[j] = newLine;
  463 + }
  464 + }
  465 +
  466 + line = bufline[j];
  467 + column = bufcolumn[j];
  468 + }
  469 +
  470 +}
  471 +/* JavaCC - OriginalChecksum=684019f26036db3f6d2af88727527a69 (do not edit this line) */
... ...
src/mtas/parser/cql/Token.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. Token.java Version 5.0 */
  2 +/* JavaCCOptions:TOKEN_EXTENDS=,KEEP_LINE_COL=null,SUPPORT_CLASS_VISIBILITY_PUBLIC=true */
  3 +package mtas.parser.cql;
  4 +
  5 +/**
  6 + * Describes the input token stream.
  7 + */
  8 +
  9 +public class Token implements java.io.Serializable {
  10 +
  11 + /**
  12 + * The version identifier for this Serializable class.
  13 + * Increment only if the <i>serialized</i> form of the
  14 + * class changes.
  15 + */
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /**
  19 + * An integer that describes the kind of this token. This numbering
  20 + * system is determined by JavaCCParser, and a table of these numbers is
  21 + * stored in the file ...Constants.java.
  22 + */
  23 + public int kind;
  24 +
  25 + /** The line number of the first character of this Token. */
  26 + public int beginLine;
  27 + /** The column number of the first character of this Token. */
  28 + public int beginColumn;
  29 + /** The line number of the last character of this Token. */
  30 + public int endLine;
  31 + /** The column number of the last character of this Token. */
  32 + public int endColumn;
  33 +
  34 + /**
  35 + * The string image of the token.
  36 + */
  37 + public String image;
  38 +
  39 + /**
  40 + * A reference to the next regular (non-special) token from the input
  41 + * stream. If this is the last token from the input stream, or if the
  42 + * token manager has not read tokens beyond this one, this field is
  43 + * set to null. This is true only if this token is also a regular
  44 + * token. Otherwise, see below for a description of the contents of
  45 + * this field.
  46 + */
  47 + public Token next;
  48 +
  49 + /**
  50 + * This field is used to access special tokens that occur prior to this
  51 + * token, but after the immediately preceding regular (non-special) token.
  52 + * If there are no such special tokens, this field is set to null.
  53 + * When there are more than one such special token, this field refers
  54 + * to the last of these special tokens, which in turn refers to the next
  55 + * previous special token through its specialToken field, and so on
  56 + * until the first special token (whose specialToken field is null).
  57 + * The next fields of special tokens refer to other special tokens that
  58 + * immediately follow it (without an intervening regular token). If there
  59 + * is no such token, this field is null.
  60 + */
  61 + public Token specialToken;
  62 +
  63 + /**
  64 + * An optional attribute value of the Token.
  65 + * Tokens which are not used as syntactic sugar will often contain
  66 + * meaningful values that will be used later on by the compiler or
  67 + * interpreter. This attribute value is often different from the image.
  68 + * Any subclass of Token that actually wants to return a non-null value can
  69 + * override this method as appropriate.
  70 + */
  71 + public Object getValue() {
  72 + return null;
  73 + }
  74 +
  75 + /**
  76 + * No-argument constructor
  77 + */
  78 + public Token() {}
  79 +
  80 + /**
  81 + * Constructs a new token for the specified Image.
  82 + */
  83 + public Token(int kind)
  84 + {
  85 + this(kind, null);
  86 + }
  87 +
  88 + /**
  89 + * Constructs a new token for the specified Image and Kind.
  90 + */
  91 + public Token(int kind, String image)
  92 + {
  93 + this.kind = kind;
  94 + this.image = image;
  95 + }
  96 +
  97 + /**
  98 + * Returns the image.
  99 + */
  100 + public String toString()
  101 + {
  102 + return image;
  103 + }
  104 +
  105 + /**
  106 + * Returns a new Token object, by default. However, if you want, you
  107 + * can create and return subclass objects based on the value of ofKind.
  108 + * Simply add the cases to the switch for all those special cases.
  109 + * For example, if you have a subclass of Token called IDToken that
  110 + * you want to create if ofKind is ID, simply add something like :
  111 + *
  112 + * case MyParserConstants.ID : return new IDToken(ofKind, image);
  113 + *
  114 + * to the following switch statement. Then you can cast matchedToken
  115 + * variable to the appropriate type and use sit in your lexical actions.
  116 + */
  117 + public static Token newToken(int ofKind, String image)
  118 + {
  119 + switch(ofKind)
  120 + {
  121 + default : return new Token(ofKind, image);
  122 + }
  123 + }
  124 +
  125 + public static Token newToken(int ofKind)
  126 + {
  127 + return newToken(ofKind, null);
  128 + }
  129 +
  130 +}
  131 +/* JavaCC - OriginalChecksum=e03311f40a067ab1c4ea0bcdd2b5d3be (do not edit this line) */
... ...
src/mtas/parser/cql/TokenMgrError.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
  2 +/* JavaCCOptions: */
  3 +package mtas.parser.cql;
  4 +
  5 +/** Token Manager Error. */
  6 +public class TokenMgrError extends Error
  7 +{
  8 +
  9 + /**
  10 + * The version identifier for this Serializable class.
  11 + * Increment only if the <i>serialized</i> form of the
  12 + * class changes.
  13 + */
  14 + private static final long serialVersionUID = 1L;
  15 +
  16 + /*
  17 + * Ordinals for various reasons why an Error of this type can be thrown.
  18 + */
  19 +
  20 + /**
  21 + * Lexical error occurred.
  22 + */
  23 + static final int LEXICAL_ERROR = 0;
  24 +
  25 + /**
  26 + * An attempt was made to create a second instance of a static token manager.
  27 + */
  28 + static final int STATIC_LEXER_ERROR = 1;
  29 +
  30 + /**
  31 + * Tried to change to an invalid lexical state.
  32 + */
  33 + static final int INVALID_LEXICAL_STATE = 2;
  34 +
  35 + /**
  36 + * Detected (and bailed out of) an infinite loop in the token manager.
  37 + */
  38 + static final int LOOP_DETECTED = 3;
  39 +
  40 + /**
  41 + * Indicates the reason why the exception is thrown. It will have
  42 + * one of the above 4 values.
  43 + */
  44 + int errorCode;
  45 +
  46 + /**
  47 + * Replaces unprintable characters by their escaped (or unicode escaped)
  48 + * equivalents in the given string
  49 + */
  50 + protected static final String addEscapes(String str) {
  51 + StringBuffer retval = new StringBuffer();
  52 + char ch;
  53 + for (int i = 0; i < str.length(); i++) {
  54 + switch (str.charAt(i))
  55 + {
  56 + case 0 :
  57 + continue;
  58 + case '\b':
  59 + retval.append("\\b");
  60 + continue;
  61 + case '\t':
  62 + retval.append("\\t");
  63 + continue;
  64 + case '\n':
  65 + retval.append("\\n");
  66 + continue;
  67 + case '\f':
  68 + retval.append("\\f");
  69 + continue;
  70 + case '\r':
  71 + retval.append("\\r");
  72 + continue;
  73 + case '\"':
  74 + retval.append("\\\"");
  75 + continue;
  76 + case '\'':
  77 + retval.append("\\\'");
  78 + continue;
  79 + case '\\':
  80 + retval.append("\\\\");
  81 + continue;
  82 + default:
  83 + if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
  84 + String s = "0000" + Integer.toString(ch, 16);
  85 + retval.append("\\u" + s.substring(s.length() - 4, s.length()));
  86 + } else {
  87 + retval.append(ch);
  88 + }
  89 + continue;
  90 + }
  91 + }
  92 + return retval.toString();
  93 + }
  94 +
  95 + /**
  96 + * Returns a detailed message for the Error when it is thrown by the
  97 + * token manager to indicate a lexical error.
  98 + * Parameters :
  99 + * EOFSeen : indicates if EOF caused the lexical error
  100 + * curLexState : lexical state in which this error occurred
  101 + * errorLine : line number when the error occurred
  102 + * errorColumn : column number when the error occurred
  103 + * errorAfter : prefix that was seen before this error occurred
  104 + * curchar : the offending character
  105 + * Note: You can customize the lexical error message by modifying this method.
  106 + */
  107 + protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
  108 + return("Lexical error at line " +
  109 + errorLine + ", column " +
  110 + errorColumn + ". Encountered: " +
  111 + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") +
  112 + "after : \"" + addEscapes(errorAfter) + "\"");
  113 + }
  114 +
  115 + /**
  116 + * You can also modify the body of this method to customize your error messages.
  117 + * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not
  118 + * of end-users concern, so you can return something like :
  119 + *
  120 + * "Internal Error : Please file a bug report .... "
  121 + *
  122 + * from this method for such cases in the release version of your parser.
  123 + */
  124 + public String getMessage() {
  125 + return super.getMessage();
  126 + }
  127 +
  128 + /*
  129 + * Constructors of various flavors follow.
  130 + */
  131 +
  132 + /** No arg constructor. */
  133 + public TokenMgrError() {
  134 + }
  135 +
  136 + /** Constructor with message and reason. */
  137 + public TokenMgrError(String message, int reason) {
  138 + super(message);
  139 + errorCode = reason;
  140 + }
  141 +
  142 + /** Full Constructor. */
  143 + public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
  144 + this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
  145 + }
  146 +}
  147 +/* JavaCC - OriginalChecksum=e6fb0e781afa8bd7df734ee8575150b6 (do not edit this line) */
... ...