2007-07-21 11:40:53 -04:00
|
|
|
import color, mode2
|
|
|
|
|
|
|
|
from point2 import Point
|
|
|
|
from lex3 import Grammar, PatternRule, RegionRule
|
|
|
|
|
|
|
|
class MetadataGrammar(Grammar):
|
|
|
|
rules = [
|
|
|
|
PatternRule(r'username', r'[a-zA-Z0-9_]+'),
|
|
|
|
]
|
|
|
|
|
|
|
|
class BlameGrammar(Grammar):
|
|
|
|
rules = [
|
2007-07-23 17:07:43 -04:00
|
|
|
RegionRule(r'metadata', r'^[0-9\.]+', MetadataGrammar, r'(?:[0-9]{4}-[0-9]{2}-[0-9]{2}|[0-9]{2}-[A-Z][a-z]{2}-[0-9]{2})'),
|
2007-07-21 11:40:53 -04:00
|
|
|
PatternRule(r'data', r'.+$'),
|
|
|
|
]
|
|
|
|
|
|
|
|
class Blame(mode2.Fundamental):
|
2007-10-18 17:07:35 -04:00
|
|
|
modename = 'Blame'
|
2007-07-21 11:40:53 -04:00
|
|
|
grammar = BlameGrammar
|
|
|
|
colors = {
|
|
|
|
'metadata.start': ('blue', 'default', 'bold'),
|
|
|
|
'metadata.username': ('cyan', 'default', 'bold'),
|
|
|
|
'metadata.end': ('green', 'default', 'bold'),
|
|
|
|
}
|