Commit cac6601c611fd300b075447ee1eb8299e5bffc90

Authored by Matthijs Brouwer
1 parent ca49b0d7

update

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) */
... ...
src/mtas/parser/function/MtasFunctionParser.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. MtasFunctionParser.java */
  2 +package mtas.parser.function;
  3 +import mtas.codec.util.CodecUtil;
  4 +import mtas.parser.function.util.MtasFunctionParserFunction;
  5 +import mtas.parser.function.util.MtasFunctionParserFunctionBasic;
  6 +import mtas.parser.function.util.MtasFunctionParserItem;
  7 +import java.io.IOException;
  8 +
  9 +public class MtasFunctionParser implements MtasFunctionParserConstants {
  10 + public MtasFunctionParserFunction parse() throws ParseException
  11 + {
  12 + MtasFunctionParserFunction pf = parserFunction();
  13 + pf.close();
  14 + return pf;
  15 + }
  16 +
  17 + final private MtasFunctionParserFunction parserFunction() throws ParseException, ParseException {
  18 + MtasFunctionParserFunction pf;
  19 + pf = parserFunctionBasic();
  20 + jj_consume_token(0);
  21 + {if (true) return pf;}
  22 + throw new Error("Missing return statement in function");
  23 + }
  24 +
  25 + final private MtasFunctionParserFunction parserFunctionBasic() throws ParseException, ParseException {
  26 + Token v, operator;
  27 + long vLong;
  28 + double vDouble;
  29 + MtasFunctionParserItem item;
  30 + MtasFunctionParserFunctionBasic pf;
  31 + item = parserFunctionItem();
  32 + pf = new MtasFunctionParserFunctionBasic(item);
  33 + label_1:
  34 + while (true) {
  35 + if (jj_2_1(100)) {
  36 + ;
  37 + } else {
  38 + break label_1;
  39 + }
  40 + if (jj_2_2(100)) {
  41 + operator = jj_consume_token(BASIC_OPERATOR_ADD);
  42 + item = parserFunctionItem();
  43 + pf.add(item);
  44 + } else if (jj_2_3(100)) {
  45 + operator = jj_consume_token(BASIC_OPERATOR_SUBTRACT);
  46 + item = parserFunctionItem();
  47 + pf.subtract(item);
  48 + } else if (jj_2_4(100)) {
  49 + operator = jj_consume_token(BASIC_OPERATOR_MULTIPLY);
  50 + item = parserFunctionItem();
  51 + pf.multiply(item);
  52 + } else if (jj_2_5(100)) {
  53 + operator = jj_consume_token(BASIC_OPERATOR_DIVIDE);
  54 + item = parserFunctionItem();
  55 + pf.divide(item);
  56 + } else if (jj_2_6(100)) {
  57 + operator = jj_consume_token(BASIC_OPERATOR_POWER);
  58 + item = parserFunctionItem();
  59 + pf.power(item);
  60 + } else if (jj_2_7(100)) {
  61 + v = jj_consume_token(LONG);
  62 + vLong = Long.parseLong(v.image);
  63 + if (vLong > 0)
  64 + {
  65 + {if (true) throw new ParseException("only negative");}
  66 + }
  67 + else
  68 + {
  69 + item = new MtasFunctionParserItem(MtasFunctionParserItem.TYPE_CONSTANT_LONG, - 1 * vLong);
  70 + pf.subtract(item);
  71 + }
  72 + } else if (jj_2_8(100)) {
  73 + v = jj_consume_token(DOUBLE);
  74 + vDouble = Double.parseDouble(v.image);
  75 + if (vDouble > 0)
  76 + {
  77 + {if (true) throw new ParseException("only negative");}
  78 + }
  79 + else
  80 + {
  81 + item = new MtasFunctionParserItem(MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE, - 1 * vDouble);
  82 + pf.subtract(item);
  83 + }
  84 + } else {
  85 + jj_consume_token(-1);
  86 + throw new ParseException();
  87 + }
  88 + }
  89 + {if (true) return pf;}
  90 + throw new Error("Missing return statement in function");
  91 + }
  92 +
  93 + final private MtasFunctionParserItem parserFunctionItem() throws ParseException, ParseException {
  94 + Token v;
  95 + long vLong;
  96 + int vInt;
  97 + double vDouble;
  98 + String type;
  99 + MtasFunctionParserItem item;
  100 + MtasFunctionParserFunction pf;
  101 + if (jj_2_9(100)) {
  102 + v = jj_consume_token(VARIABLE);
  103 + vInt = Integer.parseInt(v.image.substring(2));
  104 + item = new MtasFunctionParserItem(MtasFunctionParserItem.TYPE_ARGUMENT, vInt);
  105 + {if (true) return item;}
  106 + } else if (jj_2_10(100)) {
  107 + jj_consume_token(N);
  108 + item = new MtasFunctionParserItem(MtasFunctionParserItem.TYPE_N);
  109 + {if (true) return item;}
  110 + } else if (jj_2_11(100)) {
  111 + v = jj_consume_token(LONG);
  112 + vLong = Long.parseLong(v.image);
  113 + item = new MtasFunctionParserItem(MtasFunctionParserItem.TYPE_CONSTANT_LONG, vLong);
  114 + {if (true) return item;}
  115 + } else if (jj_2_12(100)) {
  116 + v = jj_consume_token(DOUBLE);
  117 + vDouble = Double.parseDouble(v.image);
  118 + item = new MtasFunctionParserItem(MtasFunctionParserItem.TYPE_CONSTANT_DOUBLE, vDouble);
  119 + {if (true) return item;}
  120 + } else if (jj_2_13(100)) {
  121 + jj_consume_token(BRACKET_START);
  122 + pf = parserFunctionBasic();
  123 + jj_consume_token(BRACKET_END);
  124 + type = pf.getType();
  125 + if (type.equals(CodecUtil.DATA_TYPE_LONG))
  126 + {
  127 + item = new MtasFunctionParserItem(MtasFunctionParserItem.TYPE_PARSER_LONG, pf);
  128 + {if (true) return item;}
  129 + }
  130 + else if (type.equals(CodecUtil.DATA_TYPE_DOUBLE))
  131 + {
  132 + item = new MtasFunctionParserItem(MtasFunctionParserItem.TYPE_PARSER_DOUBLE, pf);
  133 + {if (true) return item;}
  134 + }
  135 + else
  136 + {
  137 + {if (true) throw new ParseException("unknown dataType");}
  138 + }
  139 + } else {
  140 + jj_consume_token(-1);
  141 + throw new ParseException();
  142 + }
  143 + {if (true) throw new ParseException("unknown type");}
  144 + throw new Error("Missing return statement in function");
  145 + }
  146 +
  147 + private boolean jj_2_1(int xla) {
  148 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  149 + try { return !jj_3_1(); }
  150 + catch(LookaheadSuccess ls) { return true; }
  151 + finally { jj_save(0, xla); }
  152 + }
  153 +
  154 + private boolean jj_2_2(int xla) {
  155 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  156 + try { return !jj_3_2(); }
  157 + catch(LookaheadSuccess ls) { return true; }
  158 + finally { jj_save(1, xla); }
  159 + }
  160 +
  161 + private boolean jj_2_3(int xla) {
  162 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  163 + try { return !jj_3_3(); }
  164 + catch(LookaheadSuccess ls) { return true; }
  165 + finally { jj_save(2, xla); }
  166 + }
  167 +
  168 + private boolean jj_2_4(int xla) {
  169 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  170 + try { return !jj_3_4(); }
  171 + catch(LookaheadSuccess ls) { return true; }
  172 + finally { jj_save(3, xla); }
  173 + }
  174 +
  175 + private boolean jj_2_5(int xla) {
  176 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  177 + try { return !jj_3_5(); }
  178 + catch(LookaheadSuccess ls) { return true; }
  179 + finally { jj_save(4, xla); }
  180 + }
  181 +
  182 + private boolean jj_2_6(int xla) {
  183 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  184 + try { return !jj_3_6(); }
  185 + catch(LookaheadSuccess ls) { return true; }
  186 + finally { jj_save(5, xla); }
  187 + }
  188 +
  189 + private boolean jj_2_7(int xla) {
  190 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  191 + try { return !jj_3_7(); }
  192 + catch(LookaheadSuccess ls) { return true; }
  193 + finally { jj_save(6, xla); }
  194 + }
  195 +
  196 + private boolean jj_2_8(int xla) {
  197 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  198 + try { return !jj_3_8(); }
  199 + catch(LookaheadSuccess ls) { return true; }
  200 + finally { jj_save(7, xla); }
  201 + }
  202 +
  203 + private boolean jj_2_9(int xla) {
  204 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  205 + try { return !jj_3_9(); }
  206 + catch(LookaheadSuccess ls) { return true; }
  207 + finally { jj_save(8, xla); }
  208 + }
  209 +
  210 + private boolean jj_2_10(int xla) {
  211 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  212 + try { return !jj_3_10(); }
  213 + catch(LookaheadSuccess ls) { return true; }
  214 + finally { jj_save(9, xla); }
  215 + }
  216 +
  217 + private boolean jj_2_11(int xla) {
  218 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  219 + try { return !jj_3_11(); }
  220 + catch(LookaheadSuccess ls) { return true; }
  221 + finally { jj_save(10, xla); }
  222 + }
  223 +
  224 + private boolean jj_2_12(int xla) {
  225 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  226 + try { return !jj_3_12(); }
  227 + catch(LookaheadSuccess ls) { return true; }
  228 + finally { jj_save(11, xla); }
  229 + }
  230 +
  231 + private boolean jj_2_13(int xla) {
  232 + jj_la = xla; jj_lastpos = jj_scanpos = token;
  233 + try { return !jj_3_13(); }
  234 + catch(LookaheadSuccess ls) { return true; }
  235 + finally { jj_save(12, xla); }
  236 + }
  237 +
  238 + private boolean jj_3R_2() {
  239 + Token xsp;
  240 + xsp = jj_scanpos;
  241 + if (jj_3_9()) {
  242 + jj_scanpos = xsp;
  243 + if (jj_3_10()) {
  244 + jj_scanpos = xsp;
  245 + if (jj_3_11()) {
  246 + jj_scanpos = xsp;
  247 + if (jj_3_12()) {
  248 + jj_scanpos = xsp;
  249 + if (jj_3_13()) return true;
  250 + }
  251 + }
  252 + }
  253 + }
  254 + return false;
  255 + }
  256 +
  257 + private boolean jj_3_12() {
  258 + if (jj_scan_token(DOUBLE)) return true;
  259 + return false;
  260 + }
  261 +
  262 + private boolean jj_3_6() {
  263 + if (jj_scan_token(BASIC_OPERATOR_POWER)) return true;
  264 + if (jj_3R_2()) return true;
  265 + return false;
  266 + }
  267 +
  268 + private boolean jj_3_1() {
  269 + Token xsp;
  270 + xsp = jj_scanpos;
  271 + if (jj_3_2()) {
  272 + jj_scanpos = xsp;
  273 + if (jj_3_3()) {
  274 + jj_scanpos = xsp;
  275 + if (jj_3_4()) {
  276 + jj_scanpos = xsp;
  277 + if (jj_3_5()) {
  278 + jj_scanpos = xsp;
  279 + if (jj_3_6()) {
  280 + jj_scanpos = xsp;
  281 + if (jj_3_7()) {
  282 + jj_scanpos = xsp;
  283 + if (jj_3_8()) return true;
  284 + }
  285 + }
  286 + }
  287 + }
  288 + }
  289 + }
  290 + return false;
  291 + }
  292 +
  293 + private boolean jj_3_2() {
  294 + if (jj_scan_token(BASIC_OPERATOR_ADD)) return true;
  295 + if (jj_3R_2()) return true;
  296 + return false;
  297 + }
  298 +
  299 + private boolean jj_3_8() {
  300 + if (jj_scan_token(DOUBLE)) return true;
  301 + return false;
  302 + }
  303 +
  304 + private boolean jj_3_11() {
  305 + if (jj_scan_token(LONG)) return true;
  306 + return false;
  307 + }
  308 +
  309 + private boolean jj_3_5() {
  310 + if (jj_scan_token(BASIC_OPERATOR_DIVIDE)) return true;
  311 + if (jj_3R_2()) return true;
  312 + return false;
  313 + }
  314 +
  315 + private boolean jj_3R_3() {
  316 + if (jj_3R_2()) return true;
  317 + Token xsp;
  318 + while (true) {
  319 + xsp = jj_scanpos;
  320 + if (jj_3_1()) { jj_scanpos = xsp; break; }
  321 + }
  322 + return false;
  323 + }
  324 +
  325 + private boolean jj_3_10() {
  326 + if (jj_scan_token(N)) return true;
  327 + return false;
  328 + }
  329 +
  330 + private boolean jj_3_4() {
  331 + if (jj_scan_token(BASIC_OPERATOR_MULTIPLY)) return true;
  332 + if (jj_3R_2()) return true;
  333 + return false;
  334 + }
  335 +
  336 + private boolean jj_3_13() {
  337 + if (jj_scan_token(BRACKET_START)) return true;
  338 + if (jj_3R_3()) return true;
  339 + if (jj_scan_token(BRACKET_END)) return true;
  340 + return false;
  341 + }
  342 +
  343 + private boolean jj_3_7() {
  344 + if (jj_scan_token(LONG)) return true;
  345 + return false;
  346 + }
  347 +
  348 + private boolean jj_3_9() {
  349 + if (jj_scan_token(VARIABLE)) return true;
  350 + return false;
  351 + }
  352 +
  353 + private boolean jj_3_3() {
  354 + if (jj_scan_token(BASIC_OPERATOR_SUBTRACT)) return true;
  355 + if (jj_3R_2()) return true;
  356 + return false;
  357 + }
  358 +
  359 + /** Generated Token Manager. */
  360 + public MtasFunctionParserTokenManager token_source;
  361 + SimpleCharStream jj_input_stream;
  362 + /** Current token. */
  363 + public Token token;
  364 + /** Next token. */
  365 + public Token jj_nt;
  366 + private int jj_ntk;
  367 + private Token jj_scanpos, jj_lastpos;
  368 + private int jj_la;
  369 + private int jj_gen;
  370 + final private int[] jj_la1 = new int[0];
  371 + static private int[] jj_la1_0;
  372 + static {
  373 + jj_la1_init_0();
  374 + }
  375 + private static void jj_la1_init_0() {
  376 + jj_la1_0 = new int[] {};
  377 + }
  378 + final private JJCalls[] jj_2_rtns = new JJCalls[13];
  379 + private boolean jj_rescan = false;
  380 + private int jj_gc = 0;
  381 +
  382 + /** Constructor with InputStream. */
  383 + public MtasFunctionParser(java.io.InputStream stream) {
  384 + this(stream, null);
  385 + }
  386 + /** Constructor with InputStream and supplied encoding */
  387 + public MtasFunctionParser(java.io.InputStream stream, String encoding) {
  388 + try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
  389 + token_source = new MtasFunctionParserTokenManager(jj_input_stream);
  390 + token = new Token();
  391 + jj_ntk = -1;
  392 + jj_gen = 0;
  393 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  394 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  395 + }
  396 +
  397 + /** Reinitialise. */
  398 + public void ReInit(java.io.InputStream stream) {
  399 + ReInit(stream, null);
  400 + }
  401 + /** Reinitialise. */
  402 + public void ReInit(java.io.InputStream stream, String encoding) {
  403 + try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
  404 + token_source.ReInit(jj_input_stream);
  405 + token = new Token();
  406 + jj_ntk = -1;
  407 + jj_gen = 0;
  408 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  409 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  410 + }
  411 +
  412 + /** Constructor. */
  413 + public MtasFunctionParser(java.io.Reader stream) {
  414 + jj_input_stream = new SimpleCharStream(stream, 1, 1);
  415 + token_source = new MtasFunctionParserTokenManager(jj_input_stream);
  416 + token = new Token();
  417 + jj_ntk = -1;
  418 + jj_gen = 0;
  419 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  420 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  421 + }
  422 +
  423 + /** Reinitialise. */
  424 + public void ReInit(java.io.Reader stream) {
  425 + jj_input_stream.ReInit(stream, 1, 1);
  426 + token_source.ReInit(jj_input_stream);
  427 + token = new Token();
  428 + jj_ntk = -1;
  429 + jj_gen = 0;
  430 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  431 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  432 + }
  433 +
  434 + /** Constructor with generated Token Manager. */
  435 + public MtasFunctionParser(MtasFunctionParserTokenManager tm) {
  436 + token_source = tm;
  437 + token = new Token();
  438 + jj_ntk = -1;
  439 + jj_gen = 0;
  440 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  441 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  442 + }
  443 +
  444 + /** Reinitialise. */
  445 + public void ReInit(MtasFunctionParserTokenManager tm) {
  446 + token_source = tm;
  447 + token = new Token();
  448 + jj_ntk = -1;
  449 + jj_gen = 0;
  450 + for (int i = 0; i < 0; i++) jj_la1[i] = -1;
  451 + for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
  452 + }
  453 +
  454 + private Token jj_consume_token(int kind) throws ParseException {
  455 + Token oldToken;
  456 + if ((oldToken = token).next != null) token = token.next;
  457 + else token = token.next = token_source.getNextToken();
  458 + jj_ntk = -1;
  459 + if (token.kind == kind) {
  460 + jj_gen++;
  461 + if (++jj_gc > 100) {
  462 + jj_gc = 0;
  463 + for (int i = 0; i < jj_2_rtns.length; i++) {
  464 + JJCalls c = jj_2_rtns[i];
  465 + while (c != null) {
  466 + if (c.gen < jj_gen) c.first = null;
  467 + c = c.next;
  468 + }
  469 + }
  470 + }
  471 + return token;
  472 + }
  473 + token = oldToken;
  474 + jj_kind = kind;
  475 + throw generateParseException();
  476 + }
  477 +
  478 + static private final class LookaheadSuccess extends java.lang.Error { }
  479 + final private LookaheadSuccess jj_ls = new LookaheadSuccess();
  480 + private boolean jj_scan_token(int kind) {
  481 + if (jj_scanpos == jj_lastpos) {
  482 + jj_la--;
  483 + if (jj_scanpos.next == null) {
  484 + jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
  485 + } else {
  486 + jj_lastpos = jj_scanpos = jj_scanpos.next;
  487 + }
  488 + } else {
  489 + jj_scanpos = jj_scanpos.next;
  490 + }
  491 + if (jj_rescan) {
  492 + int i = 0; Token tok = token;
  493 + while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
  494 + if (tok != null) jj_add_error_token(kind, i);
  495 + }
  496 + if (jj_scanpos.kind != kind) return true;
  497 + if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
  498 + return false;
  499 + }
  500 +
  501 +
  502 +/** Get the next Token. */
  503 + final public Token getNextToken() {
  504 + if (token.next != null) token = token.next;
  505 + else token = token.next = token_source.getNextToken();
  506 + jj_ntk = -1;
  507 + jj_gen++;
  508 + return token;
  509 + }
  510 +
  511 +/** Get the specific Token. */
  512 + final public Token getToken(int index) {
  513 + Token t = token;
  514 + for (int i = 0; i < index; i++) {
  515 + if (t.next != null) t = t.next;
  516 + else t = t.next = token_source.getNextToken();
  517 + }
  518 + return t;
  519 + }
  520 +
  521 + private int jj_ntk() {
  522 + if ((jj_nt=token.next) == null)
  523 + return (jj_ntk = (token.next=token_source.getNextToken()).kind);
  524 + else
  525 + return (jj_ntk = jj_nt.kind);
  526 + }
  527 +
  528 + private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
  529 + private int[] jj_expentry;
  530 + private int jj_kind = -1;
  531 + private int[] jj_lasttokens = new int[100];
  532 + private int jj_endpos;
  533 +
  534 + private void jj_add_error_token(int kind, int pos) {
  535 + if (pos >= 100) return;
  536 + if (pos == jj_endpos + 1) {
  537 + jj_lasttokens[jj_endpos++] = kind;
  538 + } else if (jj_endpos != 0) {
  539 + jj_expentry = new int[jj_endpos];
  540 + for (int i = 0; i < jj_endpos; i++) {
  541 + jj_expentry[i] = jj_lasttokens[i];
  542 + }
  543 + jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) {
  544 + int[] oldentry = (int[])(it.next());
  545 + if (oldentry.length == jj_expentry.length) {
  546 + for (int i = 0; i < jj_expentry.length; i++) {
  547 + if (oldentry[i] != jj_expentry[i]) {
  548 + continue jj_entries_loop;
  549 + }
  550 + }
  551 + jj_expentries.add(jj_expentry);
  552 + break jj_entries_loop;
  553 + }
  554 + }
  555 + if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
  556 + }
  557 + }
  558 +
  559 + /** Generate ParseException. */
  560 + public ParseException generateParseException() {
  561 + jj_expentries.clear();
  562 + boolean[] la1tokens = new boolean[16];
  563 + if (jj_kind >= 0) {
  564 + la1tokens[jj_kind] = true;
  565 + jj_kind = -1;
  566 + }
  567 + for (int i = 0; i < 0; i++) {
  568 + if (jj_la1[i] == jj_gen) {
  569 + for (int j = 0; j < 32; j++) {
  570 + if ((jj_la1_0[i] & (1<<j)) != 0) {
  571 + la1tokens[j] = true;
  572 + }
  573 + }
  574 + }
  575 + }
  576 + for (int i = 0; i < 16; i++) {
  577 + if (la1tokens[i]) {
  578 + jj_expentry = new int[1];
  579 + jj_expentry[0] = i;
  580 + jj_expentries.add(jj_expentry);
  581 + }
  582 + }
  583 + jj_endpos = 0;
  584 + jj_rescan_token();
  585 + jj_add_error_token(0, 0);
  586 + int[][] exptokseq = new int[jj_expentries.size()][];
  587 + for (int i = 0; i < jj_expentries.size(); i++) {
  588 + exptokseq[i] = jj_expentries.get(i);
  589 + }
  590 + return new ParseException(token, exptokseq, tokenImage);
  591 + }
  592 +
  593 + /** Enable tracing. */
  594 + final public void enable_tracing() {
  595 + }
  596 +
  597 + /** Disable tracing. */
  598 + final public void disable_tracing() {
  599 + }
  600 +
  601 + private void jj_rescan_token() {
  602 + jj_rescan = true;
  603 + for (int i = 0; i < 13; i++) {
  604 + try {
  605 + JJCalls p = jj_2_rtns[i];
  606 + do {
  607 + if (p.gen > jj_gen) {
  608 + jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
  609 + switch (i) {
  610 + case 0: jj_3_1(); break;
  611 + case 1: jj_3_2(); break;
  612 + case 2: jj_3_3(); break;
  613 + case 3: jj_3_4(); break;
  614 + case 4: jj_3_5(); break;
  615 + case 5: jj_3_6(); break;
  616 + case 6: jj_3_7(); break;
  617 + case 7: jj_3_8(); break;
  618 + case 8: jj_3_9(); break;
  619 + case 9: jj_3_10(); break;
  620 + case 10: jj_3_11(); break;
  621 + case 11: jj_3_12(); break;
  622 + case 12: jj_3_13(); break;
  623 + }
  624 + }
  625 + p = p.next;
  626 + } while (p != null);
  627 + } catch(LookaheadSuccess ls) { }
  628 + }
  629 + jj_rescan = false;
  630 + }
  631 +
  632 + private void jj_save(int index, int xla) {
  633 + JJCalls p = jj_2_rtns[index];
  634 + while (p.gen > jj_gen) {
  635 + if (p.next == null) { p = p.next = new JJCalls(); break; }
  636 + p = p.next;
  637 + }
  638 + p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
  639 + }
  640 +
  641 + static final class JJCalls {
  642 + int gen;
  643 + Token first;
  644 + int arg;
  645 + JJCalls next;
  646 + }
  647 +
  648 +}
