lily mode

--HG--
branch : pmacs2
This commit is contained in:
moculus 2009-02-17 21:45:23 +00:00
parent b0b050d092
commit f07449a82c
1 changed files with 33 additions and 0 deletions

33
mode/lily.py Normal file
View File

@ -0,0 +1,33 @@
import color, mode
from lex import Grammar, PatternRule, RegionRule
from mode.scheme import SchemeGrammar
class CommentGrammar(Grammar):
rules = [PatternRule(r'data', r'(?:[^%]|%[^}])+')]
class LilyGrammar(Grammar):
rules = [
PatternRule(r'comment', r'%.*$'),
RegionRule(r'comment', r'%\{', CommentGrammar, r'%\}'),
PatternRule(r'delimiter', r'(?:[=(){}\[\];:,.])'),
PatternRule(r'note', r'[a-g'),
RegionRule(r'scheme', r'#\(', SchemeGrammar, '\)'),
PatternRule(r'directive', r'\\[a-zA-Z_][a-zA-Z_0-9]*'),
PatternRule(r'bareword', r'[a-zA-Z_][a-zA-Z_0-9]*'),
]
class Lily(mode.Fundamental):
modename = 'lily'
extensions = ['.ly']
grammar = LilyGrammar
commentc = '%'
colors = {}
opentokens = ('delimiter',)
opentags = {'(': ')', '[': ']', '{': '}'}
closetokens = ('delimiter',)
closetags = {')': '(', ']': '[', '}': '{'}
install = Lily.install