From 6eb083ff355c1d5fd32942a019bb5edb2d604245 Mon Sep 17 00:00:00 2001 From: moculus Date: Sat, 14 Feb 2009 03:36:38 +0000 Subject: [PATCH] mode cleanup --HG-- branch : pmacs2 --- mode/lisp.py | 4 ++-- mode/scheme.py | 2 ++ mode/sql.py | 12 ++++++++---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mode/lisp.py b/mode/lisp.py index 55cce01..eb3f811 100644 --- a/mode/lisp.py +++ b/mode/lisp.py @@ -56,7 +56,7 @@ class Lisp(mode.Fundamental): self.add_bindings('close-paren', (')',)) self.add_bindings('close-brace', ('}',)) self.add_bindings('close-bracket', (']',)) - self.add_action_and_bindings('lisp-comment-region', ('C-c #',)) - self.add_action_and_bindings('lisp-uncomment-region', ('C-u C-C #',)) + self.add_bindings('lisp-comment-region', ('C-c #',)) + self.add_bindings('lisp-uncomment-region', ('C-u C-C #',)) install = Lisp.install diff --git a/mode/scheme.py b/mode/scheme.py index 122dba4..378e2f6 100644 --- a/mode/scheme.py +++ b/mode/scheme.py @@ -60,5 +60,7 @@ class Scheme(mode.Fundamental): self.add_bindings('close-brace', ('}',)) self.add_bindings('close-bracket', (']',)) self.add_bindings('scheme-check-syntax', ('C-c s',)) + self.add_bindings('lisp-comment-region', ('C-c #',)) + self.add_bindings('lisp-uncomment-region', ('C-u C-C #',)) install = Scheme.install diff --git a/mode/sql.py b/mode/sql.py index 0baf31a..e077a7f 100644 --- a/mode/sql.py +++ b/mode/sql.py @@ -13,9 +13,9 @@ class PlPgSqlGrammar(Grammar): NocasePatternRule(r'attribute', r'(?:check|exists|unique|not null|default|primary key|minvalue|foreign key|references)(?![A-Za-z0-9_])'), NocasePatternRule(r'sql_keyword', r'(?:declare|begin|end if|end loop|end|raise notice|return|if|while|for|else)(?![A-Za-z0-9_])'), - NocasePatternRule(r'sql_operator', r'(?:case|when|then|else|end|not|and|or|is not|is|in|not in)(?![A-Za-z0-9_])'), + NocasePatternRule(r'sql_operator', r'(?:case|when|then|else|end|not in|not|and|or|is not|is|in|between|overlaps|like|ilike|similar)(?![A-Za-z0-9_])'), NocasePatternRule(r'sql_keyword', r'(?:create database|create index|create sequence|create table|create trigger|create view|select|insert|update|delete|drop database|drop index|drop sequence|drop table|drop trigger|drop view|create user|alter user|drop user|drop function|grant|revoke|create function|create or replace function|create or replace view|create language|create operator|create type)(?![A-Za-z0-9_])'), - NocasePatternRule(r'pseudokeyword', r'(?:returns|language|right join|left join|inner join|outer join|join|where|null|true|false|into|values|as|from|order by|next|asc|desc|limit|distinct|cascade|alias for|using|on)(?![A-Za-z0-9_])'), + NocasePatternRule(r'pseudokeyword', r'(?:returns|language|right join|left join|inner join|outer join|join|where|unknown|null|true|false|into|values|as|from|order by|next|asc|desc|limit|distinct|cascade|alias for|using|on)(?![A-Za-z0-9_])'), NocasePatternRule(r'sql_type', r'(?:void|row|serial|varchar|float|integer|int|text|timestamptz|timestamp|datetz|date|timetz|time|boolean|bool|record|row)(?![A-Za-z0-9_])'), PatternRule(r'sql_builtin', r'(?:nextval|current_timestamp|current_time|current_date)(?![A-Za-z0-9_])'), RegionRule(r'string', "''", StringGrammar1, "''"), @@ -58,9 +58,9 @@ class SqlGrammar(Grammar): NocaseRegionRule(r'function', r'create or replace function', FunctionGrammar, r';'), NocasePatternRule(r'attribute', r'(?:check|exists|unique|not null|default|primary key|minvalue|foreign key|references)(?![A-Za-z0-9_])'), - NocasePatternRule(r'sql_operator', r'(?:case|when|then|else|end|not|and|or|is not|is|in|not in)(?![A-Za-z0-9_])'), + NocasePatternRule(r'sql_operator', r'(?:case|when|then|else|end|not in|not|and|or|is not|is|in|between|overlaps|like|ilike|similar)(?![A-Za-z0-9_])'), NocasePatternRule(r'sql_keyword', r'(?:create database|create index|create sequence|create table|create trigger|create view|select|insert|update|delete|drop database|drop index|drop sequence|drop table|drop trigger|drop view|create user|alter user|drop user|drop function|grant|revoke|create function|create or replace function|create or replace view|create language|create operator|create type)(?![A-Za-z0-9_])'), - NocasePatternRule(r'pseudokeyword', r'(?:returns|language|right join|left join|inner join|outer join|join|where|null|true|false|into|values|as|from|order by|asc|desc|limit|distinct|cascade|using|on)(?![A-Za-z0-9_])'), + NocasePatternRule(r'pseudokeyword', r'(?:returns|language|right join|left join|inner join|outer join|join|where|unknown|null|true|false|into|values|as|from|order by|asc|desc|limit|distinct|cascade|using|on)(?![A-Za-z0-9_])'), NocasePatternRule(r'sql_type', r'(?:void|row|serial|varchar|float|integer|int|text|timestamptz|timestamp|datetz|date|timetz|time|boolean|bool)(?![A-Za-z0-9_])'), PatternRule(r'sql_builtin', r'(?:nextval|current_timestamp|current_time|current_date)(?![A-Za-z0-9_])'), RegionRule(r'string', "'", StringGrammar1, "'"), @@ -128,6 +128,8 @@ class Sql(mode.Fundamental): opentags = {'(': ')', '[': ']', '{': '}'} closetokens = ('delimiter',) closetags = {')': '(', ']': '[', '}': '{'} + actions = [SqlCommentRegion, SqlUncommentRegion] + colors = { 'sql_operator': ('yellow', 'default', 'bold'), 'attribute': ('magenta', 'default', 'bold'), @@ -160,5 +162,7 @@ class Sql(mode.Fundamental): self.add_bindings('close-paren', (')',)) self.add_bindings('close-brace', ('}',)) self.add_bindings('close-bracket', (']',)) + self.add_bindings('sql-comment-region', ('C-c #',)) + self.add_bindings('sql-uncomment-region', ('C-u C-c #',)) install = Sql.install