... ...
src/mtas/parser/function/MtasFunctionParserConstants.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. MtasFunctionParserConstants.java */
  2 +package mtas.parser.function;
  3 +
  4 +
  5 +/**
  6 + * Token literal values and constants.
  7 + * Generated by org.javacc.parser.OtherFilesGen#start()
  8 + */
  9 +public interface MtasFunctionParserConstants {
  10 +
  11 + /** End of File. */
  12 + int EOF = 0;
  13 + /** RegularExpression Id. */
  14 + int VARIABLE = 5;
  15 + /** RegularExpression Id. */
  16 + int LONG = 6;
  17 + /** RegularExpression Id. */
  18 + int DOUBLE = 7;
  19 + /** RegularExpression Id. */
  20 + int N = 8;
  21 + /** RegularExpression Id. */
  22 + int BASIC_OPERATOR_ADD = 9;
  23 + /** RegularExpression Id. */
  24 + int BASIC_OPERATOR_SUBTRACT = 10;
  25 + /** RegularExpression Id. */
  26 + int BASIC_OPERATOR_MULTIPLY = 11;
  27 + /** RegularExpression Id. */
  28 + int BASIC_OPERATOR_DIVIDE = 12;
  29 + /** RegularExpression Id. */
  30 + int BASIC_OPERATOR_POWER = 13;
  31 + /** RegularExpression Id. */
  32 + int BRACKET_START = 14;
  33 + /** RegularExpression Id. */
  34 + int BRACKET_END = 15;
  35 +
  36 + /** Lexical state. */
  37 + int DEFAULT = 0;
  38 +
  39 + /** Literal token values. */
  40 + String[] tokenImage = {
  41 + "<EOF>",
  42 + "\" \"",
  43 + "\"\\r\"",
  44 + "\"\\t\"",
  45 + "\"\\n\"",
  46 + "<VARIABLE>",
  47 + "<LONG>",
  48 + "<DOUBLE>",
  49 + "\"$n\"",
  50 + "\"+\"",
  51 + "\"-\"",
  52 + "\"*\"",
  53 + "\"/\"",
  54 + "\"^\"",
  55 + "\"(\"",
  56 + "\")\"",
  57 + };
  58 +
  59 +}
