21 lines
631 B
Python
21 lines
631 B
Python
from mode import Fundamental
|
|
from lex import Grammar, PatternRule, RegionRule
|
|
from mode.python import StringGrammar1, StringGrammar2
|
|
|
|
class ConfGrammar(Grammar):
|
|
rules = [
|
|
PatternRule('conf.comment', '#.*$'),
|
|
PatternRule('conf.comment', '//.*$'),
|
|
RegionRule('conf.string', "'", StringGrammar1, "'"),
|
|
RegionRule('conf.string', '"', StringGrammar2, '"'),
|
|
PatternRule('conf.data', r'(?:[^\'"#/]|/(?!/))+'),
|
|
]
|
|
|
|
class Conf(Fundamental):
|
|
name = 'conf'
|
|
extensions = ['.conf', '.cfg', '.cnf', '.config']
|
|
grammar = ConfGrammar
|
|
colors = {}
|
|
|
|
install = Conf.install
|