branch : pmacs2
This commit is contained in:
moculus 2008-03-16 06:16:41 +00:00
parent bc65acb16d
commit a968dae8b0
5 changed files with 27 additions and 46 deletions

8
README
View File

@ -80,10 +80,10 @@ Quick Start Guide:
C-x C-c quit C-x C-c quit
NOTE: the notation used corresponds to the following: NOTE: the notation used corresponds to the following:
C-x hold Control then press x. C-x hold Control and press x.
M-x hold Meta then press x. M-x hold Meta and press x.
C-c j hold Control then press c, and then press j C-c j hold Control and press c, then press j
C-x C-s hold Control then press x, then hold Control then press s C-x C-s hold Control and press x, then hold Control and press s
6. Other documentation: 6. Other documentation:

View File

@ -48,7 +48,13 @@ class Application(object):
self.error_string = "" self.error_string = ""
self.error_timestamp = None self.error_timestamp = None
self.input = keyinput.Handler() self.input = keyinput.Handler()
self.token_colors = {} # let's prepopulate some default token colors
self.token_colors = {
'comment': ('red', 'default'),
'comment.start': ('red', 'default'),
'comment.null': ('red', 'default'),
'comment.end': ('red', 'default'),
}
self.default_color = ('default', 'default',) self.default_color = ('default', 'default',)
# initialize our colors # initialize our colors

View File

@ -8,5 +8,6 @@ def do_junk(*args):
s = "<foo blah='3'>bar</foo>" s = "<foo blah='3'>bar</foo>"
#@@:string:python #@@:string:python
s = "lambda x, y: 'result: %d' % x + y" #@@:string.string:sql
s = "lambda x, y: 'select * from foo where x = %d and y = %d;' % x + y"
s = "lambda x, y: 'result: %d' % x + y" s = "lambda x, y: 'result: %d' % x + y"

View File

