Add classes for visitor traversal
[cql-java-moved-to-github.git] / src / main / java / org / z3950 / zing / cql / CQLTokenizer.java
1 /*
2  * Copyright (c) 1995-2014, Index Datassss
3  * All rights reserved.
4  * See the file LICENSE for details.
5  */
6 package org.z3950.zing.cql;
7
8 /**
9  * API bridge between the parser and lexer implementation
10  * @author jakub
11  */
12 public interface CQLTokenizer {
13   
14   public static final int TT_EOF  = -1;
15   public static final int TT_WORD = -3;
16   public static final int TT_NOTHING = -4;
17   
18   public final static int TT_STRING = 999;      // quoted string
19   public final static int TT_LE     = 1000;     // The "<=" relation
20   public final static int TT_GE     = 1001;     // The ">=" relation
21   public final static int TT_NE     = 1002;     // The "<>" relation
22   public final static int TT_EQEQ   = 1003;     // The "==" relation
23   public final static int TT_AND    = 1004;     // The "and" boolean
24   public final static int TT_OR     = 1005;     // The "or" boolean
25   public final static int TT_NOT    = 1006;     // The "not" boolean
26   public final static int TT_PROX   = 1007;     // The "prox" boolean
27   public final static int TT_SORTBY = 1008;     // The "sortby" operator
28   
29   /**
30    * Consume next input token
31    */
32   public void move();
33   
34   /**
35    * Return the value of the last consumed token
36    * @return value of the token
37    */
38   public String value();
39   
40   /**
41    * Return the type of the last consumed token
42    * @return last consumed token
43    */
44   public int what();
45   
46   /**
47    * Render the type and value of the last consumed token
48    * @return human-readable string
49    */
50   public String render();
51   
52   /**
53    * Render specified token type
54    * @param what token type
55    * @param quote true, if single characters should be quoted for readability
56    * @return human-readable string
57    */
58   public String render(int what, boolean quote);
59   
60   public int pos();
61   
62 }