KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > hibernate > hql > classic > ParserHelper


1 //$Id: ParserHelper.java,v 1.2 2005/05/23 19:54:13 oneovthafew Exp $
2
package org.hibernate.hql.classic;
3
4 import org.hibernate.QueryException;
5 import org.hibernate.util.StringHelper;
6
7 import java.util.StringTokenizer JavaDoc;
8
9 public final class ParserHelper {
10
11     public static final String JavaDoc HQL_VARIABLE_PREFIX = ":";
12
13     public static final String JavaDoc HQL_SEPARATORS = " \n\r\f\t,()=<>&|+-=/*'^![]#~\\";
14     //NOTICE: no " or . since they are part of (compound) identifiers
15
public static final String JavaDoc PATH_SEPARATORS = ".";
16
17     public static boolean isWhitespace(String JavaDoc str) {
18         return StringHelper.WHITESPACE.indexOf( str ) > -1;
19     }
20
21     private ParserHelper() {
22         //cannot instantiate
23
}
24
25     public static void parse(Parser p, String JavaDoc text, String JavaDoc seperators, QueryTranslatorImpl q) throws QueryException {
26         StringTokenizer JavaDoc tokens = new StringTokenizer JavaDoc( text, seperators, true );
27         p.start( q );
28         while ( tokens.hasMoreElements() ) p.token( tokens.nextToken(), q );
29         p.end( q );
30     }
31
32 }
33
34
35
36
37
38
39
Popular Tags