... ...
src/mtas/parser/function/MtasFunctionParserTokenManager.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. MtasFunctionParserTokenManager.java */
  2 +package mtas.parser.function;
  3 +import mtas.codec.util.CodecUtil;
  4 +import mtas.parser.function.util.MtasFunctionParserFunction;
  5 +import mtas.parser.function.util.MtasFunctionParserFunctionBasic;
  6 +import mtas.parser.function.util.MtasFunctionParserItem;
  7 +import java.io.IOException;
  8 +
  9 +/** Token Manager. */
  10 +public class MtasFunctionParserTokenManager implements MtasFunctionParserConstants
  11 +{
  12 +
  13 + /** Debug output. */
  14 + public java.io.PrintStream debugStream = System.out;
  15 + /** Set debug output. */
  16 + public void setDebugStream(java.io.PrintStream ds) { debugStream = ds; }
  17 +private final int jjStopStringLiteralDfa_0(int pos, long active0)
  18 +{
  19 + switch (pos)
  20 + {
  21 + case 0:
  22 + if ((active0 & 0x100L) != 0L)
  23 + return 0;
  24 + if ((active0 & 0x400L) != 0L)
  25 + return 4;
  26 + return -1;
  27 + default :
  28 + return -1;
  29 + }
  30 +}
  31 +private final int jjStartNfa_0(int pos, long active0)
  32 +{
  33 + return jjMoveNfa_0(jjStopStringLiteralDfa_0(pos, active0), pos + 1);
  34 +}
  35 +private int jjStopAtPos(int pos, int kind)
  36 +{
  37 + jjmatchedKind = kind;
  38 + jjmatchedPos = pos;
  39 + return pos + 1;
  40 +}
  41 +private int jjMoveStringLiteralDfa0_0()
  42 +{
  43 + switch(curChar)
  44 + {
  45 + case 36:
  46 + return jjMoveStringLiteralDfa1_0(0x100L);
  47 + case 40:
  48 + return jjStopAtPos(0, 14);
  49 + case 41:
  50 + return jjStopAtPos(0, 15);
  51 + case 42:
  52 + return jjStopAtPos(0, 11);
  53 + case 43:
  54 + return jjStopAtPos(0, 9);
  55 + case 45:
  56 + return jjStartNfaWithStates_0(0, 10, 4);
  57 + case 47:
  58 + return jjStopAtPos(0, 12);
  59 + case 94:
  60 + return jjStopAtPos(0, 13);
  61 + default :
  62 + return jjMoveNfa_0(2, 0);
  63 + }
  64 +}
  65 +private int jjMoveStringLiteralDfa1_0(long active0)
  66 +{
  67 + try { curChar = input_stream.readChar(); }
  68 + catch(java.io.IOException e) {
  69 + jjStopStringLiteralDfa_0(0, active0);
  70 + return 1;
  71 + }
  72 + switch(curChar)
  73 + {
  74 + case 110:
  75 + if ((active0 & 0x100L) != 0L)
  76 + return jjStopAtPos(1, 8);
  77 + break;
  78 + default :
  79 + break;
  80 + }
  81 + return jjStartNfa_0(0, active0);
  82 +}
  83 +private int jjStartNfaWithStates_0(int pos, int kind, int state)
  84 +{
  85 + jjmatchedKind = kind;
  86 + jjmatchedPos = pos;
  87 + try { curChar = input_stream.readChar(); }
  88 + catch(java.io.IOException e) { return pos + 1; }
  89 + return jjMoveNfa_0(state, pos + 1);
  90 +}
  91 +private int jjMoveNfa_0(int startState, int curPos)
  92 +{
  93 + int startsAt = 0;
  94 + jjnewStateCnt = 14;
  95 + int i = 1;
  96 + jjstateSet[0] = startState;
  97 + int kind = 0x7fffffff;
  98 + for (;;)
  99 + {
  100 + if (++jjround == 0x7fffffff)
  101 + ReInitRounds();
  102 + if (curChar < 64)
  103 + {
  104 + long l = 1L << curChar;
  105 + do
  106 + {
  107 + switch(jjstateSet[--i])
  108 + {
  109 + case 4:
  110 + if ((0x3fe000000000000L & l) != 0L)
  111 + jjCheckNAddTwoStates(8, 9);
  112 + else if (curChar == 48)
  113 + jjCheckNAdd(9);
  114 + if ((0x3fe000000000000L & l) != 0L)
  115 + {
  116 + if (kind > 6)
  117 + kind = 6;
  118 + jjCheckNAdd(5);
  119 + }
  120 + else if (curChar == 48)
  121 + {
  122 + if (kind > 6)
  123 + kind = 6;
  124 + }
  125 + break;
  126 + case 2:
  127 + if ((0x3fe000000000000L & l) != 0L)
  128 + {
  129 + if (kind > 6)
  130 + kind = 6;
  131 + jjCheckNAddStates(0, 2);
  132 + }
  133 + else if (curChar == 48)
  134 + {
  135 + if (kind > 6)
  136 + kind = 6;
  137 + jjCheckNAdd(9);
  138 + }
  139 + else if (curChar == 45)
  140 + jjAddStates(3, 6);
  141 + else if (curChar == 36)
  142 + jjstateSet[jjnewStateCnt++] = 0;
  143 + break;
  144 + case 1:
  145 + if ((0x3ff000000000000L & l) == 0L)
  146 + break;
  147 + if (kind > 5)
  148 + kind = 5;
  149 + jjstateSet[jjnewStateCnt++] = 1;
  150 + break;
  151 + case 3:
  152 + if (curChar == 45)
  153 + jjAddStates(3, 6);
  154 + break;
  155 + case 5:
  156 + if ((0x3ff000000000000L & l) == 0L)
  157 + break;
  158 + if (kind > 6)
  159 + kind = 6;
  160 + jjCheckNAdd(5);
  161 + break;
  162 + case 6:
  163 + if (curChar == 48 && kind > 6)
  164 + kind = 6;
  165 + break;
  166 + case 7:
  167 + if ((0x3fe000000000000L & l) != 0L)
  168 + jjCheckNAddTwoStates(8, 9);
  169 + break;
  170 + case 8:
  171 + if ((0x3ff000000000000L & l) != 0L)
  172 + jjCheckNAddTwoStates(8, 9);
  173 + break;
  174 + case 9:
  175 + if (curChar == 46)
  176 + jjCheckNAdd(10);
  177 + break;
  178 + case 10:
  179 + if ((0x3ff000000000000L & l) == 0L)
  180 + break;
  181 + if (kind > 7)
  182 + kind = 7;
  183 + jjCheckNAdd(10);
  184 + break;
  185 + case 11:
  186 + if (curChar == 48)
  187 + jjCheckNAdd(9);
  188 + break;
  189 + case 12:
  190 + if ((0x3fe000000000000L & l) == 0L)
  191 + break;
  192 + if (kind > 6)
  193 + kind = 6;
  194 + jjCheckNAddStates(0, 2);
  195 + break;
  196 + case 13:
  197 + if (curChar != 48)
  198 + break;
  199 + if (kind > 6)
  200 + kind = 6;
  201 + jjCheckNAdd(9);
  202 + break;
  203 + default : break;
  204 + }
  205 + } while(i != startsAt);
  206 + }
  207 + else if (curChar < 128)
  208 + {
  209 + long l = 1L << (curChar & 077);
  210 + do
  211 + {
  212 + switch(jjstateSet[--i])
  213 + {
  214 + case 0:
  215 + if (curChar == 113)
  216 + jjstateSet[jjnewStateCnt++] = 1;
  217 + break;
  218 + default : break;
  219 + }
  220 + } while(i != startsAt);
  221 + }
  222 + else
  223 + {
  224 + int hiByte = (int)(curChar >> 8);
  225 + int i1 = hiByte >> 6;
  226 + long l1 = 1L << (hiByte & 077);
  227 + int i2 = (curChar & 0xff) >> 6;
  228 + long l2 = 1L << (curChar & 077);
  229 + do
  230 + {
  231 + switch(jjstateSet[--i])
  232 + {
  233 + default : break;
  234 + }
  235 + } while(i != startsAt);
  236 + }
  237 + if (kind != 0x7fffffff)
  238 + {
  239 + jjmatchedKind = kind;
  240 + jjmatchedPos = curPos;
  241 + kind = 0x7fffffff;
  242 + }
  243 + ++curPos;
  244 + if ((i = jjnewStateCnt) == (startsAt = 14 - (jjnewStateCnt = startsAt)))
  245 + return curPos;
  246 + try { curChar = input_stream.readChar(); }
  247 + catch(java.io.IOException e) { return curPos; }
  248 + }
  249 +}
  250 +static final int[] jjnextStates = {
  251 + 5, 8, 9, 4, 6, 7, 11,
  252 +};
  253 +
  254 +/** Token literal values. */
  255 +public static final String[] jjstrLiteralImages = {
  256 +"", null, null, null, null, null, null, null, "\44\156", "\53", "\55", "\52",
  257 +"\57", "\136", "\50", "\51", };
  258 +
  259 +/** Lexer state names. */
  260 +public static final String[] lexStateNames = {
  261 + "DEFAULT",
  262 +};
  263 +static final long[] jjtoToken = {
  264 + 0xffe1L,
  265 +};
  266 +static final long[] jjtoSkip = {
  267 + 0x1eL,
  268 +};
  269 +protected SimpleCharStream input_stream;
  270 +private final int[] jjrounds = new int[14];
  271 +private final int[] jjstateSet = new int[28];
  272 +protected char curChar;
  273 +/** Constructor. */
  274 +public MtasFunctionParserTokenManager(SimpleCharStream stream){
  275 + if (SimpleCharStream.staticFlag)
  276 + throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
  277 + input_stream = stream;
  278 +}
  279 +
  280 +/** Constructor. */
  281 +public MtasFunctionParserTokenManager(SimpleCharStream stream, int lexState){
  282 + this(stream);
  283 + SwitchTo(lexState);
  284 +}
  285 +
  286 +/** Reinitialise parser. */
  287 +public void ReInit(SimpleCharStream stream)
  288 +{
  289 + jjmatchedPos = jjnewStateCnt = 0;
  290 + curLexState = defaultLexState;
  291 + input_stream = stream;
  292 + ReInitRounds();
  293 +}
  294 +private void ReInitRounds()
  295 +{
  296 + int i;
  297 + jjround = 0x80000001;
  298 + for (i = 14; i-- > 0;)
  299 + jjrounds[i] = 0x80000000;
  300 +}
  301 +
  302 +/** Reinitialise parser. */
  303 +public void ReInit(SimpleCharStream stream, int lexState)
  304 +{
  305 + ReInit(stream);
  306 + SwitchTo(lexState);
  307 +}
  308 +
  309 +/** Switch to specified lex state. */
  310 +public void SwitchTo(int lexState)
  311 +{
  312 + if (lexState >= 1 || lexState < 0)
  313 + throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
  314 + else
  315 + curLexState = lexState;
  316 +}
  317 +
  318 +protected Token jjFillToken()
  319 +{
  320 + final Token t;
  321 + final String curTokenImage;
  322 + final int beginLine;
  323 + final int endLine;
  324 + final int beginColumn;
  325 + final int endColumn;
  326 + String im = jjstrLiteralImages[jjmatchedKind];
  327 + curTokenImage = (im == null) ? input_stream.GetImage() : im;
  328 + beginLine = input_stream.getBeginLine();
  329 + beginColumn = input_stream.getBeginColumn();
  330 + endLine = input_stream.getEndLine();
  331 + endColumn = input_stream.getEndColumn();
  332 + t = Token.newToken(jjmatchedKind, curTokenImage);
  333 +
  334 + t.beginLine = beginLine;
  335 + t.endLine = endLine;
  336 + t.beginColumn = beginColumn;
  337 + t.endColumn = endColumn;
  338 +
  339 + return t;
  340 +}
  341 +
  342 +int curLexState = 0;
  343 +int defaultLexState = 0;
  344 +int jjnewStateCnt;
  345 +int jjround;
  346 +int jjmatchedPos;
  347 +int jjmatchedKind;
  348 +
  349 +/** Get the next Token. */
  350 +public Token getNextToken()
  351 +{
  352 + Token matchedToken;
  353 + int curPos = 0;
  354 +
  355 + EOFLoop :
  356 + for (;;)
  357 + {
  358 + try
  359 + {
  360 + curChar = input_stream.BeginToken();
  361 + }
  362 + catch(java.io.IOException e)
  363 + {
  364 + jjmatchedKind = 0;
  365 + matchedToken = jjFillToken();
  366 + return matchedToken;
  367 + }
  368 +
  369 + try { input_stream.backup(0);
  370 + while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L)
  371 + curChar = input_stream.BeginToken();
  372 + }
  373 + catch (java.io.IOException e1) { continue EOFLoop; }
  374 + jjmatchedKind = 0x7fffffff;
  375 + jjmatchedPos = 0;
  376 + curPos = jjMoveStringLiteralDfa0_0();
  377 + if (jjmatchedKind != 0x7fffffff)
  378 + {
  379 + if (jjmatchedPos + 1 < curPos)
  380 + input_stream.backup(curPos - jjmatchedPos - 1);
  381 + if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
  382 + {
  383 + matchedToken = jjFillToken();
  384 + return matchedToken;
  385 + }
  386 + else
  387 + {
  388 + continue EOFLoop;
  389 + }
  390 + }
  391 + int error_line = input_stream.getEndLine();
  392 + int error_column = input_stream.getEndColumn();
  393 + String error_after = null;
  394 + boolean EOFSeen = false;
  395 + try { input_stream.readChar(); input_stream.backup(1); }
  396 + catch (java.io.IOException e1) {
  397 + EOFSeen = true;
  398 + error_after = curPos <= 1 ? "" : input_stream.GetImage();
  399 + if (curChar == '\n' || curChar == '\r') {
  400 + error_line++;
  401 + error_column = 0;
  402 + }
  403 + else
  404 + error_column++;
  405 + }
  406 + if (!EOFSeen) {
  407 + input_stream.backup(1);
  408 + error_after = curPos <= 1 ? "" : input_stream.GetImage();
  409 + }
  410 + throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR);
  411 + }
  412 +}
  413 +
  414 +private void jjCheckNAdd(int state)
  415 +{
  416 + if (jjrounds[state] != jjround)
  417 + {
  418 + jjstateSet[jjnewStateCnt++] = state;
  419 + jjrounds[state] = jjround;
  420 + }
  421 +}
  422 +private void jjAddStates(int start, int end)
  423 +{
  424 + do {
  425 + jjstateSet[jjnewStateCnt++] = jjnextStates[start];
  426 + } while (start++ != end);
  427 +}
  428 +private void jjCheckNAddTwoStates(int state1, int state2)
  429 +{
  430 + jjCheckNAdd(state1);
  431 + jjCheckNAdd(state2);
  432 +}
  433 +
  434 +private void jjCheckNAddStates(int start, int end)
  435 +{
  436 + do {
  437 + jjCheckNAdd(jjnextStates[start]);
  438 + } while (start++ != end);
  439 +}
  440 +
  441 +}
