2007-06-23 21:41:18 -04:00
|
|
|
import color, mode2
|
2007-03-06 10:05:38 -05:00
|
|
|
|
2007-06-23 21:41:18 -04:00
|
|
|
from point2 import Point
|
2007-07-15 15:07:36 -04:00
|
|
|
from lex3 import Grammar, PatternRule, RegionRule
|
2007-06-23 21:41:18 -04:00
|
|
|
|
|
|
|
class MetadataGrammar(Grammar):
|
|
|
|
rules = [
|
2007-07-15 15:07:36 -04:00
|
|
|
PatternRule(r'username', r'[a-zA-Z0-9_]+'),
|
2007-06-23 21:41:18 -04:00
|
|
|
]
|
2007-03-06 10:05:38 -05:00
|
|
|
|
2007-06-23 21:41:18 -04:00
|
|
|
class BlameGrammar(Grammar):
|
|
|
|
rules = [
|
2007-07-15 15:07:36 -04:00
|
|
|
RegionRule(r'metadata', r'^[0-9\.]+', MetadataGrammar, r'[0-9]{4}-[0-9]{2}-[0-9]{2}'),
|
|
|
|
PatternRule(r'data', r'.+$'),
|
2007-06-23 21:41:18 -04:00
|
|
|
]
|
2007-03-06 10:05:38 -05:00
|
|
|
|
2007-06-23 21:41:18 -04:00
|
|
|
class Blame(mode2.Fundamental):
|
2007-07-15 15:07:36 -04:00
|
|
|
grammar = BlameGrammar
|
2007-07-18 07:22:12 -04:00
|
|
|
colors = {
|
|
|
|
'metadata.start': ('blue', 'default', 'bold'),
|
|
|
|
'metadata.username': ('cyan', 'default', 'bold'),
|
|
|
|
'metadata.end': ('green', 'default', 'bold'),
|
|
|
|
}
|
2007-03-06 10:05:38 -05:00
|
|
|
def name(self):
|
|
|
|
return "Blame"
|