parent
b0b050d092
commit
f07449a82c
|
@ -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
|
Loading…
Reference in New Issue