pygments.rb 0.3.7 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +9 -0
- data/CHANGELOG.md +6 -0
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lexers +0 -0
- data/lib/pygments/version.rb +1 -1
- data/test/test_pygments.rb +0 -1
- data/vendor/pygments-main/AUTHORS +14 -1
- data/vendor/pygments-main/CHANGES +56 -6
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/Makefile +1 -1
- data/vendor/pygments-main/REVISION +1 -0
- data/vendor/pygments-main/docs/generate.py +1 -1
- data/vendor/pygments-main/docs/src/api.txt +1 -1
- data/vendor/pygments-main/docs/src/index.txt +1 -1
- data/vendor/pygments-main/docs/src/integrate.txt +5 -0
- data/vendor/pygments-main/docs/src/java.txt +70 -0
- data/vendor/pygments-main/external/autopygmentize +64 -0
- data/vendor/pygments-main/external/markdown-processor.py +2 -2
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive-old.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +1 -1
- data/vendor/pygments-main/pygments/__init__.py +2 -2
- data/vendor/pygments-main/pygments/cmdline.py +14 -6
- 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 +1 -1
- data/vendor/pygments-main/pygments/formatter.py +1 -1
- data/vendor/pygments-main/pygments/formatters/__init__.py +1 -1
- data/vendor/pygments-main/pygments/formatters/_mapping.py +1 -1
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +73 -2
- data/vendor/pygments-main/pygments/formatters/img.py +1 -1
- data/vendor/pygments-main/pygments/formatters/latex.py +1 -1
- data/vendor/pygments-main/pygments/formatters/other.py +1 -1
- data/vendor/pygments-main/pygments/formatters/rtf.py +1 -1
- data/vendor/pygments-main/pygments/formatters/svg.py +1 -1
- data/vendor/pygments-main/pygments/formatters/terminal.py +1 -1
- data/vendor/pygments-main/pygments/formatters/terminal256.py +1 -1
- data/vendor/pygments-main/pygments/lexer.py +76 -12
- data/vendor/pygments-main/pygments/lexers/__init__.py +2 -2
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +4 -1
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_mapping.py +26 -10
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +11 -0
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +2 -2
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +4 -2
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +14 -3
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +11 -0
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +2 -2
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +6 -6
- data/vendor/pygments-main/pygments/lexers/agile.py +6 -4
- data/vendor/pygments-main/pygments/lexers/asm.py +40 -2
- data/vendor/pygments-main/pygments/lexers/compiled.py +751 -438
- data/vendor/pygments-main/pygments/lexers/dalvik.py +2 -2
- data/vendor/pygments-main/pygments/lexers/dotnet.py +1 -1
- data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +6 -5
- data/vendor/pygments-main/pygments/lexers/hdl.py +3 -3
- data/vendor/pygments-main/pygments/lexers/jvm.py +130 -16
- data/vendor/pygments-main/pygments/lexers/math.py +250 -9
- data/vendor/pygments-main/pygments/lexers/other.py +518 -13
- data/vendor/pygments-main/pygments/lexers/parsers.py +3 -2
- data/vendor/pygments-main/pygments/lexers/shell.py +48 -2
- data/vendor/pygments-main/pygments/lexers/special.py +1 -1
- data/vendor/pygments-main/pygments/lexers/sql.py +1 -1
- data/vendor/pygments-main/pygments/lexers/templates.py +7 -6
- data/vendor/pygments-main/pygments/lexers/text.py +9 -9
- data/vendor/pygments-main/pygments/lexers/web.py +264 -51
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +1 -1
- data/vendor/pygments-main/pygments/style.py +1 -1
- data/vendor/pygments-main/pygments/styles/__init__.py +1 -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/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
- 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/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/token.py +1 -1
- data/vendor/pygments-main/pygments/unistring.py +1 -1
- data/vendor/pygments-main/pygments/util.py +1 -1
- data/vendor/pygments-main/scripts/check_sources.py +2 -2
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +2 -0
- data/vendor/pygments-main/scripts/find_codetags.py +1 -1
- data/vendor/pygments-main/scripts/find_error.py +5 -6
- data/vendor/pygments-main/setup.cfg +1 -0
- data/vendor/pygments-main/setup.py +6 -4
- data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
- data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
- data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
- data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +89 -4
- data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
- data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
- data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +2 -2
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
- data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
- data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
- data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +191 -701
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
- data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
- data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
- data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
- data/vendor/pygments-main/tests/old_run.py +1 -1
- data/vendor/pygments-main/tests/run.py +3 -2
- data/vendor/pygments-main/tests/support/tags +36 -0
- data/vendor/pygments-main/tests/test_basic_api.py +3 -2
- data/vendor/pygments-main/tests/test_clexer.py +1 -1
- data/vendor/pygments-main/tests/test_cmdline.py +1 -1
- data/vendor/pygments-main/tests/test_examplefiles.py +1 -1
- data/vendor/pygments-main/tests/test_html_formatter.py +17 -1
- data/vendor/pygments-main/tests/test_latex_formatter.py +1 -1
- data/vendor/pygments-main/tests/test_perllexer.py +1 -1
- data/vendor/pygments-main/tests/test_regexlexer.py +1 -1
- data/vendor/pygments-main/tests/test_token.py +1 -1
- data/vendor/pygments-main/tests/test_using_api.py +1 -1
- data/vendor/pygments-main/tests/test_util.py +5 -4
- metadata +26 -2
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Lexers for parser generators.
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
@@ -738,7 +738,8 @@ class TreetopBaseLexer(RegexLexer):
|
|
738
738
|
(r'[()]', Punctuation),
|
739
739
|
(r'[?+*/&!~]', Operator),
|
740
740
|
(r'\[(?:\\.|\[:\^?[a-z]+:\]|[^\\\]])+\]', String.Regex),
|
741
|
-
(r'([0-9]*)(\.\.)([0-9]*)',
|
741
|
+
(r'([0-9]*)(\.\.)([0-9]*)',
|
742
|
+
bygroups(Number.Integer, Operator, Number.Integer)),
|
742
743
|
(r'(<)([^>]+)(>)', bygroups(Punctuation, Name.Class, Punctuation)),
|
743
744
|
(r'{', Punctuation, 'inline_module'),
|
744
745
|
(r'\.', String.Regex),
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Lexers for various shells.
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
@@ -18,7 +18,7 @@ from pygments.util import shebang_matches
|
|
18
18
|
|
19
19
|
|
20
20
|
__all__ = ['BashLexer', 'BashSessionLexer', 'TcshLexer', 'BatchLexer',
|
21
|
-
'PowerShellLexer']
|
21
|
+
'PowerShellLexer', 'ShellSessionLexer']
|
22
22
|
|
23
23
|
line_re = re.compile('.*?\n')
|
24
24
|
|
@@ -153,6 +153,52 @@ class BashSessionLexer(Lexer):
|
|
153
153
|
yield pos+i, t, v
|
154
154
|
|
155
155
|
|
156
|
+
class ShellSessionLexer(Lexer):
|
157
|
+
"""
|
158
|
+
Lexer for shell sessions that works with different command prompts
|
159
|
+
|
160
|
+
*New in Pygments 1.6.*
|
161
|
+
"""
|
162
|
+
|
163
|
+
name = 'Shell Session'
|
164
|
+
aliases = ['shell-session']
|
165
|
+
filenames = ['*.shell-session']
|
166
|
+
mimetypes = ['application/x-sh-session']
|
167
|
+
|
168
|
+
def get_tokens_unprocessed(self, text):
|
169
|
+
bashlexer = BashLexer(**self.options)
|
170
|
+
|
171
|
+
pos = 0
|
172
|
+
curcode = ''
|
173
|
+
insertions = []
|
174
|
+
|
175
|
+
for match in line_re.finditer(text):
|
176
|
+
line = match.group()
|
177
|
+
m = re.match(r'^((?:\[?\S+@[^$#%]+)[$#%])(.*\n?)', line)
|
178
|
+
if m:
|
179
|
+
# To support output lexers (say diff output), the output
|
180
|
+
# needs to be broken by prompts whenever the output lexer
|
181
|
+
# changes.
|
182
|
+
if not insertions:
|
183
|
+
pos = match.start()
|
184
|
+
|
185
|
+
insertions.append((len(curcode),
|
186
|
+
[(0, Generic.Prompt, m.group(1))]))
|
187
|
+
curcode += m.group(2)
|
188
|
+
else:
|
189
|
+
if insertions:
|
190
|
+
toks = bashlexer.get_tokens_unprocessed(curcode)
|
191
|
+
for i, t, v in do_insertions(insertions, toks):
|
192
|
+
yield pos+i, t, v
|
193
|
+
yield match.start(), Generic.Output, line
|
194
|
+
insertions = []
|
195
|
+
curcode = ''
|
196
|
+
if insertions:
|
197
|
+
for i, t, v in do_insertions(insertions,
|
198
|
+
bashlexer.get_tokens_unprocessed(curcode)):
|
199
|
+
yield pos+i, t, v
|
200
|
+
|
201
|
+
|
156
202
|
class BatchLexer(RegexLexer):
|
157
203
|
"""
|
158
204
|
Lexer for the DOS/Windows Batch file format.
|
@@ -34,7 +34,7 @@
|
|
34
34
|
The ``tests/examplefiles`` contains a few test files with data to be
|
35
35
|
parsed by these lexers.
|
36
36
|
|
37
|
-
:copyright: Copyright 2006-
|
37
|
+
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
|
38
38
|
:license: BSD, see LICENSE for details.
|
39
39
|
"""
|
40
40
|
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Lexers for various template engines' markup.
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
@@ -224,12 +224,14 @@ class VelocityLexer(RegexLexer):
|
|
224
224
|
'variable': [
|
225
225
|
(identifier, Name.Variable),
|
226
226
|
(r'\(', Punctuation, 'funcparams'),
|
227
|
-
(r'(\.)(' + identifier + r')',
|
227
|
+
(r'(\.)(' + identifier + r')',
|
228
|
+
bygroups(Punctuation, Name.Variable), '#push'),
|
228
229
|
(r'\}', Punctuation, '#pop'),
|
229
230
|
(r'', Other, '#pop')
|
230
231
|
],
|
231
232
|
'directiveparams': [
|
232
|
-
(r'(&&|\|\||==?|!=?|[-<>+*%&\|\^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b',
|
233
|
+
(r'(&&|\|\||==?|!=?|[-<>+*%&\|\^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b',
|
234
|
+
Operator),
|
233
235
|
(r'\[', Operator, 'rangeoperator'),
|
234
236
|
(r'\b' + identifier + r'\b', Name.Function),
|
235
237
|
include('funcparams')
|
@@ -261,7 +263,8 @@ class VelocityLexer(RegexLexer):
|
|
261
263
|
rv += 0.15
|
262
264
|
if re.search(r'#\{?foreach\}?\(.+?\).*?#\{?end\}?', text):
|
263
265
|
rv += 0.15
|
264
|
-
if re.search(r'\$\{?[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?
|
266
|
+
if re.search(r'\$\{?[a-zA-Z_][a-zA-Z0-9_]*(\([^)]*\))?'
|
267
|
+
r'(\.[a-zA-Z0-9_]+(\([^)]*\))?)*\}?', text):
|
265
268
|
rv += 0.01
|
266
269
|
return rv
|
267
270
|
|
@@ -1651,7 +1654,6 @@ class LassoHtmlLexer(DelegatingLexer):
|
|
1651
1654
|
'application/x-httpd-lasso[89]']
|
1652
1655
|
|
1653
1656
|
def __init__(self, **options):
|
1654
|
-
options['requiredelimiters'] = True
|
1655
1657
|
super(LassoHtmlLexer, self).__init__(HtmlLexer, LassoLexer, **options)
|
1656
1658
|
|
1657
1659
|
def analyse_text(text):
|
@@ -1678,7 +1680,6 @@ class LassoXmlLexer(DelegatingLexer):
|
|
1678
1680
|
mimetypes = ['application/xml+lasso']
|
1679
1681
|
|
1680
1682
|
def __init__(self, **options):
|
1681
|
-
options['requiredelimiters'] = True
|
1682
1683
|
super(LassoXmlLexer, self).__init__(XmlLexer, LassoLexer, **options)
|
1683
1684
|
|
1684
1685
|
def analyse_text(text):
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Lexers for non-source code file types.
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
@@ -65,7 +65,7 @@ class RegeditLexer(RegexLexer):
|
|
65
65
|
"""
|
66
66
|
|
67
67
|
name = 'reg'
|
68
|
-
aliases = []
|
68
|
+
aliases = ['registry']
|
69
69
|
filenames = ['*.reg']
|
70
70
|
mimetypes = ['text/x-windows-registry']
|
71
71
|
|
@@ -616,7 +616,7 @@ class MoinWikiLexer(RegexLexer):
|
|
616
616
|
(r'(\'\'\'?|\|\||`|__|~~|\^|,,|::)', Comment), # Formatting
|
617
617
|
# Lists
|
618
618
|
(r'^( +)([.*-])( )', bygroups(Text, Name.Builtin, Text)),
|
619
|
-
(r'^( +)([a-
|
619
|
+
(r'^( +)([a-z]{1,5}\.)( )', bygroups(Text, Name.Builtin, Text)),
|
620
620
|
# Other Formatting
|
621
621
|
(r'\[\[\w+.*?\]\]', Keyword), # Macro
|
622
622
|
(r'(\[[^\s\]]+)(\s+[^\]]+?)?(\])',
|
@@ -1824,20 +1824,20 @@ class HxmlLexer(RegexLexer):
|
|
1824
1824
|
# Targets and other options that take an argument
|
1825
1825
|
(r'(-)(cpp|js|neko|x|as3|swf9?|swf-lib|php|xml|main|lib|D|resource|'
|
1826
1826
|
r'cp|cmd)( +)(.+)',
|
1827
|
-
bygroups(Punctuation, Keyword, Whitespace, String)),
|
1827
|
+
bygroups(Punctuation, Keyword, Whitespace, String)),
|
1828
1828
|
# Options that take only numerical arguments
|
1829
1829
|
(r'(-)(swf-version)( +)(\d+)',
|
1830
1830
|
bygroups(Punctuation, Keyword, Number.Integer)),
|
1831
|
-
# An Option that defines the size, the fps and the background
|
1831
|
+
# An Option that defines the size, the fps and the background
|
1832
1832
|
# color of an flash movie
|
1833
|
-
(r'(-)(swf-header)( +)(\d+)(:)(\d+)(:)(\d+)(:)([A-Fa-f0-9]{6})',
|
1833
|
+
(r'(-)(swf-header)( +)(\d+)(:)(\d+)(:)(\d+)(:)([A-Fa-f0-9]{6})',
|
1834
1834
|
bygroups(Punctuation, Keyword, Whitespace, Number.Integer,
|
1835
1835
|
Punctuation, Number.Integer, Punctuation, Number.Integer,
|
1836
|
-
Punctuation, Number.Hex)),
|
1836
|
+
Punctuation, Number.Hex)),
|
1837
1837
|
# options with two dashes that takes arguments
|
1838
1838
|
(r'(--)(js-namespace|php-front|php-lib|remap|gen-hx-classes)( +)'
|
1839
|
-
r'(.+)', bygroups(Punctuation, Keyword, Whitespace, String)),
|
1839
|
+
r'(.+)', bygroups(Punctuation, Keyword, Whitespace, String)),
|
1840
1840
|
# Single line comment, multiline ones are not allowed.
|
1841
|
-
(r'#.*', Comment.Single)
|
1841
|
+
(r'#.*', Comment.Single)
|
1842
1842
|
]
|
1843
1843
|
}
|
@@ -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-2013 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
@@ -27,7 +27,7 @@ __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']
|
30
|
+
'DtdLexer', 'DartLexer', 'LassoLexer', 'QmlLexer', 'TypeScriptLexer']
|
31
31
|
|
32
32
|
|
33
33
|
class JavascriptLexer(RegexLexer):
|
@@ -791,7 +791,7 @@ class PhpLexer(RegexLexer):
|
|
791
791
|
|
792
792
|
name = 'PHP'
|
793
793
|
aliases = ['php', 'php3', 'php4', 'php5']
|
794
|
-
filenames = ['*.php', '*.php[345]']
|
794
|
+
filenames = ['*.php', '*.php[345]', '*.inc']
|
795
795
|
mimetypes = ['text/x-php']
|
796
796
|
|
797
797
|
flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
|
@@ -969,7 +969,8 @@ class DtdLexer(RegexLexer):
|
|
969
969
|
|
970
970
|
'attlist': [
|
971
971
|
include('common'),
|
972
|
-
(r'CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION',
|
972
|
+
(r'CDATA|IDREFS|IDREF|ID|NMTOKENS|NMTOKEN|ENTITIES|ENTITY|NOTATION',
|
973
|
+
Keyword.Constant),
|
973
974
|
(r'#REQUIRED|#IMPLIED|#FIXED', Keyword.Constant),
|
974
975
|
(r'xml:space|xml:lang', Keyword.Reserved),
|
975
976
|
(r'[^>\s\|()?+*,]+', Name.Attribute),
|
@@ -1762,7 +1763,7 @@ class ScssLexer(RegexLexer):
|
|
1762
1763
|
(r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'),
|
1763
1764
|
(r'@extend', Keyword, 'selector'),
|
1764
1765
|
(r'@[a-z0-9_-]+', Keyword, 'selector'),
|
1765
|
-
(r'(\$[\w-]
|
1766
|
+
(r'(\$[\w-]*\w)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'),
|
1766
1767
|
(r'(?=[^;{}][;}])', Name.Attribute, 'attr'),
|
1767
1768
|
(r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'),
|
1768
1769
|
(r'', Text, 'selector'),
|
@@ -2936,27 +2937,25 @@ class DartLexer(RegexLexer):
|
|
2936
2937
|
|
2937
2938
|
tokens = {
|
2938
2939
|
'root': [
|
2940
|
+
include('string_literal'),
|
2939
2941
|
(r'#!(.*?)$', Comment.Preproc),
|
2940
|
-
(r'(
|
2942
|
+
(r'\b(import|export)\b', Keyword, 'import_decl'),
|
2943
|
+
(r'\b(library|source|part of|part)\b', Keyword),
|
2941
2944
|
(r'[^\S\n]+', Text),
|
2942
2945
|
(r'//.*?\n', Comment.Single),
|
2943
2946
|
(r'/\*.*?\*/', Comment.Multiline),
|
2944
|
-
(r'(class
|
2947
|
+
(r'\b(class)\b(\s+)',
|
2945
2948
|
bygroups(Keyword.Declaration, Text), 'class'),
|
2946
|
-
(r'(assert|break|case|catch|continue|default|do|else|finally|for|'
|
2949
|
+
(r'\b(assert|break|case|catch|continue|default|do|else|finally|for|'
|
2947
2950
|
r'if|in|is|new|return|super|switch|this|throw|try|while)\b',
|
2948
2951
|
Keyword),
|
2949
|
-
(r'(abstract|const|extends|factory|final|get|implements|'
|
2952
|
+
(r'\b(abstract|const|extends|factory|final|get|implements|'
|
2950
2953
|
r'native|operator|set|static|typedef|var)\b', Keyword.Declaration),
|
2951
|
-
(r'(bool|double|Dynamic|int|num|Object|String|void)', Keyword.Type),
|
2952
|
-
(r'(false|null|true)', Keyword.Constant),
|
2953
|
-
(r'
|
2954
|
-
(r"@'(\\\\|\\'|[^'])*'", String.Single), # raw string
|
2955
|
-
(r'"', String.Double, 'string_double'),
|
2956
|
-
(r"'", String.Single, 'string_single'),
|
2954
|
+
(r'\b(bool|double|Dynamic|int|num|Object|String|void)\b', Keyword.Type),
|
2955
|
+
(r'\b(false|null|true)\b', Keyword.Constant),
|
2956
|
+
(r'[~!%^&*+=|?:<>/-]|as', Operator),
|
2957
2957
|
(r'[a-zA-Z_$][a-zA-Z0-9_]*:', Name.Label),
|
2958
2958
|
(r'[a-zA-Z_$][a-zA-Z0-9_]*', Name),
|
2959
|
-
(r'[~!%^&*+=|?:<>/-]', Operator),
|
2960
2959
|
(r'[(){}\[\],.;]', Punctuation),
|
2961
2960
|
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
2962
2961
|
# DIGIT+ (‘.’ DIGIT*)? EXPONENT?
|
@@ -2968,21 +2967,132 @@ class DartLexer(RegexLexer):
|
|
2968
2967
|
'class': [
|
2969
2968
|
(r'[a-zA-Z_$][a-zA-Z0-9_]*', Name.Class, '#pop')
|
2970
2969
|
],
|
2971
|
-
'
|
2972
|
-
(
|
2973
|
-
(r'
|
2970
|
+
'import_decl': [
|
2971
|
+
include('string_literal'),
|
2972
|
+
(r'\s+', Text),
|
2973
|
+
(r'\b(as|show|hide)\b', Keyword),
|
2974
|
+
(r'[a-zA-Z_$][a-zA-Z0-9_]*', Name),
|
2975
|
+
(r'\,', Punctuation),
|
2976
|
+
(r'\;', Punctuation, '#pop')
|
2977
|
+
],
|
2978
|
+
'string_literal': [
|
2979
|
+
# Raw strings.
|
2980
|
+
(r'r"""([\s|\S]*?)"""', String.Double),
|
2981
|
+
(r"r'''([\s|\S]*?)'''", String.Single),
|
2982
|
+
(r'r"(.*?)"', String.Double),
|
2983
|
+
(r"r'(.*?)'", String.Single),
|
2984
|
+
# Normal Strings.
|
2985
|
+
(r'"""', String.Double, 'string_double_multiline'),
|
2986
|
+
(r"'''", String.Single, 'string_single_multiline'),
|
2987
|
+
(r'"', String.Double, 'string_double'),
|
2988
|
+
(r"'", String.Single, 'string_single')
|
2989
|
+
],
|
2990
|
+
'string_common': [
|
2991
|
+
(r"\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\{[0-9A-Fa-f]*\}|[a-z\'\"$\\])",
|
2992
|
+
String.Escape),
|
2974
2993
|
(r'(\$)([a-zA-Z_][a-zA-Z0-9_]*)', bygroups(String.Interpol, Name)),
|
2975
2994
|
(r'(\$\{)(.*?)(\})',
|
2976
|
-
bygroups(String.Interpol, using(this), String.Interpol))
|
2995
|
+
bygroups(String.Interpol, using(this), String.Interpol))
|
2996
|
+
],
|
2997
|
+
'string_double': [
|
2998
|
+
(r'"', String.Double, '#pop'),
|
2999
|
+
(r'[^\"$\\\n]+', String.Double),
|
3000
|
+
include('string_common'),
|
2977
3001
|
(r'\$+', String.Double)
|
2978
3002
|
],
|
3003
|
+
'string_double_multiline': [
|
3004
|
+
(r'"""', String.Double, '#pop'),
|
3005
|
+
(r'[^\"$\\]+', String.Double),
|
3006
|
+
include('string_common'),
|
3007
|
+
(r'(\$|\")+', String.Double)
|
3008
|
+
],
|
2979
3009
|
'string_single': [
|
2980
3010
|
(r"'", String.Single, '#pop'),
|
2981
|
-
(r"[
|
2982
|
-
(
|
2983
|
-
(r'(\$\{)(.*?)(\})',
|
2984
|
-
bygroups(String.Interpol, using(this), String.Interpol)),
|
3011
|
+
(r"[^\'$\\\n]+", String.Single),
|
3012
|
+
include('string_common'),
|
2985
3013
|
(r'\$+', String.Single)
|
3014
|
+
],
|
3015
|
+
'string_single_multiline': [
|
3016
|
+
(r"'''", String.Single, '#pop'),
|
3017
|
+
(r'[^\'$\\]+', String.Single),
|
3018
|
+
include('string_common'),
|
3019
|
+
(r'(\$|\')+', String.Single)
|
3020
|
+
]
|
3021
|
+
}
|
3022
|
+
|
3023
|
+
|
3024
|
+
class TypeScriptLexer(RegexLexer):
|
3025
|
+
"""
|
3026
|
+
For `TypeScript <http://www.python.org>`_ source code.
|
3027
|
+
|
3028
|
+
*New in Pygments 1.6.*
|
3029
|
+
"""
|
3030
|
+
|
3031
|
+
name = 'TypeScript'
|
3032
|
+
aliases = ['ts']
|
3033
|
+
filenames = ['*.ts']
|
3034
|
+
mimetypes = ['text/x-typescript']
|
3035
|
+
|
3036
|
+
flags = re.DOTALL
|
3037
|
+
tokens = {
|
3038
|
+
'commentsandwhitespace': [
|
3039
|
+
(r'\s+', Text),
|
3040
|
+
(r'<!--', Comment),
|
3041
|
+
(r'//.*?\n', Comment.Single),
|
3042
|
+
(r'/\*.*?\*/', Comment.Multiline)
|
3043
|
+
],
|
3044
|
+
'slashstartsregex': [
|
3045
|
+
include('commentsandwhitespace'),
|
3046
|
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
3047
|
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
3048
|
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
3049
|
+
(r'', Text, '#pop')
|
3050
|
+
],
|
3051
|
+
'badregex': [
|
3052
|
+
(r'\n', Text, '#pop')
|
3053
|
+
],
|
3054
|
+
'root': [
|
3055
|
+
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
3056
|
+
include('commentsandwhitespace'),
|
3057
|
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
3058
|
+
r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
|
3059
|
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
3060
|
+
(r'[})\].]', Punctuation),
|
3061
|
+
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
|
3062
|
+
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
3063
|
+
r'this)\b', Keyword, 'slashstartsregex'),
|
3064
|
+
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
3065
|
+
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
|
3066
|
+
r'extends|final|float|goto|implements|import|int|interface|long|native|'
|
3067
|
+
r'package|private|protected|public|short|static|super|synchronized|throws|'
|
3068
|
+
r'transient|volatile)\b', Keyword.Reserved),
|
3069
|
+
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
3070
|
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
3071
|
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
3072
|
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
3073
|
+
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
3074
|
+
r'window)\b', Name.Builtin),
|
3075
|
+
# Match stuff like: module name {...}
|
3076
|
+
(r'\b(module)(\s*)(\s*[a-zA-Z0-9_?.$][\w?.$]*)(\s*)',
|
3077
|
+
bygroups(Keyword.Reserved, Text, Name.Other, Text), 'slashstartsregex'),
|
3078
|
+
# Match variable type keywords
|
3079
|
+
(r'\b(string|bool|number)\b', Keyword.Type),
|
3080
|
+
# Match stuff like: constructor
|
3081
|
+
(r'\b(constructor|declare|interface|as|AS)\b', Keyword.Reserved),
|
3082
|
+
# Match stuff like: super(argument, list)
|
3083
|
+
(r'(super)(\s*)(\([a-zA-Z0-9,_?.$\s]+\s*\))',
|
3084
|
+
bygroups(Keyword.Reserved, Text), 'slashstartsregex'),
|
3085
|
+
# Match stuff like: function() {...}
|
3086
|
+
(r'([a-zA-Z_?.$][\w?.$]*)\(\) \{', Name.Other, 'slashstartsregex'),
|
3087
|
+
# Match stuff like: (function: return type)
|
3088
|
+
(r'([a-zA-Z0-9_?.$][\w?.$]*)(\s*:\s*)([a-zA-Z0-9_?.$][\w?.$]*)',
|
3089
|
+
bygroups(Name.Other, Text, Keyword.Type)),
|
3090
|
+
(r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other),
|
3091
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
3092
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
3093
|
+
(r'[0-9]+', Number.Integer),
|
3094
|
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
3095
|
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
2986
3096
|
]
|
2987
3097
|
}
|
2988
3098
|
|
@@ -3015,19 +3125,14 @@ class LassoLexer(RegexLexer):
|
|
3015
3125
|
tokens = {
|
3016
3126
|
'root': [
|
3017
3127
|
(r'^#!.+lasso9\b', Comment.Preproc, 'lasso'),
|
3018
|
-
(r'\s+', Other),
|
3019
3128
|
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
|
3020
3129
|
(r'\[noprocess\]', Comment.Preproc, ('delimiters', 'noprocess')),
|
3021
3130
|
(r'\[', Comment.Preproc, ('delimiters', 'squarebrackets')),
|
3022
3131
|
(r'<\?(LassoScript|lasso|=)', Comment.Preproc,
|
3023
3132
|
('delimiters', 'anglebrackets')),
|
3024
3133
|
(r'<', Other, 'delimiters'),
|
3025
|
-
|
3026
|
-
|
3027
|
-
'nosquarebrackets': [
|
3028
|
-
(r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
|
3029
|
-
(r'<', Other),
|
3030
|
-
(r'[^<]+', Other),
|
3134
|
+
(r'\s+', Other),
|
3135
|
+
(r'', Other, ('delimiters', 'lassofile')),
|
3031
3136
|
],
|
3032
3137
|
'delimiters': [
|
3033
3138
|
(r'\[no_square_brackets\]', Comment.Preproc, 'nosquarebrackets'),
|
@@ -3037,6 +3142,11 @@ class LassoLexer(RegexLexer):
|
|
3037
3142
|
(r'<', Other),
|
3038
3143
|
(r'[^[<]+', Other),
|
3039
3144
|
],
|
3145
|
+
'nosquarebrackets': [
|
3146
|
+
(r'<\?(LassoScript|lasso|=)', Comment.Preproc, 'anglebrackets'),
|
3147
|
+
(r'<', Other),
|
3148
|
+
(r'[^<]+', Other),
|
3149
|
+
],
|
3040
3150
|
'noprocess': [
|
3041
3151
|
(r'\[/noprocess\]', Comment.Preproc, '#pop'),
|
3042
3152
|
(r'\[', Other),
|
@@ -3050,12 +3160,20 @@ class LassoLexer(RegexLexer):
|
|
3050
3160
|
(r'\?>', Comment.Preproc, '#pop'),
|
3051
3161
|
include('lasso'),
|
3052
3162
|
],
|
3053
|
-
'
|
3054
|
-
#
|
3163
|
+
'lassofile': [
|
3164
|
+
(r'\]', Comment.Preproc, '#pop'),
|
3165
|
+
(r'\?>', Comment.Preproc, '#pop'),
|
3166
|
+
include('lasso'),
|
3167
|
+
],
|
3168
|
+
'whitespacecomments': [
|
3055
3169
|
(r'\s+', Text),
|
3056
3170
|
(r'//.*?\n', Comment.Single),
|
3057
3171
|
(r'/\*\*!.*?\*/', String.Doc),
|
3058
3172
|
(r'/\*.*?\*/', Comment.Multiline),
|
3173
|
+
],
|
3174
|
+
'lasso': [
|
3175
|
+
# whitespace/comments
|
3176
|
+
include('whitespacecomments'),
|
3059
3177
|
|
3060
3178
|
# literals
|
3061
3179
|
(r'\d*\.\d+(e[+-]?\d+)?', Number.Float),
|
@@ -3098,10 +3216,9 @@ class LassoLexer(RegexLexer):
|
|
3098
3216
|
(r'(define)(\s+)([a-z_][\w.]*)',
|
3099
3217
|
bygroups(Keyword.Declaration, Text, Name.Function),
|
3100
3218
|
'signature'),
|
3101
|
-
(r'(public|protected|private|provide)(\s+)([a-z_][\w.]*=?|'
|
3102
|
-
r'[-+*/%<>]|==)(
|
3103
|
-
|
3104
|
-
('signature', 'parameter')),
|
3219
|
+
(r'(public|protected|private|provide)(\s+)(([a-z_][\w.]*=?|'
|
3220
|
+
r'[-+*/%<>]|==)(?=\s*\())', bygroups(Keyword, Text, Name.Function),
|
3221
|
+
'signature'),
|
3105
3222
|
(r'(public|protected|private)(\s+)([a-z_][\w.]*)',
|
3106
3223
|
bygroups(Keyword, Text, Name.Function)),
|
3107
3224
|
|
@@ -3112,6 +3229,9 @@ class LassoLexer(RegexLexer):
|
|
3112
3229
|
r'null)\b', Keyword.Type),
|
3113
3230
|
(r'([a-z_][\w.]*)(\s+)(in)\b', bygroups(Name, Text, Keyword)),
|
3114
3231
|
(r'(let|into)(\s+)([a-z_][\w.]*)', bygroups(Keyword, Text, Name)),
|
3232
|
+
(r'require\b', Keyword, 'requiresection'),
|
3233
|
+
(r'(/?)(Namespace_Using)\b',
|
3234
|
+
bygroups(Punctuation, Keyword.Namespace)),
|
3115
3235
|
(r'(/?)(Cache|Database_Names|Database_SchemaNames|'
|
3116
3236
|
r'Database_TableNames|Define_Tag|Define_Type|Email_Batch|'
|
3117
3237
|
r'Encode_Set|HTML_Comment|Handle|Handle_Error|Header|If|Inline|'
|
@@ -3119,19 +3239,21 @@ class LassoLexer(RegexLexer):
|
|
3119
3239
|
r'Link_CurrentRecord|Link_Detail|Link_FirstGroup|'
|
3120
3240
|
r'Link_FirstRecord|Link_LastGroup|Link_LastRecord|Link_NextGroup|'
|
3121
3241
|
r'Link_NextRecord|Link_PrevGroup|Link_PrevRecord|Log|Loop|'
|
3122
|
-
r'
|
3123
|
-
r'
|
3124
|
-
r'
|
3125
|
-
r'
|
3126
|
-
r'
|
3127
|
-
r'
|
3128
|
-
r'
|
3129
|
-
r'
|
3130
|
-
r'
|
3131
|
-
r'
|
3132
|
-
|
3242
|
+
r'NoProcess|Output_None|Portal|Private|Protect|Records|Referer|'
|
3243
|
+
r'Referrer|Repeating|ResultSet|Rows|Search_Args|Search_Arguments|'
|
3244
|
+
r'Select|Sort_Args|Sort_Arguments|Thread_Atomic|Value_List|While|'
|
3245
|
+
r'Abort|Case|Else|If_Empty|If_False|If_Null|If_True|Loop_Abort|'
|
3246
|
+
r'Loop_Continue|Loop_Count|Params|Params_Up|Return|Return_Value|'
|
3247
|
+
r'Run_Children|SOAP_DefineTag|SOAP_LastRequest|SOAP_LastResponse|'
|
3248
|
+
r'Tag_Name|ascending|average|by|define|descending|do|equals|'
|
3249
|
+
r'frozen|group|handle_failure|import|in|into|join|let|match|max|'
|
3250
|
+
r'min|on|order|parent|protected|provide|public|require|skip|'
|
3251
|
+
r'split_thread|sum|take|thread|to|trait|type|where|with|yield)\b',
|
3252
|
+
bygroups(Punctuation, Keyword)),
|
3133
3253
|
|
3134
3254
|
# other
|
3255
|
+
(r'(([a-z_][\w.]*=?|[-+*/%<>]|==)(?=\s*\([^)]*\)\s*=>))',
|
3256
|
+
Name.Function, 'signature'),
|
3135
3257
|
(r'(and|or|not)\b', Operator.Word),
|
3136
3258
|
(r'([a-z_][\w.]*)(\s*)(::\s*)([a-z_][\w.]*)(\s*)(=)',
|
3137
3259
|
bygroups(Name, Text, Punctuation, Name.Label, Text, Operator)),
|
@@ -3160,16 +3282,34 @@ class LassoLexer(RegexLexer):
|
|
3160
3282
|
r'[abefnrtv?\"\'\\]|$)', String.Escape),
|
3161
3283
|
],
|
3162
3284
|
'signature': [
|
3163
|
-
(r'[(,]', Punctuation, 'parameter'),
|
3164
3285
|
(r'=>', Operator, '#pop'),
|
3286
|
+
(r'\)', Punctuation, '#pop'),
|
3287
|
+
(r'[(,]', Punctuation, 'parameter'),
|
3165
3288
|
include('lasso'),
|
3166
3289
|
],
|
3167
3290
|
'parameter': [
|
3168
|
-
(r'\.\.\.', Name.Builtin.Pseudo),
|
3169
|
-
(r'-?[a-z_][\w.]*', Name.Attribute, '#pop'),
|
3170
3291
|
(r'\)', Punctuation, '#pop'),
|
3292
|
+
(r'-?[a-z_][\w.]*', Name.Attribute, '#pop'),
|
3293
|
+
(r'\.\.\.', Name.Builtin.Pseudo),
|
3171
3294
|
include('lasso'),
|
3172
3295
|
],
|
3296
|
+
'requiresection': [
|
3297
|
+
(r'(([a-z_][\w.]*=?|[-+*/%<>]|==)(?=\s*\())', Name, 'requiresignature'),
|
3298
|
+
(r'(([a-z_][\w.]*=?|[-+*/%<>]|==)(?=(\s*::\s*[\w.]+)?\s*,))', Name),
|
3299
|
+
(r'[a-z_][\w.]*=?|[-+*/%<>]|==', Name, '#pop'),
|
3300
|
+
(r'(::\s*)([a-z_][\w.]*)', bygroups(Punctuation, Name.Label)),
|
3301
|
+
(r',', Punctuation),
|
3302
|
+
include('whitespacecomments'),
|
3303
|
+
],
|
3304
|
+
'requiresignature': [
|
3305
|
+
(r'(\)(?=(\s*::\s*[\w.]+)?\s*,))', Punctuation, '#pop'),
|
3306
|
+
(r'\)', Punctuation, '#pop:2'),
|
3307
|
+
(r'-?[a-z_][\w.]*', Name.Attribute),
|
3308
|
+
(r'(::\s*)([a-z_][\w.]*)', bygroups(Punctuation, Name.Label)),
|
3309
|
+
(r'\.\.\.', Name.Builtin.Pseudo),
|
3310
|
+
(r'[(,]', Punctuation),
|
3311
|
+
include('whitespacecomments'),
|
3312
|
+
],
|
3173
3313
|
}
|
3174
3314
|
|
3175
3315
|
def __init__(self, **options):
|
@@ -3208,3 +3348,76 @@ class LassoLexer(RegexLexer):
|
|
3208
3348
|
if re.search(r'\[\n|\?>', text):
|
3209
3349
|
rv += 0.4
|
3210
3350
|
return rv
|
3351
|
+
|
3352
|
+
|
3353
|
+
class QmlLexer(RegexLexer):
|
3354
|
+
"""
|
3355
|
+
For QML files. See http://doc.qt.digia.com/4.7/qdeclarativeintroduction.html.
|
3356
|
+
|
3357
|
+
*New in Pygments 1.6.*
|
3358
|
+
"""
|
3359
|
+
|
3360
|
+
# QML is based on javascript, so much of this is taken from the
|
3361
|
+
# JavascriptLexer above.
|
3362
|
+
|
3363
|
+
name = 'QML'
|
3364
|
+
aliases = ['qml', 'Qt Meta Language', 'Qt modeling Language']
|
3365
|
+
filenames = ['*.qml',]
|
3366
|
+
mimetypes = [ 'application/x-qml',]
|
3367
|
+
|
3368
|
+
|
3369
|
+
# pasted from JavascriptLexer, with some additions
|
3370
|
+
flags = re.DOTALL
|
3371
|
+
tokens = {
|
3372
|
+
'commentsandwhitespace': [
|
3373
|
+
(r'\s+', Text),
|
3374
|
+
(r'<!--', Comment),
|
3375
|
+
(r'//.*?\n', Comment.Single),
|
3376
|
+
(r'/\*.*?\*/', Comment.Multiline)
|
3377
|
+
],
|
3378
|
+
'slashstartsregex': [
|
3379
|
+
include('commentsandwhitespace'),
|
3380
|
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
3381
|
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
3382
|
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
3383
|
+
(r'', Text, '#pop')
|
3384
|
+
],
|
3385
|
+
'badregex': [
|
3386
|
+
(r'\n', Text, '#pop')
|
3387
|
+
],
|
3388
|
+
'root' : [
|
3389
|
+
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
3390
|
+
include('commentsandwhitespace'),
|
3391
|
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
3392
|
+
r'(<<|>>>?|==?|!=?|[-<>+*%&\|\^/])=?', Operator, 'slashstartsregex'),
|
3393
|
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
3394
|
+
(r'[})\].]', Punctuation),
|
3395
|
+
|
3396
|
+
# QML insertions
|
3397
|
+
(r'\bid\s*:\s*[A-Za-z][_A-Za-z.0-9]*',Keyword.Declaration,
|
3398
|
+
'slashstartsregex'),
|
3399
|
+
(r'\b[A-Za-z][_A-Za-z.0-9]*\s*:',Keyword, 'slashstartsregex'),
|
3400
|
+
|
3401
|
+
# the rest from JavascriptLexer
|
3402
|
+
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|'
|
3403
|
+
r'throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
3404
|
+
r'this)\b', Keyword, 'slashstartsregex'),
|
3405
|
+
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
3406
|
+
(r'(abstract|boolean|byte|char|class|const|debugger|double|enum|export|'
|
3407
|
+
r'extends|final|float|goto|implements|import|int|interface|long|native|'
|
3408
|
+
r'package|private|protected|public|short|static|super|synchronized|throws|'
|
3409
|
+
r'transient|volatile)\b', Keyword.Reserved),
|
3410
|
+
(r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant),
|
3411
|
+
(r'(Array|Boolean|Date|Error|Function|Math|netscape|'
|
3412
|
+
r'Number|Object|Packages|RegExp|String|sun|decodeURI|'
|
3413
|
+
r'decodeURIComponent|encodeURI|encodeURIComponent|'
|
3414
|
+
r'Error|eval|isFinite|isNaN|parseFloat|parseInt|document|this|'
|
3415
|
+
r'window)\b', Name.Builtin),
|
3416
|
+
(r'[$a-zA-Z_][a-zA-Z0-9_]*', Name.Other),
|
3417
|
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
3418
|
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
3419
|
+
(r'[0-9]+', Number.Integer),
|
3420
|
+
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
3421
|
+
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
3422
|
+
]
|
3423
|
+
}
|