pygments.rb 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +40 -0
- data/README.md +3 -0
- data/lexers +0 -0
- data/lib/pygments/popen.rb +3 -2
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -1
- data/vendor/pygments-main/AUTHORS +20 -1
- data/vendor/pygments-main/CHANGES +55 -3
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/MANIFEST.in +1 -1
- data/vendor/pygments-main/Makefile +5 -8
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/doc/Makefile +153 -0
- data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
- data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
- data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
- data/vendor/pygments-main/doc/_templates/docssidebar.html +3 -0
- data/vendor/pygments-main/doc/_templates/indexsidebar.html +25 -0
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +98 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +401 -0
- data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +15 -0
- data/vendor/pygments-main/doc/conf.py +249 -0
- data/vendor/pygments-main/doc/docs/api.rst +316 -0
- data/vendor/pygments-main/doc/docs/authors.rst +4 -0
- data/vendor/pygments-main/doc/docs/changelog.rst +1 -0
- data/vendor/pygments-main/{docs/src/cmdline.txt → doc/docs/cmdline.rst} +9 -11
- data/vendor/pygments-main/{docs/src/filterdevelopment.txt → doc/docs/filterdevelopment.rst} +1 -1
- data/vendor/pygments-main/{docs/src/filters.txt → doc/docs/filters.rst} +4 -5
- data/vendor/pygments-main/{docs/src/formatterdevelopment.txt → doc/docs/formatterdevelopment.rst} +1 -1
- data/vendor/pygments-main/{docs/src/formatters.txt → doc/docs/formatters.rst} +6 -6
- data/vendor/pygments-main/doc/docs/index.rst +66 -0
- data/vendor/pygments-main/{docs/src/integrate.txt → doc/docs/integrate.rst} +3 -7
- data/vendor/pygments-main/{docs/src/java.txt → doc/docs/java.rst} +0 -0
- data/vendor/pygments-main/{docs/src/lexerdevelopment.txt → doc/docs/lexerdevelopment.rst} +13 -14
- data/vendor/pygments-main/{docs/src/lexers.txt → doc/docs/lexers.rst} +7 -5
- data/vendor/pygments-main/{docs/src/moinmoin.txt → doc/docs/moinmoin.rst} +0 -0
- data/vendor/pygments-main/{docs/src/plugins.txt → doc/docs/plugins.rst} +0 -0
- data/vendor/pygments-main/{docs/src/quickstart.txt → doc/docs/quickstart.rst} +22 -19
- data/vendor/pygments-main/{docs/src/rstdirective.txt → doc/docs/rstdirective.rst} +0 -0
- data/vendor/pygments-main/{docs/src/styles.txt → doc/docs/styles.rst} +2 -2
- data/vendor/pygments-main/{docs/src/tokens.txt → doc/docs/tokens.rst} +10 -7
- data/vendor/pygments-main/{docs/src/unicode.txt → doc/docs/unicode.rst} +8 -7
- data/vendor/pygments-main/doc/download.rst +41 -0
- data/vendor/pygments-main/doc/faq.rst +143 -0
- data/vendor/pygments-main/doc/index.rst +53 -0
- data/vendor/pygments-main/doc/languages.rst +151 -0
- data/vendor/pygments-main/doc/make.bat +190 -0
- data/vendor/pygments-main/{docs → doc}/pygmentize.1 +0 -0
- data/vendor/pygments-main/external/autopygmentize +65 -48
- data/vendor/pygments-main/external/markdown-processor.py +15 -15
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +2 -3
- data/vendor/pygments-main/ez_setup.py +340 -234
- data/vendor/pygments-main/pygments/__init__.py +4 -4
- data/vendor/pygments-main/pygments/cmdline.py +81 -68
- data/vendor/pygments-main/pygments/console.py +1 -1
- data/vendor/pygments-main/pygments/filter.py +1 -1
- data/vendor/pygments-main/pygments/filters/__init__.py +11 -9
- data/vendor/pygments-main/pygments/formatter.py +3 -3
- data/vendor/pygments-main/pygments/formatters/__init__.py +5 -3
- data/vendor/pygments-main/pygments/formatters/_mapping.py +16 -5
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +44 -26
- data/vendor/pygments-main/pygments/formatters/img.py +21 -14
- data/vendor/pygments-main/pygments/formatters/latex.py +104 -12
- data/vendor/pygments-main/pygments/formatters/other.py +53 -6
- data/vendor/pygments-main/pygments/formatters/rtf.py +30 -16
- data/vendor/pygments-main/pygments/formatters/svg.py +2 -2
- data/vendor/pygments-main/pygments/formatters/terminal.py +41 -1
- data/vendor/pygments-main/pygments/formatters/terminal256.py +2 -2
- data/vendor/pygments-main/pygments/lexer.py +59 -39
- data/vendor/pygments-main/pygments/lexers/__init__.py +38 -15
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +15 -15
- data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +73 -0
- data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +11 -1
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +14 -8
- data/vendor/pygments-main/pygments/lexers/_mapping.py +81 -30
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +1067 -95
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +7 -7
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +5 -4
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +12 -7
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +112 -18
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/agile.py +644 -382
- data/vendor/pygments-main/pygments/lexers/asm.py +66 -29
- data/vendor/pygments-main/pygments/lexers/compiled.py +1643 -174
- data/vendor/pygments-main/pygments/lexers/dalvik.py +27 -6
- data/vendor/pygments-main/pygments/lexers/dotnet.py +45 -33
- data/vendor/pygments-main/pygments/lexers/foxpro.py +3 -3
- data/vendor/pygments-main/pygments/lexers/functional.py +1510 -570
- data/vendor/pygments-main/pygments/lexers/graph.py +81 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +29 -30
- data/vendor/pygments-main/pygments/lexers/inferno.py +96 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +622 -207
- data/vendor/pygments-main/pygments/lexers/math.py +438 -70
- data/vendor/pygments-main/pygments/lexers/other.py +885 -171
- data/vendor/pygments-main/pygments/lexers/parsers.py +24 -24
- data/vendor/pygments-main/pygments/lexers/qbasic.py +157 -0
- data/vendor/pygments-main/pygments/lexers/rdf.py +99 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +28 -25
- data/vendor/pygments-main/pygments/lexers/special.py +7 -8
- data/vendor/pygments-main/pygments/lexers/sql.py +56 -23
- data/vendor/pygments-main/pygments/lexers/templates.py +377 -59
- data/vendor/pygments-main/pygments/lexers/text.py +208 -46
- data/vendor/pygments-main/pygments/lexers/web.py +729 -264
- data/vendor/pygments-main/pygments/modeline.py +1 -1
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +1 -1
- data/vendor/pygments-main/pygments/sphinxext.py +153 -0
- data/vendor/pygments-main/pygments/style.py +3 -2
- data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
- data/vendor/pygments-main/pygments/styles/borland.py +1 -1
- data/vendor/pygments-main/pygments/styles/bw.py +1 -1
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
- data/vendor/pygments-main/pygments/styles/default.py +1 -1
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/igor.py +29 -0
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +4 -4
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
- data/vendor/pygments-main/pygments/styles/native.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +125 -0
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +125 -0
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/tango.py +1 -1
- data/vendor/pygments-main/pygments/styles/trac.py +1 -1
- data/vendor/pygments-main/pygments/styles/vim.py +1 -1
- data/vendor/pygments-main/pygments/styles/vs.py +1 -1
- data/vendor/pygments-main/pygments/styles/xcode.py +51 -0
- data/vendor/pygments-main/pygments/token.py +4 -1
- data/vendor/pygments-main/pygments/unistring.py +6 -5
- data/vendor/pygments-main/pygments/util.py +35 -21
- data/vendor/pygments-main/scripts/check_sources.py +28 -44
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +5 -4
- data/vendor/pygments-main/scripts/find_codetags.py +27 -19
- data/vendor/pygments-main/scripts/find_error.py +16 -13
- data/vendor/pygments-main/scripts/get_vimkw.py +3 -3
- data/vendor/pygments-main/scripts/vim2pygments.py +9 -7
- data/vendor/pygments-main/setup.py +19 -19
- data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +118 -0
- data/vendor/pygments-main/tests/examplefiles/Error.pmod +38 -0
- data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +360 -0
- data/vendor/pygments-main/tests/examplefiles/{ANTLRv3.g → antlr_ANTLRv3.g} +0 -0
- data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +5 -0
- data/vendor/pygments-main/tests/examplefiles/core.cljs +52 -0
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +13 -1
- data/vendor/pygments-main/tests/examplefiles/demo.hbs +12 -0
- data/vendor/pygments-main/tests/examplefiles/ember.handlebars +33 -0
- data/vendor/pygments-main/tests/examplefiles/example.als +217 -0
- data/vendor/pygments-main/tests/examplefiles/example.c +1 -1
- data/vendor/pygments-main/tests/examplefiles/example.chai +6 -0
- data/vendor/pygments-main/tests/examplefiles/example.coffee +27 -0
- data/vendor/pygments-main/tests/examplefiles/example.e +124 -0
- data/vendor/pygments-main/tests/examplefiles/example.f90 +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.feature +16 -0
- data/vendor/pygments-main/tests/examplefiles/example.gd +23 -0
- data/vendor/pygments-main/tests/examplefiles/example.gi +64 -0
- data/vendor/pygments-main/tests/examplefiles/example.groovy +2 -0
- data/vendor/pygments-main/tests/examplefiles/example.hs +27 -0
- data/vendor/pygments-main/tests/examplefiles/example.hx +44 -1
- data/vendor/pygments-main/tests/examplefiles/example.i6t +32 -0
- data/vendor/pygments-main/tests/examplefiles/example.i7x +45 -0
- data/vendor/pygments-main/tests/examplefiles/example.inf +374 -0
- data/vendor/pygments-main/tests/examplefiles/example.j +564 -0
- data/vendor/pygments-main/tests/examplefiles/example.java +16 -0
- data/vendor/pygments-main/tests/examplefiles/example.kal +75 -0
- data/vendor/pygments-main/tests/examplefiles/example.liquid +42 -0
- data/vendor/pygments-main/tests/examplefiles/example.ma +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.mq4 +187 -0
- data/vendor/pygments-main/tests/examplefiles/example.mqh +123 -0
- data/vendor/pygments-main/tests/examplefiles/example.ni +57 -0
- data/vendor/pygments-main/tests/examplefiles/example.nix +80 -0
- data/vendor/pygments-main/tests/examplefiles/example.pp +8 -0
- data/vendor/pygments-main/tests/examplefiles/example.red +257 -0
- data/vendor/pygments-main/tests/examplefiles/example.reds +150 -0
- data/vendor/pygments-main/tests/examplefiles/example.rkt +677 -29
- data/vendor/pygments-main/tests/examplefiles/example.sh +22 -0
- data/vendor/pygments-main/tests/examplefiles/example.slim +31 -0
- data/vendor/pygments-main/tests/examplefiles/example.sls +51 -0
- data/vendor/pygments-main/tests/examplefiles/example.stan +2 -0
- data/vendor/pygments-main/tests/examplefiles/example.todotxt +9 -0
- data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +241 -0
- data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +18 -0
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +192 -350
- data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +5 -0
- data/vendor/pygments-main/tests/examplefiles/hello.at +6 -0
- data/vendor/pygments-main/tests/examplefiles/hello.golo +5 -0
- data/vendor/pygments-main/tests/examplefiles/hello.lsl +12 -0
- data/vendor/pygments-main/tests/examplefiles/{File.hy → hybris_File.hy} +0 -0
- data/vendor/pygments-main/tests/examplefiles/{mg_sample.pro → idl_sample.pro} +0 -0
- data/vendor/pygments-main/tests/examplefiles/iex_example +23 -0
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +24 -24
- data/vendor/pygments-main/tests/examplefiles/language.hy +165 -0
- data/vendor/pygments-main/tests/examplefiles/limbo.b +456 -0
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +3 -1
- data/vendor/pygments-main/tests/examplefiles/main.cmake +2 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +163 -16
- data/vendor/pygments-main/tests/examplefiles/{example.p → openedge_example} +0 -0
- data/vendor/pygments-main/tests/examplefiles/pawn_example +25 -0
- data/vendor/pygments-main/tests/examplefiles/qbasic_example +2 -0
- data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +23 -0
- data/vendor/pygments-main/tests/examplefiles/{robotframework.txt → robotframework_test.txt} +0 -0
- data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +34 -0
- data/vendor/pygments-main/tests/examplefiles/scope.cirru +43 -0
- data/vendor/pygments-main/tests/examplefiles/sparql.rq +23 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +37 -5
- data/vendor/pygments-main/tests/examplefiles/test.apl +26 -0
- data/vendor/pygments-main/tests/examplefiles/test.cyp +123 -0
- data/vendor/pygments-main/tests/examplefiles/test.idr +93 -0
- data/vendor/pygments-main/tests/examplefiles/test.mask +41 -0
- data/vendor/pygments-main/tests/examplefiles/test.pan +54 -0
- data/vendor/pygments-main/tests/examplefiles/test.php +3 -1
- data/vendor/pygments-main/tests/examplefiles/test.pig +148 -0
- data/vendor/pygments-main/tests/examplefiles/test.pwn +253 -0
- data/vendor/pygments-main/tests/examplefiles/test.r3 +27 -7
- data/vendor/pygments-main/tests/examplefiles/test.rsl +111 -0
- data/vendor/pygments-main/tests/examplefiles/test.swift +65 -0
- data/vendor/pygments-main/tests/examplefiles/test.zep +33 -0
- data/vendor/pygments-main/tests/examplefiles/unicode.go +10 -0
- data/vendor/pygments-main/tests/examplefiles/{test.bas → vbnet_test.bas} +0 -0
- data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +4 -0
- data/vendor/pygments-main/tests/examplefiles/vimrc +21 -0
- data/vendor/pygments-main/tests/run.py +14 -19
- data/vendor/pygments-main/tests/string_asserts.py +22 -0
- data/vendor/pygments-main/tests/test_basic_api.py +28 -14
- data/vendor/pygments-main/tests/test_cfm.py +46 -0
- data/vendor/pygments-main/tests/test_clexer.py +208 -3
- data/vendor/pygments-main/tests/test_cmdline.py +6 -5
- data/vendor/pygments-main/tests/test_examplefiles.py +30 -19
- data/vendor/pygments-main/tests/test_html_formatter.py +15 -13
- data/vendor/pygments-main/tests/test_latex_formatter.py +4 -2
- data/vendor/pygments-main/tests/test_lexers_other.py +11 -11
- data/vendor/pygments-main/tests/test_objectiveclexer.py +81 -0
- data/vendor/pygments-main/tests/test_perllexer.py +1 -1
- data/vendor/pygments-main/tests/test_qbasiclexer.py +43 -0
- data/vendor/pygments-main/tests/test_regexlexer.py +8 -1
- data/vendor/pygments-main/tests/test_rtf_formatter.py +109 -0
- data/vendor/pygments-main/tests/test_string_asserts.py +39 -0
- data/vendor/pygments-main/tests/test_token.py +3 -3
- data/vendor/pygments-main/tests/test_using_api.py +1 -1
- data/vendor/pygments-main/tests/test_util.py +1 -1
- metadata +138 -51
- data/vendor/pygments-main/docs/generate.py +0 -472
- data/vendor/pygments-main/docs/src/api.txt +0 -270
- data/vendor/pygments-main/docs/src/authors.txt +0 -5
- data/vendor/pygments-main/docs/src/changelog.txt +0 -5
- data/vendor/pygments-main/docs/src/index.txt +0 -69
- data/vendor/pygments-main/docs/src/installation.txt +0 -71
- data/vendor/pygments-main/external/rst-directive-old.py +0 -77
- data/vendor/pygments-main/scripts/reindent.py +0 -291
- data/vendor/pygments-main/tests/examplefiles/import.hs +0 -4
- data/vendor/pygments-main/tests/examplefiles/objc_example2.m +0 -24
- data/vendor/pygments-main/tests/old_run.py +0 -138
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Lexers for web-related languages and markup.
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
@@ -13,11 +13,11 @@ import re
|
|
13
13
|
import copy
|
14
14
|
|
15
15
|
from pygments.lexer import RegexLexer, ExtendedRegexLexer, bygroups, using, \
|
16
|
-
|
16
|
+
include, this, default
|
17
17
|
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
18
|
-
|
18
|
+
Number, Other, Punctuation, Literal
|
19
19
|
from pygments.util import get_bool_opt, get_list_opt, looks_like_xml, \
|
20
|
-
|
20
|
+
html_doctype_matches, unirange, iteritems
|
21
21
|
from pygments.lexers.agile import RubyLexer
|
22
22
|
from pygments.lexers.compiled import ScalaLexer
|
23
23
|
|
@@ -27,7 +27,8 @@ __all__ = ['HtmlLexer', 'XmlLexer', 'JavascriptLexer', 'JsonLexer', 'CssLexer',
|
|
27
27
|
'MxmlLexer', 'HaxeLexer', 'HamlLexer', 'SassLexer', 'ScssLexer',
|
28
28
|
'ObjectiveJLexer', 'CoffeeScriptLexer', 'LiveScriptLexer',
|
29
29
|
'DuelLexer', 'ScamlLexer', 'JadeLexer', 'XQueryLexer',
|
30
|
-
'DtdLexer', 'DartLexer', 'LassoLexer', 'QmlLexer', 'TypeScriptLexer'
|
30
|
+
'DtdLexer', 'DartLexer', 'LassoLexer', 'QmlLexer', 'TypeScriptLexer',
|
31
|
+
'KalLexer', 'CirruLexer', 'MaskLexer', 'ZephirLexer', 'SlimLexer']
|
31
32
|
|
32
33
|
|
33
34
|
class JavascriptLexer(RegexLexer):
|
@@ -54,7 +55,7 @@ class JavascriptLexer(RegexLexer):
|
|
54
55
|
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
55
56
|
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
56
57
|
(r'(?=/)', Text, ('#pop', 'badregex')),
|
57
|
-
(
|
58
|
+
default('#pop')
|
58
59
|
],
|
59
60
|
'badregex': [
|
60
61
|
(r'\n', Text, '#pop')
|
@@ -80,7 +81,7 @@ class JavascriptLexer(RegexLexer):
|
|
80
81
|
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
81
82
|
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
82
83
|
r'window)\b', Name.Builtin),
|
83
|
-
(r'[$a-zA-Z_]
|
84
|
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
84
85
|
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
85
86
|
(r'0x[0-9a-fA-F]+', Number.Hex),
|
86
87
|
(r'[0-9]+', Number.Integer),
|
@@ -94,7 +95,7 @@ class JsonLexer(RegexLexer):
|
|
94
95
|
"""
|
95
96
|
For JSON data structures.
|
96
97
|
|
97
|
-
|
98
|
+
.. versionadded:: 1.5
|
98
99
|
"""
|
99
100
|
|
100
101
|
name = 'JSON'
|
@@ -177,14 +178,14 @@ class ActionScriptLexer(RegexLexer):
|
|
177
178
|
"""
|
178
179
|
For ActionScript source code.
|
179
180
|
|
180
|
-
|
181
|
+
.. versionadded:: 0.9
|
181
182
|
"""
|
182
183
|
|
183
184
|
name = 'ActionScript'
|
184
185
|
aliases = ['as', 'actionscript']
|
185
186
|
filenames = ['*.as']
|
186
|
-
mimetypes = ['application/x-
|
187
|
-
'text/
|
187
|
+
mimetypes = ['application/x-actionscript', 'text/x-actionscript',
|
188
|
+
'text/actionscript']
|
188
189
|
|
189
190
|
flags = re.DOTALL
|
190
191
|
tokens = {
|
@@ -247,7 +248,7 @@ class ActionScriptLexer(RegexLexer):
|
|
247
248
|
r'isXMLName|clearInterval|fscommand|getTimer|getURL|getVersion|'
|
248
249
|
r'isFinite|parseFloat|parseInt|setInterval|trace|updateAfterEvent|'
|
249
250
|
r'unescape)\b',Name.Function),
|
250
|
-
(r'[$a-zA-Z_]
|
251
|
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
251
252
|
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
252
253
|
(r'0x[0-9a-f]+', Number.Hex),
|
253
254
|
(r'[0-9]+', Number.Integer),
|
@@ -261,16 +262,16 @@ class ActionScript3Lexer(RegexLexer):
|
|
261
262
|
"""
|
262
263
|
For ActionScript 3 source code.
|
263
264
|
|
264
|
-
|
265
|
+
.. versionadded:: 0.11
|
265
266
|
"""
|
266
267
|
|
267
268
|
name = 'ActionScript 3'
|
268
269
|
aliases = ['as3', 'actionscript3']
|
269
270
|
filenames = ['*.as']
|
270
|
-
mimetypes = ['application/x-
|
271
|
-
'text/
|
271
|
+
mimetypes = ['application/x-actionscript3', 'text/x-actionscript3',
|
272
|
+
'text/actionscript3']
|
272
273
|
|
273
|
-
identifier = r'[$a-zA-Z_]
|
274
|
+
identifier = r'[$a-zA-Z_]\w*'
|
274
275
|
typeidentifier = identifier + '(?:\.<\w+>)?'
|
275
276
|
|
276
277
|
flags = re.DOTALL | re.MULTILINE
|
@@ -358,12 +359,12 @@ class CssLexer(RegexLexer):
|
|
358
359
|
(r'\s+', Text),
|
359
360
|
(r'/\*(?:.|\n)*?\*/', Comment),
|
360
361
|
(r'{', Punctuation, 'content'),
|
361
|
-
(r'\:[
|
362
|
-
(r'\.[
|
363
|
-
(r'\#[
|
364
|
-
(r'@[
|
365
|
-
(r'[
|
366
|
-
(r'[
|
362
|
+
(r'\:[\w-]+', Name.Decorator),
|
363
|
+
(r'\.[\w-]+', Name.Class),
|
364
|
+
(r'\#[\w-]+', Name.Function),
|
365
|
+
(r'@[\w-]+', Keyword, 'atrule'),
|
366
|
+
(r'[\w-]+', Name.Tag),
|
367
|
+
(r'[~\^\*!%&$\[\]\(\)<>\|+=@:;,./?-]', Operator),
|
367
368
|
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
368
369
|
(r"'(\\\\|\\'|[^'])*'", String.Single)
|
369
370
|
],
|
@@ -398,19 +399,19 @@ class CssLexer(RegexLexer):
|
|
398
399
|
r'list-style-type|list-style-image|list-style-position|'
|
399
400
|
r'list-style|margin-bottom|margin-left|margin-right|'
|
400
401
|
r'margin-top|margin|marker-offset|marks|max-height|max-width|'
|
401
|
-
r'min-height|min-width|opacity|orphans|outline
|
402
|
-
r'outline-style|outline-width|overflow(?:-x|-y)?|padding-bottom|'
|
402
|
+
r'min-height|min-width|opacity|orphans|outline-color|'
|
403
|
+
r'outline-style|outline-width|outline|overflow(?:-x|-y)?|padding-bottom|'
|
403
404
|
r'padding-left|padding-right|padding-top|padding|page|'
|
404
405
|
r'page-break-after|page-break-before|page-break-inside|'
|
405
|
-
r'pause-after|pause-before|pause|pitch
|
406
|
+
r'pause-after|pause-before|pause|pitch-range|pitch|'
|
406
407
|
r'play-during|position|quotes|richness|right|size|'
|
407
408
|
r'speak-header|speak-numeral|speak-punctuation|speak|'
|
408
409
|
r'speech-rate|stress|table-layout|text-align|text-decoration|'
|
409
410
|
r'text-indent|text-shadow|text-transform|top|unicode-bidi|'
|
410
411
|
r'vertical-align|visibility|voice-family|volume|white-space|'
|
411
|
-
r'widows|width|word-spacing|z-index|bottom|
|
412
|
+
r'widows|width|word-spacing|z-index|bottom|'
|
412
413
|
r'above|absolute|always|armenian|aural|auto|avoid|baseline|'
|
413
|
-
r'behind|below|bidi-override|blink|block|bold|
|
414
|
+
r'behind|below|bidi-override|blink|block|bolder|bold|both|'
|
414
415
|
r'capitalize|center-left|center-right|center|circle|'
|
415
416
|
r'cjk-ideographic|close-quote|collapse|condensed|continuous|'
|
416
417
|
r'crop|crosshair|cross|cursive|dashed|decimal-leading-zero|'
|
@@ -420,7 +421,7 @@ class CssLexer(RegexLexer):
|
|
420
421
|
r'hidden|hide|higher|high|hiragana-iroha|hiragana|icon|'
|
421
422
|
r'inherit|inline-table|inline|inset|inside|invert|italic|'
|
422
423
|
r'justify|katakana-iroha|katakana|landscape|larger|large|'
|
423
|
-
r'left-side|leftwards|level|lighter|line-through|list-item|'
|
424
|
+
r'left-side|leftwards|left|level|lighter|line-through|list-item|'
|
424
425
|
r'loud|lower-alpha|lower-greek|lower-roman|lowercase|ltr|'
|
425
426
|
r'lower|low|medium|message-box|middle|mix|monospace|'
|
426
427
|
r'n-resize|narrower|ne-resize|no-close-quote|no-open-quote|'
|
@@ -429,11 +430,11 @@ class CssLexer(RegexLexer):
|
|
429
430
|
r'relative|repeat-x|repeat-y|repeat|rgb|ridge|right-side|'
|
430
431
|
r'rightwards|s-resize|sans-serif|scroll|se-resize|'
|
431
432
|
r'semi-condensed|semi-expanded|separate|serif|show|silent|'
|
432
|
-
r'slow|
|
433
|
+
r'slower|slow|small-caps|small-caption|smaller|soft|solid|'
|
433
434
|
r'spell-out|square|static|status-bar|super|sw-resize|'
|
434
435
|
r'table-caption|table-cell|table-column|table-column-group|'
|
435
436
|
r'table-footer-group|table-header-group|table-row|'
|
436
|
-
r'table-row-group|text
|
437
|
+
r'table-row-group|text-bottom|text-top|text|thick|thin|'
|
437
438
|
r'transparent|ultra-condensed|ultra-expanded|underline|'
|
438
439
|
r'upper-alpha|upper-latin|upper-roman|uppercase|url|'
|
439
440
|
r'visible|w-resize|wait|wider|x-fast|x-high|x-large|x-loud|'
|
@@ -466,13 +467,15 @@ class CssLexer(RegexLexer):
|
|
466
467
|
(r'\!important', Comment.Preproc),
|
467
468
|
(r'/\*(?:.|\n)*?\*/', Comment),
|
468
469
|
(r'\#[a-zA-Z0-9]{1,6}', Number),
|
469
|
-
(r'[\.-]?[0-9]*[\.]?[0-9]+(em|px
|
470
|
+
(r'[\.-]?[0-9]*[\.]?[0-9]+(em|px|pt|pc|in|mm|cm|ex|s)\b', Number),
|
471
|
+
# Separate regex for percentages, as can't do word boundaries with %
|
472
|
+
(r'[\.-]?[0-9]*[\.]?[0-9]+%', Number),
|
470
473
|
(r'-?[0-9]+', Number),
|
471
474
|
(r'[~\^\*!%&<>\|+=@:,./?-]+', Operator),
|
472
475
|
(r'[\[\]();]+', Punctuation),
|
473
476
|
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
474
477
|
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
475
|
-
(r'[a-zA-Z_]
|
478
|
+
(r'[a-zA-Z_]\w*', Name)
|
476
479
|
]
|
477
480
|
}
|
478
481
|
|
@@ -481,7 +484,7 @@ class ObjectiveJLexer(RegexLexer):
|
|
481
484
|
"""
|
482
485
|
For Objective-J source code with preprocessor directives.
|
483
486
|
|
484
|
-
|
487
|
+
.. versionadded:: 1.3
|
485
488
|
"""
|
486
489
|
|
487
490
|
name = 'Objective-J'
|
@@ -539,7 +542,7 @@ class ObjectiveJLexer(RegexLexer):
|
|
539
542
|
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
540
543
|
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
541
544
|
(r'(?=/)', Text, ('#pop', 'badregex')),
|
542
|
-
(
|
545
|
+
default('#pop'),
|
543
546
|
],
|
544
547
|
'badregex': [
|
545
548
|
(r'\n', Text, '#pop'),
|
@@ -592,26 +595,26 @@ class ObjectiveJLexer(RegexLexer):
|
|
592
595
|
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
593
596
|
r'window)\b', Name.Builtin),
|
594
597
|
|
595
|
-
(r'([$a-zA-Z_]
|
598
|
+
(r'([$a-zA-Z_]\w*)(' + _ws + r')(?=\()',
|
596
599
|
bygroups(Name.Function, using(this))),
|
597
600
|
|
598
|
-
(r'[$a-zA-Z_]
|
601
|
+
(r'[$a-zA-Z_]\w*', Name),
|
599
602
|
],
|
600
603
|
'classname' : [
|
601
604
|
# interface definition that inherits
|
602
|
-
(r'([a-zA-Z_]
|
603
|
-
r')([a-zA-Z_]
|
605
|
+
(r'([a-zA-Z_]\w*)(' + _ws + r':' + _ws +
|
606
|
+
r')([a-zA-Z_]\w*)?',
|
604
607
|
bygroups(Name.Class, using(this), Name.Class), '#pop'),
|
605
608
|
# interface definition for a category
|
606
|
-
(r'([a-zA-Z_]
|
609
|
+
(r'([a-zA-Z_]\w*)(' + _ws + r'\()([a-zA-Z_]\w*)(\))',
|
607
610
|
bygroups(Name.Class, using(this), Name.Label, Text), '#pop'),
|
608
611
|
# simple interface / implementation
|
609
|
-
(r'([a-zA-Z_]
|
612
|
+
(r'([a-zA-Z_]\w*)', Name.Class, '#pop'),
|
610
613
|
],
|
611
614
|
'forward_classname' : [
|
612
|
-
(r'([a-zA-Z_]
|
615
|
+
(r'([a-zA-Z_]\w*)(\s*,\s*)',
|
613
616
|
bygroups(Name.Class, Text), '#push'),
|
614
|
-
(r'([a-zA-Z_]
|
617
|
+
(r'([a-zA-Z_]\w*)(\s*;?)',
|
615
618
|
bygroups(Name.Class, Text), '#pop'),
|
616
619
|
],
|
617
620
|
'function_signature': [
|
@@ -619,26 +622,26 @@ class ObjectiveJLexer(RegexLexer):
|
|
619
622
|
|
620
623
|
# start of a selector w/ parameters
|
621
624
|
(r'(\(' + _ws + r')' # open paren
|
622
|
-
r'([a-zA-Z_]
|
625
|
+
r'([a-zA-Z_]\w+)' # return type
|
623
626
|
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
624
|
-
r'([$a-zA-Z_]
|
627
|
+
r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
625
628
|
bygroups(using(this), Keyword.Type, using(this),
|
626
629
|
Name.Function), 'function_parameters'),
|
627
630
|
|
628
631
|
# no-param function
|
629
632
|
(r'(\(' + _ws + r')' # open paren
|
630
|
-
r'([a-zA-Z_]
|
633
|
+
r'([a-zA-Z_]\w+)' # return type
|
631
634
|
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
632
|
-
r'([$a-zA-Z_]
|
635
|
+
r'([$a-zA-Z_]\w+)', # function name
|
633
636
|
bygroups(using(this), Keyword.Type, using(this),
|
634
637
|
Name.Function), "#pop"),
|
635
638
|
|
636
639
|
# no return type given, start of a selector w/ parameters
|
637
|
-
(r'([$a-zA-Z_]
|
640
|
+
(r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
638
641
|
bygroups (Name.Function), 'function_parameters'),
|
639
642
|
|
640
643
|
# no return type given, no-param function
|
641
|
-
(r'([$a-zA-Z_]
|
644
|
+
(r'([$a-zA-Z_]\w+)', # function name
|
642
645
|
bygroups(Name.Function), "#pop"),
|
643
646
|
|
644
647
|
('', Text, '#pop'),
|
@@ -650,11 +653,11 @@ class ObjectiveJLexer(RegexLexer):
|
|
650
653
|
(r'(\(' + _ws + ')' # open paren
|
651
654
|
r'([^\)]+)' # type
|
652
655
|
r'(' + _ws + r'\)' + _ws + r')' # close paren
|
653
|
-
r'([$a-zA-Z_]
|
656
|
+
r'([$a-zA-Z_]\w+)', # param name
|
654
657
|
bygroups(using(this), Keyword.Type, using(this), Text)),
|
655
658
|
|
656
659
|
# one piece of a selector name
|
657
|
-
(r'([$a-zA-Z_]
|
660
|
+
(r'([$a-zA-Z_]\w+' + _ws + r':)', # function name
|
658
661
|
Name.Function),
|
659
662
|
|
660
663
|
# smallest possible selector piece
|
@@ -664,10 +667,10 @@ class ObjectiveJLexer(RegexLexer):
|
|
664
667
|
(r'(,' + _ws + r'\.\.\.)', using(this)),
|
665
668
|
|
666
669
|
# param name
|
667
|
-
(r'([$a-zA-Z_]
|
670
|
+
(r'([$a-zA-Z_]\w+)', Text),
|
668
671
|
],
|
669
672
|
'expression' : [
|
670
|
-
(r'([$a-zA-Z_]
|
673
|
+
(r'([$a-zA-Z_]\w*)(\()', bygroups(Name.Function,
|
671
674
|
Punctuation)),
|
672
675
|
(r'(\))', Punctuation, "#pop"),
|
673
676
|
],
|
@@ -734,8 +737,8 @@ class HtmlLexer(RegexLexer):
|
|
734
737
|
],
|
735
738
|
'tag': [
|
736
739
|
(r'\s+', Text),
|
737
|
-
(r'[
|
738
|
-
(r'[
|
740
|
+
(r'[\w:-]+\s*=', Name.Attribute, 'attr'),
|
741
|
+
(r'[\w:-]+', Name.Attribute),
|
739
742
|
(r'/?\s*>', Name.Tag, '#pop'),
|
740
743
|
],
|
741
744
|
'script-content': [
|
@@ -796,6 +799,13 @@ class PhpLexer(RegexLexer):
|
|
796
799
|
filenames = ['*.php', '*.php[345]', '*.inc']
|
797
800
|
mimetypes = ['text/x-php']
|
798
801
|
|
802
|
+
# Note that a backslash is included in the following two patterns
|
803
|
+
# PHP uses a backslash as a namespace separator
|
804
|
+
_ident_char = r'[\\\w]|[^\x00-\x7f]'
|
805
|
+
_ident_begin = r'(?:[\\_a-z]|[^\x00-\x7f])'
|
806
|
+
_ident_end = r'(?:' + _ident_char + ')*'
|
807
|
+
_ident_inner = _ident_begin + _ident_end
|
808
|
+
|
799
809
|
flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
|
800
810
|
tokens = {
|
801
811
|
'root': [
|
@@ -805,7 +815,7 @@ class PhpLexer(RegexLexer):
|
|
805
815
|
],
|
806
816
|
'php': [
|
807
817
|
(r'\?>', Comment.Preproc, '#pop'),
|
808
|
-
(r'<<<(\'?)(
|
818
|
+
(r'<<<(\'?)(' + _ident_inner + ')\1\n.*?\n\2\;?\n', String),
|
809
819
|
(r'\s+', Text),
|
810
820
|
(r'#.*?\n', Comment.Single),
|
811
821
|
(r'//.*?\n', Comment.Single),
|
@@ -814,7 +824,7 @@ class PhpLexer(RegexLexer):
|
|
814
824
|
(r'/\*\*/', Comment.Multiline),
|
815
825
|
(r'/\*\*.*?\*/', String.Doc),
|
816
826
|
(r'/\*.*?\*/', Comment.Multiline),
|
817
|
-
(r'(->|::)(\s*)(
|
827
|
+
(r'(->|::)(\s*)(' + _ident_inner + ')',
|
818
828
|
bygroups(Operator, Text, Name.Attribute)),
|
819
829
|
(r'[~!%^&*+=|:.<>/?@-]+', Operator),
|
820
830
|
(r'[\[\]{}();,]+', Punctuation),
|
@@ -822,7 +832,7 @@ class PhpLexer(RegexLexer):
|
|
822
832
|
(r'(function)(\s*)(?=\()', bygroups(Keyword, Text)),
|
823
833
|
(r'(function)(\s+)(&?)(\s*)',
|
824
834
|
bygroups(Keyword, Text, Operator, Text), 'functionname'),
|
825
|
-
(r'(const)(\s+)(
|
835
|
+
(r'(const)(\s+)(' + _ident_inner + ')',
|
826
836
|
bygroups(Keyword, Text, Name.Constant)),
|
827
837
|
(r'(and|E_PARSE|old_function|E_ERROR|or|as|E_WARNING|parent|'
|
828
838
|
r'eval|PHP_OS|break|exit|case|extends|PHP_VERSION|cfunction|'
|
@@ -833,31 +843,33 @@ class PhpLexer(RegexLexer):
|
|
833
843
|
r'endif|list|__LINE__|endswitch|new|__sleep|endwhile|not|'
|
834
844
|
r'array|__wakeup|E_ALL|NULL|final|php_user_filter|interface|'
|
835
845
|
r'implements|public|private|protected|abstract|clone|try|'
|
836
|
-
r'catch|throw|this|use|namespace|trait
|
846
|
+
r'catch|throw|this|use|namespace|trait|yield|'
|
847
|
+
r'finally)\b', Keyword),
|
837
848
|
(r'(true|false|null)\b', Keyword.Constant),
|
838
|
-
(r'\$\{\$+
|
839
|
-
(r'\$+
|
840
|
-
(
|
849
|
+
(r'\$\{\$+' + _ident_inner + '\}', Name.Variable),
|
850
|
+
(r'\$+' + _ident_inner, Name.Variable),
|
851
|
+
(_ident_inner, Name.Other),
|
841
852
|
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
842
853
|
(r'\d+[eE][+-]?[0-9]+', Number.Float),
|
843
854
|
(r'0[0-7]+', Number.Oct),
|
844
|
-
(r'0[xX][a-
|
855
|
+
(r'0[xX][a-f0-9]+', Number.Hex),
|
845
856
|
(r'\d+', Number.Integer),
|
857
|
+
(r'0b[01]+', Number.Bin),
|
846
858
|
(r"'([^'\\]*(?:\\.[^'\\]*)*)'", String.Single),
|
847
859
|
(r'`([^`\\]*(?:\\.[^`\\]*)*)`', String.Backtick),
|
848
860
|
(r'"', String.Double, 'string'),
|
849
861
|
],
|
850
862
|
'classname': [
|
851
|
-
(
|
863
|
+
(_ident_inner, Name.Class, '#pop')
|
852
864
|
],
|
853
865
|
'functionname': [
|
854
|
-
(
|
866
|
+
(_ident_inner, Name.Function, '#pop')
|
855
867
|
],
|
856
868
|
'string': [
|
857
869
|
(r'"', String.Double, '#pop'),
|
858
870
|
(r'[^{$"\\]+', String.Double),
|
859
|
-
(r'\\([nrt\"$\\]|[0-7]{1,3}|x[0-
|
860
|
-
(r'\$
|
871
|
+
(r'\\([nrt\"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})', String.Escape),
|
872
|
+
(r'\$' + _ident_inner + '(\[\S+?\]|->' + _ident_inner + ')?',
|
861
873
|
String.Interpol),
|
862
874
|
(r'(\{\$\{)(.*?)(\}\})',
|
863
875
|
bygroups(String.Interpol, using(this, _startinline=True),
|
@@ -886,7 +898,7 @@ class PhpLexer(RegexLexer):
|
|
886
898
|
self._functions = set()
|
887
899
|
if self.funcnamehighlighting:
|
888
900
|
from pygments.lexers._phpbuiltins import MODULES
|
889
|
-
for key, value in
|
901
|
+
for key, value in iteritems(MODULES):
|
890
902
|
if key not in self.disabledmodules:
|
891
903
|
self._functions.update(value)
|
892
904
|
RegexLexer.__init__(self, **options)
|
@@ -916,7 +928,7 @@ class DtdLexer(RegexLexer):
|
|
916
928
|
"""
|
917
929
|
A lexer for DTDs (Document Type Definitions).
|
918
930
|
|
919
|
-
|
931
|
+
.. versionadded:: 1.5
|
920
932
|
"""
|
921
933
|
|
922
934
|
flags = re.MULTILINE | re.DOTALL
|
@@ -1051,7 +1063,7 @@ class XsltLexer(XmlLexer):
|
|
1051
1063
|
'''
|
1052
1064
|
A lexer for XSLT.
|
1053
1065
|
|
1054
|
-
|
1066
|
+
.. versionadded:: 0.10
|
1055
1067
|
'''
|
1056
1068
|
|
1057
1069
|
name = 'XSLT'
|
@@ -1089,7 +1101,7 @@ class MxmlLexer(RegexLexer):
|
|
1089
1101
|
For MXML markup.
|
1090
1102
|
Nested AS3 in <script> tags is highlighted by the appropriate lexer.
|
1091
1103
|
|
1092
|
-
|
1104
|
+
.. versionadded:: 1.1
|
1093
1105
|
"""
|
1094
1106
|
flags = re.MULTILINE | re.DOTALL
|
1095
1107
|
name = 'MXML'
|
@@ -1106,8 +1118,8 @@ class MxmlLexer(RegexLexer):
|
|
1106
1118
|
('<!--', Comment, 'comment'),
|
1107
1119
|
(r'<\?.*?\?>', Comment.Preproc),
|
1108
1120
|
('<![^>]*>', Comment.Preproc),
|
1109
|
-
(r'<\s*[
|
1110
|
-
(r'<\s*/\s*[
|
1121
|
+
(r'<\s*[\w:.-]+', Name.Tag, 'tag'),
|
1122
|
+
(r'<\s*/\s*[\w:.-]+\s*>', Name.Tag),
|
1111
1123
|
],
|
1112
1124
|
'comment': [
|
1113
1125
|
('[^-]+', Comment),
|
@@ -1116,7 +1128,7 @@ class MxmlLexer(RegexLexer):
|
|
1116
1128
|
],
|
1117
1129
|
'tag': [
|
1118
1130
|
(r'\s+', Text),
|
1119
|
-
(r'[
|
1131
|
+
(r'[\w.:-]+\s*=', Name.Attribute, 'attr'),
|
1120
1132
|
(r'/?\s*>', Name.Tag, '#pop'),
|
1121
1133
|
],
|
1122
1134
|
'attr': [
|
@@ -1132,11 +1144,11 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1132
1144
|
"""
|
1133
1145
|
For Haxe source code (http://haxe.org/).
|
1134
1146
|
|
1135
|
-
|
1147
|
+
.. versionadded:: 1.3
|
1136
1148
|
"""
|
1137
1149
|
|
1138
1150
|
name = 'Haxe'
|
1139
|
-
aliases = ['hx', '
|
1151
|
+
aliases = ['hx', 'haxe', 'hxsl']
|
1140
1152
|
filenames = ['*.hx', '*.hxsl']
|
1141
1153
|
mimetypes = ['text/haxe', 'text/x-haxe', 'text/x-hx']
|
1142
1154
|
|
@@ -1149,11 +1161,10 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1149
1161
|
r'inline|using|null|true|false|abstract)\b')
|
1150
1162
|
|
1151
1163
|
# idtype in lexer.mll
|
1152
|
-
typeid = r'_*[A-Z]
|
1164
|
+
typeid = r'_*[A-Z]\w*'
|
1153
1165
|
|
1154
1166
|
# combined ident and dollar and idtype
|
1155
|
-
ident = r'(?:_*[a-z]
|
1156
|
-
'|_+|\$[_a-zA-Z0-9]+)'
|
1167
|
+
ident = r'(?:_*[a-z]\w*|_+[0-9]\w*|' + typeid + '|_+|\$\w+)'
|
1157
1168
|
|
1158
1169
|
binop = (r'(?:%=|&=|\|=|\^=|\+=|\-=|\*=|/=|<<=|>\s*>\s*=|>\s*>\s*>\s*=|==|'
|
1159
1170
|
r'!=|<=|>\s*=|&&|\|\||<<|>>>|>\s*>|\.\.\.|<|>|%|&|\||\^|\+|\*|'
|
@@ -1247,7 +1258,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1247
1258
|
include('spaces'),
|
1248
1259
|
(ident, Name.Namespace),
|
1249
1260
|
(r'\.', Punctuation, 'import-ident'),
|
1250
|
-
(
|
1261
|
+
default('#pop'),
|
1251
1262
|
],
|
1252
1263
|
|
1253
1264
|
'import': [
|
@@ -1256,7 +1267,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1256
1267
|
(r'\*', Keyword), # wildcard import
|
1257
1268
|
(r'\.', Punctuation, 'import-ident'),
|
1258
1269
|
(r'in', Keyword.Namespace, 'ident'),
|
1259
|
-
(
|
1270
|
+
default('#pop'),
|
1260
1271
|
],
|
1261
1272
|
|
1262
1273
|
'import-ident': [
|
@@ -1269,14 +1280,14 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1269
1280
|
include('spaces'),
|
1270
1281
|
(ident, Name.Namespace),
|
1271
1282
|
(r'\.', Punctuation, 'import-ident'),
|
1272
|
-
(
|
1283
|
+
default('#pop'),
|
1273
1284
|
],
|
1274
1285
|
|
1275
1286
|
'preproc-error': [
|
1276
1287
|
(r'\s+', Comment.Preproc),
|
1277
1288
|
(r"'", String.Single, ('#pop', 'string-single')),
|
1278
1289
|
(r'"', String.Double, ('#pop', 'string-double')),
|
1279
|
-
(
|
1290
|
+
default('#pop'),
|
1280
1291
|
],
|
1281
1292
|
|
1282
1293
|
'preproc-expr': [
|
@@ -1285,6 +1296,19 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1285
1296
|
(r'\(', Comment.Preproc, ('#pop', 'preproc-parenthesis')),
|
1286
1297
|
|
1287
1298
|
(ident, Comment.Preproc, '#pop'),
|
1299
|
+
|
1300
|
+
# Float
|
1301
|
+
(r'\.[0-9]+', Number.Float),
|
1302
|
+
(r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float),
|
1303
|
+
(r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float),
|
1304
|
+
(r'[0-9]+\.[0-9]+', Number.Float),
|
1305
|
+
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float),
|
1306
|
+
|
1307
|
+
# Int
|
1308
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
1309
|
+
(r'[0-9]+', Number.Integer),
|
1310
|
+
|
1311
|
+
# String
|
1288
1312
|
(r"'", String.Single, ('#pop', 'string-single')),
|
1289
1313
|
(r'"', String.Double, ('#pop', 'string-double')),
|
1290
1314
|
],
|
@@ -1298,7 +1322,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1298
1322
|
'preproc-expr-chain': [
|
1299
1323
|
(r'\s+', Comment.Preproc),
|
1300
1324
|
(binop, Comment.Preproc, ('#pop', 'preproc-expr-in-parenthesis')),
|
1301
|
-
(
|
1325
|
+
default('#pop'),
|
1302
1326
|
],
|
1303
1327
|
|
1304
1328
|
# same as 'preproc-expr' but able to chain 'preproc-expr-chain'
|
@@ -1309,6 +1333,19 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1309
1333
|
('#pop', 'preproc-expr-chain', 'preproc-parenthesis')),
|
1310
1334
|
|
1311
1335
|
(ident, Comment.Preproc, ('#pop', 'preproc-expr-chain')),
|
1336
|
+
|
1337
|
+
# Float
|
1338
|
+
(r'\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1339
|
+
(r'[0-9]+[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1340
|
+
(r'[0-9]+\.[0-9]*[eE][\+\-]?[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1341
|
+
(r'[0-9]+\.[0-9]+', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1342
|
+
(r'[0-9]+\.(?!' + ident + '|\.\.)', Number.Float, ('#pop', 'preproc-expr-chain')),
|
1343
|
+
|
1344
|
+
# Int
|
1345
|
+
(r'0x[0-9a-fA-F]+', Number.Hex, ('#pop', 'preproc-expr-chain')),
|
1346
|
+
(r'[0-9]+', Number.Integer, ('#pop', 'preproc-expr-chain')),
|
1347
|
+
|
1348
|
+
# String
|
1312
1349
|
(r"'", String.Single,
|
1313
1350
|
('#pop', 'preproc-expr-chain', 'string-single')),
|
1314
1351
|
(r'"', String.Double,
|
@@ -1317,7 +1354,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1317
1354
|
|
1318
1355
|
'abstract' : [
|
1319
1356
|
include('spaces'),
|
1320
|
-
(
|
1357
|
+
default(('#pop', 'abstract-body', 'abstract-relation',
|
1321
1358
|
'abstract-opaque', 'type-param-constraint', 'type-name')),
|
1322
1359
|
],
|
1323
1360
|
|
@@ -1329,14 +1366,14 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1329
1366
|
'abstract-opaque' : [
|
1330
1367
|
include('spaces'),
|
1331
1368
|
(r'\(', Punctuation, ('#pop', 'parenthesis-close', 'type')),
|
1332
|
-
(
|
1369
|
+
default('#pop'),
|
1333
1370
|
],
|
1334
1371
|
|
1335
1372
|
'abstract-relation': [
|
1336
1373
|
include('spaces'),
|
1337
1374
|
(r'(?:to|from)', Keyword.Declaration, 'type'),
|
1338
1375
|
(r',', Punctuation),
|
1339
|
-
(
|
1376
|
+
default('#pop'),
|
1340
1377
|
],
|
1341
1378
|
|
1342
1379
|
'meta': [
|
@@ -1348,7 +1385,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1348
1385
|
'meta-colon': [
|
1349
1386
|
include('spaces'),
|
1350
1387
|
(r':', Name.Decorator, '#pop'),
|
1351
|
-
(
|
1388
|
+
default('#pop'),
|
1352
1389
|
],
|
1353
1390
|
|
1354
1391
|
# same as 'ident' but set token as Name.Decorator instead of Name
|
@@ -1360,13 +1397,13 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1360
1397
|
'meta-body': [
|
1361
1398
|
include('spaces'),
|
1362
1399
|
(r'\(', Name.Decorator, ('#pop', 'meta-call')),
|
1363
|
-
(
|
1400
|
+
default('#pop'),
|
1364
1401
|
],
|
1365
1402
|
|
1366
1403
|
'meta-call': [
|
1367
1404
|
include('spaces'),
|
1368
1405
|
(r'\)', Name.Decorator, '#pop'),
|
1369
|
-
(
|
1406
|
+
default(('#pop', 'meta-call-sep', 'expr')),
|
1370
1407
|
],
|
1371
1408
|
|
1372
1409
|
'meta-call-sep': [
|
@@ -1377,7 +1414,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1377
1414
|
|
1378
1415
|
'typedef': [
|
1379
1416
|
include('spaces'),
|
1380
|
-
(
|
1417
|
+
default(('#pop', 'typedef-body', 'type-param-constraint',
|
1381
1418
|
'type-name')),
|
1382
1419
|
],
|
1383
1420
|
|
@@ -1388,7 +1425,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1388
1425
|
|
1389
1426
|
'enum': [
|
1390
1427
|
include('spaces'),
|
1391
|
-
(
|
1428
|
+
default(('#pop', 'enum-body', 'bracket-open',
|
1392
1429
|
'type-param-constraint', 'type-name')),
|
1393
1430
|
],
|
1394
1431
|
|
@@ -1403,12 +1440,12 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1403
1440
|
include('spaces'),
|
1404
1441
|
(r'\(', Punctuation,
|
1405
1442
|
('#pop', 'semicolon', 'flag', 'function-param')),
|
1406
|
-
(
|
1443
|
+
default(('#pop', 'semicolon', 'flag')),
|
1407
1444
|
],
|
1408
1445
|
|
1409
1446
|
'class': [
|
1410
1447
|
include('spaces'),
|
1411
|
-
(
|
1448
|
+
default(('#pop', 'class-body', 'bracket-open', 'extends',
|
1412
1449
|
'type-param-constraint', 'type-name')),
|
1413
1450
|
],
|
1414
1451
|
|
@@ -1417,7 +1454,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1417
1454
|
(r'(?:extends|implements)\b', Keyword.Declaration, 'type'),
|
1418
1455
|
(r',', Punctuation), # the comma is made optional here, since haxe2
|
1419
1456
|
# requires the comma but haxe3 does not allow it
|
1420
|
-
(
|
1457
|
+
default('#pop'),
|
1421
1458
|
],
|
1422
1459
|
|
1423
1460
|
'bracket-open': [
|
@@ -1436,13 +1473,13 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1436
1473
|
(r'\}', Punctuation, '#pop'),
|
1437
1474
|
(r'(?:static|public|private|override|dynamic|inline|macro)\b',
|
1438
1475
|
Keyword.Declaration),
|
1439
|
-
(
|
1476
|
+
default('class-member'),
|
1440
1477
|
],
|
1441
1478
|
|
1442
1479
|
'class-member': [
|
1443
1480
|
include('spaces'),
|
1444
1481
|
(r'(var)\b', Keyword.Declaration,
|
1445
|
-
('#pop', 'optional-semicolon', '
|
1482
|
+
('#pop', 'optional-semicolon', 'var')),
|
1446
1483
|
(r'(function)\b', Keyword.Declaration,
|
1447
1484
|
('#pop', 'optional-semicolon', 'class-method')),
|
1448
1485
|
],
|
@@ -1451,14 +1488,14 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1451
1488
|
'function-local': [
|
1452
1489
|
include('spaces'),
|
1453
1490
|
(r'(' + ident_no_keyword + ')?', Name.Function,
|
1454
|
-
('#pop', 'expr', 'flag', 'function-param',
|
1491
|
+
('#pop', 'optional-expr', 'flag', 'function-param',
|
1455
1492
|
'parenthesis-open', 'type-param-constraint')),
|
1456
1493
|
],
|
1457
1494
|
|
1458
1495
|
'optional-expr': [
|
1459
1496
|
include('spaces'),
|
1460
1497
|
include('expr'),
|
1461
|
-
(
|
1498
|
+
default('#pop'),
|
1462
1499
|
],
|
1463
1500
|
|
1464
1501
|
'class-method': [
|
@@ -1483,18 +1520,11 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1483
1520
|
(r',', Punctuation, ('#pop', 'function-param')),
|
1484
1521
|
],
|
1485
1522
|
|
1486
|
-
# class property
|
1487
|
-
# eg. var prop(default, null):String;
|
1488
|
-
'prop': [
|
1489
|
-
include('spaces'),
|
1490
|
-
(ident_no_keyword, Name, ('#pop', 'assign', 'flag', 'prop-get-set')),
|
1491
|
-
],
|
1492
|
-
|
1493
1523
|
'prop-get-set': [
|
1494
1524
|
include('spaces'),
|
1495
1525
|
(r'\(', Punctuation, ('#pop', 'parenthesis-close',
|
1496
1526
|
'prop-get-set-opt', 'comma', 'prop-get-set-opt')),
|
1497
|
-
(
|
1527
|
+
default('#pop'),
|
1498
1528
|
],
|
1499
1529
|
|
1500
1530
|
'prop-get-set-opt': [
|
@@ -1507,7 +1537,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1507
1537
|
include('spaces'),
|
1508
1538
|
# makes semicolon optional here, just to avoid checking the last
|
1509
1539
|
# one is bracket or not.
|
1510
|
-
(
|
1540
|
+
default(('#pop', 'optional-semicolon', 'expr')),
|
1511
1541
|
],
|
1512
1542
|
|
1513
1543
|
'expr': [
|
@@ -1516,7 +1546,8 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1516
1546
|
'meta-ident', 'meta-colon')),
|
1517
1547
|
(r'(?:\+\+|\-\-|~(?!/)|!|\-)', Operator),
|
1518
1548
|
(r'\(', Punctuation, ('#pop', 'expr-chain', 'parenthesis')),
|
1519
|
-
(r'(?:inline)\b',
|
1549
|
+
(r'(?:static|public|private|override|dynamic|inline)\b',
|
1550
|
+
Keyword.Declaration),
|
1520
1551
|
(r'(?:function)\b', Keyword.Declaration, ('#pop', 'expr-chain',
|
1521
1552
|
'function-local')),
|
1522
1553
|
(r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket')),
|
@@ -1569,14 +1600,22 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1569
1600
|
(r'(\.)(' + ident_no_keyword + ')', bygroups(Punctuation, Name)),
|
1570
1601
|
(r'\[', Punctuation, 'array-access'),
|
1571
1602
|
(r'\(', Punctuation, 'call'),
|
1572
|
-
(
|
1603
|
+
default('#pop'),
|
1573
1604
|
],
|
1574
1605
|
|
1575
1606
|
# macro reification
|
1576
1607
|
'macro': [
|
1577
1608
|
include('spaces'),
|
1609
|
+
include('meta'),
|
1578
1610
|
(r':', Punctuation, ('#pop', 'type')),
|
1579
|
-
|
1611
|
+
|
1612
|
+
(r'(?:extern|private)\b', Keyword.Declaration),
|
1613
|
+
(r'(?:abstract)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'abstract')),
|
1614
|
+
(r'(?:class|interface)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'class')),
|
1615
|
+
(r'(?:enum)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'enum')),
|
1616
|
+
(r'(?:typedef)\b', Keyword.Declaration, ('#pop', 'optional-semicolon', 'typedef')),
|
1617
|
+
|
1618
|
+
default(('#pop', 'expr')),
|
1580
1619
|
],
|
1581
1620
|
|
1582
1621
|
# cast can be written as "cast expr" or "cast(expr, type)"
|
@@ -1584,27 +1623,27 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1584
1623
|
include('spaces'),
|
1585
1624
|
(r'\(', Punctuation, ('#pop', 'parenthesis-close',
|
1586
1625
|
'cast-type', 'expr')),
|
1587
|
-
(
|
1626
|
+
default(('#pop', 'expr')),
|
1588
1627
|
],
|
1589
1628
|
|
1590
1629
|
# optionally give a type as the 2nd argument of cast()
|
1591
1630
|
'cast-type': [
|
1592
1631
|
include('spaces'),
|
1593
1632
|
(r',', Punctuation, ('#pop', 'type')),
|
1594
|
-
(
|
1633
|
+
default('#pop'),
|
1595
1634
|
],
|
1596
1635
|
|
1597
1636
|
'catch': [
|
1598
1637
|
include('spaces'),
|
1599
1638
|
(r'(?:catch)\b', Keyword, ('expr', 'function-param',
|
1600
1639
|
'parenthesis-open')),
|
1601
|
-
(
|
1640
|
+
default('#pop'),
|
1602
1641
|
],
|
1603
1642
|
|
1604
1643
|
# do-while loop
|
1605
1644
|
'do': [
|
1606
1645
|
include('spaces'),
|
1607
|
-
(
|
1646
|
+
default(('#pop', 'do-while', 'expr')),
|
1608
1647
|
],
|
1609
1648
|
|
1610
1649
|
# the while after do
|
@@ -1633,12 +1672,12 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1633
1672
|
'else': [
|
1634
1673
|
include('spaces'),
|
1635
1674
|
(r'(?:else)\b', Keyword, ('#pop', 'expr')),
|
1636
|
-
(
|
1675
|
+
default('#pop'),
|
1637
1676
|
],
|
1638
1677
|
|
1639
1678
|
'switch': [
|
1640
1679
|
include('spaces'),
|
1641
|
-
(
|
1680
|
+
default(('#pop', 'switch-body', 'bracket-open', 'expr')),
|
1642
1681
|
],
|
1643
1682
|
|
1644
1683
|
'switch-body': [
|
@@ -1650,7 +1689,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1650
1689
|
'case': [
|
1651
1690
|
include('spaces'),
|
1652
1691
|
(r':', Punctuation, '#pop'),
|
1653
|
-
(
|
1692
|
+
default(('#pop', 'case-sep', 'case-guard', 'expr')),
|
1654
1693
|
],
|
1655
1694
|
|
1656
1695
|
'case-sep': [
|
@@ -1662,25 +1701,25 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1662
1701
|
'case-guard': [
|
1663
1702
|
include('spaces'),
|
1664
1703
|
(r'(?:if)\b', Keyword, ('#pop', 'parenthesis', 'parenthesis-open')),
|
1665
|
-
(
|
1704
|
+
default('#pop'),
|
1666
1705
|
],
|
1667
1706
|
|
1668
1707
|
# optional multiple expr under a case
|
1669
1708
|
'case-block': [
|
1670
1709
|
include('spaces'),
|
1671
1710
|
(r'(?!(?:case|default)\b|\})', Keyword, 'expr-statement'),
|
1672
|
-
(
|
1711
|
+
default('#pop'),
|
1673
1712
|
],
|
1674
1713
|
|
1675
1714
|
'new': [
|
1676
1715
|
include('spaces'),
|
1677
|
-
(
|
1716
|
+
default(('#pop', 'call', 'parenthesis-open', 'type')),
|
1678
1717
|
],
|
1679
1718
|
|
1680
1719
|
'array-decl': [
|
1681
1720
|
include('spaces'),
|
1682
1721
|
(r'\]', Punctuation, '#pop'),
|
1683
|
-
(
|
1722
|
+
default(('#pop', 'array-decl-sep', 'expr')),
|
1684
1723
|
],
|
1685
1724
|
|
1686
1725
|
'array-decl-sep': [
|
@@ -1691,7 +1730,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1691
1730
|
|
1692
1731
|
'array-access': [
|
1693
1732
|
include('spaces'),
|
1694
|
-
(
|
1733
|
+
default(('#pop', 'array-access-close', 'expr')),
|
1695
1734
|
],
|
1696
1735
|
|
1697
1736
|
'array-access-close': [
|
@@ -1717,7 +1756,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1717
1756
|
'optional-semicolon': [
|
1718
1757
|
include('spaces'),
|
1719
1758
|
(r';', Punctuation, '#pop'),
|
1720
|
-
(
|
1759
|
+
default('#pop'),
|
1721
1760
|
],
|
1722
1761
|
|
1723
1762
|
# identity that CAN be a Haxe keyword
|
@@ -1728,8 +1767,8 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1728
1767
|
|
1729
1768
|
'dollar': [
|
1730
1769
|
include('spaces'),
|
1731
|
-
(r'\{',
|
1732
|
-
(
|
1770
|
+
(r'\{', Punctuation, ('#pop', 'expr-chain', 'bracket-close', 'expr')),
|
1771
|
+
default(('#pop', 'expr-chain')),
|
1733
1772
|
],
|
1734
1773
|
|
1735
1774
|
'type-name': [
|
@@ -1740,7 +1779,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1740
1779
|
'type-full-name': [
|
1741
1780
|
include('spaces'),
|
1742
1781
|
(r'\.', Punctuation, 'ident'),
|
1743
|
-
(
|
1782
|
+
default('#pop'),
|
1744
1783
|
],
|
1745
1784
|
|
1746
1785
|
'type': [
|
@@ -1753,14 +1792,14 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1753
1792
|
|
1754
1793
|
'type-parenthesis': [
|
1755
1794
|
include('spaces'),
|
1756
|
-
(
|
1795
|
+
default(('#pop', 'parenthesis-close', 'type')),
|
1757
1796
|
],
|
1758
1797
|
|
1759
1798
|
'type-check': [
|
1760
1799
|
include('spaces'),
|
1761
1800
|
(r'->', Punctuation, ('#pop', 'type')),
|
1762
1801
|
(r'<(?!=)', Punctuation, 'type-param'),
|
1763
|
-
(
|
1802
|
+
default('#pop'),
|
1764
1803
|
],
|
1765
1804
|
|
1766
1805
|
'type-struct': [
|
@@ -1808,7 +1847,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1808
1847
|
# ie. the <A,B> path in Map<A,B>
|
1809
1848
|
'type-param': [
|
1810
1849
|
include('spaces'),
|
1811
|
-
(
|
1850
|
+
default(('#pop', 'type-param-sep', 'type-param-type')),
|
1812
1851
|
],
|
1813
1852
|
|
1814
1853
|
'type-param-sep': [
|
@@ -1823,7 +1862,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1823
1862
|
include('spaces'),
|
1824
1863
|
(r'<(?!=)', Punctuation, ('#pop', 'type-param-constraint-sep',
|
1825
1864
|
'type-param-constraint-flag', 'type-name')),
|
1826
|
-
(
|
1865
|
+
default('#pop'),
|
1827
1866
|
],
|
1828
1867
|
|
1829
1868
|
'type-param-constraint-sep': [
|
@@ -1837,14 +1876,14 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1837
1876
|
'type-param-constraint-flag': [
|
1838
1877
|
include('spaces'),
|
1839
1878
|
(r':', Punctuation, ('#pop', 'type-param-constraint-flag-type')),
|
1840
|
-
(
|
1879
|
+
default('#pop'),
|
1841
1880
|
],
|
1842
1881
|
|
1843
1882
|
'type-param-constraint-flag-type': [
|
1844
1883
|
include('spaces'),
|
1845
1884
|
(r'\(', Punctuation, ('#pop', 'type-param-constraint-flag-type-sep',
|
1846
1885
|
'type')),
|
1847
|
-
(
|
1886
|
+
default(('#pop', 'type')),
|
1848
1887
|
],
|
1849
1888
|
|
1850
1889
|
'type-param-constraint-flag-type-sep': [
|
@@ -1856,7 +1895,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1856
1895
|
# a parenthesis expr that contain exactly one expr
|
1857
1896
|
'parenthesis': [
|
1858
1897
|
include('spaces'),
|
1859
|
-
(
|
1898
|
+
default(('#pop', 'parenthesis-close', 'flag', 'expr')),
|
1860
1899
|
],
|
1861
1900
|
|
1862
1901
|
'parenthesis-open': [
|
@@ -1871,28 +1910,28 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1871
1910
|
|
1872
1911
|
'var': [
|
1873
1912
|
include('spaces'),
|
1874
|
-
(ident_no_keyword, Text, ('#pop', 'var-sep', 'assign', 'flag')),
|
1913
|
+
(ident_no_keyword, Text, ('#pop', 'var-sep', 'assign', 'flag', 'prop-get-set')),
|
1875
1914
|
],
|
1876
1915
|
|
1877
1916
|
# optional more var decl.
|
1878
1917
|
'var-sep': [
|
1879
1918
|
include('spaces'),
|
1880
1919
|
(r',', Punctuation, ('#pop', 'var')),
|
1881
|
-
(
|
1920
|
+
default('#pop'),
|
1882
1921
|
],
|
1883
1922
|
|
1884
1923
|
# optional assignment
|
1885
1924
|
'assign': [
|
1886
1925
|
include('spaces'),
|
1887
1926
|
(r'=', Operator, ('#pop', 'expr')),
|
1888
|
-
(
|
1927
|
+
default('#pop'),
|
1889
1928
|
],
|
1890
1929
|
|
1891
1930
|
# optional type flag
|
1892
1931
|
'flag': [
|
1893
1932
|
include('spaces'),
|
1894
1933
|
(r':', Punctuation, ('#pop', 'type')),
|
1895
|
-
(
|
1934
|
+
default('#pop'),
|
1896
1935
|
],
|
1897
1936
|
|
1898
1937
|
# colon as part of a ternary operator (?:)
|
@@ -1905,7 +1944,7 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1905
1944
|
'call': [
|
1906
1945
|
include('spaces'),
|
1907
1946
|
(r'\)', Punctuation, '#pop'),
|
1908
|
-
(
|
1947
|
+
default(('#pop', 'call-sep', 'expr')),
|
1909
1948
|
],
|
1910
1949
|
|
1911
1950
|
# after a call param
|
@@ -1922,27 +1961,27 @@ class HaxeLexer(ExtendedRegexLexer):
|
|
1922
1961
|
('#pop', 'bracket-check')),
|
1923
1962
|
(r"'", String.Single, ('#pop', 'bracket-check', 'string-single')),
|
1924
1963
|
(r'"', String.Double, ('#pop', 'bracket-check', 'string-double')),
|
1925
|
-
(
|
1964
|
+
default(('#pop', 'block')),
|
1926
1965
|
],
|
1927
1966
|
|
1928
1967
|
'bracket-check': [
|
1929
1968
|
include('spaces'),
|
1930
1969
|
(r':', Punctuation, ('#pop', 'object-sep', 'expr')), #is object
|
1931
|
-
(
|
1970
|
+
default(('#pop', 'block', 'optional-semicolon', 'expr-chain')), #is block
|
1932
1971
|
],
|
1933
1972
|
|
1934
1973
|
# code block
|
1935
1974
|
'block': [
|
1936
1975
|
include('spaces'),
|
1937
1976
|
(r'\}', Punctuation, '#pop'),
|
1938
|
-
(
|
1977
|
+
default('expr-statement'),
|
1939
1978
|
],
|
1940
1979
|
|
1941
1980
|
# object in key-value pairs
|
1942
1981
|
'object': [
|
1943
1982
|
include('spaces'),
|
1944
1983
|
(r'\}', Punctuation, '#pop'),
|
1945
|
-
(
|
1984
|
+
default(('#pop', 'object-sep', 'expr', 'colon', 'ident-or-string'))
|
1946
1985
|
],
|
1947
1986
|
|
1948
1987
|
# a key of an object
|
@@ -2002,11 +2041,11 @@ class HamlLexer(ExtendedRegexLexer):
|
|
2002
2041
|
"""
|
2003
2042
|
For Haml markup.
|
2004
2043
|
|
2005
|
-
|
2044
|
+
.. versionadded:: 1.3
|
2006
2045
|
"""
|
2007
2046
|
|
2008
2047
|
name = 'Haml'
|
2009
|
-
aliases = ['haml'
|
2048
|
+
aliases = ['haml']
|
2010
2049
|
filenames = ['*.haml']
|
2011
2050
|
mimetypes = ['text/x-haml']
|
2012
2051
|
|
@@ -2026,8 +2065,8 @@ class HamlLexer(ExtendedRegexLexer):
|
|
2026
2065
|
],
|
2027
2066
|
|
2028
2067
|
'css': [
|
2029
|
-
(r'\.[
|
2030
|
-
(r'\#[
|
2068
|
+
(r'\.[\w:-]+', Name.Class, 'tag'),
|
2069
|
+
(r'\#[\w:-]+', Name.Function, 'tag'),
|
2031
2070
|
],
|
2032
2071
|
|
2033
2072
|
'eval-or-plain': [
|
@@ -2035,12 +2074,12 @@ class HamlLexer(ExtendedRegexLexer):
|
|
2035
2074
|
(r'([&!]?[=~])(' + _comma_dot + r'*\n)',
|
2036
2075
|
bygroups(Punctuation, using(RubyLexer)),
|
2037
2076
|
'root'),
|
2038
|
-
(
|
2077
|
+
default('plain'),
|
2039
2078
|
],
|
2040
2079
|
|
2041
2080
|
'content': [
|
2042
2081
|
include('css'),
|
2043
|
-
(r'%[
|
2082
|
+
(r'%[\w:-]+', Name.Tag, 'tag'),
|
2044
2083
|
(r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
|
2045
2084
|
(r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
|
2046
2085
|
bygroups(Comment, Comment.Special, Comment),
|
@@ -2076,16 +2115,16 @@ class HamlLexer(ExtendedRegexLexer):
|
|
2076
2115
|
|
2077
2116
|
'html-attributes': [
|
2078
2117
|
(r'\s+', Text),
|
2079
|
-
(r'[
|
2080
|
-
(r'[
|
2118
|
+
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
2119
|
+
(r'[\w:-]+', Name.Attribute),
|
2081
2120
|
(r'\)', Text, '#pop'),
|
2082
2121
|
],
|
2083
2122
|
|
2084
2123
|
'html-attribute-value': [
|
2085
2124
|
(r'[ \t]+', Text),
|
2086
|
-
(r'
|
2087
|
-
(r'
|
2088
|
-
(r'
|
2125
|
+
(r'\w+', Name.Variable, '#pop'),
|
2126
|
+
(r'@\w+', Name.Variable.Instance, '#pop'),
|
2127
|
+
(r'\$\w+', Name.Variable.Global, '#pop'),
|
2089
2128
|
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
2090
2129
|
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
2091
2130
|
],
|
@@ -2225,7 +2264,7 @@ common_sass_tokens = {
|
|
2225
2264
|
(r'\:', Name.Decorator, 'pseudo-class'),
|
2226
2265
|
(r'\.', Name.Class, 'class'),
|
2227
2266
|
(r'\#', Name.Namespace, 'id'),
|
2228
|
-
(r'[
|
2267
|
+
(r'[\w-]+', Name.Tag),
|
2229
2268
|
(r'#\{', String.Interpol, 'interpolation'),
|
2230
2269
|
(r'&', Keyword),
|
2231
2270
|
(r'[~\^\*!&\[\]\(\)<>\|+=@:;,./?-]', Operator),
|
@@ -2254,19 +2293,19 @@ common_sass_tokens = {
|
|
2254
2293
|
'pseudo-class': [
|
2255
2294
|
(r'[\w-]+', Name.Decorator),
|
2256
2295
|
(r'#\{', String.Interpol, 'interpolation'),
|
2257
|
-
(
|
2296
|
+
default('#pop'),
|
2258
2297
|
],
|
2259
2298
|
|
2260
2299
|
'class': [
|
2261
2300
|
(r'[\w-]+', Name.Class),
|
2262
2301
|
(r'#\{', String.Interpol, 'interpolation'),
|
2263
|
-
(
|
2302
|
+
default('#pop'),
|
2264
2303
|
],
|
2265
2304
|
|
2266
2305
|
'id': [
|
2267
2306
|
(r'[\w-]+', Name.Namespace),
|
2268
2307
|
(r'#\{', String.Interpol, 'interpolation'),
|
2269
|
-
(
|
2308
|
+
default('#pop'),
|
2270
2309
|
],
|
2271
2310
|
|
2272
2311
|
'for': [
|
@@ -2279,11 +2318,11 @@ class SassLexer(ExtendedRegexLexer):
|
|
2279
2318
|
"""
|
2280
2319
|
For Sass stylesheets.
|
2281
2320
|
|
2282
|
-
|
2321
|
+
.. versionadded:: 1.3
|
2283
2322
|
"""
|
2284
2323
|
|
2285
2324
|
name = 'Sass'
|
2286
|
-
aliases = ['sass'
|
2325
|
+
aliases = ['sass']
|
2287
2326
|
filenames = ['*.sass']
|
2288
2327
|
mimetypes = ['text/x-sass']
|
2289
2328
|
|
@@ -2305,14 +2344,14 @@ class SassLexer(ExtendedRegexLexer):
|
|
2305
2344
|
(r'(@mixin)( [\w-]+)', bygroups(Keyword, Name.Function), 'value'),
|
2306
2345
|
(r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'),
|
2307
2346
|
(r'@extend', Keyword, 'selector'),
|
2308
|
-
(r'@[
|
2347
|
+
(r'@[\w-]+', Keyword, 'selector'),
|
2309
2348
|
(r'=[\w-]+', Name.Function, 'value'),
|
2310
2349
|
(r'\+[\w-]+', Name.Decorator, 'value'),
|
2311
2350
|
(r'([!$][\w-]\w*)([ \t]*(?:(?:\|\|)?=|:))',
|
2312
2351
|
bygroups(Name.Variable, Operator), 'value'),
|
2313
2352
|
(r':', Name.Attribute, 'old-style-attr'),
|
2314
2353
|
(r'(?=.+?[=:]([^a-z]|$))', Name.Attribute, 'new-style-attr'),
|
2315
|
-
(
|
2354
|
+
default('selector'),
|
2316
2355
|
],
|
2317
2356
|
|
2318
2357
|
'single-comment': [
|
@@ -2335,7 +2374,7 @@ class SassLexer(ExtendedRegexLexer):
|
|
2335
2374
|
(r'[^\s:="\[]+', Name.Attribute),
|
2336
2375
|
(r'#{', String.Interpol, 'interpolation'),
|
2337
2376
|
(r'[ \t]*=', Operator, 'value'),
|
2338
|
-
(
|
2377
|
+
default('value'),
|
2339
2378
|
],
|
2340
2379
|
|
2341
2380
|
'new-style-attr': [
|
@@ -2350,7 +2389,7 @@ class SassLexer(ExtendedRegexLexer):
|
|
2350
2389
|
(r"\*/", Comment, '#pop'),
|
2351
2390
|
],
|
2352
2391
|
}
|
2353
|
-
for group, common in
|
2392
|
+
for group, common in iteritems(common_sass_tokens):
|
2354
2393
|
tokens[group] = copy.copy(common)
|
2355
2394
|
tokens['value'].append((r'\n', Text, 'root'))
|
2356
2395
|
tokens['selector'].append((r'\n', Text, 'root'))
|
@@ -2378,11 +2417,11 @@ class ScssLexer(RegexLexer):
|
|
2378
2417
|
(r'(@mixin)( [\w-]+)', bygroups(Keyword, Name.Function), 'value'),
|
2379
2418
|
(r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'),
|
2380
2419
|
(r'@extend', Keyword, 'selector'),
|
2381
|
-
(r'@[
|
2420
|
+
(r'@[\w-]+', Keyword, 'selector'),
|
2382
2421
|
(r'(\$[\w-]*\w)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'),
|
2383
2422
|
(r'(?=[^;{}][;}])', Name.Attribute, 'attr'),
|
2384
2423
|
(r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'),
|
2385
|
-
(
|
2424
|
+
default('selector'),
|
2386
2425
|
],
|
2387
2426
|
|
2388
2427
|
'attr': [
|
@@ -2397,7 +2436,7 @@ class ScssLexer(RegexLexer):
|
|
2397
2436
|
(r"\*/", Comment, '#pop'),
|
2398
2437
|
],
|
2399
2438
|
}
|
2400
|
-
for group, common in
|
2439
|
+
for group, common in iteritems(common_sass_tokens):
|
2401
2440
|
tokens[group] = copy.copy(common)
|
2402
2441
|
tokens['value'].extend([(r'\n', Text), (r'[;{}]', Punctuation, 'root')])
|
2403
2442
|
tokens['selector'].extend([(r'\n', Text), (r'[;{}]', Punctuation, 'root')])
|
@@ -2409,7 +2448,7 @@ class CoffeeScriptLexer(RegexLexer):
|
|
2409
2448
|
|
2410
2449
|
.. _CoffeeScript: http://coffeescript.org
|
2411
2450
|
|
2412
|
-
|
2451
|
+
.. versionadded:: 1.3
|
2413
2452
|
"""
|
2414
2453
|
|
2415
2454
|
name = 'CoffeeScript'
|
@@ -2435,17 +2474,17 @@ class CoffeeScriptLexer(RegexLexer):
|
|
2435
2474
|
(r'///', String.Regex, ('#pop', 'multilineregex')),
|
2436
2475
|
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
2437
2476
|
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
2438
|
-
(
|
2477
|
+
default('#pop'),
|
2439
2478
|
],
|
2440
2479
|
'root': [
|
2441
2480
|
# this next expr leads to infinite loops root -> slashstartsregex
|
2442
2481
|
#(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
2443
2482
|
include('commentsandwhitespace'),
|
2444
2483
|
(r'\+\+|~|&&|\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|\?|:|'
|
2445
|
-
r'\|\||\\(?=\n)|
|
2446
|
-
r'
|
2484
|
+
r'\|\||\\(?=\n)|'
|
2485
|
+
r'(<<|>>>?|==?(?!>)|!=?|=(?!>)|-(?!>)|[<>+*`%&\|\^/])=?',
|
2447
2486
|
Operator, 'slashstartsregex'),
|
2448
|
-
(r'(?:\([^()]
|
2487
|
+
(r'(?:\([^()]*\))?\s*[=-]>', Name.Function),
|
2449
2488
|
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
2450
2489
|
(r'[})\].]', Punctuation),
|
2451
2490
|
(r'(?<![\.\$])(for|own|in|of|while|until|'
|
@@ -2461,12 +2500,12 @@ class CoffeeScriptLexer(RegexLexer):
|
|
2461
2500
|
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
2462
2501
|
r'eval|isFinite|isNaN|parseFloat|parseInt|document|window)\b',
|
2463
2502
|
Name.Builtin),
|
2464
|
-
(r'[$a-zA-Z_][
|
2503
|
+
(r'[$a-zA-Z_][\w\.:\$]*\s*[:=]\s', Name.Variable,
|
2465
2504
|
'slashstartsregex'),
|
2466
|
-
(r'@[$a-zA-Z_][
|
2505
|
+
(r'@[$a-zA-Z_][\w\.:\$]*\s*[:=]\s', Name.Variable.Instance,
|
2467
2506
|
'slashstartsregex'),
|
2468
2507
|
(r'@', Name.Other, 'slashstartsregex'),
|
2469
|
-
(r'@?[$a-zA-Z_][
|
2508
|
+
(r'@?[$a-zA-Z_][\w\$]*', Name.Other, 'slashstartsregex'),
|
2470
2509
|
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
2471
2510
|
(r'0x[0-9a-fA-F]+', Number.Hex),
|
2472
2511
|
(r'[0-9]+', Number.Integer),
|
@@ -2484,6 +2523,125 @@ class CoffeeScriptLexer(RegexLexer):
|
|
2484
2523
|
(r'}', String.Interpol, "#pop"),
|
2485
2524
|
include('root')
|
2486
2525
|
],
|
2526
|
+
'dqs': [
|
2527
|
+
(r'"', String, '#pop'),
|
2528
|
+
(r'\\.|\'', String), # double-quoted string don't need ' escapes
|
2529
|
+
(r'#{', String.Interpol, "interpoling_string"),
|
2530
|
+
(r'#', String),
|
2531
|
+
include('strings')
|
2532
|
+
],
|
2533
|
+
'sqs': [
|
2534
|
+
(r"'", String, '#pop'),
|
2535
|
+
(r'#|\\.|"', String), # single quoted strings don't need " escapses
|
2536
|
+
include('strings')
|
2537
|
+
],
|
2538
|
+
'tdqs': [
|
2539
|
+
(r'"""', String, '#pop'),
|
2540
|
+
(r'\\.|\'|"', String), # no need to escape quotes in triple-string
|
2541
|
+
(r'#{', String.Interpol, "interpoling_string"),
|
2542
|
+
(r'#', String),
|
2543
|
+
include('strings'),
|
2544
|
+
],
|
2545
|
+
'tsqs': [
|
2546
|
+
(r"'''", String, '#pop'),
|
2547
|
+
(r'#|\\.|\'|"', String), # no need to escape quotes in triple-strings
|
2548
|
+
include('strings')
|
2549
|
+
],
|
2550
|
+
}
|
2551
|
+
|
2552
|
+
|
2553
|
+
class KalLexer(RegexLexer):
|
2554
|
+
"""
|
2555
|
+
For `Kal`_ source code.
|
2556
|
+
|
2557
|
+
.. _Kal: http://rzimmerman.github.io/kal
|
2558
|
+
|
2559
|
+
|
2560
|
+
.. versionadded:: 2.0
|
2561
|
+
"""
|
2562
|
+
|
2563
|
+
name = 'Kal'
|
2564
|
+
aliases = ['kal']
|
2565
|
+
filenames = ['*.kal']
|
2566
|
+
mimetypes = ['text/kal', 'application/kal']
|
2567
|
+
|
2568
|
+
flags = re.DOTALL
|
2569
|
+
tokens = {
|
2570
|
+
'commentsandwhitespace': [
|
2571
|
+
(r'\s+', Text),
|
2572
|
+
(r'###[^#].*?###', Comment.Multiline),
|
2573
|
+
(r'#(?!##[^#]).*?\n', Comment.Single),
|
2574
|
+
],
|
2575
|
+
'functiondef': [
|
2576
|
+
(r'[$a-zA-Z_][\w\$]*\s*', Name.Function, '#pop'),
|
2577
|
+
include('commentsandwhitespace'),
|
2578
|
+
],
|
2579
|
+
'classdef': [
|
2580
|
+
(r'\binherits\s+from\b', Keyword),
|
2581
|
+
(r'[$a-zA-Z_][\w\$]*\s*\n', Name.Class, '#pop'),
|
2582
|
+
(r'[$a-zA-Z_][\w\$]*\s*', Name.Class),
|
2583
|
+
include('commentsandwhitespace'),
|
2584
|
+
],
|
2585
|
+
'listcomprehension': [
|
2586
|
+
(r'\]', Punctuation, '#pop'),
|
2587
|
+
(r'\b(property|value)\b', Keyword),
|
2588
|
+
include('root'),
|
2589
|
+
],
|
2590
|
+
'waitfor': [
|
2591
|
+
(r'\n', Punctuation, '#pop'),
|
2592
|
+
(r'\bfrom\b', Keyword),
|
2593
|
+
include('root'),
|
2594
|
+
],
|
2595
|
+
'root': [
|
2596
|
+
include('commentsandwhitespace'),
|
2597
|
+
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
2598
|
+
r'([gim]+\b|\B)', String.Regex),
|
2599
|
+
(r'\?|:|_(?=\n)|==?|!=|-(?!>)|[<>+*/-]=?',
|
2600
|
+
Operator),
|
2601
|
+
(r'\band\b|\bor\b|\bis\b|\bisnt\b|\bnot\b|'
|
2602
|
+
r'\bbut\b|\bbitwise\b|\bmod\b|\^|\bxor\b|\bexists\b|\bdoesnt\s+exist\b',
|
2603
|
+
Operator.Word),
|
2604
|
+
(r'(?:\([^()]+\))?\s*>', Name.Function),
|
2605
|
+
(r'[{(]', Punctuation),
|
2606
|
+
(r'\[', Punctuation, 'listcomprehension'),
|
2607
|
+
(r'[})\]\.\,]', Punctuation),
|
2608
|
+
(r'\b(function|method|task)\b', Keyword.Declaration, 'functiondef'),
|
2609
|
+
(r'\bclass\b', Keyword.Declaration, 'classdef'),
|
2610
|
+
(r'\b(safe\s+)?wait\s+for\b', Keyword, 'waitfor'),
|
2611
|
+
(r'\b(me|this)(\.[$a-zA-Z_][\w\.\$]*)?\b', Name.Variable.Instance),
|
2612
|
+
(r'(?<![\.\$])(for(\s+(parallel|series))?|in|of|while|until|'
|
2613
|
+
r'break|return|continue|'
|
2614
|
+
r'when|if|unless|else|otherwise|except\s+when|'
|
2615
|
+
r'throw|raise|fail\s+with|try|catch|finally|new|delete|'
|
2616
|
+
r'typeof|instanceof|super|run\s+in\s+parallel|'
|
2617
|
+
r'inherits\s+from)\b', Keyword),
|
2618
|
+
(r'(?<![\.\$])(true|false|yes|no|on|off|null|nothing|none|'
|
2619
|
+
r'NaN|Infinity|undefined)\b',
|
2620
|
+
Keyword.Constant),
|
2621
|
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
2622
|
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
2623
|
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
2624
|
+
r'eval|isFinite|isNaN|parseFloat|parseInt|document|window|'
|
2625
|
+
r'print)\b',
|
2626
|
+
Name.Builtin),
|
2627
|
+
(r'[$a-zA-Z_][\w\.\$]*\s*(:|[\+\-\*\/]?\=)?\b', Name.Variable),
|
2628
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
2629
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
2630
|
+
(r'[0-9]+', Number.Integer),
|
2631
|
+
('"""', String, 'tdqs'),
|
2632
|
+
("'''", String, 'tsqs'),
|
2633
|
+
('"', String, 'dqs'),
|
2634
|
+
("'", String, 'sqs'),
|
2635
|
+
],
|
2636
|
+
'strings': [
|
2637
|
+
(r'[^#\\\'"]+', String),
|
2638
|
+
# note that all kal strings are multi-line.
|
2639
|
+
# hashmarks, quotes and backslashes must be parsed one at a time
|
2640
|
+
],
|
2641
|
+
'interpoling_string' : [
|
2642
|
+
(r'}', String.Interpol, "#pop"),
|
2643
|
+
include('root')
|
2644
|
+
],
|
2487
2645
|
'dqs': [
|
2488
2646
|
(r'"', String, '#pop'),
|
2489
2647
|
(r'\\.|\'', String), # double-quoted string don't need ' escapes
|
@@ -2541,7 +2699,7 @@ class LiveScriptLexer(RegexLexer):
|
|
2541
2699
|
(r'//', String.Regex, ('#pop', 'multilineregex')),
|
2542
2700
|
(r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
2543
2701
|
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
2544
|
-
(
|
2702
|
+
default('#pop'),
|
2545
2703
|
],
|
2546
2704
|
'root': [
|
2547
2705
|
# this next expr leads to infinite loops root -> slashstartsregex
|
@@ -2569,20 +2727,20 @@ class LiveScriptLexer(RegexLexer):
|
|
2569
2727
|
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
2570
2728
|
r'eval|isFinite|isNaN|parseFloat|parseInt|document|window)\b',
|
2571
2729
|
Name.Builtin),
|
2572
|
-
(r'[$a-zA-Z_][
|
2730
|
+
(r'[$a-zA-Z_][\w\.\-:\$]*\s*[:=]\s', Name.Variable,
|
2573
2731
|
'slashstartsregex'),
|
2574
|
-
(r'@[$a-zA-Z_][
|
2732
|
+
(r'@[$a-zA-Z_][\w\.\-:\$]*\s*[:=]\s', Name.Variable.Instance,
|
2575
2733
|
'slashstartsregex'),
|
2576
2734
|
(r'@', Name.Other, 'slashstartsregex'),
|
2577
|
-
(r'@?[$a-zA-Z_][
|
2735
|
+
(r'@?[$a-zA-Z_][\w\-]*', Name.Other, 'slashstartsregex'),
|
2578
2736
|
(r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?(?:[a-zA-Z_]+)?', Number.Float),
|
2579
2737
|
(r'[0-9]+(~[0-9a-z]+)?(?:[a-zA-Z_]+)?', Number.Integer),
|
2580
2738
|
('"""', String, 'tdqs'),
|
2581
2739
|
("'''", String, 'tsqs'),
|
2582
2740
|
('"', String, 'dqs'),
|
2583
2741
|
("'", String, 'sqs'),
|
2584
|
-
(r'
|
2585
|
-
(r'<\[
|
2742
|
+
(r'\\\S+', String),
|
2743
|
+
(r'<\[.*?\]>', String),
|
2586
2744
|
],
|
2587
2745
|
'strings': [
|
2588
2746
|
(r'[^#\\\'"]+', String),
|
@@ -2626,11 +2784,11 @@ class DuelLexer(RegexLexer):
|
|
2626
2784
|
See http://duelengine.org/.
|
2627
2785
|
See http://jsonml.org/jbst/.
|
2628
2786
|
|
2629
|
-
|
2787
|
+
.. versionadded:: 1.4
|
2630
2788
|
"""
|
2631
2789
|
|
2632
2790
|
name = 'Duel'
|
2633
|
-
aliases = ['duel', '
|
2791
|
+
aliases = ['duel', 'jbst', 'jsonml+bst']
|
2634
2792
|
filenames = ['*.duel','*.jbst']
|
2635
2793
|
mimetypes = ['text/x-duel','text/x-jbst']
|
2636
2794
|
|
@@ -2657,11 +2815,11 @@ class ScamlLexer(ExtendedRegexLexer):
|
|
2657
2815
|
"""
|
2658
2816
|
For `Scaml markup <http://scalate.fusesource.org/>`_. Scaml is Haml for Scala.
|
2659
2817
|
|
2660
|
-
|
2818
|
+
.. versionadded:: 1.4
|
2661
2819
|
"""
|
2662
2820
|
|
2663
2821
|
name = 'Scaml'
|
2664
|
-
aliases = ['scaml'
|
2822
|
+
aliases = ['scaml']
|
2665
2823
|
filenames = ['*.scaml']
|
2666
2824
|
mimetypes = ['text/x-scaml']
|
2667
2825
|
|
@@ -2679,8 +2837,8 @@ class ScamlLexer(ExtendedRegexLexer):
|
|
2679
2837
|
],
|
2680
2838
|
|
2681
2839
|
'css': [
|
2682
|
-
(r'\.[
|
2683
|
-
(r'\#[
|
2840
|
+
(r'\.[\w:-]+', Name.Class, 'tag'),
|
2841
|
+
(r'\#[\w:-]+', Name.Function, 'tag'),
|
2684
2842
|
],
|
2685
2843
|
|
2686
2844
|
'eval-or-plain': [
|
@@ -2688,12 +2846,12 @@ class ScamlLexer(ExtendedRegexLexer):
|
|
2688
2846
|
(r'([&!]?[=~])(' + _dot + r'*\n)',
|
2689
2847
|
bygroups(Punctuation, using(ScalaLexer)),
|
2690
2848
|
'root'),
|
2691
|
-
(
|
2849
|
+
default('plain'),
|
2692
2850
|
],
|
2693
2851
|
|
2694
2852
|
'content': [
|
2695
2853
|
include('css'),
|
2696
|
-
(r'%[
|
2854
|
+
(r'%[\w:-]+', Name.Tag, 'tag'),
|
2697
2855
|
(r'!!!' + _dot + r'*\n', Name.Namespace, '#pop'),
|
2698
2856
|
(r'(/)(\[' + _dot + '*?\])(' + _dot + r'*\n)',
|
2699
2857
|
bygroups(Comment, Comment.Special, Comment),
|
@@ -2732,16 +2890,16 @@ class ScamlLexer(ExtendedRegexLexer):
|
|
2732
2890
|
|
2733
2891
|
'html-attributes': [
|
2734
2892
|
(r'\s+', Text),
|
2735
|
-
(r'[
|
2736
|
-
(r'[
|
2893
|
+
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
2894
|
+
(r'[\w:-]+', Name.Attribute),
|
2737
2895
|
(r'\)', Text, '#pop'),
|
2738
2896
|
],
|
2739
2897
|
|
2740
2898
|
'html-attribute-value': [
|
2741
2899
|
(r'[ \t]+', Text),
|
2742
|
-
(r'
|
2743
|
-
(r'
|
2744
|
-
(r'
|
2900
|
+
(r'\w+', Name.Variable, '#pop'),
|
2901
|
+
(r'@\w+', Name.Variable.Instance, '#pop'),
|
2902
|
+
(r'\$\w+', Name.Variable.Global, '#pop'),
|
2745
2903
|
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
2746
2904
|
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
2747
2905
|
],
|
@@ -2771,11 +2929,11 @@ class JadeLexer(ExtendedRegexLexer):
|
|
2771
2929
|
Jade is a variant of Scaml, see:
|
2772
2930
|
http://scalate.fusesource.org/documentation/scaml-reference.html
|
2773
2931
|
|
2774
|
-
|
2932
|
+
.. versionadded:: 1.4
|
2775
2933
|
"""
|
2776
2934
|
|
2777
2935
|
name = 'Jade'
|
2778
|
-
aliases = ['jade'
|
2936
|
+
aliases = ['jade']
|
2779
2937
|
filenames = ['*.jade']
|
2780
2938
|
mimetypes = ['text/x-jade']
|
2781
2939
|
|
@@ -2789,15 +2947,15 @@ class JadeLexer(ExtendedRegexLexer):
|
|
2789
2947
|
],
|
2790
2948
|
|
2791
2949
|
'css': [
|
2792
|
-
(r'\.[
|
2793
|
-
(r'\#[
|
2950
|
+
(r'\.[\w:-]+', Name.Class, 'tag'),
|
2951
|
+
(r'\#[\w:-]+', Name.Function, 'tag'),
|
2794
2952
|
],
|
2795
2953
|
|
2796
2954
|
'eval-or-plain': [
|
2797
2955
|
(r'[&!]?==', Punctuation, 'plain'),
|
2798
2956
|
(r'([&!]?[=~])(' + _dot + r'*\n)',
|
2799
2957
|
bygroups(Punctuation, using(ScalaLexer)), 'root'),
|
2800
|
-
(
|
2958
|
+
default('plain'),
|
2801
2959
|
],
|
2802
2960
|
|
2803
2961
|
'content': [
|
@@ -2818,7 +2976,7 @@ class JadeLexer(ExtendedRegexLexer):
|
|
2818
2976
|
'#pop'),
|
2819
2977
|
(r':' + _dot + r'*\n', _starts_block(Name.Decorator, 'filter-block'),
|
2820
2978
|
'#pop'),
|
2821
|
-
(r'[
|
2979
|
+
(r'[\w:-]+', Name.Tag, 'tag'),
|
2822
2980
|
(r'\|', Text, 'eval-or-plain'),
|
2823
2981
|
],
|
2824
2982
|
|
@@ -2841,16 +2999,16 @@ class JadeLexer(ExtendedRegexLexer):
|
|
2841
2999
|
|
2842
3000
|
'html-attributes': [
|
2843
3001
|
(r'\s+', Text),
|
2844
|
-
(r'[
|
2845
|
-
(r'[
|
3002
|
+
(r'[\w:-]+[ \t]*=', Name.Attribute, 'html-attribute-value'),
|
3003
|
+
(r'[\w:-]+', Name.Attribute),
|
2846
3004
|
(r'\)', Text, '#pop'),
|
2847
3005
|
],
|
2848
3006
|
|
2849
3007
|
'html-attribute-value': [
|
2850
3008
|
(r'[ \t]+', Text),
|
2851
|
-
(r'
|
2852
|
-
(r'
|
2853
|
-
(r'
|
3009
|
+
(r'\w+', Name.Variable, '#pop'),
|
3010
|
+
(r'@\w+', Name.Variable.Instance, '#pop'),
|
3011
|
+
(r'\$\w+', Name.Variable.Global, '#pop'),
|
2854
3012
|
(r"'(\\\\|\\'|[^'\n])*'", String, '#pop'),
|
2855
3013
|
(r'"(\\\\|\\"|[^"\n])*"', String, '#pop'),
|
2856
3014
|
],
|
@@ -2879,7 +3037,7 @@ class XQueryLexer(ExtendedRegexLexer):
|
|
2879
3037
|
An XQuery lexer, parsing a stream and outputting the tokens needed to
|
2880
3038
|
highlight xquery code.
|
2881
3039
|
|
2882
|
-
|
3040
|
+
.. versionadded:: 1.4
|
2883
3041
|
"""
|
2884
3042
|
name = 'XQuery'
|
2885
3043
|
aliases = ['xquery', 'xqy', 'xq', 'xql', 'xqm']
|
@@ -3284,7 +3442,7 @@ class XQueryLexer(ExtendedRegexLexer):
|
|
3284
3442
|
'xml_comment': [
|
3285
3443
|
(r'(-->)', popstate_xmlcomment_callback),
|
3286
3444
|
(r'[^-]{1,2}', Literal),
|
3287
|
-
(
|
3445
|
+
(u'\\t|\\r|\\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|' +
|
3288
3446
|
unirange(0x10000, 0x10ffff), Literal),
|
3289
3447
|
],
|
3290
3448
|
'processing_instruction': [
|
@@ -3294,12 +3452,12 @@ class XQueryLexer(ExtendedRegexLexer):
|
|
3294
3452
|
],
|
3295
3453
|
'processing_instruction_content': [
|
3296
3454
|
(r'\?>', String.Doc, '#pop'),
|
3297
|
-
(
|
3455
|
+
(u'\\t|\\r|\\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|' +
|
3298
3456
|
unirange(0x10000, 0x10ffff), Literal),
|
3299
3457
|
],
|
3300
3458
|
'cdata_section': [
|
3301
3459
|
(r']]>', String.Doc, '#pop'),
|
3302
|
-
(
|
3460
|
+
(u'\\t|\\r|\\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|' +
|
3303
3461
|
unirange(0x10000, 0x10ffff), Literal),
|
3304
3462
|
],
|
3305
3463
|
'start_tag': [
|
@@ -3368,7 +3526,7 @@ class XQueryLexer(ExtendedRegexLexer):
|
|
3368
3526
|
],
|
3369
3527
|
'pragmacontents': [
|
3370
3528
|
(r'#\)', Punctuation, 'operator'),
|
3371
|
-
(
|
3529
|
+
(u'\\t|\\r|\\n|[\u0020-\uD7FF]|[\uE000-\uFFFD]|' +
|
3372
3530
|
unirange(0x10000, 0x10ffff), Literal),
|
3373
3531
|
(r'(\s+)', Text),
|
3374
3532
|
],
|
@@ -3377,7 +3535,7 @@ class XQueryLexer(ExtendedRegexLexer):
|
|
3377
3535
|
(r'\(:', Comment, 'comment'),
|
3378
3536
|
(r'\*|\?|\+', Operator, 'operator'),
|
3379
3537
|
(r':=', Operator, 'root'),
|
3380
|
-
(
|
3538
|
+
default('operator'),
|
3381
3539
|
],
|
3382
3540
|
'option': [
|
3383
3541
|
include('whitespace'),
|
@@ -3400,9 +3558,9 @@ class XQueryLexer(ExtendedRegexLexer):
|
|
3400
3558
|
|
3401
3559
|
# handle operator state
|
3402
3560
|
# order on numbers matters - handle most complex first
|
3403
|
-
(r'\d+(\.\d*)?[eE][\+\-]?\d+', Number.
|
3404
|
-
(r'(\.\d+)[eE][\+\-]?\d+', Number.
|
3405
|
-
(r'(\.\d+|\d+\.\d*)', Number, 'operator'),
|
3561
|
+
(r'\d+(\.\d*)?[eE][\+\-]?\d+', Number.Float, 'operator'),
|
3562
|
+
(r'(\.\d+)[eE][\+\-]?\d+', Number.Float, 'operator'),
|
3563
|
+
(r'(\.\d+|\d+\.\d*)', Number.Float, 'operator'),
|
3406
3564
|
(r'(\d+)', Number.Integer, 'operator'),
|
3407
3565
|
(r'(\.\.|\.|\))', Punctuation, 'operator'),
|
3408
3566
|
(r'(declare)(\s+)(construction)',
|
@@ -3541,7 +3699,7 @@ class DartLexer(RegexLexer):
|
|
3541
3699
|
"""
|
3542
3700
|
For `Dart <http://dartlang.org/>`_ source code.
|
3543
3701
|
|
3544
|
-
|
3702
|
+
.. versionadded:: 1.5
|
3545
3703
|
"""
|
3546
3704
|
|
3547
3705
|
name = 'Dart'
|
@@ -3569,9 +3727,9 @@ class DartLexer(RegexLexer):
|
|
3569
3727
|
r'native|operator|set|static|typedef|var)\b', Keyword.Declaration),
|
3570
3728
|
(r'\b(bool|double|Dynamic|int|num|Object|String|void)\b', Keyword.Type),
|
3571
3729
|
(r'\b(false|null|true)\b', Keyword.Constant),
|
3572
|
-
(r'[~!%^&*+=|?:<>/-]|as', Operator),
|
3573
|
-
(r'[a-zA-Z_$]
|
3574
|
-
(r'[a-zA-Z_$]
|
3730
|
+
(r'[~!%^&*+=|?:<>/-]|as\b', Operator),
|
3731
|
+
(r'[a-zA-Z_$]\w*:', Name.Label),
|
3732
|
+
(r'[a-zA-Z_$]\w*', Name),
|
3575
3733
|
(r'[(){}\[\],.;]', Punctuation),
|
3576
3734
|
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
3577
3735
|
# DIGIT+ (‘.’ DIGIT*)? EXPONENT?
|
@@ -3581,13 +3739,13 @@ class DartLexer(RegexLexer):
|
|
3581
3739
|
# pseudo-keyword negate intentionally left out
|
3582
3740
|
],
|
3583
3741
|
'class': [
|
3584
|
-
(r'[a-zA-Z_$]
|
3742
|
+
(r'[a-zA-Z_$]\w*', Name.Class, '#pop')
|
3585
3743
|
],
|
3586
3744
|
'import_decl': [
|
3587
3745
|
include('string_literal'),
|
3588
3746
|
(r'\s+', Text),
|
3589
3747
|
(r'\b(as|show|hide)\b', Keyword),
|
3590
|
-
(r'[a-zA-Z_$]
|
3748
|
+
(r'[a-zA-Z_$]\w*', Name),
|
3591
3749
|
(r'\,', Punctuation),
|
3592
3750
|
(r'\;', Punctuation, '#pop')
|
3593
3751
|
],
|
@@ -3606,7 +3764,7 @@ class DartLexer(RegexLexer):
|
|
3606
3764
|
'string_common': [
|
3607
3765
|
(r"\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z\'\"$\\])",
|
3608
3766
|
String.Escape),
|
3609
|
-
(r'(\$)([a-zA-Z_]
|
3767
|
+
(r'(\$)([a-zA-Z_]\w*)', bygroups(String.Interpol, Name)),
|
3610
3768
|
(r'(\$\{)(.*?)(\})',
|
3611
3769
|
bygroups(String.Interpol, using(this), String.Interpol))
|
3612
3770
|
],
|
@@ -3639,9 +3797,9 @@ class DartLexer(RegexLexer):
|
|
3639
3797
|
|
3640
3798
|
class TypeScriptLexer(RegexLexer):
|
3641
3799
|
"""
|
3642
|
-
For `TypeScript <http://
|
3800
|
+
For `TypeScript <http://typescriptlang.org/>`_ source code.
|
3643
3801
|
|
3644
|
-
|
3802
|
+
.. versionadded:: 1.6
|
3645
3803
|
"""
|
3646
3804
|
|
3647
3805
|
name = 'TypeScript'
|
@@ -3662,7 +3820,7 @@ class TypeScriptLexer(RegexLexer):
|
|
3662
3820
|
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
3663
3821
|
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
3664
3822
|
(r'(?=/)', Text, ('#pop', 'badregex')),
|
3665
|
-
(
|
3823
|
+
default('#pop')
|
3666
3824
|
],
|
3667
3825
|
'badregex': [
|
3668
3826
|
(r'\n', Text, '#pop')
|
@@ -3689,7 +3847,7 @@ class TypeScriptLexer(RegexLexer):
|
|
3689
3847
|
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
3690
3848
|
r'window)\b', Name.Builtin),
|
3691
3849
|
# Match stuff like: module name {...}
|
3692
|
-
(r'\b(module)(\s*)(\s*[
|
3850
|
+
(r'\b(module)(\s*)(\s*[\w?.$][\w?.$]*)(\s*)',
|
3693
3851
|
bygroups(Keyword.Reserved, Text, Name.Other, Text), 'slashstartsregex'),
|
3694
3852
|
# Match variable type keywords
|
3695
3853
|
(r'\b(string|bool|number)\b', Keyword.Type),
|
@@ -3701,9 +3859,9 @@ class TypeScriptLexer(RegexLexer):
|
|
3701
3859
|
# Match stuff like: function() {...}
|
3702
3860
|
(r'([a-zA-Z_?.$][\w?.$]*)\(\) \{', Name.Other, 'slashstartsregex'),
|
3703
3861
|
# Match stuff like: (function: return type)
|
3704
|
-
(r'([
|
3862
|
+
(r'([\w?.$][\w?.$]*)(\s*:\s*)([\w?.$][\w?.$]*)',
|
3705
3863
|
bygroups(Name.Other, Text, Keyword.Type)),
|
3706
|
-
(r'[$a-zA-Z_]
|
3864
|
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
3707
3865
|
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
3708
3866
|
(r'0x[0-9a-fA-F]+', Number.Hex),
|
3709
3867
|
(r'[0-9]+', Number.Integer),
|
@@ -3728,7 +3886,7 @@ class LassoLexer(RegexLexer):
|
|
3728
3886
|
If given and ``True``, only highlight code between delimiters as Lasso
|
3729
3887
|
(default: ``False``).
|
3730
3888
|
|
3731
|
-
|
3889
|
+
.. versionadded:: 1.6
|
3732
3890
|
"""
|
3733
3891
|
|
3734
3892
|
name = 'Lasso'
|
@@ -3746,16 +3904,16 @@ class LassoLexer(RegexLexer):
|
|
3746
3904
|
(r'\[', Comment.Preproc, ('delimiters', 'squarebrackets')),
|
3747
3905
|
(r'<\?(LassoScript|lasso|=)', Comment.Preproc,
|
3748
3906
|
('delimiters', 'anglebrackets')),
|
3749
|
-
(r'<', Other, 'delimiters'),
|
3907
|
+
(r'<(!--.*?-->)?', Other, 'delimiters'),
|
3750
3908
|
(r'\s+', Other),
|
3751
|
-
(
|
3909
|
+
default(('delimiters', 'lassofile')),
|
3752
3910
|
],
|
3753
3911
|
'delimiters': [
|
3754
3912
|
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
|
3755
3913
|
(r'\[noprocess\]', Comment.Preproc, 'noprocess'),
|
3756
3914
|
(r'\[', Comment.Preproc, 'squarebrackets'),
|
3757
3915
|
(r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
|
3758
|
-
(r'<', Other),
|
3916
|
+
(r'<(!--.*?-->)?', Other),
|
3759
3917
|
(r'[^[<]+', Other),
|
3760
3918
|
],
|
3761
3919
|
'nosquarebrackets': [
|
@@ -3777,8 +3935,7 @@ class LassoLexer(RegexLexer):
|
|
3777
3935
|
include('lasso'),
|
3778
3936
|
],
|
3779
3937
|
'lassofile': [
|
3780
|
-
(r'\]', Comment.Preproc, '#pop'),
|
3781
|
-
(r'\?>', Comment.Preproc, '#pop'),
|
3938
|
+
(r'\]|\?>', Comment.Preproc, '#pop'),
|
3782
3939
|
include('lasso'),
|
3783
3940
|
],
|
3784
3941
|
'whitespacecomments': [
|
@@ -3807,13 +3964,13 @@ class LassoLexer(RegexLexer):
|
|
3807
3964
|
bygroups(Name.Builtin.Pseudo, Name.Variable.Class)),
|
3808
3965
|
(r"(self)(\s*->\s*)('[a-z_][\w.]*')",
|
3809
3966
|
bygroups(Name.Builtin.Pseudo, Operator, Name.Variable.Class)),
|
3810
|
-
(r'(\.\.?)([a-z_][\w.]*)',
|
3967
|
+
(r'(\.\.?)([a-z_][\w.]*(=(?!=))?)',
|
3811
3968
|
bygroups(Name.Builtin.Pseudo, Name.Other.Member)),
|
3812
|
-
(r'(->\\?\s*|&\s*)([a-z_][\w.]*)',
|
3969
|
+
(r'(->\\?\s*|&\s*)([a-z_][\w.]*(=(?!=))?)',
|
3813
3970
|
bygroups(Operator, Name.Other.Member)),
|
3814
|
-
(r'(self|inherited
|
3971
|
+
(r'(self|inherited)\b', Name.Builtin.Pseudo),
|
3815
3972
|
(r'-[a-z_][\w.]*', Name.Attribute),
|
3816
|
-
(r'
|
3973
|
+
(r'::\s*[a-z_][\w.]*', Name.Label),
|
3817
3974
|
(r'(error_(code|msg)_\w+|Error_AddError|Error_ColumnRestriction|'
|
3818
3975
|
r'Error_DatabaseConnectionUnavailable|Error_DatabaseTimeout|'
|
3819
3976
|
r'Error_DeleteError|Error_FieldRestriction|Error_FileNotFound|'
|
@@ -3827,22 +3984,22 @@ class LassoLexer(RegexLexer):
|
|
3827
3984
|
# definitions
|
3828
3985
|
(r'(define)(\s+)([a-z_][\w.]*)(\s*=>\s*)(type|trait|thread)\b',
|
3829
3986
|
bygroups(Keyword.Declaration, Text, Name.Class, Operator, Keyword)),
|
3830
|
-
(r'(define)(\s+)([a-z_][\w.]*)(\s*->\s*)([a-z_][\w.]*=?|[
|
3987
|
+
(r'(define)(\s+)([a-z_][\w.]*)(\s*->\s*)([a-z_][\w.]*=?|[-+*/%])',
|
3831
3988
|
bygroups(Keyword.Declaration, Text, Name.Class, Operator,
|
3832
3989
|
Name.Function), 'signature'),
|
3833
3990
|
(r'(define)(\s+)([a-z_][\w.]*)',
|
3834
3991
|
bygroups(Keyword.Declaration, Text, Name.Function), 'signature'),
|
3835
|
-
(r'(public|protected|private|provide)(\s+)(([a-z_][\w.]*=?|'
|
3836
|
-
r'
|
3992
|
+
(r'(public|protected|private|provide)(\s+)(([a-z_][\w.]*=?|[-+*/%])'
|
3993
|
+
r'(?=\s*\())', bygroups(Keyword, Text, Name.Function),
|
3837
3994
|
'signature'),
|
3838
|
-
(r'(public|protected|private)(\s+)([a-z_][\w.]*)',
|
3995
|
+
(r'(public|protected|private|provide)(\s+)([a-z_][\w.]*)',
|
3839
3996
|
bygroups(Keyword, Text, Name.Function)),
|
3840
3997
|
|
3841
3998
|
# keywords
|
3842
|
-
(r'(true|false|none|minimal|full|all)\b', Keyword.Constant),
|
3843
|
-
(r'(local|var|variable|data(?=\s))\b', Keyword.Declaration),
|
3999
|
+
(r'(true|false|none|minimal|full|all|void)\b', Keyword.Constant),
|
4000
|
+
(r'(local|var|variable|global|data(?=\s))\b', Keyword.Declaration),
|
3844
4001
|
(r'(array|date|decimal|duration|integer|map|pair|string|tag|xml|'
|
3845
|
-
r'null|list|queue|set|stack|staticarray)\b', Keyword.Type),
|
4002
|
+
r'null|bytes|list|queue|set|stack|staticarray|tie)\b', Keyword.Type),
|
3846
4003
|
(r'([a-z_][\w.]*)(\s+)(in)\b', bygroups(Name, Text, Keyword)),
|
3847
4004
|
(r'(let|into)(\s+)([a-z_][\w.]*)', bygroups(Keyword, Text, Name)),
|
3848
4005
|
(r'require\b', Keyword, 'requiresection'),
|
@@ -3862,17 +4019,18 @@ class LassoLexer(RegexLexer):
|
|
3862
4019
|
r'Run_Children|SOAP_DefineTag|SOAP_LastRequest|SOAP_LastResponse|'
|
3863
4020
|
r'Tag_Name|ascending|average|by|define|descending|do|equals|'
|
3864
4021
|
r'frozen|group|handle_failure|import|in|into|join|let|match|max|'
|
3865
|
-
r'min|on|order|parent|protected|provide|public|require|
|
3866
|
-
r'split_thread|sum|take|thread|to|trait|type|where|with|
|
4022
|
+
r'min|on|order|parent|protected|provide|public|require|returnhome|'
|
4023
|
+
r'skip|split_thread|sum|take|thread|to|trait|type|where|with|'
|
4024
|
+
r'yield|yieldhome)\b',
|
3867
4025
|
bygroups(Punctuation, Keyword)),
|
3868
4026
|
|
3869
4027
|
# other
|
3870
4028
|
(r',', Punctuation, 'commamember'),
|
3871
4029
|
(r'(and|or|not)\b', Operator.Word),
|
3872
|
-
(r'([a-z_][\w.]*)(\s*::\s*
|
3873
|
-
bygroups(Name,
|
4030
|
+
(r'([a-z_][\w.]*)(\s*::\s*[a-z_][\w.]*)?(\s*=(?!=))',
|
4031
|
+
bygroups(Name, Name.Label, Operator)),
|
3874
4032
|
(r'(/?)([\w.]+)', bygroups(Punctuation, Name.Other)),
|
3875
|
-
(r'(=)(bw|ew|cn|lte?|gte?|n?eq|
|
4033
|
+
(r'(=)(n?bw|n?ew|n?cn|lte?|gte?|n?eq|n?rx|ft)\b',
|
3876
4034
|
bygroups(Operator, Operator.Word)),
|
3877
4035
|
(r':=|[-+*/%=<>&|!?\\]+', Operator),
|
3878
4036
|
(r'[{}():;,@^]', Punctuation),
|
@@ -3881,13 +4039,13 @@ class LassoLexer(RegexLexer):
|
|
3881
4039
|
(r"'", String.Single, '#pop'),
|
3882
4040
|
(r"[^'\\]+", String.Single),
|
3883
4041
|
include('escape'),
|
3884
|
-
(r"
|
4042
|
+
(r"\\", String.Single),
|
3885
4043
|
],
|
3886
4044
|
'doublestring': [
|
3887
4045
|
(r'"', String.Double, '#pop'),
|
3888
4046
|
(r'[^"\\]+', String.Double),
|
3889
4047
|
include('escape'),
|
3890
|
-
(r'
|
4048
|
+
(r'\\', String.Double),
|
3891
4049
|
],
|
3892
4050
|
'escape': [
|
3893
4051
|
(r'\\(U[\da-f]{8}|u[\da-f]{4}|x[\da-f]{1,2}|[0-7]{1,3}|:[^:]+:|'
|
@@ -3906,10 +4064,10 @@ class LassoLexer(RegexLexer):
|
|
3906
4064
|
include('lasso'),
|
3907
4065
|
],
|
3908
4066
|
'requiresection': [
|
3909
|
-
(r'(([a-z_][\w.]*=?|[
|
3910
|
-
(r'(([a-z_][\w.]*=?|[
|
3911
|
-
(r'[a-z_][\w.]*=?|[
|
3912
|
-
(r'
|
4067
|
+
(r'(([a-z_][\w.]*=?|[-+*/%])(?=\s*\())', Name, 'requiresignature'),
|
4068
|
+
(r'(([a-z_][\w.]*=?|[-+*/%])(?=(\s*::\s*[\w.]+)?\s*,))', Name),
|
4069
|
+
(r'[a-z_][\w.]*=?|[-+*/%]', Name, '#pop'),
|
4070
|
+
(r'::\s*[a-z_][\w.]*', Name.Label),
|
3913
4071
|
(r',', Punctuation),
|
3914
4072
|
include('whitespacecomments'),
|
3915
4073
|
],
|
@@ -3917,17 +4075,17 @@ class LassoLexer(RegexLexer):
|
|
3917
4075
|
(r'(\)(?=(\s*::\s*[\w.]+)?\s*,))', Punctuation, '#pop'),
|
3918
4076
|
(r'\)', Punctuation, '#pop:2'),
|
3919
4077
|
(r'-?[a-z_][\w.]*', Name.Attribute),
|
3920
|
-
(r'
|
4078
|
+
(r'::\s*[a-z_][\w.]*', Name.Label),
|
3921
4079
|
(r'\.\.\.', Name.Builtin.Pseudo),
|
3922
4080
|
(r'[(,]', Punctuation),
|
3923
4081
|
include('whitespacecomments'),
|
3924
4082
|
],
|
3925
4083
|
'commamember': [
|
3926
|
-
(r'(([a-z_][\w.]*=?|[
|
4084
|
+
(r'(([a-z_][\w.]*=?|[-+*/%])'
|
3927
4085
|
r'(?=\s*(\(([^()]*\([^()]*\))*[^)]*\)\s*)?(::[\w.\s]+)?=>))',
|
3928
4086
|
Name.Function, 'signature'),
|
3929
4087
|
include('whitespacecomments'),
|
3930
|
-
(
|
4088
|
+
default('#pop'),
|
3931
4089
|
],
|
3932
4090
|
}
|
3933
4091
|
|
@@ -3941,9 +4099,9 @@ class LassoLexer(RegexLexer):
|
|
3941
4099
|
self._members = set()
|
3942
4100
|
if self.builtinshighlighting:
|
3943
4101
|
from pygments.lexers._lassobuiltins import BUILTINS, MEMBERS
|
3944
|
-
for key, value in
|
4102
|
+
for key, value in iteritems(BUILTINS):
|
3945
4103
|
self._builtins.update(value)
|
3946
|
-
for key, value in
|
4104
|
+
for key, value in iteritems(MEMBERS):
|
3947
4105
|
self._members.update(value)
|
3948
4106
|
RegexLexer.__init__(self, **options)
|
3949
4107
|
|
@@ -3954,7 +4112,8 @@ class LassoLexer(RegexLexer):
|
|
3954
4112
|
for index, token, value in \
|
3955
4113
|
RegexLexer.get_tokens_unprocessed(self, text, stack):
|
3956
4114
|
if (token is Name.Other and value.lower() in self._builtins or
|
3957
|
-
|
4115
|
+
token is Name.Other.Member and
|
4116
|
+
value.lower().rstrip('=') in self._members):
|
3958
4117
|
yield index, Name.Builtin, value
|
3959
4118
|
continue
|
3960
4119
|
yield index, token, value
|
@@ -3976,14 +4135,14 @@ class QmlLexer(RegexLexer):
|
|
3976
4135
|
"""
|
3977
4136
|
For QML files. See http://doc.qt.digia.com/4.7/qdeclarativeintroduction.html.
|
3978
4137
|
|
3979
|
-
|
4138
|
+
.. versionadded:: 1.6
|
3980
4139
|
"""
|
3981
4140
|
|
3982
4141
|
# QML is based on javascript, so much of this is taken from the
|
3983
4142
|
# JavascriptLexer above.
|
3984
4143
|
|
3985
4144
|
name = 'QML'
|
3986
|
-
aliases = ['qml'
|
4145
|
+
aliases = ['qml']
|
3987
4146
|
filenames = ['*.qml',]
|
3988
4147
|
mimetypes = [ 'application/x-qml',]
|
3989
4148
|
|
@@ -4002,7 +4161,7 @@ class QmlLexer(RegexLexer):
|
|
4002
4161
|
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
4003
4162
|
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
4004
4163
|
(r'(?=/)', Text, ('#pop', 'badregex')),
|
4005
|
-
(
|
4164
|
+
default('#pop')
|
4006
4165
|
],
|
4007
4166
|
'badregex': [
|
4008
4167
|
(r'\n', Text, '#pop')
|
@@ -4035,7 +4194,7 @@ class QmlLexer(RegexLexer):
|
|
4035
4194
|
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
4036
4195
|
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
4037
4196
|
r'window)\b', Name.Builtin),
|
4038
|
-
(r'[$a-zA-Z_]
|
4197
|
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
4039
4198
|
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
4040
4199
|
(r'0x[0-9a-fA-F]+', Number.Hex),
|
4041
4200
|
(r'[0-9]+', Number.Integer),
|
@@ -4043,3 +4202,309 @@ class QmlLexer(RegexLexer):
|
|
4043
4202
|
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
4044
4203
|
]
|
4045
4204
|
}
|
4205
|
+
|
4206
|
+
|
4207
|
+
class CirruLexer(RegexLexer):
|
4208
|
+
"""
|
4209
|
+
Syntax rules of Cirru can be found at:
|
4210
|
+
http://grammar.cirru.org/
|
4211
|
+
|
4212
|
+
* using ``()`` to markup blocks, but limited in the same line
|
4213
|
+
* using ``""`` to markup strings, allow ``\`` to escape
|
4214
|
+
* using ``$`` as a shorthand for ``()`` till indentation end or ``)``
|
4215
|
+
* using indentations for create nesting
|
4216
|
+
|
4217
|
+
.. versionadded:: 2.0
|
4218
|
+
"""
|
4219
|
+
|
4220
|
+
name = 'Cirru'
|
4221
|
+
aliases = ['cirru']
|
4222
|
+
filenames = ['*.cirru', '*.cr']
|
4223
|
+
mimetypes = ['text/x-cirru']
|
4224
|
+
flags = re.MULTILINE
|
4225
|
+
|
4226
|
+
tokens = {
|
4227
|
+
'string': [
|
4228
|
+
(r'[^"\\\n]', String),
|
4229
|
+
(r'\\', String.Escape, 'escape'),
|
4230
|
+
(r'"', String, '#pop'),
|
4231
|
+
],
|
4232
|
+
'escape': [
|
4233
|
+
(r'.', String.Escape, '#pop'),
|
4234
|
+
],
|
4235
|
+
'function': [
|
4236
|
+
(r'[\w-][^\s\(\)\"]*', Name.Function, '#pop'),
|
4237
|
+
(r'\)', Operator, '#pop'),
|
4238
|
+
(r'(?=\n)', Text, '#pop'),
|
4239
|
+
(r'\(', Operator, '#push'),
|
4240
|
+
(r'"', String, ('#pop', 'string')),
|
4241
|
+
(r'\s+', Text.Whitespace),
|
4242
|
+
(r'\,', Operator, '#pop'),
|
4243
|
+
],
|
4244
|
+
'line': [
|
4245
|
+
(r'^\B', Text.Whitespace, 'function'),
|
4246
|
+
(r'\$', Operator, 'function'),
|
4247
|
+
(r'\(', Operator, 'function'),
|
4248
|
+
(r'\)', Operator),
|
4249
|
+
(r'(?=\n)', Text, '#pop'),
|
4250
|
+
(r'\n', Text, '#pop'),
|
4251
|
+
(r'"', String, 'string'),
|
4252
|
+
(r'\s+', Text.Whitespace),
|
4253
|
+
(r'[\d\.]+', Number),
|
4254
|
+
(r'[\w-][^\"\(\)\s]*', Name.Variable),
|
4255
|
+
(r'--', Comment.Single)
|
4256
|
+
],
|
4257
|
+
'root': [
|
4258
|
+
(r'^\s*', Text.Whitespace, ('line', 'function')),
|
4259
|
+
(r'^\s+$', Text.Whitespace),
|
4260
|
+
]
|
4261
|
+
}
|
4262
|
+
|
4263
|
+
|
4264
|
+
class MaskLexer(RegexLexer):
|
4265
|
+
"""
|
4266
|
+
For `Mask <http://github.com/atmajs/MaskJS>`__ markup.
|
4267
|
+
|
4268
|
+
.. versionadded:: 2.0
|
4269
|
+
"""
|
4270
|
+
name = 'Mask'
|
4271
|
+
aliases = ['mask']
|
4272
|
+
filenames = ['*.mask']
|
4273
|
+
mimetypes = ['text/x-mask']
|
4274
|
+
|
4275
|
+
flags = re.MULTILINE | re.IGNORECASE | re.DOTALL
|
4276
|
+
tokens = {
|
4277
|
+
'root': [
|
4278
|
+
(r'\s+', Text),
|
4279
|
+
(r'//.*?\n', Comment.Single),
|
4280
|
+
(r'/\*.*?\*/', Comment.Multiline),
|
4281
|
+
(r'[\{\};>]', Punctuation),
|
4282
|
+
(r"'''", String, 'string-trpl-single'),
|
4283
|
+
(r'"""', String, 'string-trpl-double'),
|
4284
|
+
(r"'", String, 'string-single'),
|
4285
|
+
(r'"', String, 'string-double'),
|
4286
|
+
(r'([\w-]+)', Name.Tag, 'node'),
|
4287
|
+
(r'([^\.#;{>\s]+)', Name.Class, 'node'),
|
4288
|
+
(r'(#[\w-]+)', Name.Function, 'node'),
|
4289
|
+
(r'(\.[\w-]+)', Name.Variable.Class, 'node')
|
4290
|
+
],
|
4291
|
+
'string-base': [
|
4292
|
+
(r'\\.', String.Escape),
|
4293
|
+
(r'~\[', String.Interpol, 'interpolation'),
|
4294
|
+
(r'.', String.Single),
|
4295
|
+
],
|
4296
|
+
'string-single':[
|
4297
|
+
(r"'", String.Single, '#pop'),
|
4298
|
+
include('string-base')
|
4299
|
+
],
|
4300
|
+
'string-double':[
|
4301
|
+
(r'"', String.Single, '#pop'),
|
4302
|
+
include('string-base')
|
4303
|
+
],
|
4304
|
+
'string-trpl-single':[
|
4305
|
+
(r"'''", String.Single, '#pop'),
|
4306
|
+
include('string-base')
|
4307
|
+
],
|
4308
|
+
'string-trpl-double':[
|
4309
|
+
(r'"""', String.Single, '#pop'),
|
4310
|
+
include('string-base')
|
4311
|
+
],
|
4312
|
+
'interpolation': [
|
4313
|
+
(r'\]', String.Interpol, '#pop'),
|
4314
|
+
(r'\s*:', String.Interpol, 'expression'),
|
4315
|
+
(r'\s*\w+:', Name.Other),
|
4316
|
+
(r'[^\]]+', String.Interpol)
|
4317
|
+
],
|
4318
|
+
'expression': [
|
4319
|
+
(r'[^\]]+', using(JavascriptLexer), '#pop')
|
4320
|
+
],
|
4321
|
+
'node': [
|
4322
|
+
(r'\s+', Text),
|
4323
|
+
(r'\.', Name.Variable.Class, 'node-class'),
|
4324
|
+
(r'\#', Name.Function, 'node-id'),
|
4325
|
+
(r'style[ \t]*=', Name.Attribute, 'node-attr-style-value'),
|
4326
|
+
(r'[\w:-]+[ \t]*=', Name.Attribute, 'node-attr-value'),
|
4327
|
+
(r'[\w:-]+', Name.Attribute),
|
4328
|
+
(r'[>{;]', Punctuation, '#pop')
|
4329
|
+
],
|
4330
|
+
'node-class': [
|
4331
|
+
(r'[\w-]+', Name.Variable.Class),
|
4332
|
+
(r'~\[', String.Interpol, 'interpolation'),
|
4333
|
+
default('#pop')
|
4334
|
+
],
|
4335
|
+
'node-id': [
|
4336
|
+
(r'[\w-]+', Name.Function),
|
4337
|
+
(r'~\[', String.Interpol, 'interpolation'),
|
4338
|
+
default('#pop')
|
4339
|
+
],
|
4340
|
+
'node-attr-value':[
|
4341
|
+
(r'\s+', Text),
|
4342
|
+
(r'\w+', Name.Variable, '#pop'),
|
4343
|
+
(r"'", String, 'string-single-pop2'),
|
4344
|
+
(r'"', String, 'string-double-pop2'),
|
4345
|
+
default('#pop')
|
4346
|
+
],
|
4347
|
+
'node-attr-style-value':[
|
4348
|
+
(r'\s+', Text),
|
4349
|
+
(r"'", String.Single, 'css-single-end'),
|
4350
|
+
(r'"', String.Single, 'css-double-end'),
|
4351
|
+
include('node-attr-value')
|
4352
|
+
],
|
4353
|
+
'css-base': [
|
4354
|
+
(r'\s+', Text),
|
4355
|
+
(r";", Punctuation),
|
4356
|
+
(r"[\w\-]+\s*:", Name.Builtin)
|
4357
|
+
],
|
4358
|
+
'css-single-end': [
|
4359
|
+
include('css-base'),
|
4360
|
+
(r"'", String.Single, '#pop:2'),
|
4361
|
+
(r"[^;']+", Name.Entity)
|
4362
|
+
],
|
4363
|
+
'css-double-end': [
|
4364
|
+
include('css-base'),
|
4365
|
+
(r'"', String.Single, '#pop:2'),
|
4366
|
+
(r"[^;\"]+", Name.Entity)
|
4367
|
+
],
|
4368
|
+
'string-single-pop2':[
|
4369
|
+
(r"'", String.Single, '#pop:2'),
|
4370
|
+
include('string-base')
|
4371
|
+
],
|
4372
|
+
'string-double-pop2':[
|
4373
|
+
(r'"', String.Single, '#pop:2'),
|
4374
|
+
include('string-base')
|
4375
|
+
],
|
4376
|
+
}
|
4377
|
+
|
4378
|
+
|
4379
|
+
class ZephirLexer(RegexLexer):
|
4380
|
+
"""
|
4381
|
+
For `Zephir language <http://zephir-lang.com/>`_ source code.
|
4382
|
+
|
4383
|
+
Zephir is a compiled high level language aimed
|
4384
|
+
to the creation of C-extensions for PHP.
|
4385
|
+
|
4386
|
+
.. versionadded:: 2.0
|
4387
|
+
"""
|
4388
|
+
|
4389
|
+
name = 'Zephir'
|
4390
|
+
aliases = ['zephir']
|
4391
|
+
filenames = ['*.zep']
|
4392
|
+
|
4393
|
+
zephir_keywords = [ 'fetch', 'echo', 'isset', 'empty']
|
4394
|
+
zephir_type = [ 'bit', 'bits' , 'string' ]
|
4395
|
+
|
4396
|
+
flags = re.DOTALL | re.MULTILINE
|
4397
|
+
|
4398
|
+
tokens = {
|
4399
|
+
'commentsandwhitespace': [
|
4400
|
+
(r'\s+', Text),
|
4401
|
+
(r'//.*?\n', Comment.Single),
|
4402
|
+
(r'/\*.*?\*/', Comment.Multiline)
|
4403
|
+
],
|
4404
|
+
'slashstartsregex': [
|
4405
|
+
include('commentsandwhitespace'),
|
4406
|
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
4407
|
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
4408
|
+
default('#pop')
|
4409
|
+
],
|
4410
|
+
'badregex': [
|
4411
|
+
(r'\n', Text, '#pop')
|
4412
|
+
],
|
4413
|
+
'root': [
|
4414
|
+
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
4415
|
+
include('commentsandwhitespace'),
|
4416
|
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
4417
|
+
r'(<<|>>>?|==?|!=?|->|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
|
4418
|
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
4419
|
+
(r'[})\].]', Punctuation),
|
4420
|
+
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|loop|'
|
4421
|
+
r'require|inline|throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
4422
|
+
r'namespace|use|extends|this|fetch|isset|unset|echo|fetch|likely|unlikely|'
|
4423
|
+
r'empty)\b', Keyword, 'slashstartsregex'),
|
4424
|
+
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
4425
|
+
(r'(abstract|boolean|bool|char|class|const|double|enum|export|extends|final|'
|
4426
|
+
r'native|goto|implements|import|int|string|interface|long|ulong|char|uchar|'
|
4427
|
+
r'float|unsigned|private|protected|public|short|static|self|throws|reverse|'
|
4428
|
+
r'transient|volatile)\b', Keyword.Reserved),
|
4429
|
+
(r'(true|false|null|undefined)\b', Keyword.Constant),
|
4430
|
+
(r'(Array|Boolean|Date|_REQUEST|_COOKIE|_SESSION|'
|
4431
|
+
r'_GET|_POST|_SERVER|this|stdClass|range|count|iterator|'
|
4432
|
+
r'window)\b', Name.Builtin),
|
4433
|
+
(r'[$a-zA-Z_][\w\\]*', Name.Other),
|
4434
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
4435
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
4436
|
+
(r'[0-9]+', Number.Integer),
|
4437
|
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
4438
|
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
4439
|
+
]
|
4440
|
+
}
|
4441
|
+
|
4442
|
+
class SlimLexer(ExtendedRegexLexer):
|
4443
|
+
"""
|
4444
|
+
For Slim markup.
|
4445
|
+
"""
|
4446
|
+
|
4447
|
+
name = 'Slim'
|
4448
|
+
aliases = ['slim']
|
4449
|
+
filenames = ['*.slim']
|
4450
|
+
mimetypes = ['text/x-slim']
|
4451
|
+
|
4452
|
+
flags = re.IGNORECASE
|
4453
|
+
_dot = r'(?: \|\n(?=.* \|)|.)'
|
4454
|
+
tokens = {
|
4455
|
+
'root': [
|
4456
|
+
(r'[ \t]*\n', Text),
|
4457
|
+
(r'[ \t]*', _indentation),
|
4458
|
+
],
|
4459
|
+
|
4460
|
+
'css': [
|
4461
|
+
(r'\.[\w:-]+', Name.Class, 'tag'),
|
4462
|
+
(r'\#[\w:-]+', Name.Function, 'tag'),
|
4463
|
+
],
|
4464
|
+
|
4465
|
+
'eval-or-plain': [
|
4466
|
+
(r'([ \t]*==?)(.*\n)',
|
4467
|
+
bygroups(Punctuation, using(RubyLexer)),
|
4468
|
+
'root'),
|
4469
|
+
(r'[ \t]+[\w:-]+(?=[=])', Name.Attribute, 'html-attributes'),
|
4470
|
+
(r'', Text, 'plain'),
|
4471
|
+
],
|
4472
|
+
|
4473
|
+
'content': [
|
4474
|
+
include('css'),
|
4475
|
+
(r'[\w:-]+:[ \t]*\n', Text, 'plain'),
|
4476
|
+
(r'(-)(.*\n)',
|
4477
|
+
bygroups(Punctuation, using(RubyLexer)),
|
4478
|
+
'#pop'),
|
4479
|
+
(r'\|' + _dot + r'*\n', _starts_block(Text, 'plain'), '#pop'),
|
4480
|
+
(r'/' + _dot + r'*\n', _starts_block(Comment.Preproc, 'slim-comment-block'), '#pop'),
|
4481
|
+
(r'[\w:-]+', Name.Tag, 'tag'),
|
4482
|
+
include('eval-or-plain'),
|
4483
|
+
],
|
4484
|
+
|
4485
|
+
'tag': [
|
4486
|
+
include('css'),
|
4487
|
+
(r'[<>]{1,2}(?=[ \t=])', Punctuation),
|
4488
|
+
(r'[ \t]+\n', Punctuation, '#pop:2'),
|
4489
|
+
include('eval-or-plain'),
|
4490
|
+
],
|
4491
|
+
|
4492
|
+
'plain': [
|
4493
|
+
(r'([^#\n]|#[^{\n]|(\\\\)*\\#\{)+', Text),
|
4494
|
+
(r'(#\{)(.*?)(\})',
|
4495
|
+
bygroups(String.Interpol, using(RubyLexer), String.Interpol)),
|
4496
|
+
(r'\n', Text, 'root'),
|
4497
|
+
],
|
4498
|
+
|
4499
|
+
'html-attributes': [
|
4500
|
+
(r'=', Punctuation),
|
4501
|
+
(r'"[^\"]+"', using(RubyLexer), 'tag'),
|
4502
|
+
(r'\'[^\']+\'', using(RubyLexer), 'tag'),
|
4503
|
+
(r'[\w]+', Text, 'tag'),
|
4504
|
+
],
|
4505
|
+
|
4506
|
+
'slim-comment-block': [
|
4507
|
+
(_dot + '+', Comment.Preproc),
|
4508
|
+
(r'\n', Text, 'root'),
|
4509
|
+
],
|
4510
|
+
}
|