fixed small sh mode eval highlighting bug

--HG--
branch : pmacs2
This commit is contained in:
moculus 2007-10-14 17:11:01 +00:00
parent 9f22f9dbc1
commit c63e82e9a7
1 changed files with 14 additions and 2 deletions

View File

@ -11,6 +11,16 @@ class StringGrammar(Grammar):
PatternRule(r'variable', r"\$(?=\()"), PatternRule(r'variable', r"\$(?=\()"),
] ]
class EvalGrammar(Grammar):
rules = [
RegionRule(r'string', "'", Grammar, "'"),
RegionRule(r'string', '"', StringGrammar, '"'),
PatternRule(r'escaped', r'\\.'),
PatternRule(r'variable', r"\${(?:[a-zA-Z0-9_]+|\?\$)}"),
PatternRule(r"variable", r"\$[^({][a-zA-Z0-9_]*"),
PatternRule(r'variable', r"\$(?=\()"),
]
class CaseGrammar(Grammar): class CaseGrammar(Grammar):
rules = [ rules = [
RegionRule(r'stanza', r'.+\)', Grammar, r';;'), RegionRule(r'stanza', r'.+\)', Grammar, r';;'),
@ -44,8 +54,10 @@ class ShGrammar(Grammar):
RegionRule(r'test', r'test', TestGrammar, r'\n'), RegionRule(r'test', r'test', TestGrammar, r'\n'),
RegionRule(r'test2', r'\[', TestGrammar, r'\]'), RegionRule(r'test2', r'\[', TestGrammar, r'\]'),
PatternRule(r'delimiter', r";;|[();{}|&><]"), PatternRule(r'delimiter', r";;|[();{}|&><]"),
RegionRule(r'eval', r'`', StringGrammar, r'`'), #RegionRule(r'eval', r'`', StringGrammar, r'`'),
RegionRule(r'neval', r'\$\(', StringGrammar, r'\)'), #RegionRule(r'neval', r'\$\(', StringGrammar, r'\)'),
RegionRule(r'eval', r'`', EvalGrammar, r'`'),
RegionRule(r'neval', r'\$\(', EvalGrammar, r'\)'),
PatternRule(r'variable', r"(?:^|(?<= ))[a-zA-Z_][a-zA-Z0-9_]*(?==)"), PatternRule(r'variable', r"(?:^|(?<= ))[a-zA-Z_][a-zA-Z0-9_]*(?==)"),
PatternRule(r'variable', r"\${(?:[a-zA-Z0-9_]+|\?\$)}"), PatternRule(r'variable', r"\${(?:[a-zA-Z0-9_]+|\?\$)}"),
PatternRule(r"variable", r"\$[^({][a-zA-Z0-9_]*"), PatternRule(r"variable", r"\$[^({][a-zA-Z0-9_]*"),