diff --git a/application.py b/application.py index 6e12bf9..6074b4d 100755 --- a/application.py +++ b/application.py @@ -129,7 +129,7 @@ class Application(object): 'latex', 'insertmini', 'conf', 'haskell', 'erlang', 'iperl', 'iperlmini', 'ipython', 'ipythonmini', 'bds', #XYZ - 'shell', 'shellmini', + 'shell', 'shellmini', 'fstab' ) for name in names: exec("import mode.%s; mode.%s.install(self)" % (name, name)) diff --git a/mode/fstab.py b/mode/fstab.py new file mode 100644 index 0000000..7b916c5 --- /dev/null +++ b/mode/fstab.py @@ -0,0 +1,34 @@ +import color, mode +from lex import Grammar, PatternRule, RegionRule, PatternGroupRule +from mode.sh import StringGrammar + +class FstabGrammar(Grammar): + rules = [ + PatternRule(r'comment', r'#.*$'), + PatternGroupRule(r'fstab_stanza', + r'fstab_device', r'^ *(?:[^# \n\t]+|\\.)+', + r'fstab_point', r' *(?:[^# \n\t]+|\\.)+', + r'fstab_type', r' *(?:[^# \n\t]+|\\.)+', + r'fstab_options', r' *(?:[^# \n\t]+|\\.)+', + r'fstab_dump', r' *(?:[^# \n\t]+|\\.)+', + r'fstab_pass', r' *(?:[^# \n\t]+|\\.)+', + r'fstab_error', r'[^\n]*', + r'fstab_eol', r'\n') + + ] + +class Fstab(mode.Fundamental): + modename = 'fstab' + basenames = ['fstab'] + grammar = FstabGrammar + colors = { + 'fstab_device': ('magenta', 'default', 'bold'), + 'fstab_point': ('cyan', 'default', 'bold'), + 'fstab_type': ('green', 'default', 'bold'), + 'fstab_options': ('cyan', 'default', 'bold'), + 'fstab_dump': ('green', 'default', 'bold'), + 'fstab_pass': ('green', 'default', 'bold'), + 'fstab_error': ('default', 'red', 'bold'), + } + +install = Fstab.install