From b0b050d092c84a41f885f25c34eb19940cd6f207 Mon Sep 17 00:00:00 2001 From: moculus Date: Tue, 17 Feb 2009 14:51:26 +0000 Subject: [PATCH] finalized comment-region refactor --HG-- branch : pmacs2 --- mode/elisp.py | 2 -- mode/sql.py | 23 +++++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/mode/elisp.py b/mode/elisp.py index 61e9d68..e238648 100644 --- a/mode/elisp.py +++ b/mode/elisp.py @@ -50,8 +50,6 @@ class ELisp(mode.Fundamental): 'close-paren': (')',), 'close-brace': ('}',), 'close-bracket': (']',), - 'lisp-comment-region': ('C-c #',), - 'lisp-uncomment-region': ('C-u C-C #',), } install = ELisp.install diff --git a/mode/sql.py b/mode/sql.py index b6a6c82..af2e046 100644 --- a/mode/sql.py +++ b/mode/sql.py @@ -21,9 +21,7 @@ end_rules = [ PatternRule(r'eol', r'\n'), ] -class PlPgSqlGrammar(Grammar): - #rules = base_rules + sql_rules + end_rules - pass +class PlPgSqlGrammar(Grammar): pass sql_type_rule = 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_])') @@ -51,16 +49,23 @@ sql_rules = [ PatternRule(r'number', r'[0-9]+(?:e[+-]?[0-9]+)?'), PatternRule(r'number', r'[0-9]+\.(?:[0-9]+)?(?:e[+-]?[0-9]+)?'), PatternRule(r'number', r'\.[0-9]+(?:e[+-]?[0-9]+)'), - RegionRule(r'string', "B'", BitStringGrammar, "'"), - RegionRule(r'string', "X'", HexStringGrammar, "'"), - RegionRule(r'string', "'", StringGrammar1, "'"), RegionRule(r'sql_quoted', '"', StringGrammar2, '"'), ] -PlPgSqlGrammar.rules = base_rules + sql_rules + end_rules +string_rules = [ + RegionRule(r'string', "B'", BitStringGrammar, "'"), + RegionRule(r'string', "X'", HexStringGrammar, "'"), + RegionRule(r'string', "'", StringGrammar1, "'"), +] + +PlPgSqlGrammar.rules = base_rules + sql_rules + [ + RegionRule(r'string', "B''", BitStringGrammar, "''"), + RegionRule(r'string', "X''", HexStringGrammar, "''"), + RegionRule(r'string', "''", StringGrammar1, "''"), +] + end_rules class SqlGrammar(Grammar): - rules = base_rules + function_rules + sql_rules + end_rules + rules = base_rules + function_rules + sql_rules + string_rules + end_rules class SqlTabber(tab.StackTabber): wst = ('null', 'eol',) @@ -146,8 +151,6 @@ class Sql(mode.Fundamental): 'close-paren': (')',), 'close-brace': ('}',), 'close-bracket': (']',), - 'sql-comment-region': ('C-c #',), - 'sql-uncomment-region': ('C-u C-c #',), } install = Sql.install