pmacs3/mode/blame.py

24 lines
689 B
Python
Raw Normal View History

2009-03-29 20:50:27 -04:00
from mode import Fundamental
2007-10-21 20:52:48 -04:00
from lex import Grammar, PatternRule, RegionRule
2007-07-21 11:40:53 -04:00
class MetadataGrammar(Grammar):
2009-03-29 20:50:27 -04:00
rules = [PatternRule(r'username', r'[a-zA-Z0-9_]+')]
2007-07-21 11:40:53 -04:00
class BlameGrammar(Grammar):
rules = [
2009-03-29 20:50:27 -04:00
RegionRule(r'metadata', r'^[0-9\.]+', MetadataGrammar,
r'(?:\d{4}-\d{2}-\d{2}|\d{2}-[A-Z][a-z]{2}-\d{2})'),
2007-07-21 11:40:53 -04:00
PatternRule(r'data', r'.+$'),
]
2009-03-29 20:50:27 -04:00
class Blame(Fundamental):
name = 'Blame'
2007-07-21 11:40:53 -04:00
grammar = BlameGrammar
colors = {
2007-07-21 11:40:53 -04:00
'metadata.start': ('blue', 'default', 'bold'),
'metadata.username': ('cyan', 'default', 'bold'),
'metadata.end': ('green', 'default', 'bold'),
}
2007-10-19 02:41:33 -04:00
install = Blame.install