2009-03-28 22:20:37 -04:00
|
|
|
from mode import Fundamental
|
|
|
|
from lex import Grammar, PatternRule, RegionRule, PatternMatchRule
|
|
|
|
|
|
|
|
fields = (
|
|
|
|
(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'),
|
|
|
|
)
|
|
|
|
fregex = ''.join(['(%s)' % tpl[1] for tpl in fields])
|
|
|
|
fnames = [tpl[0] for tpl in fields]
|
2008-09-15 19:08:16 -04:00
|
|
|
|
|
|
|
class FstabGrammar(Grammar):
|
|
|
|
rules = [
|
|
|
|
PatternRule(r'comment', r'#.*$'),
|
2009-03-28 22:20:37 -04:00
|
|
|
PatternMatchRule(r'x', fregex, *fnames),
|
2008-09-15 19:08:16 -04:00
|
|
|
]
|
|
|
|
|
2009-03-28 22:20:37 -04:00
|
|
|
class Fstab(Fundamental):
|
2009-03-17 15:24:10 -04:00
|
|
|
name = 'fstab'
|
2008-10-07 23:39:22 -04:00
|
|
|
basenames = ['fstab']
|
|
|
|
grammar = FstabGrammar
|
|
|
|
colors = {
|
|
|
|
'fstab_device': ('magenta', 'default', 'bold'),
|
|
|
|
'fstab_point': ('cyan', 'default', 'bold'),
|
|
|
|
'fstab_type': ('green', 'default', 'bold'),
|
2008-09-15 19:08:16 -04:00
|
|
|
'fstab_options': ('cyan', 'default', 'bold'),
|
2008-10-07 23:39:22 -04:00
|
|
|
'fstab_dump': ('green', 'default', 'bold'),
|
|
|
|
'fstab_pass': ('green', 'default', 'bold'),
|
|
|
|
'fstab_error': ('default', 'red', 'bold'),
|
2008-09-15 19:08:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
install = Fstab.install
|