Created
July 17, 2011 07:26
-
-
Save bigeasy/1087307 to your computer and use it in GitHub Desktop.
Pygments CoffeeScript Lexer Patch - Lone @ / Division / Multi-line Regex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r 4550b08c3a85 pygments/lexers/web.py | |
--- a/pygments/lexers/web.py Sun Jul 17 00:00:59 2011 +0200 | |
+++ b/pygments/lexers/web.py Sun Jul 17 07:25:43 2011 +0000 | |
@@ -1718,16 +1718,18 @@ | |
(r'\s+', Text), | |
(r'#.*?\n', Comment.Single), | |
], | |
+ 'multilineregex': [ | |
+ include('commentsandwhitespace'), | |
+ (r'///', String.Regex, '#pop'), | |
+ (r'[^#]+', String.Regex) | |
+ ], | |
'slashstartsregex': [ | |
include('commentsandwhitespace'), | |
+ (r'///', String.Regex, ('#pop', 'multilineregex')), | |
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' | |
r'([gim]+\b|\B)', String.Regex, '#pop'), | |
- (r'(?=/)', Text, ('#pop', 'badregex')), | |
(r'', Text, '#pop'), | |
], | |
- 'badregex': [ | |
- ('\n', Text, '#pop'), | |
- ], | |
'root': [ | |
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'), | |
include('commentsandwhitespace'), | |
@@ -1751,6 +1753,7 @@ | |
'slashstartsregex'), | |
(r'@[$a-zA-Z_][a-zA-Z0-9_\.:]*\s*[:=]\s', Name.Variable.Instance, | |
'slashstartsregex'), | |
+ (r'@', Name.Other, 'slashstartsregex'), | |
(r'@?[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other, 'slashstartsregex'), | |
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), | |
(r'0x[0-9a-fA-F]+', Number.Hex), |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment