Skip to content

Commit

Permalink
Added a long list of keywords to the keywords checks. Since we probab…
Browse files Browse the repository at this point in the history
…ly want to reuse that list we need some variable substituion of whatever in the config DSL really
  • Loading branch information
claesjac committed Jan 15, 2012
1 parent 8079503 commit 7402131
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
32 changes: 31 additions & 1 deletion rules/keywords.pcs
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
token "keywords-in-caps" {
type: SELECT, CASE, IS, NOT, ELSE, WHEN, END_P, THEN;
type: ABORT_P, ABSOLUTE_P, ACCESS, ACTION, ADD_P, ADMIN, AFTER, AGGREGATE, ALL, ALSO, ALTER, ALWAYS, ANALYSE, ANALYZE, AND,
ANY, ARRAY, AS, ASC, ASSERTION, ASSIGNMENT, ASYMMETRIC, AT, ATTRIBUTE, AUTHORIZATION, BACKWARD, BEFORE, BEGIN_P, BETWEEN,
BIGINT, BINARY, BIT, BOOLEAN_P, BOTH, BY, CACHE, CALLED, CASCADE, CASCADED, CASE, CAST, CATALOG_P, CHAIN, CHAR_P,
CHARACTER, CHARACTERISTICS, CHECK, CHECKPOINT, CLASS, CLOSE, CLUSTER, COALESCE, COLLATE, COLLATION, COLUMN, COMMENT,
COMMENTS, COMMIT, COMMITTED, CONCURRENTLY, CONFIGURATION, CONNECTION, CONSTRAINT, CONSTRAINTS, CONTENT_P, CONTINUE_P,
CONVERSION_P, COPY, COST, CREATE, CROSS, CSV, CURRENT_P, CURRENT_CATALOG, CURRENT_DATE, CURRENT_ROLE, CURRENT_SCHEMA,
CURRENT_TIME, CURRENT_TIMESTAMP, CURRENT_USER, CURSOR, CYCLE, DATA_P, DATABASE, DAY_P, DEALLOCATE, DEC, DECIMAL_P,
DECLARE, DEFAULT, DEFAULTS, DEFERRABLE, DEFERRED, DEFINER, DELETE_P, DELIMITER, DELIMITERS, DESC, DICTIONARY, DISABLE_P,
DISCARD, DISTINCT, DO, DOCUMENT_P, DOMAIN_P, DOUBLE_P, DROP, EACH, ELSE, ENABLE_P, ENCODING, ENCRYPTED, END_P, ENUM_P,
ESCAPE, EXCEPT, EXCLUDE, EXCLUDING, EXCLUSIVE, EXECUTE, EXISTS, EXPLAIN, EXTENSION, EXTERNAL, EXTRACT, FALSE_P, FAMILY,
FETCH, FIRST_P, FLOAT_P, FOLLOWING, FOR, FORCE, FOREIGN, FORWARD, FREEZE, FROM, FULL, FUNCTION, FUNCTIONS, GLOBAL, GRANT,
GRANTED, GREATEST, GROUP_P, HANDLER, HAVING, HEADER_P, HOLD, HOUR_P, IDENTITY_P, IF_P, ILIKE, IMMEDIATE, IMMUTABLE,
IMPLICIT_P, IN_P, INCLUDING, INCREMENT, INDEX, INDEXES, INHERIT, INHERITS, INITIALLY, INLINE_P, INNER_P, INOUT, INPUT_P,
INSENSITIVE, INSERT, INSTEAD, INT_P, INTEGER, INTERSECT, INTERVAL, INTO, INVOKER, IS, ISNULL, ISOLATION, JOIN, KEY,
LABEL, LANGUAGE, LARGE_P, LAST_P, LC_COLLATE_P, LC_CTYPE_P, LEADING, LEAST, LEFT, LEVEL, LIKE, LIMIT, LISTEN, LOAD,
LOCAL, LOCALTIME, LOCALTIMESTAMP, LOCATION, LOCK_P, MAPPING, MATCH, MAXVALUE, MINUTE_P, MINVALUE, MODE, MONTH_P, MOVE,
NAME_P, NAMES, NATIONAL, NATURAL, NCHAR, NEXT, NO, NONE, NOT, NOTHING, NOTIFY, NOTNULL, NOWAIT, NULL_P, NULLIF, NULLS_P,
NUMERIC, OBJECT_P, OF, OFF, OFFSET, OIDS, ON, ONLY, OPERATOR, OPTION, OPTIONS, OR, ORDER, OUT_P, OUTER_P, OVER, OVERLAPS,
OVERLAY, OWNED, OWNER, PARSER, PARTIAL, PARTITION, PASSING, PASSWORD, PLACING, PLANS, POSITION, PRECEDING, PRECISION,
PREPARE, PREPARED, PRESERVE, PRIMARY, PRIOR, PRIVILEGES, PROCEDURAL, PROCEDURE, QUOTE, RANGE, READ, REAL, REASSIGN,
RECHECK, RECURSIVE, REF, REFERENCES, REINDEX, RELATIVE_P, RELEASE, RENAME, REPEATABLE, REPLACE, REPLICA, RESET, RESTART,
RESTRICT, RETURNING, RETURNS, REVOKE, RIGHT, ROLE, ROLLBACK, ROW, ROWS, RULE, SAVEPOINT, SCHEMA, SCROLL, SEARCH,
SECOND_P, SECURITY, SELECT, SEQUENCE, SEQUENCES, SERIALIZABLE, SERVER, SESSION, SESSION_USER, SET, SETOF, SHARE, SHOW,
SIMILAR, SIMPLE, SMALLINT, SNAPSHOT, SOME, STABLE, STANDALONE_P, START, STATEMENT, STATISTICS, STDIN, STDOUT, STORAGE,
STRICT_P, STRIP_P, SUBSTRING, SYMMETRIC, SYSID, SYSTEM_P, TABLE, TABLES, TABLESPACE, TEMP, TEMPLATE, TEMPORARY, TEXT_P,
THEN, TIME, TIMESTAMP, TO, TRAILING, TRANSACTION, TREAT, TRIGGER, TRIM, TRUE_P, TRUNCATE, TRUSTED, TYPE_P, TYPES_P,
UNBOUNDED, UNCOMMITTED, UNENCRYPTED, UNION, UNIQUE, UNKNOWN, UNLISTEN, UNLOGGED, UNTIL, UPDATE, USER, USING, VACUUM,
VALID, VALIDATE, VALIDATOR, VALUE_P, VALUES, VARCHAR, VARIADIC, VARYING, VERBOSE, VERSION_P, VIEW, VOLATILE, WHEN, WHERE,
WHITESPACE_P, WINDOW, WITH, WITHOUT, WORK, WRAPPER, WRITE, XML_P, XMLATTRIBUTES, XMLCONCAT, XMLELEMENT, XMLEXISTS,
XMLFOREST, XMLPARSE, XMLPI, XMLROOT, XMLSERIALIZE, YEAR_P, YES_P, ZONE;

matches: "[A-Z]+";
};
4 changes: 2 additions & 2 deletions test.sql
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SELECT COUNT(*), x*y, SUM(CASE WHEN Foo IS NOT NULL THEN 1 ELSE 0 END)
select COUNT(*), x*y, SUM(CASE WHEN Foo IS NOT NULL THEN 1 ELSE 0 END)
FROM Bar
WHERE Quax = $1 AND Datestamp>=now() -'1 hour'::interval;
WHERE Quax = $1 and Datestamp>=now() -'1 hour'::interval;

0 comments on commit 7402131

Please sign in to comment.