@ -9,17 +9,17 @@ from mode.perl import StringGrammar
class BDSGrammar(Grammar): class BDSGrammar(Grammar):
rules = [ rules = [
RegionRule(r'comment', r'<!--', Grammar, r'-->'), RegionRule(r'comment', r'<!--', Grammar, r'-->'),
RegionRule(r'tag', r'< */?', TagGrammar, r'/?>'), RegionRule(r'xml_tag', r'< */?', TagGrammar, r'/?>'),
PatternRule(r'delimiter', r'[\[\]\{\}\(\),\?:]'), PatternRule(r'delimiter', r'[\[\]\{\}\(\),\?:]'),
PatternRule(r'derived', r'(?:FM|CD|FS|FM|TA)[0-9]{3}-[0-9]{3}-[0-9]{3}'), PatternRule(r'bds_derived', r'(?:FM|CD|FS|FM|TA)[0-9]{3}-[0-9]{3}-[0-9]{3}'),
PatternRule(r'question', r'GQ[0-9]{3}-[0-9]{3}-[0-9]{3}:MQ[0-9]{3}-[0-9]{3}-[0-9]{3}'), PatternRule(r'bds_question', r'GQ[0-9]{3}-[0-9]{3}-[0-9]{3}:MQ[0-9]{3}-[0-9]{3}-[0-9]{3}'),
PatternRule(r'bdsfunc', r'[A-Z_][A-Z0-9_]+(?= *\()'), PatternRule(r'bds_function', r'[A-Z_][A-Z0-9_]+(?= *\()'),
PatternRule(r'perlfunc', r'[a-zA-Z_][a-zA-Z0-9_]+(?= *\()'), PatternRule(r'bds_perlfunc', r'[a-zA-Z_][a-zA-Z0-9_]+(?= *\()'),
PatternRule(r'misquoted', r"'[A-Z]{2}[0-9]{3}-[0-9]{3}-[0-9]{3}(?::[A-Z]{2}[0-9]{3}-[0-9]{3}-[0-9]{3})?'"), PatternRule(r'bds_misquoted', r"'[A-Z]{2}[0-9]{3}-[0-9]{3}-[0-9]{3}(?::[A-Z]{2}[0-9]{3}-[0-9]{3}-[0-9]{3})?'"),
PatternRule(r'misquoted', r'"[A-Z]{2}[0-9]{3}-[0-9]{3}-[0-9]{3}(?::[A-Z]{2}[0-9]{3}-[0-9]{3}-[0-9]{3})?"'), PatternRule(r'bds_misquoted', r'"[A-Z]{2}[0-9]{3}-[0-9]{3}-[0-9]{3}(?::[A-Z]{2}[0-9]{3}-[0-9]{3}-[0-9]{3})?"'),
RegionRule(r'string', '"', StringGrammar, '"'), RegionRule(r'string', '"', StringGrammar, '"'),
RegionRule(r'string', "'", Grammar, "'"), RegionRule(r'string', "'", Grammar, "'"),
PatternRule(r'operator', r'(?:&gt;=|&lt;=|&gt;|&lt;|==|&amp;&amp;|\|\||eq|ne)'), PatternRule(r'bds_operator', r'(?:&gt;=|&lt;=|&gt;|&lt;|==|&amp;&amp;|\|\||eq|ne)'),
] ]
class BDS(mode.Fundamental): class BDS(mode.Fundamental):
@ -31,32 +31,12 @@ class BDS(mode.Fundamental):
closetokens = ('delimiter',) closetokens = ('delimiter',)
closetags = {')': '(', ']': '[', '}': '{'} closetags = {')': '(', ']': '[', '}': '{'}
colors = { colors = {
# comments 'bds_derived': ('yellow', 'default'),
'comment.start': ('red', 'default'), 'bds_question': ('yellow', 'default'),
'comment.null': ('red', 'default'), 'bds_misquoted': ('yellow', 'red'),
'comment.end': ('red', 'default'), 'bds_function': ('magenta', 'default'),
# xml tag 'bds_perlfunc': ('magenta', 'default'),
'tag.start': ('default', 'default'), 'bds_operator': ('magenta', 'default'),
'tag.namespace': ('magenta', 'default'),
'tag.name': ('blue', 'default'),
'tag.attrname': ('blue', 'default'),
'tag.string.start': ('cyan', 'default'),
'tag.string.null': ('cyan', 'default'),
'tag.string.end': ('cyan', 'default'),
'tag.end': ('default', 'default'),
# strings
'string.start': ('green', 'default'),
'string.octal': ('magenta', 'default'),
'string.escaped': ('magenta', 'default'),
'string.null': ('green', 'default'),
'string.end': ('green', 'default'),
# keywords, etc
'derived': ('yellow', 'default'),
'question': ('yellow', 'default'),
'misquoted': ('yellow', 'red'),
'bdsfunc': ('magenta', 'default'),
'perlfunc': ('magenta', 'default'),
'operator': ('magenta', 'default'),
} }
def __init__(self, w): def __init__(self, w):
mode.Fundamental.__init__(self, w) mode.Fundamental.__init__(self, w)

View File

@ -188,10 +188,6 @@ class C(mode.Fundamental):
'macrocomment.start': ('red', 'default'), 'macrocomment.start': ('red', 'default'),
'macrocomment.null': ('red', 'default'), 'macrocomment.null': ('red', 'default'),
'macrocomment.end': ('red', 'default'), 'macrocomment.end': ('red', 'default'),
'comment': ('red', 'default'),
'comment.start': ('red', 'default'),
'comment.end': ('red', 'default'),
'comment.null': ('red', 'default'),
'include': ('blue', 'default'), 'include': ('blue', 'default'),
'header': ('green', 'default'), 'header': ('green', 'default'),
@ -231,8 +227,6 @@ class C(mode.Fundamental):
'string.end': ('green', 'default'), 'string.end': ('green', 'default'),
'integer': ('green', 'default'), 'integer': ('green', 'default'),
'float': ('green', 'default'), 'float': ('green', 'default'),
'bizzaro': ('magenta', 'green'),
} }
def __init__(self, w): def __init__(self, w):
mode.Fundamental.__init__(self, w) mode.Fundamental.__init__(self, w)