... ...
src/mtas/parser/function/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.function;
  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=03241e67478474b014438ca8f89ad5a8 (do not edit this line) */
... ...
src/mtas/parser/function/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.function;
  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=351c902e220c6aaab99db9e1060ff515 (do not edit this line) */
... ...
src/mtas/parser/function/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.function;
  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=1ff051f734b3b825a428890df3aeb019 (do not edit this line) */
... ...
src/mtas/parser/function/TokenMgrError.java 0 → 100644
  1 +/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 5.0 */
  2 +/* JavaCCOptions: */
  3 +package mtas.parser.function;
  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=c8e52d6b54c7ac5de1d496ea7ce2fcd9 (do not edit this line) */
... ...
src/mtas/solr/handler/component/MtasMergeStrategy.java
... ... @@ -21,8 +21,14 @@ import org.apache.solr.search.SolrIndexSearcher;
21 21  
22 22 import mtas.solr.handler.component.MtasSolrSearchComponent.ComponentSortSelect;
23 23  
  24 +/**
  25 + * The Class MtasMergeStrategy.
  26 + */
24 27 public class MtasMergeStrategy implements MergeStrategy {
25 28  
  29 + /* (non-Javadoc)
  30 + * @see org.apache.solr.handler.component.MergeStrategy#merge(org.apache.solr.handler.component.ResponseBuilder, org.apache.solr.handler.component.ShardRequest)
  31 + */
26 32 @Override
27 33 public void merge(ResponseBuilder rb, ShardRequest sreq) {
28 34  
... ... @@ -84,26 +90,46 @@ public class MtasMergeStrategy implements MergeStrategy {
84 90 }
85 91 }
86 92  
  93 + /* (non-Javadoc)
  94 + * @see org.apache.solr.handler.component.MergeStrategy#mergesIds()
  95 + */
87 96 @Override
88 97 public boolean mergesIds() {
89 98 return false;
90 99 }
91 100  
  101 + /* (non-Javadoc)
  102 + * @see org.apache.solr.handler.component.MergeStrategy#handlesMergeFields()
  103 + */
92 104 @Override
93 105 public boolean handlesMergeFields() {
94 106 return false;
95 107 }
96 108  
  109 + /* (non-Javadoc)
  110 + * @see org.apache.solr.handler.component.MergeStrategy#handleMergeFields(org.apache.solr.handler.component.ResponseBuilder, org.apache.solr.search.SolrIndexSearcher)
  111 + */
97 112 @Override
98 113 public void handleMergeFields(ResponseBuilder rb,
99 114 SolrIndexSearcher searcher) {
100 115 }
101 116  
  117 + /* (non-Javadoc)
  118 + * @see org.apache.solr.handler.component.MergeStrategy#getCost()
  119 + */
102 120 @Override
103 121 public int getCost() {
104 122 return 0;
105 123 }
106 124  
  125 + /**
  126 + * Merge named list.
  127 + *
  128 + * @param sreq the sreq
  129 + * @param mtasResponse the mtas response
  130 + * @param key the key
  131 + * @param preferredPurpose the preferred purpose
  132 + */
107 133 private void mergeNamedList(ShardRequest sreq,
108 134 NamedList<Object> mtasResponse, String key, Integer preferredPurpose) {
109 135 // create new response for key
... ... @@ -147,6 +173,15 @@ public class MtasMergeStrategy implements MergeStrategy {
147 173 }
148 174 }
149 175  
  176 + /**
  177 + * Merge array list.
  178 + *
  179 + * @param sreq the sreq
  180 + * @param mtasResponse the mtas response
  181 + * @param key the key
  182 + * @param preferredPurpose the preferred purpose
  183 + * @param mergeAllShardResponses the merge all shard responses
  184 + */
150 185 private void mergeArrayList(ShardRequest sreq,
151 186 NamedList<Object> mtasResponse, String key, Integer preferredPurpose,
152 187 boolean mergeAllShardResponses) {
... ... @@ -203,6 +238,12 @@ public class MtasMergeStrategy implements MergeStrategy {
203 238 }
204 239 }
205 240  
  241 + /**
  242 + * Encode.
  243 + *
  244 + * @param o the o
  245 + * @return the string
  246 + */
206 247 String encode(Object o) {
207 248 ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
208 249 ObjectOutputStream objectOutputStream;
... ... @@ -217,6 +258,12 @@ public class MtasMergeStrategy implements MergeStrategy {
217 258 }
218 259 }
219 260  
  261 + /**
  262 + * Decode.
  263 + *
  264 + * @param s the s
  265 + * @return the object
  266 + */
220 267 private Object decode(String s) {
221 268 byte[] bytes = Base64.base64ToByteArray(s);
222 269 ObjectInputStream objectInputStream;
... ... @@ -230,6 +277,12 @@ public class MtasMergeStrategy implements MergeStrategy {
230 277 }
231 278 }
232 279  
  280 + /**
  281 + * Decode.
  282 + *
  283 + * @param l the l
  284 + * @return the array list
  285 + */
233 286 ArrayList decode(ArrayList l) {
234 287 for (int i = 0; i < l.size(); i++) {
235 288 if (l.get(i) instanceof NamedList) {
... ... @@ -241,6 +294,12 @@ public class MtasMergeStrategy implements MergeStrategy {
241 294 return l;
242 295 }
243 296  
  297 + /**
  298 + * Decode.
  299 + *
  300 + * @param nl the nl
  301 + * @return the named list
  302 + */
244 303 private NamedList<Object> decode(NamedList<Object> nl) {
245 304 for (int i = 0; i < nl.size(); i++) {
246 305 String key = nl.getName(i);
... ... @@ -276,6 +335,12 @@ public class MtasMergeStrategy implements MergeStrategy {
276 335 }
277 336  
278 337  
  338 + /**
  339 + * Merge responses tree set.
  340 + *
  341 + * @param originalList the original list
  342 + * @param shardList the shard list
  343 + */
279 344 private void mergeResponsesTreeSet(TreeSet<Object> originalList,
280 345 TreeSet<Object> shardList) {
281 346 for (Object item : shardList) {
... ... @@ -283,6 +348,13 @@ public class MtasMergeStrategy implements MergeStrategy {
283 348 }
284 349 }
285 350  
  351 + /**
  352 + * Merge responses array list.
  353 + *
  354 + * @param originalList the original list
  355 + * @param shardList the shard list
  356 + * @throws IOException Signals that an I/O exception has occurred.
  357 + */
286 358 private void mergeResponsesArrayList(ArrayList<Object> originalList,
287 359 ArrayList<Object> shardList) throws IOException {
288 360 // get keys from original
... ... @@ -324,6 +396,13 @@ public class MtasMergeStrategy implements MergeStrategy {
324 396 }
325 397 }
326 398  
  399 + /**
  400 + * Merge responses named list.
  401 + *
  402 + * @param mainResponse the main response
  403 + * @param shardResponse the shard response
  404 + * @throws IOException Signals that an I/O exception has occurred.
  405 + */
327 406 private void mergeResponsesNamedList(NamedList<Object> mainResponse,
328 407 NamedList<Object> shardResponse) throws IOException {
329 408 Iterator<Entry<String, Object>> it = shardResponse.iterator();
... ... @@ -372,6 +451,12 @@ public class MtasMergeStrategy implements MergeStrategy {
372 451 }
373 452 }
374 453  
  454 + /**
  455 + * Adjustable parts cloned.
  456 + *
  457 + * @param original the original
  458 + * @return the object
  459 + */
375 460 private Object adjustablePartsCloned(Object original) {
376 461 if (original instanceof NamedList) {
377 462 NamedList<Object> newObject = new SimpleOrderedMap();
... ...
src/mtas/solr/handler/component/MtasSolrSearchComponent.java
... ... @@ -339,14 +339,21 @@ public class MtasSolrSearchComponent extends SearchComponent {
339 339 /** The Constant SUBNAME_MTAS_STATS_SPANS_QUERY_VALUE. */
340 340 public static final String SUBNAME_MTAS_STATS_SPANS_QUERY_VALUE = "value";
341 341  
  342 + /** The Constant STAGE_TERMVECTOR_MISSING_TOP. */
342 343 public static final int STAGE_TERMVECTOR_MISSING_TOP = ResponseBuilder.STAGE_EXECUTE_QUERY
343 344 + 10;
  345 +
  346 + /** The Constant STAGE_TERMVECTOR_MISSING_KEY. */
344 347 public static final int STAGE_TERMVECTOR_MISSING_KEY = ResponseBuilder.STAGE_EXECUTE_QUERY
345 348 + 15;
  349 +
  350 + /** The Constant STAGE_LIST. */
346 351 public static final int STAGE_LIST = ResponseBuilder.STAGE_EXECUTE_QUERY + 20;
347 352  
  353 + /** The show debug info. */
348 354 private static boolean showDebugInfo = true;
349 355  
  356 + /** The merge strategy. */
350 357 private MtasMergeStrategy mergeStrategy;
351 358  
352 359 /*
... ... @@ -422,10 +429,8 @@ public class MtasSolrSearchComponent extends SearchComponent {
422 429 /**
423 430 * Gets the field type.
424 431 *
425   - * @param schema
426   - * the schema
427   - * @param field
428   - * the field
  432 + * @param schema the schema
  433 + * @param field the field
429 434 * @return the field type
430 435 */
431 436 private String getFieldType(IndexSchema schema, String field) {
... ... @@ -451,12 +456,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
451 456 /**
452 457 * Prepare kwic.
453 458 *
454   - * @param rb
455   - * the rb
456   - * @param mtasFields
457   - * the mtas fields
458   - * @throws IOException
459   - * Signals that an I/O exception has occurred.
  459 + * @param rb the rb
  460 + * @param mtasFields the mtas fields
  461 + * @throws IOException Signals that an I/O exception has occurred.
460 462 */
461 463 private void prepareKwic(ResponseBuilder rb, ComponentFields mtasFields)
462 464 throws IOException {
... ... @@ -557,12 +559,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
557 559 /**
558 560 * Prepare facet.
559 561 *
560   - * @param rb
561   - * the rb
562   - * @param mtasFields
563   - * the mtas fields
564   - * @throws IOException
565   - * Signals that an I/O exception has occurred.
  562 + * @param rb the rb
  563 + * @param mtasFields the mtas fields
  564 + * @throws IOException Signals that an I/O exception has occurred.
566 565 */
567 566 private void prepareFacet(ResponseBuilder rb, ComponentFields mtasFields)
568 567 throws IOException {
... ... @@ -725,12 +724,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
725 724 /**
726 725 * Prepare list.
727 726 *
728   - * @param rb
729   - * the rb
730   - * @param mtasFields
731   - * the mtas fields
732   - * @throws IOException
733   - * Signals that an I/O exception has occurred.
  727 + * @param rb the rb
  728 + * @param mtasFields the mtas fields
  729 + * @throws IOException Signals that an I/O exception has occurred.
734 730 */
735 731 private void prepareList(ResponseBuilder rb, ComponentFields mtasFields)
736 732 throws IOException {
... ... @@ -833,12 +829,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
833 829 /**
834 830 * Prepare group.
835 831 *
836   - * @param rb
837   - * the rb
838   - * @param mtasFields
839   - * the mtas fields
840   - * @throws IOException
841   - * Signals that an I/O exception has occurred.
  832 + * @param rb the rb
  833 + * @param mtasFields the mtas fields
  834 + * @throws IOException Signals that an I/O exception has occurred.
842 835 */
843 836 private void prepareGroup(ResponseBuilder rb, ComponentFields mtasFields)
844 837 throws IOException {
... ... @@ -985,16 +978,11 @@ public class MtasSolrSearchComponent extends SearchComponent {
985 978 /**
986 979 * Prepare group.
987 980 *
988   - * @param solrParams
989   - * the solr params
990   - * @param gids
991   - * the gids
992   - * @param name
993   - * the name
994   - * @param positions
995   - * the positions
996   - * @param prefixes
997   - * the prefixes
  981 + * @param solrParams the solr params
  982 + * @param gids the gids
  983 + * @param name the name
  984 + * @param positions the positions
  985 + * @param prefixes the prefixes
998 986 */
999 987 private void prepareGroup(SolrParams solrParams, SortedSet<String> gids,
1000 988 String name, String[] positions, String[] prefixes) {
... ... @@ -1013,12 +1001,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
1013 1001 /**
1014 1002 * Prepare term vector.
1015 1003 *
1016   - * @param rb
1017   - * the rb
1018   - * @param mtasFields
1019   - * the mtas fields
1020   - * @throws IOException
1021   - * Signals that an I/O exception has occurred.
  1004 + * @param rb the rb
  1005 + * @param mtasFields the mtas fields
  1006 + * @throws IOException Signals that an I/O exception has occurred.
1022 1007 */
1023 1008 private void prepareTermVector(ResponseBuilder rb, ComponentFields mtasFields)
1024 1009 throws IOException {
... ... @@ -1131,12 +1116,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
1131 1116 /**
1132 1117 * Prepare prefix.
1133 1118 *
1134   - * @param rb
1135   - * the rb
1136   - * @param mtasFields
1137   - * the mtas fields
1138   - * @throws IOException
1139   - * Signals that an I/O exception has occurred.
  1119 + * @param rb the rb
  1120 + * @param mtasFields the mtas fields
  1121 + * @throws IOException Signals that an I/O exception has occurred.
1140 1122 */
1141 1123 private void preparePrefix(ResponseBuilder rb, ComponentFields mtasFields)
1142 1124 throws IOException {
... ... @@ -1181,12 +1163,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
1181 1163 /**
1182 1164 * Prepare stats.
1183 1165 *
1184   - * @param rb
1185   - * the rb
1186   - * @param mtasFields
1187   - * the mtas fields
1188   - * @throws IOException
1189   - * Signals that an I/O exception has occurred.
  1166 + * @param rb the rb
  1167 + * @param mtasFields the mtas fields
  1168 + * @throws IOException Signals that an I/O exception has occurred.
1190 1169 */
1191 1170 private void prepareStats(ResponseBuilder rb, ComponentFields mtasFields)
1192 1171 throws IOException {
... ... @@ -1204,12 +1183,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
1204 1183 /**
1205 1184 * Prepare stats positions.
1206 1185 *
1207   - * @param rb
1208   - * the rb
1209   - * @param mtasFields
1210   - * the mtas fields
1211   - * @throws IOException
1212   - * Signals that an I/O exception has occurred.
  1186 + * @param rb the rb
  1187 + * @param mtasFields the mtas fields
  1188 + * @throws IOException Signals that an I/O exception has occurred.
1213 1189 */
1214 1190 private void prepareStatsPositions(ResponseBuilder rb,
1215 1191 ComponentFields mtasFields) throws IOException {
... ... @@ -1278,12 +1254,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
1278 1254 /**
1279 1255 * Prepare stats tokens.
1280 1256 *
1281   - * @param rb
1282   - * the rb
1283   - * @param mtasFields
1284   - * the mtas fields
1285   - * @throws IOException
1286   - * Signals that an I/O exception has occurred.
  1257 + * @param rb the rb
  1258 + * @param mtasFields the mtas fields
  1259 + * @throws IOException Signals that an I/O exception has occurred.
1287 1260 */
1288 1261 private void prepareStatsTokens(ResponseBuilder rb,
1289 1262 ComponentFields mtasFields) throws IOException {
... ... @@ -1352,12 +1325,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
1352 1325 /**
1353 1326 * Prepare stats spans.
1354 1327 *
1355   - * @param rb
1356   - * the rb
1357   - * @param mtasFields
1358   - * the mtas fields
1359   - * @throws IOException
1360   - * Signals that an I/O exception has occurred.
  1328 + * @param rb the rb
  1329 + * @param mtasFields the mtas fields
  1330 + * @throws IOException Signals that an I/O exception has occurred.
1361 1331 */
1362 1332 private void prepareStatsSpans(ResponseBuilder rb, ComponentFields mtasFields)
1363 1333 throws IOException {
... ... @@ -1470,10 +1440,8 @@ public class MtasSolrSearchComponent extends SearchComponent {
1470 1440 /**
1471 1441 * Gets the ids from parameters.
1472 1442 *
1473   - * @param params
1474   - * the params
1475   - * @param prefix
1476   - * the prefix
  1443 + * @param params the params
  1444 + * @param prefix the prefix
1477 1445 * @return the ids from parameters
1478 1446 */
1479 1447 private SortedSet<String> getIdsFromParameters(SolrParams params,
... ... @@ -1495,15 +1463,11 @@ public class MtasSolrSearchComponent extends SearchComponent {
1495 1463 /**
1496 1464 * Construct query.
1497 1465 *
1498   - * @param queryValue
1499   - * the query value
1500   - * @param queryType
1501   - * the query type
1502   - * @param field
1503   - * the field
  1466 + * @param queryValue the query value
  1467 + * @param queryType the query type
  1468 + * @param field the field
1504 1469 * @return the span query
1505   - * @throws IOException
1506   - * Signals that an I/O exception has occurred.
  1470 + * @throws IOException Signals that an I/O exception has occurred.
1507 1471 */
1508 1472 private SpanQuery constructQuery(String queryValue, String queryType,
1509 1473 String field) throws IOException {
... ... @@ -1533,8 +1497,7 @@ public class MtasSolrSearchComponent extends SearchComponent {
1533 1497 /**
1534 1498 * Gets the positive integer.
1535 1499 *
1536   - * @param number
1537   - * the number
  1500 + * @param number the number
1538 1501 * @return the positive integer
1539 1502 */
1540 1503 private int getPositiveInteger(String number) {
... ... @@ -1548,8 +1511,7 @@ public class MtasSolrSearchComponent extends SearchComponent {
1548 1511 /**
1549 1512 * Gets the double.
1550 1513 *
1551   - * @param number
1552   - * the number
  1514 + * @param number the number
1553 1515 * @return the double
1554 1516 */
1555 1517 private Double getDouble(String number) {
... ... @@ -1563,18 +1525,12 @@ public class MtasSolrSearchComponent extends SearchComponent {
1563 1525 /**
1564 1526 * Compare and check.
1565 1527 *
1566   - * @param list
1567   - * the list
1568   - * @param original
1569   - * the original
1570   - * @param nameNew
1571   - * the name new
1572   - * @param nameOriginal
1573   - * the name original
1574   - * @param unique
1575   - * the unique
1576   - * @throws IOException
1577   - * Signals that an I/O exception has occurred.
  1528 + * @param list the list
  1529 + * @param original the original
  1530 + * @param nameNew the name new
  1531 + * @param nameOriginal the name original
  1532 + * @param unique the unique
  1533 + * @throws IOException Signals that an I/O exception has occurred.
1578 1534 */
1579 1535 private void compareAndCheck(String[] list, String[] original, String nameNew,
1580 1536 String nameOriginal, Boolean unique) throws IOException {
... ... @@ -1928,6 +1884,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
1928 1884 // + " HANDLERESPONSES " + rb.stage + " " + rb.req.getParamString());
1929 1885 }
1930 1886  
  1887 + /* (non-Javadoc)
  1888 + * @see org.apache.solr.handler.component.SearchComponent#finishStage(org.apache.solr.handler.component.ResponseBuilder)
  1889 + */
1931 1890 @Override
1932 1891 public void finishStage(ResponseBuilder rb) {
1933 1892 // System.out
... ... @@ -1996,6 +1955,13 @@ public class MtasSolrSearchComponent extends SearchComponent {
1996 1955 return ResponseBuilder.STAGE_DONE;
1997 1956 }
1998 1957  
  1958 + /**
  1959 + * Distributed process termvector missing top.
  1960 + *
  1961 + * @param rb the rb
  1962 + * @param mtasFields the mtas fields
  1963 + * @throws IOException Signals that an I/O exception has occurred.
  1964 + */
1999 1965 private void distributedProcessTermvectorMissingTop(ResponseBuilder rb,
2000 1966 ComponentFields mtasFields) throws IOException {
2001 1967 int numberOfShards = rb.shards.length;
... ... @@ -2031,15 +1997,11 @@ public class MtasSolrSearchComponent extends SearchComponent {
2031 1997 }
2032 1998  
2033 1999 /**
2034   - * Distributed process termvector.
  2000 + * Distributed process termvector missing key.
2035 2001 *
2036   - * @param rb
2037   - * the rb
2038   - * @param mtasFields
2039   - * the mtas fields
2040   - * @return
2041   - * @throws IOException
2042   - * Signals that an I/O exception has occurred.
  2002 + * @param rb the rb
  2003 + * @param mtasFields the mtas fields
  2004 + * @throws IOException Signals that an I/O exception has occurred.
2043 2005 */
2044 2006 private void distributedProcessTermvectorMissingKey(ResponseBuilder rb,
2045 2007 ComponentFields mtasFields) throws IOException {
... ... @@ -2123,10 +2085,8 @@ public class MtasSolrSearchComponent extends SearchComponent {
2123 2085 /**
2124 2086 * Distributed process list.
2125 2087 *
2126   - * @param rb
2127   - * the rb
2128   - * @param mtasFields
2129   - * the mtas fields
  2088 + * @param rb the rb
  2089 + * @param mtasFields the mtas fields
2130 2090 */
2131 2091 private void distributedProcessList(ResponseBuilder rb,
2132 2092 ComponentFields mtasFields) {
... ... @@ -2240,15 +2200,12 @@ public class MtasSolrSearchComponent extends SearchComponent {
2240 2200 }
2241 2201  
2242 2202 /**
2243   - * Compute missing items per shard.
  2203 + * Compute missing termvector items per shard.
2244 2204 *
2245   - * @param shardResponses
2246   - * the shard responses
2247   - * @param args
2248   - * the args
  2205 + * @param shardResponses the shard responses
  2206 + * @param args the args
2249 2207 * @return the hash map
2250   - * @throws IOException
2251   - * Signals that an I/O exception has occurred.
  2208 + * @throws IOException Signals that an I/O exception has occurred.
2252 2209 */
2253 2210 private HashMap<String, HashMap<String, HashSet<String>>> computeMissingTermvectorItemsPerShard(
2254 2211 List<ShardResponse> shardResponses, String... args) throws IOException {
... ... @@ -2330,6 +2287,11 @@ public class MtasSolrSearchComponent extends SearchComponent {
2330 2287 return result;
2331 2288 }
2332 2289  
  2290 + /**
  2291 + * Repair prefix items.
  2292 + *
  2293 + * @param mtasResponse the mtas response
  2294 + */
2333 2295 private void repairPrefixItems(NamedList<Object> mtasResponse) {
2334 2296 // repair prefix lists
2335 2297 try {
... ... @@ -2360,8 +2322,7 @@ public class MtasSolrSearchComponent extends SearchComponent {
2360 2322 /**
2361 2323 * Gets the mtas fields.
2362 2324 *
2363   - * @param rb
2364   - * the rb
  2325 + * @param rb the rb
2365 2326 * @return the mtas fields
2366 2327 */
2367 2328 private ComponentFields getMtasFields(ResponseBuilder rb) {
... ... @@ -2371,13 +2332,10 @@ public class MtasSolrSearchComponent extends SearchComponent {
2371 2332 /**
2372 2333 * Creates the stats position.
2373 2334 *
2374   - * @param position
2375   - * the position
2376   - * @param encode
2377   - * the encode
  2335 + * @param position the position
  2336 + * @param encode the encode
2378 2337 * @return the simple ordered map
2379   - * @throws IOException
2380   - * Signals that an I/O exception has occurred.
  2338 + * @throws IOException Signals that an I/O exception has occurred.
2381 2339 */
2382 2340 private SimpleOrderedMap<Object> createStatsPosition(
2383 2341 ComponentPosition position, Boolean encode) throws IOException {
... ... @@ -2399,13 +2357,10 @@ public class MtasSolrSearchComponent extends SearchComponent {
2399 2357 /**
2400 2358 * Creates the stats token.
2401 2359 *
2402   - * @param token
2403   - * the token
2404   - * @param encode
2405   - * the encode
  2360 + * @param token the token
  2361 + * @param encode the encode
2406 2362 * @return the simple ordered map
2407   - * @throws IOException
2408   - * Signals that an I/O exception has occurred.
  2363 + * @throws IOException Signals that an I/O exception has occurred.
2409 2364 */
2410 2365 private SimpleOrderedMap<Object> createStatsToken(ComponentToken token,
2411 2366 Boolean encode) throws IOException {
... ... @@ -2427,13 +2382,10 @@ public class MtasSolrSearchComponent extends SearchComponent {
2427 2382 /**
2428 2383 * Creates the stats span.
2429 2384 *
2430   - * @param span
2431   - * the span
2432   - * @param encode
2433   - * the encode
  2385 + * @param span the span
  2386 + * @param encode the encode
2434 2387 * @return the simple ordered map
2435   - * @throws IOException
2436   - * Signals that an I/O exception has occurred.
  2388 + * @throws IOException Signals that an I/O exception has occurred.
2437 2389 */
2438 2390 private SimpleOrderedMap<Object> createStatsSpan(ComponentSpan span,
2439 2391 Boolean encode) throws IOException {
... ... @@ -2455,13 +2407,10 @@ public class MtasSolrSearchComponent extends SearchComponent {
2455 2407 /**
2456 2408 * Creates the term vector.
2457 2409 *
2458   - * @param termVector
2459   - * the term vector
2460   - * @param encode
2461   - * the encode
  2410 + * @param termVector the term vector
  2411 + * @param encode the encode
2462 2412 * @return the simple ordered map
2463   - * @throws IOException
2464   - * Signals that an I/O exception has occurred.
  2413 + * @throws IOException Signals that an I/O exception has occurred.
2465 2414 */
2466 2415 private SimpleOrderedMap<Object> createTermVector(
2467 2416 ComponentTermVector termVector, Boolean encode) throws IOException {
... ... @@ -2507,10 +2456,8 @@ public class MtasSolrSearchComponent extends SearchComponent {
2507 2456 /**
2508 2457 * Creates the prefix.
2509 2458 *
2510   - * @param prefix
2511   - * the prefix
2512   - * @param encode
2513   - * the encode
  2459 + * @param prefix the prefix
  2460 + * @param encode the encode
2514 2461 * @return the simple ordered map
2515 2462 */
2516 2463 private SimpleOrderedMap<Object> createPrefix(ComponentPrefix prefix,
... ... @@ -2535,8 +2482,7 @@ public class MtasSolrSearchComponent extends SearchComponent {
2535 2482 /**
2536 2483 * Creates the list.
2537 2484 *
2538   - * @param list
2539   - * the list
  2485 + * @param list the list
2540 2486 * @return the simple ordered map
2541 2487 */
2542 2488 private SimpleOrderedMap<Object> createList(ComponentList list) {
... ... @@ -2666,10 +2612,8 @@ public class MtasSolrSearchComponent extends SearchComponent {
2666 2612 /**
2667 2613 * Creates the group.
2668 2614 *
2669   - * @param group
2670   - * the group
2671   - * @param encode
2672   - * the encode
  2615 + * @param group the group
  2616 + * @param encode the encode
2673 2617 * @return the simple ordered map
2674 2618 */
2675 2619 private SimpleOrderedMap<Object> createGroup(ComponentGroup group,
... ... @@ -2698,13 +2642,10 @@ public class MtasSolrSearchComponent extends SearchComponent {
2698 2642 /**
2699 2643 * Creates the facet.
2700 2644 *
2701   - * @param facet
2702   - * the facet
2703   - * @param encode
2704   - * the encode
  2645 + * @param facet the facet
  2646 + * @param encode the encode
2705 2647 * @return the simple ordered map
2706   - * @throws IOException
2707   - * Signals that an I/O exception has occurred.
  2648 + * @throws IOException Signals that an I/O exception has occurred.
2708 2649 */
2709 2650 private SimpleOrderedMap<Object> createFacet(ComponentFacet facet,
2710 2651 Boolean encode) throws IOException {
... ... @@ -2731,8 +2672,7 @@ public class MtasSolrSearchComponent extends SearchComponent {
2731 2672 /**
2732 2673 * Creates the kwic.
2733 2674 *
2734   - * @param kwic
2735   - * the kwic
  2675 + * @param kwic the kwic
2736 2676 * @return the simple ordered map
2737 2677 */
2738 2678 private SimpleOrderedMap<Object> createKwic(ComponentKwic kwic) {
... ... @@ -2859,6 +2799,12 @@ public class MtasSolrSearchComponent extends SearchComponent {
2859 2799 return mtasKwicResponse;
2860 2800 }
2861 2801  
  2802 + /**
  2803 + * Rewrite.
  2804 + *
  2805 + * @param al the al
  2806 + * @throws IOException Signals that an I/O exception has occurred.
  2807 + */
2862 2808 private void rewrite(ArrayList<Object> al) throws IOException {
2863 2809 for (int i = 0; i < al.size(); i++) {
2864 2810 if (al.get(i) instanceof NamedList) {
... ... @@ -2872,10 +2818,8 @@ public class MtasSolrSearchComponent extends SearchComponent {
2872 2818 /**
2873 2819 * Rewrite.
2874 2820 *
2875   - * @param nl
2876   - * the nl
2877   - * @throws IOException
2878   - * Signals that an I/O exception has occurred.
  2821 + * @param nl the nl
  2822 + * @throws IOException Signals that an I/O exception has occurred.
2879 2823 */
2880 2824 private void rewrite(NamedList<Object> nl) throws IOException {
2881 2825 HashMap<String, NamedList<Object>> collapseNamedList = null;
... ... @@ -2993,22 +2937,14 @@ public class MtasSolrSearchComponent extends SearchComponent {
2993 2937 /**
2994 2938 * Instantiates a new component sort select.
2995 2939 *
2996   - * @param dataCollector
2997   - * the data collector
2998   - * @param dataType
2999   - * the data type
3000   - * @param statsType
3001   - * the stats type
3002   - * @param statsItems
3003   - * the stats items
3004   - * @param sortType
3005   - * the sort type
3006   - * @param sortDirection
3007   - * the sort direction
3008   - * @param start
3009   - * the start
3010   - * @param number
3011   - * the number
  2940 + * @param dataCollector the data collector
  2941 + * @param dataType the data type
  2942 + * @param statsType the stats type
  2943 + * @param statsItems the stats items
  2944 + * @param sortType the sort type
  2945 + * @param sortDirection the sort direction
  2946 + * @param start the start
  2947 + * @param number the number
3012 2948 */
3013 2949 public ComponentSortSelect(MtasDataCollector<?, ?> dataCollector,
3014 2950 String[] dataType, String[] statsType, TreeSet<String>[] statsItems,
... ... @@ -3046,14 +2982,10 @@ public class MtasSolrSearchComponent extends SearchComponent {
3046 2982 /**
3047 2983 * Instantiates a new component sort select.
3048 2984 *
3049   - * @param dataCollector
3050   - * the data collector
3051   - * @param dataType
3052   - * the data type
3053   - * @param statsType
3054   - * the stats type
3055   - * @param statsItems
3056   - * the stats items
  2985 + * @param dataCollector the data collector
  2986 + * @param dataType the data type
  2987 + * @param statsType the stats type
  2988 + * @param statsItems the stats items
3057 2989 */
3058 2990 public ComponentSortSelect(MtasDataCollector dataCollector, String dataType,
3059 2991 String statsType, TreeSet<String> statsItems) {
... ... @@ -3065,10 +2997,8 @@ public class MtasSolrSearchComponent extends SearchComponent {
3065 2997 /**
3066 2998 * Merge.
3067 2999 *
3068   - * @param newItem
3069   - * the new item
3070   - * @throws IOException
3071   - * Signals that an I/O exception has occurred.
  3000 + * @param newItem the new item
  3001 + * @throws IOException Signals that an I/O exception has occurred.
3072 3002 */
3073 3003 void merge(ComponentSortSelect newItem) throws IOException {
3074 3004 dataCollector.merge(newItem.dataCollector, true);
... ... @@ -3078,8 +3008,7 @@ public class MtasSolrSearchComponent extends SearchComponent {
3078 3008 * Gets the total.
3079 3009 *
3080 3010 * @return the total
3081   - * @throws IOException
3082   - * Signals that an I/O exception has occurred.
  3011 + * @throws IOException Signals that an I/O exception has occurred.
3083 3012 */
3084 3013 private int getTotal() throws IOException {
3085 3014 if (dataCollector.getCollectorType()
... ... @@ -3094,9 +3023,9 @@ public class MtasSolrSearchComponent extends SearchComponent {
3094 3023 /**
3095 3024 * Gets the data.
3096 3025 *
  3026 + * @param showDebugInfo the show debug info
3097 3027 * @return the data
3098   - * @throws IOException
3099   - * Signals that an I/O exception has occurred.
  3028 + * @throws IOException Signals that an I/O exception has occurred.
3100 3029 */
3101 3030 NamedList<Object> getData(boolean showDebugInfo) throws IOException {
3102 3031 if (dataCollector.getCollectorType()
... ... @@ -3127,6 +3056,13 @@ public class MtasSolrSearchComponent extends SearchComponent {
3127 3056 }
3128 3057 }
3129 3058  
  3059 + /**
  3060 + * Gets the key list.
  3061 + *
  3062 + * @param showFull the show full
  3063 + * @return the key list
  3064 + * @throws IOException Signals that an I/O exception has occurred.
  3065 + */
3130 3066 private Set<String> getKeyList(boolean showFull) throws IOException {
3131 3067 if (dataCollector.getCollectorType()
3132 3068 .equals(DataCollector.COLLECTOR_TYPE_LIST)) {
... ... @@ -3139,6 +3075,13 @@ public class MtasSolrSearchComponent extends SearchComponent {
3139 3075 }
3140 3076 }
3141 3077  
  3078 + /**
  3079 + * Gets the named list.
  3080 + *
  3081 + * @param showDebugInfo the show debug info
  3082 + * @return the named list
  3083 + * @throws IOException Signals that an I/O exception has occurred.
  3084 + */
3142 3085 NamedList<Object> getNamedList(boolean showDebugInfo) throws IOException {
3143 3086 return getNamedList(false, showDebugInfo);
3144 3087 }
... ... @@ -3146,9 +3089,10 @@ public class MtasSolrSearchComponent extends SearchComponent {
3146 3089 /**
3147 3090 * Gets the named list.
3148 3091 *
  3092 + * @param showFull the show full
  3093 + * @param showDebugInfo the show debug info
3149 3094 * @return the named list
3150   - * @throws IOException
3151   - * Signals that an I/O exception has occurred.
  3095 + * @throws IOException Signals that an I/O exception has occurred.
3152 3096 */
3153 3097 private NamedList<Object> getNamedList(boolean showFull,
3154 3098 boolean showDebugInfo) throws IOException {
... ...
src/mtas/solr/update/processor/MtasUpdateRequestProcessorResultReader.java
... ... @@ -15,25 +15,26 @@ public class MtasUpdateRequestProcessorResultReader implements Closeable {
15 15 /** The stored string value. */
16 16 private String storedStringValue;
17 17  
  18 + /** The file input stream. */
18 19 private FileInputStream fileInputStream;
19 20  
20 21 /** The object input stream. */
21 22 private ObjectInputStream objectInputStream;
22 23  
  24 + /** The file. */
23 25 private File file;
24 26  
25 27 /** The iterator. */
26 28 private Iterator<MtasUpdateRequestProcessorResultItem> iterator;
27 29  
  30 + /** The closed. */
28 31 private boolean closed;
29 32  
30 33 /**
31 34 * Instantiates a new mtas update request processor result reader.
32 35 *
33   - * @param fileName
34   - * the file name
35   - * @throws IOException
36   - * Signals that an I/O exception has occurred.
  36 + * @param fileName the file name
  37 + * @throws IOException Signals that an I/O exception has occurred.
37 38 */
38 39 public MtasUpdateRequestProcessorResultReader(String fileName)
39 40 throws IOException {
... ...
src/mtas/solr/update/processor/MtasUpdateRequestProcessorResultWriter.java
... ... @@ -12,22 +12,25 @@ import org.apache.lucene.util.BytesRef;
12 12 */
13 13 public class MtasUpdateRequestProcessorResultWriter implements Closeable {
14 14  
  15 + /** The object output stream. */
15 16 private ObjectOutputStream objectOutputStream;
16 17  
  18 + /** The file output stream. */
17 19 private FileOutputStream fileOutputStream;
18 20  
  21 + /** The closed. */
19 22 private boolean closed;
20 23  
  24 + /** The token number. */
21 25 private int tokenNumber;
22 26  
  27 + /** The file. */
23 28 private File file;
24 29  
25 30 /**
26 31 * Instantiates a new mtas update request processor result writer.
27 32 *
28   - * @param value
29   - * the value
30   - * @throws IOException
  33 + * @param value the value
31 34 */
32 35 public MtasUpdateRequestProcessorResultWriter(String value) {
33 36 closed = false;
... ... @@ -48,19 +51,12 @@ public class MtasUpdateRequestProcessorResultWriter implements Closeable {
48 51 /**
49 52 * Adds the item.
50 53 *
51   - * @param term
52   - * the term
53   - * @param offsetStart
54   - * the offset start
55   - * @param offsetEnd
56   - * the offset end
57   - * @param posIncr
58   - * the pos incr
59   - * @param payload
60   - * the payload
61   - * @param flags
62   - * the flags
63   - * @throws IOException
  54 + * @param term the term
  55 + * @param offsetStart the offset start
  56 + * @param offsetEnd the offset end
  57 + * @param posIncr the pos incr
  58 + * @param payload the payload
  59 + * @param flags the flags
64 60 */
65 61 public void addItem(String term, Integer offsetStart, Integer offsetEnd,
66 62 Integer posIncr, BytesRef payload, Integer flags) {
... ... @@ -78,16 +74,20 @@ public class MtasUpdateRequestProcessorResultWriter implements Closeable {
78 74 }
79 75 }
80 76  
  77 + /**
  78 + * Gets the token number.
  79 + *
  80 + * @return the token number
  81 + */
81 82 public int getTokenNumber() {
82 83 return tokenNumber;
83 84 }
84 85  
85 86 /**
86   - * Creates the file.
  87 + * Gets the file name.
87 88 *
88   - * @return the string
89   - * @throws IOException
90   - * Signals that an I/O exception has occurred.
  89 + * @return the file name
  90 + * @throws IOException Signals that an I/O exception has occurred.
91 91 */
92 92 public String getFileName() throws IOException {
93 93 if (file != null) {
... ... @@ -97,6 +97,9 @@ public class MtasUpdateRequestProcessorResultWriter implements Closeable {
97 97 }
98 98 }
99 99  
  100 + /* (non-Javadoc)
  101 + * @see java.io.Closeable#close()
  102 + */
100 103 @Override
101 104 public void close() throws IOException {
102 105 if (!closed) {
... ... @@ -106,6 +109,9 @@ public class MtasUpdateRequestProcessorResultWriter implements Closeable {
106 109 }
107 110 }
108 111  
  112 + /**
  113 + * Force close and delete.
  114 + */
109 115 public void forceCloseAndDelete() {
110 116 try {
111 117 if (objectOutputStream != null) {
... ...
src/site/markdown/download.md renamed to src/site/markdown/download.md.vm
... ... @@ -11,11 +11,11 @@
11 11 <th>Description</th>
12 12 </tr>
13 13 <tr>
14   - <td>6.1.0</td>
15   - <td>20160714</td>
16   - <td><a href='https://github.com/matthijsbrouwer/mtas/releases/download/20160714/mtas-6.1.0.jar'>Binary (jar)</a></td>
17   - <td><a href='https://github.com/matthijsbrouwer/mtas/archive/20160714.tar.gz'>Source (tgz)</a></td>
18   - <td><a href='https://github.com/matthijsbrouwer/mtas/archive/20160714.zip'>Source (zip)</a></td>
  14 + <td>$context.get("currentDevelopmentVersion")</td>
  15 + <td>$context.get("currentDevelopmentRelease")</td>
  16 + <td><a href='https://github.com/matthijsbrouwer/mtas/releases/download/${currentDevelopmentRelease}/mtas-${currentDevelopmentVersion}.jar'>Binary (jar)</a></td>
  17 + <td><a href='https://github.com/matthijsbrouwer/mtas/archive/${currentDevelopmentRelease}.tar.gz'>Source (tgz)</a></td>
  18 + <td><a href='https://github.com/matthijsbrouwer/mtas/archive/${currentDevelopmentRelease}.zip'>Source (zip)</a></td>
19 19 <td>Development version</td>
20 20 </tr>
21 21 </tbody>
... ...
src/site/markdown/index.md
1 1 #Multi Tier Annotation Search
  2 +
  3 +##Download binary
  4 +
  5 +Prebuilt JARs for Mtas are available from the [Download](downloads.html) page.
  6 +
  7 +##Building from source
  8 +
  9 +Download the source code from GitHub
  10 +
  11 +```
  12 +git clone git://github.com/meertensinstituut/mtas.git
  13 +```
  14 +
  15 +To build the library, from the created project directory
  16 +
  17 +```
  18 +mvn package
  19 +```
  20 +
  21 +
... ...
src/site/markdown/installation.md
  1 +#Getting started
  2 +
  3 +test
  4 +
  5 +```
  6 +TEST
  7 +```
  8 +
  9 +eind test
  10 +
... ...
src/site/markdown/installation_lucene.md 0 → 100644
  1 +#Installation Lucene
0 2 \ No newline at end of file
... ...
src/site/markdown/installation_solr.md 0 → 100644
  1 +#Installation Solr
... ...
src/site/resources/images/meertens.png 0 → 100644

12.7 KB

src/site/site.xml
1 1 <project name="Multi Tier Annotation Search">
  2 + <bannerRight>
  3 + <name>Meertens Instituut</name>
  4 + <src>images/meertens.png</src>
  5 + <href>http://www.meertens.knaw.nl/</href>
  6 + <width>147</width>
  7 + <height>100</height>
  8 + <title>Meertens Instituut</title>
  9 + </bannerRight>
  10 + <skin>
  11 + <groupId>org.apache.maven.skins</groupId>
  12 + <artifactId>maven-fluido-skin</artifactId>
  13 + <version>1.5</version>
  14 + </skin>
2 15 <body>
3 16 <menu name="Mtas">
4 17 <item name="Introduction" href="index.html"/>
5   - <item name="Installation" href="installation.html"/>
  18 + <item name="Getting started" href="installation.html">
  19 + <item name="Lucene" href="installation_lucene.html"/>
  20 + <item name="Solr" href="installation_solr.html"/>
  21 + </item>
6 22 <item name="Download" href="download.html"/>
7 23 </menu>
8 24 <menu ref="reports"/>
... ...