2009-03-29 20:50:27 -04:00
|
|
|
from mode import Fundamental
|
|
|
|
from lex import Grammar, PatternRule
|
2007-07-21 11:40:53 -04:00
|
|
|
|
|
|
|
class DiffGrammar(Grammar):
|
|
|
|
rules = [
|
2007-09-28 16:55:57 -04:00
|
|
|
PatternRule(name=r'left', pattern=r"^\-.*\n$"),
|
|
|
|
PatternRule(name=r'right', pattern=r"^\+.*\n$"),
|
|
|
|
PatternRule(name=r'metadata', pattern=r'^[A-Za-z].*\n$'),
|
|
|
|
PatternRule(name=r'seperator', pattern=r'^={67}\n$'),
|
|
|
|
PatternRule(name=r'location', pattern=r"^@@ [-+0-9a-z, ]* @@\n$"),
|
|
|
|
PatternRule(name=r'common', pattern=r"^.*\n$"),
|
2007-07-21 11:40:53 -04:00
|
|
|
]
|
|
|
|
|
2009-03-29 20:50:27 -04:00
|
|
|
class Diff(Fundamental):
|
2009-03-17 15:24:10 -04:00
|
|
|
name = 'diff'
|
|
|
|
extensions = ['.patch', '.diff']
|
|
|
|
grammar = DiffGrammar()
|
|
|
|
colors = {
|
2007-07-21 11:40:53 -04:00
|
|
|
'left': ('red', 'default', 'bold'),
|
|
|
|
'right': ('blue', 'default', 'bold'),
|
|
|
|
'seperator': ('magenta', 'default', 'bold'),
|
|
|
|
'metadata': ('magenta', 'default', 'bold'),
|
|
|
|
'location': ('magenta', 'default', 'bold'),
|
|
|
|
}
|
2007-10-19 02:41:33 -04:00
|
|
|
|
|
|
|
install = Diff.install
|