pmacs3/mode/text2.py

31 lines
1.1 KiB
Python
Raw Normal View History

import color, mode2, mode.text, method, ispell
from lex3 import Token, Rule, PatternRule, RegionRule, Grammar
from mode.text import WordRule, ContinuedRule
class Text2Grammar(Grammar):
rules = [
PatternRule(name=r'email', pattern=r'(?:^|(?<=[ :]))<?[^<>@\n ]+@(?:[^<>@\.\n ]+\.)*[^<>@\.\n ]+>?'),
PatternRule(name=r'url', pattern=r'(?:^|(?<= ))(?:http|https|ftp|sftp|file|smtp|smtps|torrent|news|jabber|irc|telnet)://(?:[^\.\n ]+\.)*[^\.\n ]+'),
ContinuedRule(),
WordRule(),
PatternRule(r'punct', r'[^a-zA-Z0-9_]'),
PatternRule(r'stuff', r'[a-zA-Z0-9_]+'),
]
class Text2(mode.text.Text):
2007-10-18 17:07:35 -04:00
modename = 'Text2'
grammar = Text2Grammar
extensions = ['.txt']
colors = {
'email': ('cyan', 'default'),
'url': ('green', 'default'),
'misspelled': ('red', 'default'),
'cont.start': ('default', 'default'),
'cont.end': ('default', 'default'),
'word': ('default', 'default'),
'punct': ('default', 'default'),
'stuff': ('default', 'default'),
}
2007-10-19 02:41:33 -04:00
install = Text2.install