import org.eclipse.jface.text.rules.WhitespaceRule;
public class SQLPartitionScanner extends RuleBasedPartitionScanner {
- public final static String SQL_COMMENT = "__sql_comment";
- public final static String SQL_IDENTIFIER = "__sql_word";
- public final static String SQL_STRING = "__sql_string";
- public final static String SQL_KEYWORD = "__sql_keyword";
- public final static String SQL_SYMBOL = "__sql_symbol";
- public final static String SQL_SEPARATOR = "__sql_separator";
- public final static String SQL_NUMERIC = "__sql_numeric";
+ public final static String SQL_COMMENT = "__sql_comment"; //$NON-NLS-1$
+ public final static String SQL_IDENTIFIER = "__sql_word"; //$NON-NLS-1$
+ public final static String SQL_STRING = "__sql_string"; //$NON-NLS-1$
+ public final static String SQL_KEYWORD = "__sql_keyword"; //$NON-NLS-1$
+ public final static String SQL_SYMBOL = "__sql_symbol"; //$NON-NLS-1$
+ public final static String SQL_SEPARATOR = "__sql_separator"; //$NON-NLS-1$
+ public final static String SQL_NUMERIC = "__sql_numeric"; //$NON-NLS-1$
private final static String[] KEYWORDS = {
- "ALTER",
- "AND",
- "BY",
- "COLUMN",
- "CREATE",
- "DELETE",
- "DROP",
- "FROM",
- "GROUP",
- "INSERT",
- "INTO",
- "NOT",
- "NULL",
- "OR",
- "ORDER",
- "SELECT",
- "SEQUENCE",
- "SET",
- "TABLE",
- "UNION",
- "UNIQUE",
- "UPDATE",
- "USING",
- "VALUES",
- "VIEW",
- "WHEN",
- "WHERE"
+ "ALTER", //$NON-NLS-1$
+ "AND", //$NON-NLS-1$
+ "BY", //$NON-NLS-1$
+ "COLUMN", //$NON-NLS-1$
+ "CREATE", //$NON-NLS-1$
+ "DELETE", //$NON-NLS-1$
+ "DROP", //$NON-NLS-1$
+ "FROM", //$NON-NLS-1$
+ "GROUP", //$NON-NLS-1$
+ "INSERT", //$NON-NLS-1$
+ "INTO", //$NON-NLS-1$
+ "NOT", //$NON-NLS-1$
+ "NULL", //$NON-NLS-1$
+ "OR", //$NON-NLS-1$
+ "ORDER", //$NON-NLS-1$
+ "SELECT", //$NON-NLS-1$
+ "SEQUENCE", //$NON-NLS-1$
+ "SET", //$NON-NLS-1$
+ "TABLE", //$NON-NLS-1$
+ "UNION", //$NON-NLS-1$
+ "UNIQUE", //$NON-NLS-1$
+ "UPDATE", //$NON-NLS-1$
+ "USING", //$NON-NLS-1$
+ "VALUES", //$NON-NLS-1$
+ "VIEW", //$NON-NLS-1$
+ "WHEN", //$NON-NLS-1$
+ "WHERE" //$NON-NLS-1$
};
public SQLPartitionScanner() {
IToken numeric = new Token(SQL_NUMERIC);
rules.add(new PredicateRuleAdapter(new WhitespaceRule(new WhitespaceDetector()), whitespace));
- rules.add(new MultiLineRule("/*", "*/", comment));
- rules.add(new EndOfLineRule("--", comment));
- rules.add(new SingleLineRule("'", "'", string));
+ rules.add(new MultiLineRule("/*", "*/", comment)); //$NON-NLS-1$ //$NON-NLS-2$
+ rules.add(new EndOfLineRule("--", comment)); //$NON-NLS-1$
+ rules.add(new SingleLineRule("'", "'", string)); //$NON-NLS-1$ //$NON-NLS-2$
rules.add(new PredicateRuleAdapter(new SQLNumberRule(numeric), numeric));
SQLWordRule wordRule = new SQLWordRule(identifier);
for (int i = 0; i < KEYWORDS.length; i++) {
}
public IToken evaluate(ICharacterScanner scanner) {
int val = scanner.read();
- if (val != scanner.EOF) {
+ if (val != ICharacterScanner.EOF) {
char c = (char) val;
if (!Character.isWhitespace(c) && !Character.isLetterOrDigit(c) && c != '_') {
return token;