/*
 * Created on 05-08-2003
 *
 * To change the template for this generated file go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
package net.sf.hibern8ide.highlighter;

import java.awt.Color;
import java.awt.Font;

import javax.swing.text.Document;
import javax.swing.text.StyledEditorKit;

/**
 * @author MAX
 *
 * To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Generation - Code and Comments
 */
public class REHqlTypes extends RETypes {
	public static final String CHAR = "char";
	public static final String TEXT = "text";
	public static final String ATOM = "atom";
	public static final String NUMBER = "number";

	public REHqlTypes() {
		addTokenType(TEXT, "\"(?:\\\\.|[^\"\\\\])*\"", Color.red, Font.PLAIN);
		addTokenType(CHAR, "'(?:\\\\[^']+|[^'])'", Color.red, Font.PLAIN);
		addTokenType(ATOM, "[a-zA-Z]\\w*", null, Font.PLAIN);
		addTokenType(NUMBER, "[0-9]+(\\.[0-9]+)?", Color.magenta, Font.PLAIN);

		addWordStyle("keyword1", Color.BLACK, Font.BOLD);
		addWordStyle("keyword2", Color.magenta, Font.BOLD);

		word2style.put("select", "keyword1");
		word2style.put("from", "keyword1");
		word2style.put("where", "keyword1");
		word2style.put("by", "keyword1");
		word2style.put("order", "keyword1");
		word2style.put("having", "keyword1");
		word2style.put("group", "keyword1");
		word2style.put("as", "keyword1");
		word2style.put("in", "keyword1");

		word2style.put("join", "keyword1");
		word2style.put("right", "keyword1");
		word2style.put("left", "keyword1");
		word2style.put("full", "keyword1");
		word2style.put("outer", "keyword1");
		word2style.put("class", "keyword1");
		word2style.put("inner", "keyword1");

		word2style.put("id", "keyword2");
		word2style.put("size", "keyword2");
		word2style.put("elements", "keyword2");
		word2style.put("indices", "keyword2");
		word2style.put("maxIndex", "keyword2");
		word2style.put("maxElement", "keyword2");
		word2style.put("minElement", "keyword2");

		word2style.put("<=", "keyword2");
		word2style.put(">=", "keyword2");
		word2style.put("=>", "keyword2");
		word2style.put("=<", "keyword2");
		word2style.put("!=", "keyword2");
		word2style.put("<>", "keyword2");
		word2style.put("!#", "keyword2");
		word2style.put("!~", "keyword2");
		word2style.put("!<", "keyword2");
		word2style.put("!>", "keyword2");
		word2style.put("is not", "keyword2");
		word2style.put("not", "keyword2");
		word2style.put("in", "keyword2");
		word2style.put("between", "keyword2");
		word2style.put("exists", "keyword2");

		word2style.put("count", "keyword2");
		word2style.put("avg", "keyword2");
		word2style.put("max", "keyword2");
		word2style.put("min", "keyword2");
		word2style.put("sum", "keyword2");

		word2style.put("distinct", "keyword2");
		word2style.put("all", "keyword2");
		word2style.put("*", "keyword2");

	}

	public static class Kit extends StyledEditorKit {
		public Document createDefaultDocument() {
			return new EditorDocument(new REHqlTypes());
		}
	}
}
