diff options
author | Tim Hatch <tim@timhatch.com> | 2014-04-14 13:47:40 -0400 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-04-14 13:47:40 -0400 |
commit | 06a720cca67ff19f873f8066c17cf4ea90ab0f0f (patch) | |
tree | 2901fe8e218cce5a8e788645d41aec654f297e23 /pygments/lexers/web.py | |
parent | 02683b5def213065f6b893f91fc54f313141fbdf (diff) | |
parent | 5d57fe78405ac06a306f5ed2dd1b630a909cbdfb (diff) | |
download | pygments-06a720cca67ff19f873f8066c17cf4ea90ab0f0f.tar.gz |
Merged in yloiseau/pygments-main (pull request #309)
Diffstat (limited to 'pygments/lexers/web.py')
-rw-r--r-- | pygments/lexers/web.py | 67 |
1 files changed, 65 insertions, 2 deletions
diff --git a/pygments/lexers/web.py b/pygments/lexers/web.py index c975ad80..7d3073f1 100644 --- a/pygments/lexers/web.py +++ b/pygments/lexers/web.py @@ -28,7 +28,7 @@ __all__ = ['HtmlLexer', 'XmlLexer', 'JavascriptLexer', 'JsonLexer', 'CssLexer', 'ObjectiveJLexer', 'CoffeeScriptLexer', 'LiveScriptLexer', 'DuelLexer', 'ScamlLexer', 'JadeLexer', 'XQueryLexer', 'DtdLexer', 'DartLexer', 'LassoLexer', 'QmlLexer', 'TypeScriptLexer', - 'KalLexer', 'CirruLexer', 'MaskLexer'] + 'KalLexer', 'CirruLexer', 'MaskLexer', 'ZephirLexer'] class JavascriptLexer(RegexLexer): @@ -3691,7 +3691,7 @@ class DartLexer(RegexLexer): r'native|operator|set|static|typedef|var)\b', Keyword.Declaration), (r'\b(bool|double|Dynamic|int|num|Object|String|void)\b', Keyword.Type), (r'\b(false|null|true)\b', Keyword.Constant), - (r'[~!%^&*+=|?:<>/-]|as', Operator), + (r'[~!%^&*+=|?:<>/-]|as\b', Operator), (r'[a-zA-Z_$][a-zA-Z0-9_]*:', Name.Label), (r'[a-zA-Z_$][a-zA-Z0-9_]*', Name), (r'[(){}\[\],.;]', Punctuation), @@ -4336,5 +4336,68 @@ class MaskLexer(RegexLexer): 'string-double-pop2':[ (r'"', String.Single, '#pop:2'), include('string-base') + ], + } + + +class ZephirLexer(RegexLexer): + """ + For `Zephir language <http://zephir-lang.com/>`_ source code. + + Zephir is a compiled high level language aimed + to the creation of C-extensions for PHP. + + .. versionadded:: 2.0 + """ + + name = 'Zephir' + aliases = ['zephir'] + filenames = ['*.zep'] + + zephir_keywords = [ 'fetch', 'echo', 'isset', 'empty'] + zephir_type = [ 'bit', 'bits' , 'string' ] + + flags = re.DOTALL | re.MULTILINE + + tokens = { + 'commentsandwhitespace': [ + (r'\s+', Text), + (r'//.*?\n', Comment.Single), + (r'/\*.*?\*/', Comment.Multiline) + ], + 'slashstartsregex': [ + include('commentsandwhitespace'), + (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' + r'([gim]+\b|\B)', String.Regex, '#pop'), + (r'', Text, '#pop') + ], + 'badregex': [ + (r'\n', Text, '#pop') + ], + 'root': [ + (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'), + include('commentsandwhitespace'), + (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|' + r'(<<|>>>?|==?|!=?|->|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'), + (r'[{(\[;,]', Punctuation, 'slashstartsregex'), + (r'[})\].]', Punctuation), + (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|loop|require|inline|' + r'throw|try|catch|finally|new|delete|typeof|instanceof|void|namespace|use|extends|' + r'this|fetch|isset|unset|echo|fetch|likely|unlikely|empty)\b', Keyword, 'slashstartsregex'), + (r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'), + (r'(abstract|boolean|bool|char|class|const|double|enum|export|' + r'extends|final|float|goto|implements|import|int|string|interface|long|ulong|char|uchar|native|unsigned|' + r'private|protected|public|short|static|self|throws|reverse|' + r'transient|volatile)\b', Keyword.Reserved), + (r'(true|false|null|undefined)\b', Keyword.Constant), + (r'(Array|Boolean|Date|_REQUEST|_COOKIE|_SESSION|' + r'_GET|_POST|_SERVER|this|stdClass|range|count|iterator|' + r'window)\b', Name.Builtin), + (r'[$a-zA-Z_][a-zA-Z0-9_\\]*', Name.Other), + (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float), + (r'0x[0-9a-fA-F]+', Number.Hex), + (r'[0-9]+', Number.Integer), + (r'"(\\\\|\\"|[^"])*"', String.Double), + (r"'(\\\\|\\'|[^'])*'", String.Single), ] } |