diff options
author | Tim Hatch <tim@timhatch.com> | 2014-05-05 10:36:34 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-05-05 10:36:34 -0700 |
commit | f81d591b4d2deb5edc4b3090a2f72ea62d3a58c6 (patch) | |
tree | cfc796f0e72ab9ba73c482e6e7aa7c64fefe033d /pygments | |
parent | f16d0dbfaececc1b868c11355f4bca13e06dca53 (diff) | |
parent | 9b3c28af7c23dc90e648f439397529b82624d120 (diff) | |
download | pygments-f81d591b4d2deb5edc4b3090a2f72ea62d3a58c6.tar.gz |
Merged in Oldes/pygments-main/issue-985 (pull request #345)
REBOL comments handling fixed
Diffstat (limited to 'pygments')
-rw-r--r-- | pygments/lexers/other.py | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/pygments/lexers/other.py b/pygments/lexers/other.py index 454f0e42..01c61513 100644 --- a/pygments/lexers/other.py +++ b/pygments/lexers/other.py @@ -1380,7 +1380,7 @@ class RebolLexer(RegexLexer): """ name = 'REBOL' aliases = ['rebol'] - filenames = ['*.r', '*.r3'] + filenames = ['*.r', '*.r3', '*.reb'] mimetypes = ['text/x-rebol'] flags = re.IGNORECASE | re.MULTILINE @@ -1506,7 +1506,10 @@ class RebolLexer(RegexLexer): (r'[a-zA-Z]+[^(\^{"\s:)]*://[^(\^{"\s)]*', Name.Decorator), # url (r'mailto:[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # url (r'[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # email - (r'comment\s', Comment, 'comment'), + (r'comment\s"', Comment, 'commentString1'), + (r'comment\s{', Comment, 'commentString2'), + (r'comment\s\[', Comment, 'commentBlock'), + (r'comment\s[^(\s{\"\[]+', Comment), (r'/[^(\^{^")\s/[\]]*', Name.Attribute), (r'([^(\^{^")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback), (r'<[a-zA-Z0-9:._-]*>', Name.Tag), @@ -1561,12 +1564,6 @@ class RebolLexer(RegexLexer): (r'([0-1]\s*){8}', Number.Hex), (r'}', Number.Hex, '#pop'), ], - 'comment': [ - (r'"', Comment, 'commentString1'), - (r'{', Comment, 'commentString2'), - (r'\[', Comment, 'commentBlock'), - (r'[^(\s{\"\[]+', Comment, '#pop'), - ], 'commentString1': [ (r'[^(\^")]+', Comment), (escape_re, Comment), @@ -1585,7 +1582,9 @@ class RebolLexer(RegexLexer): 'commentBlock': [ (r'\[', Comment, '#push'), (r'\]', Comment, '#pop'), - (r'[^(\[\])]+', Comment), + (r'"', Comment, "commentString1"), + (r'{', Comment, "commentString2"), + (r'[^(\[\]\"{)]+', Comment), ], } def analyse_text(text): @@ -4344,7 +4343,10 @@ class RedLexer(RegexLexer): (r'[a-zA-Z]+[^(\^{"\s:)]*://[^(\^{"\s)]*', Name.Decorator), # url (r'mailto:[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # url (r'[^(\^{"@\s)]+@[^(\^{"@\s)]+', Name.Decorator), # email - (r'comment\s', Comment, 'comment'), + (r'comment\s"', Comment, 'commentString1'), + (r'comment\s{', Comment, 'commentString2'), + (r'comment\s\[', Comment, 'commentBlock'), + (r'comment\s[^(\s{\"\[]+', Comment), (r'/[^(\^{^")\s/[\]]*', Name.Attribute), (r'([^(\^{^")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback), (r'<[a-zA-Z0-9:._-]*>', Name.Tag), @@ -4399,12 +4401,6 @@ class RedLexer(RegexLexer): (r'([0-1]\s*){8}', Number.Hex), (r'}', Number.Hex, '#pop'), ], - 'comment': [ - (r'"', Comment, 'commentString1'), - (r'{', Comment, 'commentString2'), - (r'\[', Comment, 'commentBlock'), - (r'[^(\s{\"\[]+', Comment, '#pop'), - ], 'commentString1': [ (r'[^(\^")]+', Comment), (escape_re, Comment), @@ -4423,6 +4419,8 @@ class RedLexer(RegexLexer): 'commentBlock': [ (r'\[', Comment, '#push'), (r'\]', Comment, '#pop'), - (r'[^(\[\])]+', Comment), + (r'"', Comment, "commentString1"), + (r'{', Comment, "commentString2"), + (r'[^(\[\]\"{)]+', Comment), ], } |