parent
a3ed5279be
commit
0ca66531c6
193
mode/perl.py
193
mode/perl.py
|
@ -139,7 +139,7 @@ class PerlGrammar(Grammar):
|
||||||
RegionRule('perl.string', "'", StrictStringGrammar, "'"),
|
RegionRule('perl.string', "'", StrictStringGrammar, "'"),
|
||||||
RegionRule('perl.evalstring', "`", EvalGrammar, "`"),
|
RegionRule('perl.evalstring', "`", EvalGrammar, "`"),
|
||||||
PatternRule('perl.keyword', "(?<!->)(?:continue|do|else|elsif|eval|foreach|for|if|last|my|next|no|our|package|require|return|sub|undef|unless|until|use|while)(?![a-zA-Z0-9_])"),
|
PatternRule('perl.keyword', "(?<!->)(?:continue|do|else|elsif|eval|foreach|for|if|last|my|next|no|our|package|require|return|sub|undef|unless|until|use|while)(?![a-zA-Z0-9_])"),
|
||||||
PatternRule('perl.builtin', "(?<!->)(?:STDIN|STDERR|STDOUT)(?![a-zA-Z0-9_])"),
|
PatternRule('perl.reserved', "(?<!->)(?:STDIN|STDERR|STDOUT|__PACKAGE__)(?![a-zA-Z0-9_])"),
|
||||||
PatternRule('perl.hashkey', '(?<={)' + wchr2 + '+(?=})'),
|
PatternRule('perl.hashkey', '(?<={)' + wchr2 + '+(?=})'),
|
||||||
PatternRule('perl.method', '(?<=->)' + word1),
|
PatternRule('perl.method', '(?<=->)' + word1),
|
||||||
PatternRule('perl.hashkey', wchr2 + '+(?= *=>)'),
|
PatternRule('perl.hashkey', wchr2 + '+(?= *=>)'),
|
||||||
|
@ -257,7 +257,7 @@ class PerlGrammar(Grammar):
|
||||||
PatternRule('perl.noperator', "-[rwxoRWXOezsfdlpSbctugkTBMAC](?!" +
|
PatternRule('perl.noperator', "-[rwxoRWXOezsfdlpSbctugkTBMAC](?!" +
|
||||||
wchr2 + ")"),
|
wchr2 + ")"),
|
||||||
PatternRule('perl.operator', r"\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*=|\\"),
|
PatternRule('perl.operator', r"\+=|-=|\*=|/=|//=|%=|&=\|\^=|>>=|<<=|\*\*=|\\"),
|
||||||
PatternRule('perl.operator', r"\+\+|\+|<=>|<>|<<|<=|<|-|>>|>=|>|\*\*|\*|&&|&|\|\||\||/|\^|==|//|~|=~|!~|!=|%|!|\.|x(?![a-zA-Z_])"),
|
PatternRule('perl.operator', r"\+\+|\+|<=>|<>|<<|<=|<|-|>>|>=|>|\*\*|\*|&&|&|\|\||\||/|\^|==|//|~|=~|!~|!=|%|!|\.\.|\.|x(?![a-zA-Z_])"),
|
||||||
PatternRule('perl.noperator', "(?:xor|or|not|ne|lt|le|gt|ge|eq|cmp|and)(?![a-zA-Z_])"),
|
PatternRule('perl.noperator', "(?:xor|or|not|ne|lt|le|gt|ge|eq|cmp|and)(?![a-zA-Z_])"),
|
||||||
PatternRule('perl.bareword', word2),
|
PatternRule('perl.bareword', word2),
|
||||||
|
|
||||||
|
@ -728,31 +728,33 @@ class PerlContext(context.Context):
|
||||||
if curr: self.namelines[i] = (curr, tuple(stack))
|
if curr: self.namelines[i] = (curr, tuple(stack))
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
|
# white is for delimiters, operators, numbers
|
||||||
|
default = ('default', 'default', 'bold')
|
||||||
|
|
||||||
# green is for strings and hash keys
|
# green is for strings and hash keys
|
||||||
low_green = ('green130', 'default', 'bold')
|
lo_green = ('green020', 'default', 'bold')
|
||||||
lit_green = ('green251', 'default', 'bold')
|
hi_green = ('green050', 'default', 'bold')
|
||||||
|
|
||||||
# cyan is for quotes, evals, regexes, subs
|
# cyan is for quotes, evals, regexes, subs
|
||||||
low_cyan = ('cyan022', 'default', 'bold')
|
lo_cyan = ('cyan022', 'default', 'bold')
|
||||||
med_cyan = ('cyan', 'default', 'bold')
|
hi_cyan = ('cyan255', 'default', 'bold')
|
||||||
lit_cyan = ('cyan255', 'default', 'bold')
|
|
||||||
|
|
||||||
# magenta is for keywords/builtins, translation, globs
|
# magenta is for keywords/builtins, translation, globs
|
||||||
low_magenta = ('magenta424', 'default', 'bold')
|
lo_magenta = ('magenta202', 'default', 'bold')
|
||||||
med_magenta = ('magenta', 'default', 'bold')
|
hi_magenta = ('magenta505', 'default', 'bold')
|
||||||
lit_magenta = ('magenta515', 'default', 'bold')
|
|
||||||
|
|
||||||
# yellow is for variables
|
# yellow/orange are for scalars, arrays and hashes
|
||||||
med_yellow = ('yellow', 'default', 'bold')
|
hi_yellow = ('yellow', 'default', 'bold')
|
||||||
lit_orange = ('yellow530', 'default', 'bold')
|
lo_yellow = ('yellow530', 'default', 'bold')
|
||||||
med_orange = ('yellow520', 'default', 'bold')
|
lo_orange = ('yellow520', 'default', 'bold')
|
||||||
|
|
||||||
# red is for comments, pods, endblocks
|
# red is for comments, pods, endblocks
|
||||||
low_red = ('red300', 'default', 'bold')
|
lo_red = ('red300', 'default', 'bold')
|
||||||
med_red = ('red', 'default', 'bold')
|
hi_red = ('red500', 'default', 'bold')
|
||||||
lit_red = ('red500', 'default', 'bold')
|
|
||||||
|
|
||||||
# blue is unused
|
# blue is unused
|
||||||
|
lo_blue = ('blue113', 'default', 'bold')
|
||||||
|
hi_blue = ('blue225', 'default', 'bold')
|
||||||
|
|
||||||
class Perl(Fundamental):
|
class Perl(Fundamental):
|
||||||
name = 'Perl'
|
name = 'Perl'
|
||||||
|
@ -767,103 +769,104 @@ class Perl(Fundamental):
|
||||||
closetags = {')': '(', ']': '[', '}': '{'}
|
closetags = {')': '(', ']': '[', '}': '{'}
|
||||||
colors = {
|
colors = {
|
||||||
# comments
|
# comments
|
||||||
'endblock.start': low_red,
|
'perl.comment': hi_red,
|
||||||
'endblock.end': lit_red,
|
'endblock.start': lo_red,
|
||||||
'endblock.data': lit_red,
|
'endblock.end': hi_red,
|
||||||
'endblock.null': lit_red,
|
'endblock.data': hi_red,
|
||||||
|
'endblock.null': hi_red,
|
||||||
|
|
||||||
# pod
|
# pod
|
||||||
'pod.start': med_red,
|
'pod.start': hi_red,
|
||||||
'pod.end': med_red,
|
'pod.end': hi_red,
|
||||||
'pod.data': med_red,
|
'pod.data': hi_red,
|
||||||
'pod.null': med_red,
|
'pod.null': hi_red,
|
||||||
'pod.entry.start': med_magenta,
|
'pod.entry.start': hi_magenta,
|
||||||
'pod.entry.end': med_magenta,
|
'pod.entry.end': hi_magenta,
|
||||||
'pod.entry.data': med_magenta,
|
'pod.entry.data': hi_magenta,
|
||||||
'pod.entry.null': med_magenta,
|
'pod.entry.null': hi_magenta,
|
||||||
|
|
||||||
# basic stuff
|
# basic stuff
|
||||||
'perl.sub': med_cyan,
|
'perl.sub': hi_cyan,
|
||||||
'prototype': med_yellow,
|
'perl.prototype': hi_yellow,
|
||||||
'noperator': med_magenta,
|
'perl.noperator': hi_magenta,
|
||||||
'perl.keyword': low_magenta,
|
'perl.keyword': hi_magenta,
|
||||||
'perl.builtin': med_magenta,
|
'perl.builtin': hi_magenta,
|
||||||
#'perl.cast': med_yellow,
|
'perl.reserved': hi_magenta,
|
||||||
'perl.scalar': med_yellow,
|
'perl.scalar': hi_yellow,
|
||||||
'perl.length': med_yellow,
|
'perl.length': hi_yellow,
|
||||||
'perl.deref': med_yellow,
|
'perl.deref': hi_yellow,
|
||||||
'perl.array': lit_orange,
|
'perl.array': lo_yellow,
|
||||||
'perl.hash': med_orange,
|
'perl.hash': lo_orange,
|
||||||
'perl.hashkey': lit_green,
|
'perl.hashkey': hi_green,
|
||||||
'perl.method': med_cyan,
|
'perl.method': hi_cyan,
|
||||||
'perl.function': med_cyan,
|
'perl.function': hi_cyan,
|
||||||
'perl.builtin': med_magenta,
|
'perl.label': hi_cyan,
|
||||||
'perl.label': med_cyan,
|
'perl.package': hi_cyan,
|
||||||
'package': med_cyan,
|
'perl.class': hi_cyan,
|
||||||
'perl.class': med_cyan,
|
'perl.use': hi_cyan,
|
||||||
'perl.use': med_cyan,
|
'perl.require': hi_cyan,
|
||||||
'perl.require': med_cyan,
|
'perl.glob': hi_magenta,
|
||||||
|
|
||||||
# heredoc/evaldoc
|
# heredoc/evaldoc
|
||||||
'heredoc.start': low_green,
|
'heredoc.start': lo_green,
|
||||||
'heredoc.end': low_green,
|
'heredoc.end': lo_green,
|
||||||
'heredoc.data': lit_green,
|
'heredoc.data': hi_green,
|
||||||
'heredoc.null': lit_green,
|
'heredoc.null': hi_green,
|
||||||
|
|
||||||
'evaldoc.start': low_cyan,
|
'evaldoc.start': lo_cyan,
|
||||||
'evaldoc.end': low_cyan,
|
'evaldoc.end': lo_cyan,
|
||||||
'evaldoc.data': lit_cyan,
|
'evaldoc.data': hi_cyan,
|
||||||
'evaldoc.null': lit_cyan,
|
'evaldoc.null': hi_cyan,
|
||||||
|
|
||||||
|
# numbers
|
||||||
|
'perl.number': default,
|
||||||
|
|
||||||
# strings
|
# strings
|
||||||
'perl.string.start': low_green,
|
'perl.string.start': lo_green,
|
||||||
'perl.string.end': low_green,
|
'perl.string.end': lo_green,
|
||||||
'perl.string.data': lit_green,
|
'perl.string.data': hi_green,
|
||||||
'perl.string.null': lit_green,
|
'perl.string.null': hi_green,
|
||||||
'perl.string.escaped': med_magenta,
|
'perl.string.escaped': hi_magenta,
|
||||||
'perl.string.deref': med_yellow,
|
'perl.string.deref': hi_yellow,
|
||||||
|
|
||||||
# `` strings
|
# `` strings
|
||||||
'evalstring.start': low_cyan,
|
'evalstring.start': lo_cyan,
|
||||||
'evalstring.end': low_cyan,
|
'evalstring.end': lo_cyan,
|
||||||
'evalstring.data': lit_cyan,
|
'evalstring.data': hi_cyan,
|
||||||
'evalstring.null': lit_cyan,
|
'evalstring.null': hi_cyan,
|
||||||
'evalstring.escaped': med_magenta,
|
'evalstring.escaped': hi_magenta,
|
||||||
'evalstring.deref': med_yellow,
|
'evalstring.deref': hi_yellow,
|
||||||
|
|
||||||
# quoted region
|
# quoted region
|
||||||
'perl.quoted.start': low_cyan,
|
'perl.quoted.start': lo_cyan,
|
||||||
'perl.quoted.end': low_cyan,
|
'perl.quoted.end': lo_cyan,
|
||||||
'perl.quoted.data': lit_cyan,
|
'perl.quoted.data': hi_cyan,
|
||||||
'perl.quoted.null': lit_cyan,
|
'perl.quoted.null': hi_cyan,
|
||||||
'perl.quoted.escaped': med_magenta,
|
'perl.quoted.escaped': hi_magenta,
|
||||||
'perl.quoted.deref': med_yellow,
|
'perl.quoted.deref': hi_yellow,
|
||||||
|
|
||||||
# match regex
|
# match regex
|
||||||
'match.start': low_cyan,
|
'match.start': lo_cyan,
|
||||||
'match.end': low_cyan,
|
'match.end': lo_cyan,
|
||||||
'match.data': lit_cyan,
|
'match.data': hi_cyan,
|
||||||
'match.null': lit_cyan,
|
'match.null': hi_cyan,
|
||||||
|
|
||||||
# replace regex
|
# replace regex
|
||||||
'replace.start': low_cyan,
|
'replace.start': lo_cyan,
|
||||||
'replace.middle0': low_cyan,
|
'replace.middle0': lo_cyan,
|
||||||
'replace.middle1': low_cyan,
|
'replace.middle1': lo_cyan,
|
||||||
'replace.end': low_cyan,
|
'replace.end': lo_cyan,
|
||||||
'replace.data': lit_cyan,
|
'replace.data': hi_cyan,
|
||||||
'replace.null': lit_cyan,
|
'replace.null': hi_cyan,
|
||||||
'replace.escaped': med_magenta,
|
'replace.escaped': hi_magenta,
|
||||||
'replace.deref': med_yellow,
|
'replace.deref': hi_yellow,
|
||||||
|
|
||||||
# translate regex
|
# translate regex
|
||||||
'translate.start': low_magenta,
|
'translate.start': lo_magenta,
|
||||||
'translate.middle0': low_magenta,
|
'translate.middle0': lo_magenta,
|
||||||
'translate.end': low_magenta,
|
'translate.end': lo_magenta,
|
||||||
'translate.data': lit_magenta,
|
'translate.data': hi_magenta,
|
||||||
'translate.null': lit_magenta,
|
'translate.null': hi_magenta,
|
||||||
|
|
||||||
# xyz
|
|
||||||
'perl.glob': med_magenta,
|
|
||||||
}
|
}
|
||||||
config = {}
|
config = {}
|
||||||
lconfig = {'perl.libs': []}
|
lconfig = {'perl.libs': []}
|
||||||
|
|
Loading…
Reference in New Issue