parent
78cf08ec88
commit
7a3d761c35
|
@ -4,21 +4,23 @@ from lex import Grammar, PatternRule, RegionRule, Grammar
|
|||
from method import Method
|
||||
from mode.perl import PerlGrammar
|
||||
from mode.xml import TagGrammar
|
||||
from mode.perl import StringGrammar
|
||||
from mode.perl import StringGrammar, StrictStringGrammar
|
||||
|
||||
class BDSGrammar(Grammar):
|
||||
rules = [
|
||||
RegionRule(r'comment', r'<!--', Grammar, r'-->'),
|
||||
RegionRule(r'xml_tag', r'< */?', TagGrammar, r'/?>'),
|
||||
PatternRule(r'delimiter', r'[\[\]\{\}\(\),\?:]'),
|
||||
PatternRule(r'bds_derived', r'(?:FM|CD|FS|FM|TA)[0-9]{3}-[0-9]{3}-[0-9]{3}'),
|
||||
PatternRule(r'bds_alias', r'[a-z0-9]+(?=:)'),
|
||||
PatternRule(r'keyword', r'if|else|elsif|unless'),
|
||||
PatternRule(r'bds_derived', r'(?:CN|FM|CD|IS|FS|FM|TA)[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'bds_function', r'[A-Z_][A-Z0-9_]+(?= *\()'),
|
||||
PatternRule(r'bds_perlfunc', r'[a-zA-Z_][a-zA-Z0-9_]+(?= *\()'),
|
||||
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'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', "'", Grammar, "'"),
|
||||
RegionRule(r'string', "'", StrictStringGrammar, "'"),
|
||||
PatternRule(r'bds_operator', r'(?:>=|<=|>|<|==|&&|\|\||eq|ne)'),
|
||||
]
|
||||
|
||||
|
@ -47,6 +49,7 @@ class BDS(mode.Fundamental):
|
|||
closetokens = ('delimiter',)
|
||||
closetags = {')': '(', ']': '[', '}': '{'}
|
||||
colors = {
|
||||
'bds_alias': ('yellow', 'default', 'bold'),
|
||||
'bds_derived': ('yellow', 'default', 'bold'),
|
||||
'bds_question': ('yellow', 'default', 'bold'),
|
||||
'bds_misquoted': ('yellow', 'red', 'bold'),
|
||||
|
|
Loading…
Reference in New Issue