improve indentation, git log-parsing, and scala-mode
--HG-- branch : pmacs2
This commit is contained in:
commit
5ba91e2ab1
|
@ -176,7 +176,7 @@ class GitBlame(VcBlame):
|
||||||
'''show blame output for the current version in SVN'''
|
'''show blame output for the current version in SVN'''
|
||||||
# rev, user, date, [time], [timezone], [date-str], content
|
# rev, user, date, [time], [timezone], [date-str], content
|
||||||
num_fields = 3
|
num_fields = 3
|
||||||
line_re = re.compile(r'^\^*([0-9a-f]+) \(([a-zA-Z0-9_]+|Not Committed Yet) +([-0-9]+) [:0-9]+ +[-\+]\d{4} +\d+\) (.*)\n$')
|
line_re = re.compile(r'^\^*([0-9a-f]+) \(([a-zA-Z0-9_ ]+|Not Committed Yet) +([-0-9]+) [:0-9]+ +[-\+]\d{4} +\d+\) (.*)\n$')
|
||||||
prefix_fmt = '[g:d:*]%*s [c:d:*]%-*s [b:d:*]%*s[d:d:*]'
|
prefix_fmt = '[g:d:*]%*s [c:d:*]%-*s [b:d:*]%*s[d:d:*]'
|
||||||
pretest_err_msg = 'Git is not installed'
|
pretest_err_msg = 'Git is not installed'
|
||||||
_is_method = True
|
_is_method = True
|
||||||
|
|
|
@ -30,8 +30,9 @@ class StringGrammar(Grammar):
|
||||||
class SubTypeGrammar(Grammar): pass
|
class SubTypeGrammar(Grammar): pass
|
||||||
SubTypeGrammar.rules = [
|
SubTypeGrammar.rules = [
|
||||||
RegionRule('sub', r'\[', SubTypeGrammar, r'\]'),
|
RegionRule('sub', r'\[', SubTypeGrammar, r'\]'),
|
||||||
PatternRule('scala.type', '[a-zA-Z0-9_]+'),
|
PatternRule('scala.type', '(?:[a-zA-Z0-9_.]+| *=> *)+'),
|
||||||
PatternRule('spaces', ' +'),
|
PatternRule('spaces', ' +'),
|
||||||
|
PatternRule('scala.annotation', '@[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
]
|
]
|
||||||
|
|
||||||
class ScalaGrammar(Grammar):
|
class ScalaGrammar(Grammar):
|
||||||
|
@ -40,18 +41,18 @@ class ScalaGrammar(Grammar):
|
||||||
RegionRule('scala.comment', r'/\*', NestedCommentGrammar, r'\*/'),
|
RegionRule('scala.comment', r'/\*', NestedCommentGrammar, r'\*/'),
|
||||||
RegionRule('scala.script', r'#!.+$', ShGrammar, r'!#'),
|
RegionRule('scala.script', r'#!.+$', ShGrammar, r'!#'),
|
||||||
|
|
||||||
PatternMatchRule('x', r'(?<!:)(:)([a-zA-Z0-9_]+)',
|
PatternMatchRule('x', r'(?<!:)(:)((?:[a-zA-Z0-9_.]+| *=> *)+)',
|
||||||
'delimiter', 'scala.type'),
|
'delimiter', 'scala.type'),
|
||||||
PatternMatchRule('x', r'(?<!:)(:)( +)([a-zA-Z0-9_]+)',
|
PatternMatchRule('x', r'(?<!:)(:)( +)((?:[a-zA-Z0-9_.]+| *=> *)+)',
|
||||||
'delimiter', 'spaces', 'scala.type'),
|
'delimiter', 'spaces', 'scala.type'),
|
||||||
#PatternMatchRule('x', r'(?<=[a-zA-Z0-9_ ])(:)([a-zA-Z0-9_]+)',
|
#PatternMatchRule('x', r'(?<=[a-zA-Z0-9_ ])(:)([a-zA-Z0-9_]+)',
|
||||||
# 'delimiter', 'scala.type'),
|
# 'delimiter', 'scala.type'),
|
||||||
#PatternMatchRule('x', r'(?<=[a-zA-Z0-9_ ])(:)( +)([a-zA-Z0-9_]+)',
|
#PatternMatchRule('x', r'(?<=[a-zA-Z0-9_ ])(:)( +)([a-zA-Z0-9_]+)',
|
||||||
# 'delimiter', 'spaces', 'scala.type'),
|
# 'delimiter', 'spaces', 'scala.type'),
|
||||||
|
|
||||||
PatternMatchRule('x', r'(extends)( +)([a-zA-Z0-9_]+)',
|
PatternMatchRule('x', r'(extends)( +)([a-zA-Z0-9_.]+)',
|
||||||
'scala.reserved', 'spaces', 'scala.type'),
|
'scala.reserved', 'spaces', 'scala.type'),
|
||||||
PatternMatchRule('x', r'(with)( +)([a-zA-Z0-9_]+)',
|
PatternMatchRule('x', r'(with)( +)([a-zA-Z0-9_.]+)',
|
||||||
'scala.reserved', 'spaces', 'scala.type'),
|
'scala.reserved', 'spaces', 'scala.type'),
|
||||||
|
|
||||||
#PatternRule('delimiter', r'(?:;|{|}|\[|\]|\(|\)|,|\.|<(?![a-zA-Z_])|>|:|/|\+|-|\*|=)'),
|
#PatternRule('delimiter', r'(?:;|{|}|\[|\]|\(|\)|,|\.|<(?![a-zA-Z_])|>|:|/|\+|-|\*|=)'),
|
||||||
|
@ -69,7 +70,7 @@ class ScalaGrammar(Grammar):
|
||||||
PatternRule('scala.object', '(?<=(?<![a-zA-Z0-9_])object )[a-zA-Z_][a-zA-Z0-9_]*'),
|
PatternRule('scala.object', '(?<=(?<![a-zA-Z0-9_])object )[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
PatternRule('scala.trait', '(?<=(?<![a-zA-Z0-9_])trait )[a-zA-Z_][a-zA-Z0-9_]*'),
|
PatternRule('scala.trait', '(?<=(?<![a-zA-Z0-9_])trait )[a-zA-Z_][a-zA-Z0-9_]*'),
|
||||||
|
|
||||||
PatternRule('scala.pseudo', '(?:true|null|false)'),
|
PatternRule('scala.pseudo', '(?:true|null|false)(?!%s)' % word),
|
||||||
|
|
||||||
PatternRule('scala.reserved', '(?:yield|with|while|var|val|until|type|true|try|trait|throw|to|this|super|sealed|return|protected|private|package|override|object|null|new|match|lazy|import|implicit|if|forSome|for|finally|final|false|extends|else|do|def|class|catch|case|abstract)(?!%s)' % word),
|
PatternRule('scala.reserved', '(?:yield|with|while|var|val|until|type|true|try|trait|throw|to|this|super|sealed|return|protected|private|package|override|object|null|new|match|lazy|import|implicit|if|forSome|for|finally|final|false|extends|else|do|def|class|catch|case|abstract)(?!%s)' % word),
|
||||||
|
|
||||||
|
@ -337,7 +338,7 @@ class Scala(Fundamental):
|
||||||
'scala.script.start': hi_red,
|
'scala.script.start': hi_red,
|
||||||
'scala.script.end': hi_red,
|
'scala.script.end': hi_red,
|
||||||
|
|
||||||
'scala.annotation': lo_green,
|
'scala.annotation': lo_orange,
|
||||||
'scala.pseudo': hi_magenta,
|
'scala.pseudo': hi_magenta,
|
||||||
|
|
||||||
'scala.reserved': hi_cyan,
|
'scala.reserved': hi_cyan,
|
||||||
|
|
4
tab.py
4
tab.py
|
@ -473,9 +473,9 @@ class StackTabber2(Tabber):
|
||||||
|
|
||||||
# remove implicit continuation
|
# remove implicit continuation
|
||||||
if self.end_at_eof and i + start == end:
|
if self.end_at_eof and i + start == end:
|
||||||
self._pop_while('continue', 'control')
|
self._pop_while('continue', 'control', 'pre-control')
|
||||||
elif self.end_at_tokens.get(name, {}).get(s):
|
elif self.end_at_tokens.get(name, {}).get(s):
|
||||||
self._pop_while('continue', 'control')
|
self._pop_while('continue', 'control', 'pre-control')
|
||||||
|
|
||||||
# add implicit continuation
|
# add implicit continuation
|
||||||
top = self._peek()
|
top = self._peek()
|
||||||
|
|
Loading…
Reference in New Issue