From d3fa803e766bf8b8e51dd2c32c395499914f32ea Mon Sep 17 00:00:00 2001 From: moculus Date: Mon, 7 Apr 2008 20:09:18 +0000 Subject: [PATCH] conf mode added --HG-- branch : pmacs2 --- application.py | 2 +- bufferlist.py | 6 ------ mode/conf.py | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 mode/conf.py diff --git a/application.py b/application.py index e9f4515..55d90a7 100755 --- a/application.py +++ b/application.py @@ -116,7 +116,7 @@ class Application(object): 'make', 'mini', 'mutt', 'nasm', 'ocaml', 'perl', 'python', 'replace', 'rst', 'scheme', 'search', 'sh', 'sql', 'tt', 'text', 'text2', 'which', 'xml', 'cheetah', 'colortext', - 'latex', 'insertmini') + 'latex', 'insertmini', 'conf') for name in names: exec("import mode.%s; mode.%s.install(self)" % (name, name)) diff --git a/bufferlist.py b/bufferlist.py index ace230b..4e347fc 100644 --- a/bufferlist.py +++ b/bufferlist.py @@ -137,9 +137,3 @@ class BufferList(object): def is_buffer_hidden(self, b): assert b in self.buffers, "buffer %s does not exist" % (b.name()) return b in self.hidden_buffers -# def is_buffer_visible(self, b): -# assert b in self.buffers, "buffer %s does not exist" % (b.name()) -# for slot in self.slots: -# if slot.buffer is b: -# return True -# return False diff --git a/mode/conf.py b/mode/conf.py new file mode 100644 index 0000000..b1c4067 --- /dev/null +++ b/mode/conf.py @@ -0,0 +1,18 @@ +import color, mode +from lex import Grammar, PatternRule, RegionRule +from mode.sh import StringGrammar + +class ConfGrammar(Grammar): + rules = [ + PatternRule(r'comment', r'#.*$'), + RegionRule(r'string', r"'", Grammar, r"'"), + RegionRule(r'string', r'"', StringGrammar, r'"'), + ] + +class Conf(mode.Fundamental): + modename = 'conf' + extensions = ['.conf', '.cfg', '.cnf', '.config'] + grammar = ConfGrammar + colors = {} + +install = Conf.install