finalized comment-region refactor

--HG--
branch : pmacs2
This commit is contained in:
moculus 2009-02-17 14:51:26 +00:00
parent 050f68bc69
commit b0b050d092
2 changed files with 13 additions and 12 deletions

View File

@ -50,8 +50,6 @@ class ELisp(mode.Fundamental):
'close-paren': (')',), 'close-paren': (')',),
'close-brace': ('}',), 'close-brace': ('}',),
'close-bracket': (']',), 'close-bracket': (']',),
'lisp-comment-region': ('C-c #',),
'lisp-uncomment-region': ('C-u C-C #',),
} }
install = ELisp.install install = ELisp.install

View File

@ -21,9 +21,7 @@ end_rules = [
PatternRule(r'eol', r'\n'), PatternRule(r'eol', r'\n'),
] ]
class PlPgSqlGrammar(Grammar): class PlPgSqlGrammar(Grammar): pass
#rules = base_rules + sql_rules + end_rules
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_])') 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]+(?:e[+-]?[0-9]+)?'),
PatternRule(r'number', r'[0-9]+\.(?:[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]+)'), 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, '"'), 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): 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): class SqlTabber(tab.StackTabber):
wst = ('null', 'eol',) wst = ('null', 'eol',)
@ -146,8 +151,6 @@ class Sql(mode.Fundamental):
'close-paren': (')',), 'close-paren': (')',),
'close-brace': ('}',), 'close-brace': ('}',),
'close-bracket': (']',), 'close-bracket': (']',),
'sql-comment-region': ('C-c #',),
'sql-uncomment-region': ('C-u C-c #',),
} }
install = Sql.install install = Sql.install