- public String convertToPQN()
- throws FileNotFoundException, IOException {
-
- if (qualsetProperties == null) {
- // ### Could think about caching named qualifier sets
- // across compilations (i.e. shared, in a static
- // Hashtable, between multiple CQLCompiler
- // instances.) Probably not worth it.
- InputStream is = this.getClass().getResourceAsStream(qualset);
- if (is == null)
- throw new FileNotFoundException("getResourceAsStream(" +
- qualset + ")");
- qualsetProperties = new Properties();
- qualsetProperties.load(is);
- }
-
- st = new StreamTokenizer(new StringReader(cql));
- st.wordChars('/', '/');
- st.wordChars('0', '9'); // ### but 1 is still recognised as TT_NUM
- st.wordChars('.', '.');
- st.wordChars('-', '-');
- st.ordinaryChar('=');
- st.ordinaryChar(',');
- st.ordinaryChar('(');
- st.ordinaryChar(')');
-
-// int token;
-// while ((token = st.nextToken()) != st.TT_EOF) {
-// System.out.println("token=" + token + ", " +
-// "nval=" + st.nval + ", " +
-// "sval=" + st.sval);
-// }
-
- st.nextToken();
- String ret;
- try {
- ret = parse_expression();
- } catch (CQLParseException ex) {
- System.err.println("### Oops: " + ex);
- return null;
- }
+ public CQLNode parse(String cql)
+ throws CQLParseException, IOException {
+ lexer = new CQLLexer(cql, LEXDEBUG);