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,10 +5,12 @@
|
|
5
5
|
|
6
6
|
Pygments lexers for Dalvik VM-related languages.
|
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
|
|
12
|
+
import re
|
13
|
+
|
12
14
|
from pygments.lexer import RegexLexer, include, bygroups
|
13
15
|
from pygments.token import Keyword, Text, Comment, Name, String, Number, \
|
14
16
|
Punctuation
|
@@ -21,7 +23,7 @@ class SmaliLexer(RegexLexer):
|
|
21
23
|
For `Smali <http://code.google.com/p/smali/>`_ (Android/Dalvik) assembly
|
22
24
|
code.
|
23
25
|
|
24
|
-
|
26
|
+
.. versionadded:: 1.6
|
25
27
|
"""
|
26
28
|
name = 'Smali'
|
27
29
|
aliases = ['smali']
|
@@ -73,22 +75,22 @@ class SmaliLexer(RegexLexer):
|
|
73
75
|
(r'[0-9]+L?', Number.Integer),
|
74
76
|
],
|
75
77
|
'field': [
|
76
|
-
(r'(\$?\b)([
|
78
|
+
(r'(\$?\b)([\w$]*)(:)',
|
77
79
|
bygroups(Punctuation, Name.Variable, Punctuation)),
|
78
80
|
],
|
79
81
|
'method': [
|
80
82
|
(r'<(?:cl)?init>', Name.Function), # constructor
|
81
|
-
(r'(\$?\b)([
|
83
|
+
(r'(\$?\b)([\w$]*)(\()',
|
82
84
|
bygroups(Punctuation, Name.Function, Punctuation)),
|
83
85
|
],
|
84
86
|
'label': [
|
85
|
-
(r'
|
87
|
+
(r':\w+', Name.Label),
|
86
88
|
],
|
87
89
|
'class': [
|
88
90
|
# class names in the form Lcom/namespace/ClassName;
|
89
91
|
# I only want to color the ClassName part, so the namespace part is
|
90
92
|
# treated as 'Text'
|
91
|
-
(r'(L)((?:[
|
93
|
+
(r'(L)((?:[\w$]+/)*)([\w$]+)(;)',
|
92
94
|
bygroups(Keyword.Type, Text, Name.Class, Text)),
|
93
95
|
],
|
94
96
|
'punctuation': [
|
@@ -102,3 +104,22 @@ class SmaliLexer(RegexLexer):
|
|
102
104
|
(r'#.*?\n', Comment),
|
103
105
|
],
|
104
106
|
}
|
107
|
+
|
108
|
+
def analyse_text(text):
|
109
|
+
score = 0
|
110
|
+
if re.search(r'^\s*\.class\s', text, re.MULTILINE):
|
111
|
+
score += 0.5
|
112
|
+
if re.search(r'\b((check-cast|instance-of|throw-verification-error'
|
113
|
+
r')\b|(-to|add|[ais]get|[ais]put|and|cmpl|const|div|'
|
114
|
+
r'if|invoke|move|mul|neg|not|or|rem|return|rsub|shl|'
|
115
|
+
r'shr|sub|ushr)[-/])|{|}', text, re.MULTILINE):
|
116
|
+
score += 0.3
|
117
|
+
if re.search(r'(\.(catchall|epilogue|restart local|prologue)|'
|
118
|
+
r'\b(array-data|class-change-error|declared-synchronized|'
|
119
|
+
r'(field|inline|vtable)@0x[0-9a-fA-F]|generic-error|'
|
120
|
+
r'illegal-class-access|illegal-field-access|'
|
121
|
+
r'illegal-method-access|instantiation-error|no-error|'
|
122
|
+
r'no-such-class|no-such-field|no-such-method|'
|
123
|
+
r'packed-switch|sparse-switch))\b', text, re.MULTILINE):
|
124
|
+
score += 0.6
|
125
|
+
return score
|
@@ -5,16 +5,16 @@
|
|
5
5
|
|
6
6
|
Lexers for .net languages.
|
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
|
import re
|
12
12
|
|
13
13
|
from pygments.lexer import RegexLexer, DelegatingLexer, bygroups, include, \
|
14
|
-
using, this
|
14
|
+
using, this, default
|
15
15
|
from pygments.token import Punctuation, \
|
16
16
|
Text, Comment, Operator, Keyword, Name, String, Number, Literal, Other
|
17
|
-
from pygments.util import get_choice_opt
|
17
|
+
from pygments.util import get_choice_opt, iteritems
|
18
18
|
from pygments import unistring as uni
|
19
19
|
|
20
20
|
from pygments.lexers.web import XmlLexer
|
@@ -44,7 +44,7 @@ class CSharpLexer(RegexLexer):
|
|
44
44
|
|
45
45
|
The default value is ``basic``.
|
46
46
|
|
47
|
-
|
47
|
+
.. versionadded:: 0.8
|
48
48
|
"""
|
49
49
|
|
50
50
|
name = 'C#'
|
@@ -58,7 +58,7 @@ class CSharpLexer(RegexLexer):
|
|
58
58
|
# see http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
|
59
59
|
|
60
60
|
levels = {
|
61
|
-
'none': '@?[_a-zA-Z]
|
61
|
+
'none': '@?[_a-zA-Z]\w*',
|
62
62
|
'basic': ('@?[_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl + ']' +
|
63
63
|
'[' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl +
|
64
64
|
uni.Nd + uni.Pc + uni.Cf + uni.Mn + uni.Mc + ']*'),
|
@@ -71,7 +71,7 @@ class CSharpLexer(RegexLexer):
|
|
71
71
|
tokens = {}
|
72
72
|
token_variants = True
|
73
73
|
|
74
|
-
for levelname, cs_ident in levels
|
74
|
+
for levelname, cs_ident in iteritems(levels):
|
75
75
|
tokens[levelname] = {
|
76
76
|
'root': [
|
77
77
|
# method names
|
@@ -126,7 +126,7 @@ class CSharpLexer(RegexLexer):
|
|
126
126
|
}
|
127
127
|
|
128
128
|
def __init__(self, **options):
|
129
|
-
level = get_choice_opt(options, 'unicodelevel', self.tokens
|
129
|
+
level = get_choice_opt(options, 'unicodelevel', list(self.tokens), 'basic')
|
130
130
|
if level not in self._all_tokens:
|
131
131
|
# compile the regexes now
|
132
132
|
self._tokens = self.__class__.process_tokendef(level)
|
@@ -156,7 +156,7 @@ class NemerleLexer(RegexLexer):
|
|
156
156
|
|
157
157
|
The default value is ``basic``.
|
158
158
|
|
159
|
-
|
159
|
+
.. versionadded:: 1.5
|
160
160
|
"""
|
161
161
|
|
162
162
|
name = 'Nemerle'
|
@@ -170,7 +170,7 @@ class NemerleLexer(RegexLexer):
|
|
170
170
|
# http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
|
171
171
|
|
172
172
|
levels = dict(
|
173
|
-
none = '@?[_a-zA-Z]
|
173
|
+
none = '@?[_a-zA-Z]\w*',
|
174
174
|
basic = ('@?[_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl + ']' +
|
175
175
|
'[' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl +
|
176
176
|
uni.Nd + uni.Pc + uni.Cf + uni.Mn + uni.Mc + ']*'),
|
@@ -183,7 +183,7 @@ class NemerleLexer(RegexLexer):
|
|
183
183
|
tokens = {}
|
184
184
|
token_variants = True
|
185
185
|
|
186
|
-
for levelname, cs_ident in levels
|
186
|
+
for levelname, cs_ident in iteritems(levels):
|
187
187
|
tokens[levelname] = {
|
188
188
|
'root': [
|
189
189
|
# method names
|
@@ -284,7 +284,7 @@ class NemerleLexer(RegexLexer):
|
|
284
284
|
}
|
285
285
|
|
286
286
|
def __init__(self, **options):
|
287
|
-
level = get_choice_opt(options, 'unicodelevel', self.tokens
|
287
|
+
level = get_choice_opt(options, 'unicodelevel', list(self.tokens),
|
288
288
|
'basic')
|
289
289
|
if level not in self._all_tokens:
|
290
290
|
# compile the regexes now
|
@@ -336,7 +336,7 @@ class BooLexer(RegexLexer):
|
|
336
336
|
(r'"""(\\\\|\\"|.*?)"""', String.Double),
|
337
337
|
(r'"(\\\\|\\"|[^"]*?)"', String.Double),
|
338
338
|
(r"'(\\\\|\\'|[^']*?)'", String.Single),
|
339
|
-
(r'[a-zA-Z_]
|
339
|
+
(r'[a-zA-Z_]\w*', Name),
|
340
340
|
(r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float),
|
341
341
|
(r'[0-9][0-9\.]*(ms?|d|h|s)', Number),
|
342
342
|
(r'0\d+', Number.Oct),
|
@@ -351,13 +351,13 @@ class BooLexer(RegexLexer):
|
|
351
351
|
('[*/]', Comment.Multiline)
|
352
352
|
],
|
353
353
|
'funcname': [
|
354
|
-
('[a-zA-Z_]
|
354
|
+
('[a-zA-Z_]\w*', Name.Function, '#pop')
|
355
355
|
],
|
356
356
|
'classname': [
|
357
|
-
('[a-zA-Z_]
|
357
|
+
('[a-zA-Z_]\w*', Name.Class, '#pop')
|
358
358
|
],
|
359
359
|
'namespace': [
|
360
|
-
('[a-zA-Z_][
|
360
|
+
('[a-zA-Z_][\w.]*', Name.Namespace, '#pop')
|
361
361
|
]
|
362
362
|
}
|
363
363
|
|
@@ -425,7 +425,7 @@ class VbNetLexer(RegexLexer):
|
|
425
425
|
r'<=|>=|<>|[-&*/\\^+=<>]',
|
426
426
|
Operator),
|
427
427
|
('"', String, 'string'),
|
428
|
-
('[a-
|
428
|
+
('[a-z_]\w*[%&@!#$]?', Name),
|
429
429
|
('#.*?#', Literal.Date),
|
430
430
|
(r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float),
|
431
431
|
(r'\d+([SILDFR]|US|UI|UL)?', Number.Integer),
|
@@ -439,26 +439,31 @@ class VbNetLexer(RegexLexer):
|
|
439
439
|
(r'[^"]+', String),
|
440
440
|
],
|
441
441
|
'dim': [
|
442
|
-
(r'[a-z_]
|
443
|
-
(
|
442
|
+
(r'[a-z_]\w*', Name.Variable, '#pop'),
|
443
|
+
default('#pop'), # any other syntax
|
444
444
|
],
|
445
445
|
'funcname': [
|
446
|
-
(r'[a-z_]
|
446
|
+
(r'[a-z_]\w*', Name.Function, '#pop'),
|
447
447
|
],
|
448
448
|
'classname': [
|
449
|
-
(r'[a-z_]
|
449
|
+
(r'[a-z_]\w*', Name.Class, '#pop'),
|
450
450
|
],
|
451
451
|
'namespace': [
|
452
|
-
(r'[a-z_][
|
452
|
+
(r'[a-z_][\w.]*', Name.Namespace, '#pop'),
|
453
453
|
],
|
454
454
|
'end': [
|
455
455
|
(r'\s+', Text),
|
456
456
|
(r'(Function|Sub|Property|Class|Structure|Enum|Module|Namespace)\b',
|
457
457
|
Keyword, '#pop'),
|
458
|
-
(
|
458
|
+
default('#pop'),
|
459
459
|
]
|
460
460
|
}
|
461
461
|
|
462
|
+
def analyse_text(text):
|
463
|
+
if re.search(r'^\s*(#If|Module|Namespace)', text,
|
464
|
+
re.IGNORECASE | re.MULTILINE):
|
465
|
+
return 0.5
|
466
|
+
|
462
467
|
|
463
468
|
class GenericAspxLexer(RegexLexer):
|
464
469
|
"""
|
@@ -531,7 +536,10 @@ class FSharpLexer(RegexLexer):
|
|
531
536
|
"""
|
532
537
|
For the F# language (version 3.0).
|
533
538
|
|
534
|
-
|
539
|
+
AAAAACK Strings
|
540
|
+
http://research.microsoft.com/en-us/um/cambridge/projects/fsharp/manual/spec.html#_Toc335818775
|
541
|
+
|
542
|
+
.. versionadded:: 1.5
|
535
543
|
"""
|
536
544
|
|
537
545
|
name = 'FSharp'
|
@@ -589,9 +597,9 @@ class FSharpLexer(RegexLexer):
|
|
589
597
|
'root': [
|
590
598
|
(r'\s+', Text),
|
591
599
|
(r'\(\)|\[\]', Name.Builtin.Pseudo),
|
592
|
-
(r'\b(?<!\.)([A-Z][
|
600
|
+
(r'\b(?<!\.)([A-Z][\w\']*)(?=\s*\.)',
|
593
601
|
Name.Namespace, 'dotted'),
|
594
|
-
(r'\b([A-Z][
|
602
|
+
(r'\b([A-Z][\w\']*)', Name),
|
595
603
|
(r'///.*?\n', String.Doc),
|
596
604
|
(r'//.*?\n', Comment.Single),
|
597
605
|
(r'\(\*(?!\))', Comment, 'comment'),
|
@@ -600,13 +608,13 @@ class FSharpLexer(RegexLexer):
|
|
600
608
|
(r'"""', String, 'tqs'),
|
601
609
|
(r'"', String, 'string'),
|
602
610
|
|
603
|
-
(r'\b(open|module)(\s+)([
|
611
|
+
(r'\b(open|module)(\s+)([\w.]+)',
|
604
612
|
bygroups(Keyword, Text, Name.Namespace)),
|
605
|
-
(r'\b(let!?)(\s+)(
|
613
|
+
(r'\b(let!?)(\s+)(\w+)',
|
606
614
|
bygroups(Keyword, Text, Name.Variable)),
|
607
|
-
(r'\b(type)(\s+)(
|
615
|
+
(r'\b(type)(\s+)(\w+)',
|
608
616
|
bygroups(Keyword, Text, Name.Class)),
|
609
|
-
(r'\b(member|override)(\s+)(
|
617
|
+
(r'\b(member|override)(\s+)(\w+)(\.)(\w+)',
|
610
618
|
bygroups(Keyword, Text, Name, Punctuation, Name.Function)),
|
611
619
|
(r'\b(%s)\b' % '|'.join(keywords), Keyword),
|
612
620
|
(r'(%s)' % '|'.join(keyopts), Operator),
|
@@ -621,7 +629,7 @@ class FSharpLexer(RegexLexer):
|
|
621
629
|
(r'\d[\d_]*[uU]?[yslLnQRZINGmM]?', Number.Integer),
|
622
630
|
(r'0[xX][\da-fA-F][\da-fA-F_]*[uU]?[yslLn]?[fF]?', Number.Hex),
|
623
631
|
(r'0[oO][0-7][0-7_]*[uU]?[yslLn]?', Number.Oct),
|
624
|
-
(r'0[bB][01][01_]*[uU]?[yslLn]?', Number.
|
632
|
+
(r'0[bB][01][01_]*[uU]?[yslLn]?', Number.Bin),
|
625
633
|
(r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)[fFmM]?',
|
626
634
|
Number.Float),
|
627
635
|
|
@@ -630,14 +638,18 @@ class FSharpLexer(RegexLexer):
|
|
630
638
|
(r"'.'", String.Char),
|
631
639
|
(r"'", Keyword), # a stray quote is another syntax element
|
632
640
|
|
641
|
+
(r'@?"', String.Double, 'string'),
|
642
|
+
|
633
643
|
(r'[~?][a-z][\w\']*:', Name.Variable),
|
634
644
|
],
|
635
645
|
'dotted': [
|
636
646
|
(r'\s+', Text),
|
637
647
|
(r'\.', Punctuation),
|
638
|
-
(r'[A-Z][
|
639
|
-
(r'[A-Z][
|
640
|
-
(r'[a-z_][
|
648
|
+
(r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
|
649
|
+
(r'[A-Z][\w\']*', Name, '#pop'),
|
650
|
+
(r'[a-z_][\w\']*', Name, '#pop'),
|
651
|
+
# e.g. dictionary index access
|
652
|
+
default('#pop'),
|
641
653
|
],
|
642
654
|
'comment': [
|
643
655
|
(r'[^(*)@"]+', Comment),
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Simple lexer for Microsoft Visual FoxPro source code.
|
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
|
|
@@ -24,11 +24,11 @@ class FoxProLexer(RegexLexer):
|
|
24
24
|
FoxPro syntax allows to shorten all keywords and function names
|
25
25
|
to 4 characters. Shortened forms are not recognized by this lexer.
|
26
26
|
|
27
|
-
|
27
|
+
.. versionadded:: 1.6
|
28
28
|
"""
|
29
29
|
|
30
30
|
name = 'FoxPro'
|
31
|
-
aliases = ['
|
31
|
+
aliases = ['foxpro', 'vfp', 'clipper', 'xbase']
|
32
32
|
filenames = ['*.PRG', '*.prg']
|
33
33
|
mimetype = []
|
34
34
|
|
@@ -5,21 +5,24 @@
|
|
5
5
|
|
6
6
|
Lexers for functional languages.
|
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
|
|
12
12
|
import re
|
13
13
|
|
14
|
-
from pygments.lexer import Lexer, RegexLexer, bygroups, include, do_insertions
|
14
|
+
from pygments.lexer import Lexer, RegexLexer, bygroups, include, do_insertions, default
|
15
15
|
from pygments.token import Text, Comment, Operator, Keyword, Name, \
|
16
16
|
String, Number, Punctuation, Literal, Generic, Error
|
17
|
+
from pygments import unistring as uni
|
17
18
|
|
18
|
-
__all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', '
|
19
|
-
'
|
20
|
-
'
|
21
|
-
'
|
22
|
-
'
|
19
|
+
__all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'CryptolLexer',
|
20
|
+
'HaskellLexer', 'AgdaLexer', 'LiterateCryptolLexer',
|
21
|
+
'LiterateHaskellLexer', 'LiterateAgdaLexer', 'SMLLexer',
|
22
|
+
'OcamlLexer', 'ErlangLexer', 'ErlangShellLexer', 'OpaLexer',
|
23
|
+
'CoqLexer', 'NewLispLexer', 'NixLexer', 'ElixirLexer',
|
24
|
+
'ElixirConsoleLexer', 'KokaLexer', 'IdrisLexer',
|
25
|
+
'LiterateIdrisLexer']
|
23
26
|
|
24
27
|
|
25
28
|
line_re = re.compile('.*?\n')
|
@@ -27,126 +30,219 @@ line_re = re.compile('.*?\n')
|
|
27
30
|
|
28
31
|
class RacketLexer(RegexLexer):
|
29
32
|
"""
|
30
|
-
Lexer for `Racket <http://racket-lang.org/>`_ source code (formerly
|
31
|
-
PLT Scheme).
|
33
|
+
Lexer for `Racket <http://racket-lang.org/>`_ source code (formerly
|
34
|
+
known as PLT Scheme).
|
32
35
|
|
33
|
-
|
36
|
+
.. versionadded:: 1.6
|
34
37
|
"""
|
35
38
|
|
36
39
|
name = 'Racket'
|
37
40
|
aliases = ['racket', 'rkt']
|
38
|
-
filenames = ['*.rkt', '*.rktl']
|
41
|
+
filenames = ['*.rkt', '*.rktd', '*.rktl']
|
39
42
|
mimetypes = ['text/x-racket', 'application/x-racket']
|
40
43
|
|
41
|
-
#
|
42
|
-
|
43
|
-
'#%app', '#%datum', '#%expression', '#%module-begin',
|
44
|
+
# Generated by example.rkt
|
45
|
+
_keywords = [
|
46
|
+
'#%app', '#%datum', '#%declare', '#%expression', '#%module-begin',
|
44
47
|
'#%plain-app', '#%plain-lambda', '#%plain-module-begin',
|
45
|
-
'#%
|
46
|
-
'#%
|
47
|
-
'
|
48
|
-
'
|
49
|
-
'
|
50
|
-
'
|
51
|
-
'
|
52
|
-
'
|
53
|
-
'
|
54
|
-
'
|
55
|
-
'
|
56
|
-
'
|
57
|
-
'
|
58
|
-
'
|
59
|
-
'
|
60
|
-
'
|
61
|
-
'
|
62
|
-
'
|
63
|
-
'
|
64
|
-
'
|
65
|
-
'
|
48
|
+
'#%printing-module-begin', '#%provide', '#%require',
|
49
|
+
'#%stratified-body', '#%top', '#%top-interaction',
|
50
|
+
'#%variable-reference', '->', '->*', '->*m', '->d', '->dm', '->i',
|
51
|
+
'->m', '...', ':do-in', '==', '=>', '_', 'absent', 'abstract',
|
52
|
+
'all-defined-out', 'all-from-out', 'and', 'any', 'augment', 'augment*',
|
53
|
+
'augment-final', 'augment-final*', 'augride', 'augride*', 'begin',
|
54
|
+
'begin-for-syntax', 'begin0', 'case', 'case->', 'case->m',
|
55
|
+
'case-lambda', 'class', 'class*', 'class-field-accessor',
|
56
|
+
'class-field-mutator', 'class/c', 'class/derived', 'combine-in',
|
57
|
+
'combine-out', 'command-line', 'compound-unit', 'compound-unit/infer',
|
58
|
+
'cond', 'contract', 'contract-out', 'contract-struct', 'contracted',
|
59
|
+
'define', 'define-compound-unit', 'define-compound-unit/infer',
|
60
|
+
'define-contract-struct', 'define-custom-hash-types',
|
61
|
+
'define-custom-set-types', 'define-for-syntax',
|
62
|
+
'define-local-member-name', 'define-logger', 'define-match-expander',
|
63
|
+
'define-member-name', 'define-module-boundary-contract',
|
64
|
+
'define-namespace-anchor', 'define-opt/c', 'define-sequence-syntax',
|
65
|
+
'define-serializable-class', 'define-serializable-class*',
|
66
|
+
'define-signature', 'define-signature-form', 'define-struct',
|
67
|
+
'define-struct/contract', 'define-struct/derived', 'define-syntax',
|
68
|
+
'define-syntax-rule', 'define-syntaxes', 'define-unit',
|
69
|
+
'define-unit-binding', 'define-unit-from-context',
|
70
|
+
'define-unit/contract', 'define-unit/new-import-export',
|
71
|
+
'define-unit/s', 'define-values', 'define-values-for-export',
|
72
|
+
'define-values-for-syntax', 'define-values/invoke-unit',
|
73
|
+
'define-values/invoke-unit/infer', 'define/augment',
|
74
|
+
'define/augment-final', 'define/augride', 'define/contract',
|
75
|
+
'define/final-prop', 'define/match', 'define/overment',
|
76
|
+
'define/override', 'define/override-final', 'define/private',
|
77
|
+
'define/public', 'define/public-final', 'define/pubment',
|
78
|
+
'define/subexpression-pos-prop', 'delay', 'delay/idle', 'delay/name',
|
79
|
+
'delay/strict', 'delay/sync', 'delay/thread', 'do', 'else', 'except',
|
80
|
+
'except-in', 'except-out', 'export', 'extends', 'failure-cont',
|
81
|
+
'false', 'false/c', 'field', 'field-bound?', 'file',
|
82
|
+
'flat-murec-contract', 'flat-rec-contract', 'for', 'for*', 'for*/and',
|
83
|
+
'for*/first', 'for*/fold', 'for*/fold/derived', 'for*/hash',
|
84
|
+
'for*/hasheq', 'for*/hasheqv', 'for*/last', 'for*/list', 'for*/lists',
|
85
|
+
'for*/mutable-set', 'for*/mutable-seteq', 'for*/mutable-seteqv',
|
86
|
+
'for*/or', 'for*/product', 'for*/set', 'for*/seteq', 'for*/seteqv',
|
87
|
+
'for*/sum', 'for*/vector', 'for*/weak-set', 'for*/weak-seteq',
|
88
|
+
'for*/weak-seteqv', 'for-label', 'for-meta', 'for-syntax',
|
89
|
+
'for-template', 'for/and', 'for/first', 'for/fold', 'for/fold/derived',
|
90
|
+
'for/hash', 'for/hasheq', 'for/hasheqv', 'for/last', 'for/list',
|
91
|
+
'for/lists', 'for/mutable-set', 'for/mutable-seteq',
|
92
|
+
'for/mutable-seteqv', 'for/or', 'for/product', 'for/set', 'for/seteq',
|
93
|
+
'for/seteqv', 'for/sum', 'for/vector', 'for/weak-set',
|
94
|
+
'for/weak-seteq', 'for/weak-seteqv', 'gen:custom-write', 'gen:dict',
|
95
|
+
'gen:equal+hash', 'gen:set', 'gen:stream', 'generic', 'get-field',
|
96
|
+
'if', 'implies', 'import', 'include', 'include-at/relative-to',
|
97
|
+
'include-at/relative-to/reader', 'include/reader', 'inherit',
|
98
|
+
'inherit-field', 'inherit/inner', 'inherit/super', 'init',
|
99
|
+
'init-depend', 'init-field', 'init-rest', 'inner', 'inspect',
|
100
|
+
'instantiate', 'interface', 'interface*', 'invoke-unit',
|
101
|
+
'invoke-unit/infer', 'lambda', 'lazy', 'let', 'let*', 'let*-values',
|
102
|
+
'let-syntax', 'let-syntaxes', 'let-values', 'let/cc', 'let/ec',
|
103
|
+
'letrec', 'letrec-syntax', 'letrec-syntaxes', 'letrec-syntaxes+values',
|
104
|
+
'letrec-values', 'lib', 'link', 'local', 'local-require', 'log-debug',
|
105
|
+
'log-error', 'log-fatal', 'log-info', 'log-warning', 'match', 'match*',
|
106
|
+
'match*/derived', 'match-define', 'match-define-values',
|
107
|
+
'match-lambda', 'match-lambda*', 'match-lambda**', 'match-let',
|
108
|
+
'match-let*', 'match-let*-values', 'match-let-values', 'match-letrec',
|
109
|
+
'match/derived', 'match/values', 'member-name-key', 'method-contract?',
|
110
|
+
'mixin', 'module', 'module*', 'module+', 'nand', 'new', 'nor',
|
111
|
+
'object-contract', 'object/c', 'only', 'only-in', 'only-meta-in',
|
112
|
+
'open', 'opt/c', 'or', 'overment', 'overment*', 'override',
|
113
|
+
'override*', 'override-final', 'override-final*', 'parameterize',
|
114
|
+
'parameterize*', 'parameterize-break', 'parametric->/c', 'place',
|
115
|
+
'place*', 'planet', 'prefix', 'prefix-in', 'prefix-out', 'private',
|
116
|
+
'private*', 'prompt-tag/c', 'protect-out', 'provide',
|
117
|
+
'provide-signature-elements', 'provide/contract', 'public', 'public*',
|
118
|
+
'public-final', 'public-final*', 'pubment', 'pubment*', 'quasiquote',
|
66
119
|
'quasisyntax', 'quasisyntax/loc', 'quote', 'quote-syntax',
|
67
|
-
'quote-syntax/prune', '
|
68
|
-
'
|
69
|
-
'
|
70
|
-
'
|
71
|
-
'
|
72
|
-
'
|
73
|
-
'
|
74
|
-
'
|
120
|
+
'quote-syntax/prune', 'recontract-out', 'recursive-contract',
|
121
|
+
'relative-in', 'rename', 'rename-in', 'rename-inner', 'rename-out',
|
122
|
+
'rename-super', 'require', 'send', 'send*', 'send+', 'send-generic',
|
123
|
+
'send/apply', 'send/keyword-apply', 'set!', 'set!-values',
|
124
|
+
'set-field!', 'shared', 'stream', 'stream-cons', 'struct', 'struct*',
|
125
|
+
'struct-copy', 'struct-field-index', 'struct-out', 'struct/c',
|
126
|
+
'struct/ctc', 'struct/dc', 'submod', 'super', 'super-instantiate',
|
127
|
+
'super-make-object', 'super-new', 'syntax', 'syntax-case',
|
128
|
+
'syntax-case*', 'syntax-id-rules', 'syntax-rules', 'syntax/loc', 'tag',
|
129
|
+
'this', 'this%', 'thunk', 'thunk*', 'time', 'unconstrained-domain->',
|
130
|
+
'unit', 'unit-from-context', 'unit/c', 'unit/new-import-export',
|
131
|
+
'unit/s', 'unless', 'unquote', 'unquote-splicing', 'unsyntax',
|
132
|
+
'unsyntax-splicing', 'values/drop', 'when', 'with-continuation-mark',
|
133
|
+
'with-contract', 'with-handlers', 'with-handlers*', 'with-method',
|
134
|
+
'with-syntax', u'λ'
|
75
135
|
]
|
76
136
|
|
77
|
-
#
|
78
|
-
|
79
|
-
'*', '+', '-', '/', '<', '<=', '=', '>', '
|
80
|
-
'abort-current-continuation', 'abs', 'absolute-path?',
|
81
|
-
'
|
82
|
-
'
|
83
|
-
'
|
84
|
-
'
|
85
|
-
'
|
86
|
-
'
|
87
|
-
'
|
88
|
-
'
|
137
|
+
# Generated by example.rkt
|
138
|
+
_builtins = [
|
139
|
+
'*', '+', '-', '/', '<', '</c', '<=', '<=/c', '=', '=/c', '>', '>/c',
|
140
|
+
'>=', '>=/c', 'abort-current-continuation', 'abs', 'absolute-path?',
|
141
|
+
'acos', 'add-between', 'add1', 'alarm-evt', 'always-evt', 'and/c',
|
142
|
+
'andmap', 'angle', 'any/c', 'append', 'append*', 'append-map', 'apply',
|
143
|
+
'argmax', 'argmin', 'arithmetic-shift', 'arity-at-least',
|
144
|
+
'arity-at-least-value', 'arity-at-least?', 'arity-checking-wrapper',
|
145
|
+
'arity-includes?', 'arity=?', 'asin', 'assf', 'assoc', 'assq', 'assv',
|
146
|
+
'atan', 'bad-number-of-results', 'banner', 'base->-doms/c',
|
147
|
+
'base->-rngs/c', 'base->?', 'between/c', 'bitwise-and',
|
148
|
+
'bitwise-bit-field', 'bitwise-bit-set?', 'bitwise-ior', 'bitwise-not',
|
149
|
+
'bitwise-xor', 'blame-add-car-context', 'blame-add-cdr-context',
|
150
|
+
'blame-add-context', 'blame-add-missing-party',
|
151
|
+
'blame-add-nth-arg-context', 'blame-add-or-context',
|
152
|
+
'blame-add-range-context', 'blame-add-unknown-context',
|
153
|
+
'blame-context', 'blame-contract', 'blame-fmt->-string',
|
154
|
+
'blame-negative', 'blame-original?', 'blame-positive',
|
155
|
+
'blame-replace-negative', 'blame-source', 'blame-swap',
|
156
|
+
'blame-swapped?', 'blame-update', 'blame-value', 'blame?', 'boolean=?',
|
157
|
+
'boolean?', 'bound-identifier=?', 'box', 'box-cas!', 'box-immutable',
|
158
|
+
'box-immutable/c', 'box/c', 'box?', 'break-enabled', 'break-thread',
|
159
|
+
'build-chaperone-contract-property', 'build-compound-type-name',
|
160
|
+
'build-contract-property', 'build-flat-contract-property',
|
161
|
+
'build-list', 'build-path', 'build-path/convention-type',
|
162
|
+
'build-string', 'build-vector', 'byte-pregexp', 'byte-pregexp?',
|
89
163
|
'byte-ready?', 'byte-regexp', 'byte-regexp?', 'byte?', 'bytes',
|
90
164
|
'bytes->immutable-bytes', 'bytes->list', 'bytes->path',
|
91
|
-
'bytes->path-element', 'bytes->string/latin-1',
|
92
|
-
'bytes->string/
|
165
|
+
'bytes->path-element', 'bytes->string/latin-1', 'bytes->string/locale',
|
166
|
+
'bytes->string/utf-8', 'bytes-append', 'bytes-append*',
|
93
167
|
'bytes-close-converter', 'bytes-convert', 'bytes-convert-end',
|
94
|
-
'bytes-converter?', 'bytes-copy', 'bytes-copy!',
|
95
|
-
'bytes-
|
96
|
-
'bytes-
|
97
|
-
'bytes
|
98
|
-
'
|
99
|
-
'
|
100
|
-
'
|
101
|
-
'call-with-
|
102
|
-
'call-with-
|
103
|
-
'call-with-
|
104
|
-
'call-with-
|
105
|
-
'call-with-
|
106
|
-
'call-with-
|
107
|
-
'call-with-
|
108
|
-
'call-with-
|
109
|
-
'
|
110
|
-
'
|
111
|
-
'
|
112
|
-
'
|
113
|
-
'
|
168
|
+
'bytes-converter?', 'bytes-copy', 'bytes-copy!',
|
169
|
+
'bytes-environment-variable-name?', 'bytes-fill!', 'bytes-join',
|
170
|
+
'bytes-length', 'bytes-no-nuls?', 'bytes-open-converter', 'bytes-ref',
|
171
|
+
'bytes-set!', 'bytes-utf-8-index', 'bytes-utf-8-length',
|
172
|
+
'bytes-utf-8-ref', 'bytes<?', 'bytes=?', 'bytes>?', 'bytes?', 'caaaar',
|
173
|
+
'caaadr', 'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar',
|
174
|
+
'cadadr', 'cadar', 'caddar', 'cadddr', 'caddr', 'cadr',
|
175
|
+
'call-in-nested-thread', 'call-with-atomic-output-file',
|
176
|
+
'call-with-break-parameterization',
|
177
|
+
'call-with-composable-continuation', 'call-with-continuation-barrier',
|
178
|
+
'call-with-continuation-prompt', 'call-with-current-continuation',
|
179
|
+
'call-with-default-reading-parameterization',
|
180
|
+
'call-with-escape-continuation', 'call-with-exception-handler',
|
181
|
+
'call-with-file-lock/timeout', 'call-with-immediate-continuation-mark',
|
182
|
+
'call-with-input-bytes', 'call-with-input-file',
|
183
|
+
'call-with-input-file*', 'call-with-input-string',
|
184
|
+
'call-with-output-bytes', 'call-with-output-file',
|
185
|
+
'call-with-output-file*', 'call-with-output-string',
|
186
|
+
'call-with-parameterization', 'call-with-semaphore',
|
187
|
+
'call-with-semaphore/enable-break', 'call-with-values', 'call/cc',
|
188
|
+
'call/ec', 'car', 'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr',
|
189
|
+
'cdadr', 'cdar', 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr',
|
190
|
+
'cdddr', 'cddr', 'cdr', 'ceiling', 'channel-get', 'channel-put',
|
191
|
+
'channel-put-evt', 'channel-put-evt?', 'channel-try-get', 'channel/c',
|
192
|
+
'channel?', 'chaperone-box', 'chaperone-channel',
|
193
|
+
'chaperone-continuation-mark-key', 'chaperone-contract-property?',
|
194
|
+
'chaperone-contract?', 'chaperone-evt', 'chaperone-hash',
|
195
|
+
'chaperone-of?', 'chaperone-procedure', 'chaperone-prompt-tag',
|
114
196
|
'chaperone-struct', 'chaperone-struct-type', 'chaperone-vector',
|
115
197
|
'chaperone?', 'char->integer', 'char-alphabetic?', 'char-blank?',
|
116
198
|
'char-ci<=?', 'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?',
|
117
199
|
'char-downcase', 'char-foldcase', 'char-general-category',
|
118
200
|
'char-graphic?', 'char-iso-control?', 'char-lower-case?',
|
119
|
-
'char-numeric?', 'char-punctuation?', 'char-ready?',
|
120
|
-
'char-
|
121
|
-
'char-
|
122
|
-
'char
|
123
|
-
'
|
124
|
-
'
|
201
|
+
'char-numeric?', 'char-punctuation?', 'char-ready?', 'char-symbolic?',
|
202
|
+
'char-title-case?', 'char-titlecase', 'char-upcase',
|
203
|
+
'char-upper-case?', 'char-utf-8-length', 'char-whitespace?', 'char<=?',
|
204
|
+
'char<?', 'char=?', 'char>=?', 'char>?', 'char?',
|
205
|
+
'check-duplicate-identifier', 'checked-procedure-check-and-extract',
|
206
|
+
'choice-evt', 'class->interface', 'class-info', 'class?',
|
125
207
|
'cleanse-path', 'close-input-port', 'close-output-port',
|
126
|
-
'
|
127
|
-
'
|
128
|
-
'
|
208
|
+
'coerce-chaperone-contract', 'coerce-chaperone-contracts',
|
209
|
+
'coerce-contract', 'coerce-contract/f', 'coerce-contracts',
|
210
|
+
'coerce-flat-contract', 'coerce-flat-contracts', 'collect-garbage',
|
211
|
+
'collection-file-path', 'collection-path', 'compile',
|
212
|
+
'compile-allow-set!-undefined', 'compile-context-preservation-enabled',
|
129
213
|
'compile-enforce-module-constants', 'compile-syntax',
|
130
214
|
'compiled-expression?', 'compiled-module-expression?',
|
131
|
-
'complete-path?', 'complex?', '
|
132
|
-
'
|
133
|
-
'continuation-mark-
|
134
|
-
'continuation-mark-set
|
135
|
-
'continuation-
|
136
|
-
'continuation
|
137
|
-
'
|
138
|
-
'
|
139
|
-
'
|
140
|
-
'
|
215
|
+
'complete-path?', 'complex?', 'compose', 'compose1', 'conjugate',
|
216
|
+
'cons', 'cons/c', 'cons?', 'const', 'continuation-mark-key/c',
|
217
|
+
'continuation-mark-key?', 'continuation-mark-set->context',
|
218
|
+
'continuation-mark-set->list', 'continuation-mark-set->list*',
|
219
|
+
'continuation-mark-set-first', 'continuation-mark-set?',
|
220
|
+
'continuation-marks', 'continuation-prompt-available?',
|
221
|
+
'continuation-prompt-tag?', 'continuation?',
|
222
|
+
'contract-continuation-mark-key', 'contract-first-order',
|
223
|
+
'contract-first-order-passes?', 'contract-name', 'contract-proc',
|
224
|
+
'contract-projection', 'contract-property?',
|
225
|
+
'contract-random-generate', 'contract-stronger?',
|
226
|
+
'contract-struct-exercise', 'contract-struct-generate',
|
227
|
+
'contract-val-first-projection', 'contract?', 'convert-stream',
|
228
|
+
'copy-directory/files', 'copy-file', 'copy-port', 'cos', 'cosh',
|
229
|
+
'count', 'current-blame-format', 'current-break-parameterization',
|
230
|
+
'current-code-inspector', 'current-command-line-arguments',
|
231
|
+
'current-compile', 'current-compiled-file-roots',
|
232
|
+
'current-continuation-marks', 'current-contract-region',
|
233
|
+
'current-custodian', 'current-directory', 'current-directory-for-user',
|
234
|
+
'current-drive', 'current-environment-variables', 'current-error-port',
|
141
235
|
'current-eval', 'current-evt-pseudo-random-generator',
|
142
|
-
'current-
|
143
|
-
'current-
|
144
|
-
'current-
|
236
|
+
'current-future', 'current-gc-milliseconds',
|
237
|
+
'current-get-interaction-input-port', 'current-inexact-milliseconds',
|
238
|
+
'current-input-port', 'current-inspector',
|
239
|
+
'current-library-collection-links', 'current-library-collection-paths',
|
145
240
|
'current-load', 'current-load-extension',
|
146
241
|
'current-load-relative-directory', 'current-load/use-compiled',
|
147
|
-
'current-locale', 'current-
|
148
|
-
'current-
|
149
|
-
'current-module-
|
242
|
+
'current-locale', 'current-logger', 'current-memory-use',
|
243
|
+
'current-milliseconds', 'current-module-declare-name',
|
244
|
+
'current-module-declare-source', 'current-module-name-resolver',
|
245
|
+
'current-module-path-for-load', 'current-namespace',
|
150
246
|
'current-output-port', 'current-parameterization',
|
151
247
|
'current-preserved-thread-cell-values', 'current-print',
|
152
248
|
'current-process-milliseconds', 'current-prompt-read',
|
@@ -155,133 +251,229 @@ class RacketLexer(RegexLexer):
|
|
155
251
|
'current-security-guard', 'current-subprocess-custodian-mode',
|
156
252
|
'current-thread', 'current-thread-group',
|
157
253
|
'current-thread-initial-stack-size',
|
158
|
-
'current-write-relative-directory', '
|
159
|
-
'custodian-box?', 'custodian-limit-memory',
|
254
|
+
'current-write-relative-directory', 'curry', 'curryr',
|
255
|
+
'custodian-box-value', 'custodian-box?', 'custodian-limit-memory',
|
160
256
|
'custodian-managed-list', 'custodian-memory-accounting-available?',
|
161
257
|
'custodian-require-memory', 'custodian-shutdown-all', 'custodian?',
|
162
258
|
'custom-print-quotable-accessor', 'custom-print-quotable?',
|
163
|
-
'custom-write-accessor', 'custom-write
|
164
|
-
'date*-nanosecond', 'date*-time-zone-name', 'date*?',
|
165
|
-
'date-dst?', 'date-hour', 'date-minute', 'date-month',
|
166
|
-
'date-second', 'date-time-zone-offset', 'date-week-day',
|
167
|
-
'date-year', 'date
|
168
|
-
'default-continuation-prompt-tag', '
|
169
|
-
'delete-
|
170
|
-
'
|
171
|
-
'
|
172
|
-
'
|
173
|
-
'
|
174
|
-
'
|
175
|
-
'
|
176
|
-
'
|
177
|
-
'
|
178
|
-
'
|
179
|
-
'
|
180
|
-
'
|
181
|
-
'
|
182
|
-
'
|
183
|
-
'
|
184
|
-
'
|
185
|
-
'
|
186
|
-
'
|
187
|
-
'
|
259
|
+
'custom-write-accessor', 'custom-write-property-proc', 'custom-write?',
|
260
|
+
'date', 'date*', 'date*-nanosecond', 'date*-time-zone-name', 'date*?',
|
261
|
+
'date-day', 'date-dst?', 'date-hour', 'date-minute', 'date-month',
|
262
|
+
'date-second', 'date-time-zone-offset', 'date-week-day', 'date-year',
|
263
|
+
'date-year-day', 'date?', 'datum->syntax', 'datum-intern-literal',
|
264
|
+
'default-continuation-prompt-tag', 'degrees->radians',
|
265
|
+
'delete-directory', 'delete-directory/files', 'delete-file',
|
266
|
+
'denominator', 'dict->list', 'dict-can-functional-set?',
|
267
|
+
'dict-can-remove-keys?', 'dict-clear', 'dict-clear!', 'dict-copy',
|
268
|
+
'dict-count', 'dict-empty?', 'dict-for-each', 'dict-has-key?',
|
269
|
+
'dict-implements/c', 'dict-implements?', 'dict-iter-contract',
|
270
|
+
'dict-iterate-first', 'dict-iterate-key', 'dict-iterate-next',
|
271
|
+
'dict-iterate-value', 'dict-key-contract', 'dict-keys', 'dict-map',
|
272
|
+
'dict-mutable?', 'dict-ref', 'dict-ref!', 'dict-remove',
|
273
|
+
'dict-remove!', 'dict-set', 'dict-set!', 'dict-set*', 'dict-set*!',
|
274
|
+
'dict-update', 'dict-update!', 'dict-value-contract', 'dict-values',
|
275
|
+
'dict?', 'directory-exists?', 'directory-list', 'display',
|
276
|
+
'display-lines', 'display-lines-to-file', 'display-to-file',
|
277
|
+
'displayln', 'double-flonum?', 'drop', 'drop-right', 'dropf',
|
278
|
+
'dropf-right', 'dump-memory-stats', 'dup-input-port',
|
279
|
+
'dup-output-port', 'dynamic-get-field', 'dynamic-place',
|
280
|
+
'dynamic-place*', 'dynamic-require', 'dynamic-require-for-syntax',
|
281
|
+
'dynamic-send', 'dynamic-set-field!', 'dynamic-wind', 'eighth',
|
282
|
+
'empty', 'empty-sequence', 'empty-stream', 'empty?',
|
283
|
+
'environment-variables-copy', 'environment-variables-names',
|
284
|
+
'environment-variables-ref', 'environment-variables-set!',
|
285
|
+
'environment-variables?', 'eof', 'eof-evt', 'eof-object?',
|
286
|
+
'ephemeron-value', 'ephemeron?', 'eprintf', 'eq-contract-val',
|
287
|
+
'eq-contract?', 'eq-hash-code', 'eq?', 'equal-contract-val',
|
288
|
+
'equal-contract?', 'equal-hash-code', 'equal-secondary-hash-code',
|
289
|
+
'equal<%>', 'equal?', 'equal?/recur', 'eqv-hash-code', 'eqv?', 'error',
|
290
|
+
'error-display-handler', 'error-escape-handler',
|
291
|
+
'error-print-context-length', 'error-print-source-location',
|
292
|
+
'error-print-width', 'error-value->string-handler', 'eval',
|
293
|
+
'eval-jit-enabled', 'eval-syntax', 'even?', 'evt/c', 'evt?',
|
294
|
+
'exact->inexact', 'exact-ceiling', 'exact-floor', 'exact-integer?',
|
295
|
+
'exact-nonnegative-integer?', 'exact-positive-integer?', 'exact-round',
|
296
|
+
'exact-truncate', 'exact?', 'executable-yield-handler', 'exit',
|
297
|
+
'exit-handler', 'exn', 'exn-continuation-marks', 'exn-message',
|
298
|
+
'exn:break', 'exn:break-continuation', 'exn:break:hang-up',
|
299
|
+
'exn:break:hang-up?', 'exn:break:terminate', 'exn:break:terminate?',
|
300
|
+
'exn:break?', 'exn:fail', 'exn:fail:contract',
|
301
|
+
'exn:fail:contract:arity', 'exn:fail:contract:arity?',
|
302
|
+
'exn:fail:contract:blame', 'exn:fail:contract:blame-object',
|
303
|
+
'exn:fail:contract:blame?', 'exn:fail:contract:continuation',
|
304
|
+
'exn:fail:contract:continuation?', 'exn:fail:contract:divide-by-zero',
|
188
305
|
'exn:fail:contract:divide-by-zero?',
|
189
306
|
'exn:fail:contract:non-fixnum-result',
|
190
|
-
'exn:fail:contract:non-fixnum-result?',
|
191
|
-
'exn:fail:contract:variable', 'exn:fail:contract:variable
|
192
|
-
'exn:fail:contract
|
193
|
-
'exn:fail:filesystem', 'exn:fail:filesystem:
|
194
|
-
'exn:fail:filesystem:
|
307
|
+
'exn:fail:contract:non-fixnum-result?', 'exn:fail:contract:variable',
|
308
|
+
'exn:fail:contract:variable-id', 'exn:fail:contract:variable?',
|
309
|
+
'exn:fail:contract?', 'exn:fail:filesystem',
|
310
|
+
'exn:fail:filesystem:errno', 'exn:fail:filesystem:errno-errno',
|
311
|
+
'exn:fail:filesystem:errno?', 'exn:fail:filesystem:exists',
|
312
|
+
'exn:fail:filesystem:exists?', 'exn:fail:filesystem:missing-module',
|
313
|
+
'exn:fail:filesystem:missing-module-path',
|
314
|
+
'exn:fail:filesystem:missing-module?', 'exn:fail:filesystem:version',
|
195
315
|
'exn:fail:filesystem:version?', 'exn:fail:filesystem?',
|
196
|
-
'exn:fail:network', 'exn:fail:network
|
197
|
-
'exn:fail:
|
316
|
+
'exn:fail:network', 'exn:fail:network:errno',
|
317
|
+
'exn:fail:network:errno-errno', 'exn:fail:network:errno?',
|
318
|
+
'exn:fail:network?', 'exn:fail:object', 'exn:fail:object?',
|
319
|
+
'exn:fail:out-of-memory', 'exn:fail:out-of-memory?', 'exn:fail:read',
|
198
320
|
'exn:fail:read-srclocs', 'exn:fail:read:eof', 'exn:fail:read:eof?',
|
199
|
-
'exn:fail:read:non-char', 'exn:fail:read:non-char?',
|
200
|
-
'exn:fail:
|
201
|
-
'exn:fail:syntax:
|
202
|
-
'exn:fail:syntax
|
321
|
+
'exn:fail:read:non-char', 'exn:fail:read:non-char?', 'exn:fail:read?',
|
322
|
+
'exn:fail:syntax', 'exn:fail:syntax-exprs',
|
323
|
+
'exn:fail:syntax:missing-module',
|
324
|
+
'exn:fail:syntax:missing-module-path',
|
325
|
+
'exn:fail:syntax:missing-module?', 'exn:fail:syntax:unbound',
|
326
|
+
'exn:fail:syntax:unbound?', 'exn:fail:syntax?', 'exn:fail:unsupported',
|
203
327
|
'exn:fail:unsupported?', 'exn:fail:user', 'exn:fail:user?',
|
204
|
-
'exn:fail?', 'exn:
|
205
|
-
'
|
206
|
-
'expand-syntax
|
207
|
-
'expand-
|
208
|
-
'
|
209
|
-
'file
|
210
|
-
'file
|
211
|
-
'
|
212
|
-
'
|
328
|
+
'exn:fail?', 'exn:misc:match?', 'exn:missing-module-accessor',
|
329
|
+
'exn:missing-module?', 'exn:srclocs-accessor', 'exn:srclocs?', 'exn?',
|
330
|
+
'exp', 'expand', 'expand-once', 'expand-syntax', 'expand-syntax-once',
|
331
|
+
'expand-syntax-to-top-form', 'expand-to-top-form', 'expand-user-path',
|
332
|
+
'explode-path', 'expt', 'externalizable<%>', 'false?', 'field-names',
|
333
|
+
'fifth', 'file->bytes', 'file->bytes-lines', 'file->lines',
|
334
|
+
'file->list', 'file->string', 'file->value', 'file-exists?',
|
335
|
+
'file-name-from-path', 'file-or-directory-identity',
|
336
|
+
'file-or-directory-modify-seconds', 'file-or-directory-permissions',
|
337
|
+
'file-position', 'file-position*', 'file-size',
|
338
|
+
'file-stream-buffer-mode', 'file-stream-port?', 'file-truncate',
|
339
|
+
'filename-extension', 'filesystem-change-evt',
|
340
|
+
'filesystem-change-evt-cancel', 'filesystem-change-evt?',
|
341
|
+
'filesystem-root-list', 'filter', 'filter-map', 'filter-not',
|
342
|
+
'filter-read-input-port', 'find-executable-path', 'find-files',
|
343
|
+
'find-library-collection-links', 'find-library-collection-paths',
|
344
|
+
'find-relative-path', 'find-system-path', 'findf', 'first', 'fixnum?',
|
345
|
+
'flat-contract', 'flat-contract-predicate', 'flat-contract-property?',
|
346
|
+
'flat-contract?', 'flat-named-contract', 'flatten',
|
213
347
|
'floating-point-bytes->real', 'flonum?', 'floor', 'flush-output',
|
214
|
-
'
|
215
|
-
'
|
216
|
-
'
|
217
|
-
'
|
218
|
-
'
|
219
|
-
'
|
220
|
-
'
|
348
|
+
'fold-files', 'foldl', 'foldr', 'for-each', 'force', 'format',
|
349
|
+
'fourth', 'fprintf', 'free-identifier=?', 'free-label-identifier=?',
|
350
|
+
'free-template-identifier=?', 'free-transformer-identifier=?',
|
351
|
+
'fsemaphore-count', 'fsemaphore-post', 'fsemaphore-try-wait?',
|
352
|
+
'fsemaphore-wait', 'fsemaphore?', 'future', 'future?',
|
353
|
+
'futures-enabled?', 'gcd', 'generate-member-key',
|
354
|
+
'generate-temporaries', 'generic-set?', 'generic?', 'gensym',
|
355
|
+
'get-output-bytes', 'get-output-string', 'get-preference',
|
356
|
+
'get/build-val-first-projection', 'getenv',
|
357
|
+
'global-port-print-handler', 'group-execute-bit', 'group-read-bit',
|
358
|
+
'group-write-bit', 'guard-evt', 'handle-evt', 'handle-evt?',
|
359
|
+
'has-contract?', 'hash', 'hash->list', 'hash-clear', 'hash-clear!',
|
360
|
+
'hash-copy', 'hash-copy-clear', 'hash-count', 'hash-empty?',
|
361
|
+
'hash-eq?', 'hash-equal?', 'hash-eqv?', 'hash-for-each',
|
362
|
+
'hash-has-key?', 'hash-iterate-first', 'hash-iterate-key',
|
363
|
+
'hash-iterate-next', 'hash-iterate-value', 'hash-keys', 'hash-map',
|
364
|
+
'hash-placeholder?', 'hash-ref', 'hash-ref!', 'hash-remove',
|
365
|
+
'hash-remove!', 'hash-set', 'hash-set!', 'hash-set*', 'hash-set*!',
|
366
|
+
'hash-update', 'hash-update!', 'hash-values', 'hash-weak?', 'hash/c',
|
367
|
+
'hash?', 'hasheq', 'hasheqv', 'identifier-binding',
|
368
|
+
'identifier-binding-symbol', 'identifier-label-binding',
|
369
|
+
'identifier-prune-lexical-context',
|
221
370
|
'identifier-prune-to-source-module',
|
222
371
|
'identifier-remove-from-definition-context',
|
223
372
|
'identifier-template-binding', 'identifier-transformer-binding',
|
224
|
-
'identifier?', 'imag-part', 'immutable?',
|
225
|
-
'impersonate-
|
226
|
-
'impersonate-
|
227
|
-
'
|
228
|
-
'
|
229
|
-
'impersonator-
|
230
|
-
'
|
231
|
-
'
|
232
|
-
'
|
233
|
-
'
|
373
|
+
'identifier?', 'identity', 'imag-part', 'immutable?',
|
374
|
+
'impersonate-box', 'impersonate-channel',
|
375
|
+
'impersonate-continuation-mark-key', 'impersonate-hash',
|
376
|
+
'impersonate-procedure', 'impersonate-prompt-tag',
|
377
|
+
'impersonate-struct', 'impersonate-vector', 'impersonator-contract?',
|
378
|
+
'impersonator-ephemeron', 'impersonator-of?',
|
379
|
+
'impersonator-prop:application-mark', 'impersonator-prop:contracted',
|
380
|
+
'impersonator-property-accessor-procedure?', 'impersonator-property?',
|
381
|
+
'impersonator?', 'implementation?', 'implementation?/c', 'in-bytes',
|
382
|
+
'in-bytes-lines', 'in-cycle', 'in-dict', 'in-dict-keys',
|
383
|
+
'in-dict-pairs', 'in-dict-values', 'in-directory', 'in-hash',
|
384
|
+
'in-hash-keys', 'in-hash-pairs', 'in-hash-values', 'in-indexed',
|
385
|
+
'in-input-port-bytes', 'in-input-port-chars', 'in-lines', 'in-list',
|
386
|
+
'in-mlist', 'in-naturals', 'in-parallel', 'in-permutations', 'in-port',
|
387
|
+
'in-producer', 'in-range', 'in-sequences', 'in-set', 'in-stream',
|
388
|
+
'in-string', 'in-value', 'in-values*-sequence', 'in-values-sequence',
|
389
|
+
'in-vector', 'inexact->exact', 'inexact-real?', 'inexact?',
|
390
|
+
'infinite?', 'input-port-append', 'input-port?', 'inspector?',
|
391
|
+
'instanceof/c', 'integer->char', 'integer->integer-bytes',
|
392
|
+
'integer-bytes->integer', 'integer-in', 'integer-length',
|
393
|
+
'integer-sqrt', 'integer-sqrt/remainder', 'integer?',
|
394
|
+
'interface->method-names', 'interface-extension?', 'interface?',
|
234
395
|
'internal-definition-context-seal', 'internal-definition-context?',
|
235
|
-
'
|
236
|
-
'
|
237
|
-
'
|
238
|
-
'list
|
239
|
-
'
|
240
|
-
'
|
241
|
-
'
|
242
|
-
'
|
243
|
-
'
|
244
|
-
'
|
245
|
-
'
|
246
|
-
'
|
247
|
-
'
|
248
|
-
'make-
|
249
|
-
'make-
|
396
|
+
'is-a?', 'is-a?/c', 'keyword->string', 'keyword-apply', 'keyword<?',
|
397
|
+
'keyword?', 'keywords-match', 'kill-thread', 'last', 'last-pair',
|
398
|
+
'lcm', 'length', 'liberal-define-context?', 'link-exists?', 'list',
|
399
|
+
'list*', 'list->bytes', 'list->mutable-set', 'list->mutable-seteq',
|
400
|
+
'list->mutable-seteqv', 'list->set', 'list->seteq', 'list->seteqv',
|
401
|
+
'list->string', 'list->vector', 'list->weak-set', 'list->weak-seteq',
|
402
|
+
'list->weak-seteqv', 'list-ref', 'list-tail', 'list/c', 'list?',
|
403
|
+
'listof', 'load', 'load-extension', 'load-on-demand-enabled',
|
404
|
+
'load-relative', 'load-relative-extension', 'load/cd',
|
405
|
+
'load/use-compiled', 'local-expand', 'local-expand/capture-lifts',
|
406
|
+
'local-transformer-expand', 'local-transformer-expand/capture-lifts',
|
407
|
+
'locale-string-encoding', 'log', 'log-level?', 'log-max-level',
|
408
|
+
'log-message', 'log-receiver?', 'logger-name', 'logger?', 'magnitude',
|
409
|
+
'make-arity-at-least', 'make-base-empty-namespace',
|
410
|
+
'make-base-namespace', 'make-bytes', 'make-channel',
|
411
|
+
'make-chaperone-contract', 'make-continuation-mark-key',
|
412
|
+
'make-continuation-prompt-tag', 'make-contract', 'make-custodian',
|
413
|
+
'make-custodian-box', 'make-custom-hash', 'make-custom-hash-types',
|
414
|
+
'make-custom-set', 'make-custom-set-types', 'make-date', 'make-date*',
|
415
|
+
'make-derived-parameter', 'make-directory', 'make-directory*',
|
416
|
+
'make-do-sequence', 'make-empty-namespace',
|
417
|
+
'make-environment-variables', 'make-ephemeron', 'make-exn',
|
418
|
+
'make-exn:break', 'make-exn:break:hang-up', 'make-exn:break:terminate',
|
419
|
+
'make-exn:fail', 'make-exn:fail:contract',
|
420
|
+
'make-exn:fail:contract:arity', 'make-exn:fail:contract:blame',
|
250
421
|
'make-exn:fail:contract:continuation',
|
251
422
|
'make-exn:fail:contract:divide-by-zero',
|
252
423
|
'make-exn:fail:contract:non-fixnum-result',
|
253
424
|
'make-exn:fail:contract:variable', 'make-exn:fail:filesystem',
|
254
|
-
'make-exn:fail:filesystem:exists',
|
425
|
+
'make-exn:fail:filesystem:errno', 'make-exn:fail:filesystem:exists',
|
426
|
+
'make-exn:fail:filesystem:missing-module',
|
255
427
|
'make-exn:fail:filesystem:version', 'make-exn:fail:network',
|
428
|
+
'make-exn:fail:network:errno', 'make-exn:fail:object',
|
256
429
|
'make-exn:fail:out-of-memory', 'make-exn:fail:read',
|
257
430
|
'make-exn:fail:read:eof', 'make-exn:fail:read:non-char',
|
258
|
-
'make-exn:fail:syntax', 'make-exn:fail:syntax:
|
259
|
-
'make-exn:fail:
|
260
|
-
'make-file-or-directory-link',
|
261
|
-
'make-
|
262
|
-
'make-
|
263
|
-
'make-
|
264
|
-
'make-
|
265
|
-
'make-
|
266
|
-
'make-
|
431
|
+
'make-exn:fail:syntax', 'make-exn:fail:syntax:missing-module',
|
432
|
+
'make-exn:fail:syntax:unbound', 'make-exn:fail:unsupported',
|
433
|
+
'make-exn:fail:user', 'make-file-or-directory-link',
|
434
|
+
'make-flat-contract', 'make-fsemaphore', 'make-generic',
|
435
|
+
'make-handle-get-preference-locked', 'make-hash',
|
436
|
+
'make-hash-placeholder', 'make-hasheq', 'make-hasheq-placeholder',
|
437
|
+
'make-hasheqv', 'make-hasheqv-placeholder',
|
438
|
+
'make-immutable-custom-hash', 'make-immutable-hash',
|
439
|
+
'make-immutable-hasheq', 'make-immutable-hasheqv',
|
440
|
+
'make-impersonator-property', 'make-input-port',
|
441
|
+
'make-input-port/read-to-peek', 'make-inspector',
|
442
|
+
'make-keyword-procedure', 'make-known-char-range-list',
|
443
|
+
'make-limited-input-port', 'make-list', 'make-lock-file-name',
|
444
|
+
'make-log-receiver', 'make-logger', 'make-mixin-contract',
|
445
|
+
'make-mutable-custom-set', 'make-none/c', 'make-object',
|
446
|
+
'make-output-port', 'make-parameter', 'make-phantom-bytes',
|
447
|
+
'make-pipe', 'make-pipe-with-specials', 'make-placeholder',
|
448
|
+
'make-polar', 'make-prefab-struct', 'make-primitive-class',
|
449
|
+
'make-proj-contract', 'make-pseudo-random-generator',
|
267
450
|
'make-reader-graph', 'make-readtable', 'make-rectangular',
|
268
451
|
'make-rename-transformer', 'make-resolved-module-path',
|
269
452
|
'make-security-guard', 'make-semaphore', 'make-set!-transformer',
|
270
|
-
'make-shared-bytes', 'make-sibling-inspector',
|
271
|
-
'make-
|
272
|
-
'make-struct-field-
|
273
|
-
'make-struct-type', 'make-
|
274
|
-
'make-syntax-
|
275
|
-
'make-
|
276
|
-
'make-
|
277
|
-
'
|
278
|
-
'
|
279
|
-
'
|
453
|
+
'make-shared-bytes', 'make-sibling-inspector', 'make-special-comment',
|
454
|
+
'make-srcloc', 'make-string', 'make-struct-field-accessor',
|
455
|
+
'make-struct-field-mutator', 'make-struct-type',
|
456
|
+
'make-struct-type-property', 'make-syntax-delta-introducer',
|
457
|
+
'make-syntax-introducer', 'make-temporary-file',
|
458
|
+
'make-tentative-pretty-print-output-port', 'make-thread-cell',
|
459
|
+
'make-thread-group', 'make-vector', 'make-weak-box',
|
460
|
+
'make-weak-custom-hash', 'make-weak-custom-set', 'make-weak-hash',
|
461
|
+
'make-weak-hasheq', 'make-weak-hasheqv', 'make-will-executor', 'map',
|
462
|
+
'match-equality-test', 'matches-arity-exactly?', 'max', 'mcar', 'mcdr',
|
463
|
+
'mcons', 'member', 'member-name-key-hash-code', 'member-name-key=?',
|
464
|
+
'member-name-key?', 'memf', 'memq', 'memv', 'merge-input',
|
465
|
+
'method-in-interface?', 'min', 'mixin-contract', 'module->exports',
|
466
|
+
'module->imports', 'module->language-info', 'module->namespace',
|
467
|
+
'module-compiled-cross-phase-persistent?', 'module-compiled-exports',
|
280
468
|
'module-compiled-imports', 'module-compiled-language-info',
|
281
|
-
'module-compiled-name', 'module-
|
469
|
+
'module-compiled-name', 'module-compiled-submodules',
|
470
|
+
'module-declared?', 'module-path-index-join',
|
282
471
|
'module-path-index-resolve', 'module-path-index-split',
|
283
|
-
'module-path-index
|
284
|
-
'module-provide-protected?', 'modulo', 'mpair?',
|
472
|
+
'module-path-index-submodule', 'module-path-index?', 'module-path?',
|
473
|
+
'module-predefined?', 'module-provide-protected?', 'modulo', 'mpair?',
|
474
|
+
'mutable-set', 'mutable-seteq', 'mutable-seteqv', 'n->th',
|
475
|
+
'nack-guard-evt', 'namespace-anchor->empty-namespace',
|
476
|
+
'namespace-anchor->namespace', 'namespace-anchor?',
|
285
477
|
'namespace-attach-module', 'namespace-attach-module-declaration',
|
286
478
|
'namespace-base-phase', 'namespace-mapped-symbols',
|
287
479
|
'namespace-module-identifier', 'namespace-module-registry',
|
@@ -289,136 +481,212 @@ class RacketLexer(RegexLexer):
|
|
289
481
|
'namespace-require/copy', 'namespace-require/expansion-time',
|
290
482
|
'namespace-set-variable-value!', 'namespace-symbol->identifier',
|
291
483
|
'namespace-syntax-introduce', 'namespace-undefine-variable!',
|
292
|
-
'namespace-unprotect-module', 'namespace-variable-value',
|
293
|
-
'
|
294
|
-
'
|
295
|
-
'
|
484
|
+
'namespace-unprotect-module', 'namespace-variable-value', 'namespace?',
|
485
|
+
'nan?', 'natural-number/c', 'negate', 'negative?', 'never-evt',
|
486
|
+
u'new-∀/c', u'new-∃/c', 'newline', 'ninth', 'non-empty-listof',
|
487
|
+
'none/c', 'normal-case-path', 'normalize-arity', 'normalize-path',
|
488
|
+
'normalized-arity?', 'not', 'not/c', 'null', 'null?', 'number->string',
|
489
|
+
'number?', 'numerator', 'object%', 'object->vector', 'object-info',
|
490
|
+
'object-interface', 'object-method-arity-includes?', 'object-name',
|
491
|
+
'object=?', 'object?', 'odd?', 'one-of/c', 'open-input-bytes',
|
296
492
|
'open-input-file', 'open-input-output-file', 'open-input-string',
|
297
|
-
'open-output-bytes', 'open-output-file', 'open-output-
|
298
|
-
'
|
299
|
-
'
|
300
|
-
'
|
301
|
-
'
|
302
|
-
'path
|
303
|
-
'path
|
304
|
-
'path-
|
305
|
-
'
|
306
|
-
'
|
307
|
-
'
|
308
|
-
'
|
309
|
-
'
|
310
|
-
'
|
311
|
-
'
|
312
|
-
'
|
313
|
-
'
|
314
|
-
'
|
315
|
-
'
|
316
|
-
'
|
317
|
-
'
|
318
|
-
'
|
319
|
-
'
|
493
|
+
'open-output-bytes', 'open-output-file', 'open-output-nowhere',
|
494
|
+
'open-output-string', 'or/c', 'order-of-magnitude', 'ormap',
|
495
|
+
'other-execute-bit', 'other-read-bit', 'other-write-bit',
|
496
|
+
'output-port?', 'pair?', 'parameter-procedure=?', 'parameter/c',
|
497
|
+
'parameter?', 'parameterization?', 'parse-command-line', 'partition',
|
498
|
+
'path->bytes', 'path->complete-path', 'path->directory-path',
|
499
|
+
'path->string', 'path-add-suffix', 'path-convention-type',
|
500
|
+
'path-element->bytes', 'path-element->string', 'path-element?',
|
501
|
+
'path-for-some-system?', 'path-list-string->path-list', 'path-only',
|
502
|
+
'path-replace-suffix', 'path-string?', 'path<?', 'path?',
|
503
|
+
'pathlist-closure', 'peek-byte', 'peek-byte-or-special', 'peek-bytes',
|
504
|
+
'peek-bytes!', 'peek-bytes!-evt', 'peek-bytes-avail!',
|
505
|
+
'peek-bytes-avail!*', 'peek-bytes-avail!-evt',
|
506
|
+
'peek-bytes-avail!/enable-break', 'peek-bytes-evt', 'peek-char',
|
507
|
+
'peek-char-or-special', 'peek-string', 'peek-string!',
|
508
|
+
'peek-string!-evt', 'peek-string-evt', 'peeking-input-port',
|
509
|
+
'permutations', 'phantom-bytes?', 'pi', 'pi.f', 'pipe-content-length',
|
510
|
+
'place-break', 'place-channel', 'place-channel-get',
|
511
|
+
'place-channel-put', 'place-channel-put/get', 'place-channel?',
|
512
|
+
'place-dead-evt', 'place-enabled?', 'place-kill', 'place-location?',
|
513
|
+
'place-message-allowed?', 'place-sleep', 'place-wait', 'place?',
|
514
|
+
'placeholder-get', 'placeholder-set!', 'placeholder?',
|
515
|
+
'poll-guard-evt', 'port->bytes', 'port->bytes-lines', 'port->lines',
|
516
|
+
'port->list', 'port->string', 'port-closed-evt', 'port-closed?',
|
517
|
+
'port-commit-peeked', 'port-count-lines!', 'port-count-lines-enabled',
|
518
|
+
'port-counts-lines?', 'port-display-handler', 'port-file-identity',
|
519
|
+
'port-file-unlock', 'port-next-location', 'port-print-handler',
|
520
|
+
'port-progress-evt', 'port-provides-progress-evts?',
|
521
|
+
'port-read-handler', 'port-try-file-lock?', 'port-write-handler',
|
522
|
+
'port-writes-atomic?', 'port-writes-special?', 'port?', 'positive?',
|
523
|
+
'predicate/c', 'prefab-key->struct-type', 'prefab-key?',
|
524
|
+
'prefab-struct-key', 'preferences-lock-file-mode', 'pregexp',
|
525
|
+
'pregexp?', 'pretty-display', 'pretty-format', 'pretty-print',
|
526
|
+
'pretty-print-.-symbol-without-bars',
|
527
|
+
'pretty-print-abbreviate-read-macros', 'pretty-print-columns',
|
528
|
+
'pretty-print-current-style-table', 'pretty-print-depth',
|
529
|
+
'pretty-print-exact-as-decimal', 'pretty-print-extend-style-table',
|
530
|
+
'pretty-print-handler', 'pretty-print-newline',
|
531
|
+
'pretty-print-post-print-hook', 'pretty-print-pre-print-hook',
|
532
|
+
'pretty-print-print-hook', 'pretty-print-print-line',
|
533
|
+
'pretty-print-remap-stylable', 'pretty-print-show-inexactness',
|
534
|
+
'pretty-print-size-hook', 'pretty-print-style-table?',
|
535
|
+
'pretty-printing', 'pretty-write', 'primitive-closure?',
|
536
|
+
'primitive-result-arity', 'primitive?', 'print', 'print-as-expression',
|
320
537
|
'print-boolean-long-form', 'print-box', 'print-graph',
|
321
538
|
'print-hash-table', 'print-mpair-curly-braces',
|
322
539
|
'print-pair-curly-braces', 'print-reader-abbreviations',
|
323
540
|
'print-struct', 'print-syntax-width', 'print-unreadable',
|
324
|
-
'print-vector-length', '
|
325
|
-
'procedure
|
541
|
+
'print-vector-length', 'printable/c', 'printable<%>', 'printf',
|
542
|
+
'procedure->method', 'procedure-arity', 'procedure-arity-includes/c',
|
543
|
+
'procedure-arity-includes?', 'procedure-arity?',
|
326
544
|
'procedure-closure-contents-eq?', 'procedure-extract-target',
|
327
|
-
'procedure-
|
328
|
-
'procedure-
|
329
|
-
'
|
330
|
-
'
|
331
|
-
'
|
545
|
+
'procedure-keywords', 'procedure-reduce-arity',
|
546
|
+
'procedure-reduce-keyword-arity', 'procedure-rename',
|
547
|
+
'procedure-struct-type?', 'procedure?', 'process', 'process*',
|
548
|
+
'process*/ports', 'process/ports', 'processor-count', 'progress-evt?',
|
549
|
+
'promise-forced?', 'promise-running?', 'promise/c', 'promise?',
|
550
|
+
'prop:arity-string', 'prop:chaperone-contract',
|
551
|
+
'prop:checked-procedure', 'prop:contract', 'prop:contracted',
|
552
|
+
'prop:custom-print-quotable', 'prop:custom-write', 'prop:dict',
|
553
|
+
'prop:dict/contract', 'prop:equal+hash', 'prop:evt',
|
554
|
+
'prop:exn:missing-module', 'prop:exn:srclocs', 'prop:flat-contract',
|
332
555
|
'prop:impersonator-of', 'prop:input-port',
|
333
|
-
'prop:liberal-define-context', 'prop:
|
334
|
-
'prop:
|
335
|
-
'prop:
|
556
|
+
'prop:liberal-define-context', 'prop:opt-chaperone-contract',
|
557
|
+
'prop:opt-chaperone-contract-get-test', 'prop:opt-chaperone-contract?',
|
558
|
+
'prop:output-port', 'prop:place-location', 'prop:procedure',
|
559
|
+
'prop:rename-transformer', 'prop:sequence', 'prop:set!-transformer',
|
560
|
+
'prop:stream', 'proper-subset?', 'pseudo-random-generator->vector',
|
336
561
|
'pseudo-random-generator-vector?', 'pseudo-random-generator?',
|
337
|
-
'putenv', 'quotient', 'quotient/remainder',
|
338
|
-
'
|
339
|
-
'raise-
|
340
|
-
'
|
341
|
-
'
|
342
|
-
'
|
343
|
-
'
|
344
|
-
'read
|
345
|
-
'read-
|
346
|
-
'read-
|
347
|
-
'read-
|
348
|
-
'read-
|
349
|
-
'read-
|
350
|
-
'read-
|
351
|
-
'read-
|
562
|
+
'put-preferences', 'putenv', 'quotient', 'quotient/remainder',
|
563
|
+
'radians->degrees', 'raise', 'raise-argument-error',
|
564
|
+
'raise-arguments-error', 'raise-arity-error', 'raise-blame-error',
|
565
|
+
'raise-contract-error', 'raise-mismatch-error',
|
566
|
+
'raise-not-cons-blame-error', 'raise-range-error',
|
567
|
+
'raise-result-error', 'raise-syntax-error', 'raise-type-error',
|
568
|
+
'raise-user-error', 'random', 'random-seed', 'range', 'rational?',
|
569
|
+
'rationalize', 'read', 'read-accept-bar-quote', 'read-accept-box',
|
570
|
+
'read-accept-compiled', 'read-accept-dot', 'read-accept-graph',
|
571
|
+
'read-accept-infix-dot', 'read-accept-lang', 'read-accept-quasiquote',
|
572
|
+
'read-accept-reader', 'read-byte', 'read-byte-or-special',
|
573
|
+
'read-bytes', 'read-bytes!', 'read-bytes!-evt', 'read-bytes-avail!',
|
574
|
+
'read-bytes-avail!*', 'read-bytes-avail!-evt',
|
575
|
+
'read-bytes-avail!/enable-break', 'read-bytes-evt', 'read-bytes-line',
|
576
|
+
'read-bytes-line-evt', 'read-case-sensitive', 'read-char',
|
577
|
+
'read-char-or-special', 'read-curly-brace-as-paren',
|
578
|
+
'read-decimal-as-inexact', 'read-eval-print-loop', 'read-language',
|
579
|
+
'read-line', 'read-line-evt', 'read-on-demand-source',
|
580
|
+
'read-square-bracket-as-paren', 'read-string', 'read-string!',
|
581
|
+
'read-string!-evt', 'read-string-evt', 'read-syntax',
|
352
582
|
'read-syntax/recursive', 'read/recursive', 'readtable-mapping',
|
353
|
-
'readtable?', 'real->
|
354
|
-
'real->
|
355
|
-
'
|
356
|
-
'regexp-match-
|
583
|
+
'readtable?', 'real->decimal-string', 'real->double-flonum',
|
584
|
+
'real->floating-point-bytes', 'real->single-flonum', 'real-in',
|
585
|
+
'real-part', 'real?', 'reencode-input-port', 'reencode-output-port',
|
586
|
+
'regexp', 'regexp-match', 'regexp-match*', 'regexp-match-evt',
|
587
|
+
'regexp-match-exact?', 'regexp-match-peek',
|
588
|
+
'regexp-match-peek-immediate', 'regexp-match-peek-positions',
|
589
|
+
'regexp-match-peek-positions*',
|
357
590
|
'regexp-match-peek-positions-immediate',
|
358
591
|
'regexp-match-peek-positions-immediate/end',
|
359
592
|
'regexp-match-peek-positions/end', 'regexp-match-positions',
|
360
|
-
'regexp-match-positions
|
361
|
-
'regexp-
|
362
|
-
'regexp
|
593
|
+
'regexp-match-positions*', 'regexp-match-positions/end',
|
594
|
+
'regexp-match/end', 'regexp-match?', 'regexp-max-lookbehind',
|
595
|
+
'regexp-quote', 'regexp-replace', 'regexp-replace*',
|
596
|
+
'regexp-replace-quote', 'regexp-replaces', 'regexp-split',
|
597
|
+
'regexp-try-match', 'regexp?', 'relative-path?', 'relocate-input-port',
|
598
|
+
'relocate-output-port', 'remainder', 'remove', 'remove*',
|
599
|
+
'remove-duplicates', 'remq', 'remq*', 'remv', 'remv*',
|
363
600
|
'rename-file-or-directory', 'rename-transformer-target',
|
364
|
-
'rename-transformer?', '
|
365
|
-
'resolved-module-path
|
366
|
-
'
|
367
|
-
'semaphore-
|
368
|
-
'semaphore-wait
|
369
|
-
'
|
370
|
-
'
|
371
|
-
'
|
372
|
-
'
|
373
|
-
'
|
374
|
-
'
|
375
|
-
'
|
376
|
-
'
|
601
|
+
'rename-transformer?', 'reroot-path', 'resolve-path',
|
602
|
+
'resolved-module-path-name', 'resolved-module-path?', 'rest',
|
603
|
+
'reverse', 'round', 'second', 'seconds->date', 'security-guard?',
|
604
|
+
'semaphore-peek-evt', 'semaphore-peek-evt?', 'semaphore-post',
|
605
|
+
'semaphore-try-wait?', 'semaphore-wait', 'semaphore-wait/enable-break',
|
606
|
+
'semaphore?', 'sequence->list', 'sequence->stream',
|
607
|
+
'sequence-add-between', 'sequence-andmap', 'sequence-append',
|
608
|
+
'sequence-count', 'sequence-filter', 'sequence-fold',
|
609
|
+
'sequence-for-each', 'sequence-generate', 'sequence-generate*',
|
610
|
+
'sequence-length', 'sequence-map', 'sequence-ormap', 'sequence-ref',
|
611
|
+
'sequence-tail', 'sequence?', 'set', 'set!-transformer-procedure',
|
612
|
+
'set!-transformer?', 'set->list', 'set->stream', 'set-add', 'set-add!',
|
613
|
+
'set-box!', 'set-clear', 'set-clear!', 'set-copy', 'set-copy-clear',
|
614
|
+
'set-count', 'set-empty?', 'set-eq?', 'set-equal?', 'set-eqv?',
|
615
|
+
'set-first', 'set-for-each', 'set-implements/c', 'set-implements?',
|
616
|
+
'set-intersect', 'set-intersect!', 'set-map', 'set-mcar!', 'set-mcdr!',
|
617
|
+
'set-member?', 'set-mutable?', 'set-phantom-bytes!',
|
618
|
+
'set-port-next-location!', 'set-remove', 'set-remove!', 'set-rest',
|
619
|
+
'set-subtract', 'set-subtract!', 'set-symmetric-difference',
|
620
|
+
'set-symmetric-difference!', 'set-union', 'set-union!', 'set-weak?',
|
621
|
+
'set/c', 'set=?', 'set?', 'seteq', 'seteqv', 'seventh', 'sgn',
|
622
|
+
'shared-bytes', 'shell-execute', 'shrink-path-wrt', 'shuffle',
|
623
|
+
'simple-form-path', 'simplify-path', 'sin', 'single-flonum?', 'sinh',
|
624
|
+
'sixth', 'skip-projection-wrapper?', 'sleep',
|
625
|
+
'some-system-path->string', 'sort', 'special-comment-value',
|
626
|
+
'special-comment?', 'special-filter-input-port', 'split-at',
|
627
|
+
'split-at-right', 'split-path', 'splitf-at', 'splitf-at-right', 'sqr',
|
628
|
+
'sqrt', 'srcloc', 'srcloc->string', 'srcloc-column', 'srcloc-line',
|
629
|
+
'srcloc-position', 'srcloc-source', 'srcloc-span', 'srcloc?',
|
630
|
+
'stop-after', 'stop-before', 'stream->list', 'stream-add-between',
|
631
|
+
'stream-andmap', 'stream-append', 'stream-count', 'stream-empty?',
|
632
|
+
'stream-filter', 'stream-first', 'stream-fold', 'stream-for-each',
|
633
|
+
'stream-length', 'stream-map', 'stream-ormap', 'stream-ref',
|
634
|
+
'stream-rest', 'stream-tail', 'stream?', 'string',
|
635
|
+
'string->bytes/latin-1', 'string->bytes/locale', 'string->bytes/utf-8',
|
377
636
|
'string->immutable-string', 'string->keyword', 'string->list',
|
378
637
|
'string->number', 'string->path', 'string->path-element',
|
379
|
-
'string->
|
380
|
-
'string->
|
381
|
-
'string-
|
382
|
-
'string-
|
383
|
-
'string-
|
384
|
-
'string-
|
385
|
-
'string-locale-
|
638
|
+
'string->some-system-path', 'string->symbol',
|
639
|
+
'string->uninterned-symbol', 'string->unreadable-symbol',
|
640
|
+
'string-append', 'string-append*', 'string-ci<=?', 'string-ci<?',
|
641
|
+
'string-ci=?', 'string-ci>=?', 'string-ci>?', 'string-copy',
|
642
|
+
'string-copy!', 'string-downcase', 'string-environment-variable-name?',
|
643
|
+
'string-fill!', 'string-foldcase', 'string-join', 'string-len/c',
|
644
|
+
'string-length', 'string-locale-ci<?', 'string-locale-ci=?',
|
645
|
+
'string-locale-ci>?', 'string-locale-downcase', 'string-locale-upcase',
|
386
646
|
'string-locale<?', 'string-locale=?', 'string-locale>?',
|
387
|
-
'string-normalize-nfc', 'string-normalize-nfd',
|
388
|
-
'string-normalize-nfkc', 'string-normalize-nfkd',
|
389
|
-
'string-
|
390
|
-
'string-
|
391
|
-
'string
|
647
|
+
'string-no-nuls?', 'string-normalize-nfc', 'string-normalize-nfd',
|
648
|
+
'string-normalize-nfkc', 'string-normalize-nfkd',
|
649
|
+
'string-normalize-spaces', 'string-ref', 'string-replace',
|
650
|
+
'string-set!', 'string-split', 'string-titlecase', 'string-trim',
|
651
|
+
'string-upcase', 'string-utf-8-length', 'string<=?', 'string<?',
|
652
|
+
'string=?', 'string>=?', 'string>?', 'string?', 'struct->vector',
|
392
653
|
'struct-accessor-procedure?', 'struct-constructor-procedure?',
|
393
654
|
'struct-info', 'struct-mutator-procedure?',
|
394
655
|
'struct-predicate-procedure?', 'struct-type-info',
|
395
656
|
'struct-type-make-constructor', 'struct-type-make-predicate',
|
396
|
-
'struct-type-property-accessor-procedure?',
|
657
|
+
'struct-type-property-accessor-procedure?', 'struct-type-property/c',
|
397
658
|
'struct-type-property?', 'struct-type?', 'struct:arity-at-least',
|
398
659
|
'struct:date', 'struct:date*', 'struct:exn', 'struct:exn:break',
|
660
|
+
'struct:exn:break:hang-up', 'struct:exn:break:terminate',
|
399
661
|
'struct:exn:fail', 'struct:exn:fail:contract',
|
400
|
-
'struct:exn:fail:contract:arity',
|
662
|
+
'struct:exn:fail:contract:arity', 'struct:exn:fail:contract:blame',
|
401
663
|
'struct:exn:fail:contract:continuation',
|
402
664
|
'struct:exn:fail:contract:divide-by-zero',
|
403
665
|
'struct:exn:fail:contract:non-fixnum-result',
|
404
666
|
'struct:exn:fail:contract:variable', 'struct:exn:fail:filesystem',
|
667
|
+
'struct:exn:fail:filesystem:errno',
|
405
668
|
'struct:exn:fail:filesystem:exists',
|
669
|
+
'struct:exn:fail:filesystem:missing-module',
|
406
670
|
'struct:exn:fail:filesystem:version', 'struct:exn:fail:network',
|
671
|
+
'struct:exn:fail:network:errno', 'struct:exn:fail:object',
|
407
672
|
'struct:exn:fail:out-of-memory', 'struct:exn:fail:read',
|
408
673
|
'struct:exn:fail:read:eof', 'struct:exn:fail:read:non-char',
|
409
|
-
'struct:exn:fail:syntax', 'struct:exn:fail:syntax:
|
410
|
-
'struct:exn:fail:
|
411
|
-
'struct:
|
412
|
-
'
|
413
|
-
'
|
414
|
-
'
|
415
|
-
'
|
416
|
-
'
|
417
|
-
'
|
418
|
-
'
|
419
|
-
'syntax-
|
420
|
-
'syntax-
|
421
|
-
'syntax-local-
|
674
|
+
'struct:exn:fail:syntax', 'struct:exn:fail:syntax:missing-module',
|
675
|
+
'struct:exn:fail:syntax:unbound', 'struct:exn:fail:unsupported',
|
676
|
+
'struct:exn:fail:user', 'struct:srcloc',
|
677
|
+
'struct:wrapped-extra-arg-arrow', 'struct?', 'sub1', 'subbytes',
|
678
|
+
'subclass?', 'subclass?/c', 'subprocess', 'subprocess-group-enabled',
|
679
|
+
'subprocess-kill', 'subprocess-pid', 'subprocess-status',
|
680
|
+
'subprocess-wait', 'subprocess?', 'subset?', 'substring',
|
681
|
+
'symbol->string', 'symbol-interned?', 'symbol-unreadable?', 'symbol<?',
|
682
|
+
'symbol=?', 'symbol?', 'symbols', 'sync', 'sync/enable-break',
|
683
|
+
'sync/timeout', 'sync/timeout/enable-break', 'syntax->datum',
|
684
|
+
'syntax->list', 'syntax-arm', 'syntax-column', 'syntax-disarm',
|
685
|
+
'syntax-e', 'syntax-line', 'syntax-local-bind-syntaxes',
|
686
|
+
'syntax-local-certifier', 'syntax-local-context',
|
687
|
+
'syntax-local-expand-expression', 'syntax-local-get-shadower',
|
688
|
+
'syntax-local-introduce', 'syntax-local-lift-context',
|
689
|
+
'syntax-local-lift-expression',
|
422
690
|
'syntax-local-lift-module-end-declaration',
|
423
691
|
'syntax-local-lift-provide', 'syntax-local-lift-require',
|
424
692
|
'syntax-local-lift-values-expression',
|
@@ -427,163 +695,232 @@ class RacketLexer(RegexLexer):
|
|
427
695
|
'syntax-local-module-defined-identifiers',
|
428
696
|
'syntax-local-module-exports',
|
429
697
|
'syntax-local-module-required-identifiers', 'syntax-local-name',
|
430
|
-
'syntax-local-phase-level',
|
698
|
+
'syntax-local-phase-level', 'syntax-local-submodules',
|
431
699
|
'syntax-local-transforming-module-provides?', 'syntax-local-value',
|
432
|
-
'syntax-local-value/immediate', 'syntax-original?',
|
433
|
-
'syntax-
|
434
|
-
'syntax-
|
435
|
-
'syntax-
|
436
|
-
'syntax-source-module', 'syntax-span', 'syntax-taint',
|
700
|
+
'syntax-local-value/immediate', 'syntax-original?', 'syntax-position',
|
701
|
+
'syntax-property', 'syntax-property-symbol-keys', 'syntax-protect',
|
702
|
+
'syntax-rearm', 'syntax-recertify', 'syntax-shift-phase-level',
|
703
|
+
'syntax-source', 'syntax-source-module', 'syntax-span', 'syntax-taint',
|
437
704
|
'syntax-tainted?', 'syntax-track-origin',
|
438
705
|
'syntax-transforming-module-expression?', 'syntax-transforming?',
|
439
|
-
'syntax?', 'system
|
440
|
-
'system-
|
441
|
-
'system-path-convention-type', 'system-type',
|
442
|
-
'
|
443
|
-
'
|
444
|
-
'tcp-
|
445
|
-
'tcp-
|
446
|
-
'
|
447
|
-
'
|
448
|
-
'
|
449
|
-
'
|
706
|
+
'syntax/c', 'syntax?', 'system', 'system*', 'system*/exit-code',
|
707
|
+
'system-big-endian?', 'system-idle-evt', 'system-language+country',
|
708
|
+
'system-library-subpath', 'system-path-convention-type', 'system-type',
|
709
|
+
'system/exit-code', 'tail-marks-match?', 'take', 'take-right', 'takef',
|
710
|
+
'takef-right', 'tan', 'tanh', 'tcp-abandon-port', 'tcp-accept',
|
711
|
+
'tcp-accept-evt', 'tcp-accept-ready?', 'tcp-accept/enable-break',
|
712
|
+
'tcp-addresses', 'tcp-close', 'tcp-connect',
|
713
|
+
'tcp-connect/enable-break', 'tcp-listen', 'tcp-listener?', 'tcp-port?',
|
714
|
+
'tentative-pretty-print-port-cancel',
|
715
|
+
'tentative-pretty-print-port-transfer', 'tenth', 'terminal-port?',
|
716
|
+
'the-unsupplied-arg', 'third', 'thread', 'thread-cell-ref',
|
717
|
+
'thread-cell-set!', 'thread-cell-values?', 'thread-cell?',
|
718
|
+
'thread-dead-evt', 'thread-dead?', 'thread-group?', 'thread-receive',
|
719
|
+
'thread-receive-evt', 'thread-resume', 'thread-resume-evt',
|
720
|
+
'thread-rewind-receive', 'thread-running?', 'thread-send',
|
721
|
+
'thread-suspend', 'thread-suspend-evt', 'thread-try-receive',
|
450
722
|
'thread-wait', 'thread/suspend-to-kill', 'thread?', 'time-apply',
|
451
|
-
'
|
452
|
-
'udp-
|
453
|
-
'udp-
|
454
|
-
'udp-
|
455
|
-
'udp-
|
456
|
-
'udp-
|
457
|
-
'udp-
|
458
|
-
'
|
723
|
+
'touch', 'transplant-input-port', 'transplant-output-port', 'true',
|
724
|
+
'truncate', 'udp-addresses', 'udp-bind!', 'udp-bound?', 'udp-close',
|
725
|
+
'udp-connect!', 'udp-connected?', 'udp-multicast-interface',
|
726
|
+
'udp-multicast-join-group!', 'udp-multicast-leave-group!',
|
727
|
+
'udp-multicast-loopback?', 'udp-multicast-set-interface!',
|
728
|
+
'udp-multicast-set-loopback!', 'udp-multicast-set-ttl!',
|
729
|
+
'udp-multicast-ttl', 'udp-open-socket', 'udp-receive!',
|
730
|
+
'udp-receive!*', 'udp-receive!-evt', 'udp-receive!/enable-break',
|
731
|
+
'udp-receive-ready-evt', 'udp-send', 'udp-send*', 'udp-send-evt',
|
732
|
+
'udp-send-ready-evt', 'udp-send-to', 'udp-send-to*', 'udp-send-to-evt',
|
733
|
+
'udp-send-to/enable-break', 'udp-send/enable-break', 'udp?', 'unbox',
|
734
|
+
'uncaught-exception-handler', 'unit?', 'unspecified-dom',
|
735
|
+
'unsupplied-arg?', 'use-collection-link-paths',
|
459
736
|
'use-compiled-file-paths', 'use-user-specific-search-paths',
|
460
|
-
'
|
737
|
+
'user-execute-bit', 'user-read-bit', 'user-write-bit',
|
738
|
+
'value-contract', 'values', 'variable-reference->empty-namespace',
|
461
739
|
'variable-reference->module-base-phase',
|
462
740
|
'variable-reference->module-declaration-inspector',
|
463
|
-
'variable-reference->module-
|
464
|
-
'variable-reference->
|
741
|
+
'variable-reference->module-path-index',
|
742
|
+
'variable-reference->module-source', 'variable-reference->namespace',
|
743
|
+
'variable-reference->phase',
|
465
744
|
'variable-reference->resolved-module-path',
|
466
745
|
'variable-reference-constant?', 'variable-reference?', 'vector',
|
467
746
|
'vector->immutable-vector', 'vector->list',
|
468
|
-
'vector->pseudo-random-generator',
|
469
|
-
'vector->
|
470
|
-
'vector-
|
471
|
-
'vector-
|
472
|
-
'
|
473
|
-
'
|
474
|
-
'
|
475
|
-
'
|
747
|
+
'vector->pseudo-random-generator', 'vector->pseudo-random-generator!',
|
748
|
+
'vector->values', 'vector-append', 'vector-argmax', 'vector-argmin',
|
749
|
+
'vector-copy', 'vector-copy!', 'vector-count', 'vector-drop',
|
750
|
+
'vector-drop-right', 'vector-fill!', 'vector-filter',
|
751
|
+
'vector-filter-not', 'vector-immutable', 'vector-immutable/c',
|
752
|
+
'vector-immutableof', 'vector-length', 'vector-map', 'vector-map!',
|
753
|
+
'vector-member', 'vector-memq', 'vector-memv', 'vector-ref',
|
754
|
+
'vector-set!', 'vector-set*!', 'vector-set-performance-stats!',
|
755
|
+
'vector-split-at', 'vector-split-at-right', 'vector-take',
|
756
|
+
'vector-take-right', 'vector/c', 'vector?', 'vectorof', 'version',
|
757
|
+
'void', 'void?', 'weak-box-value', 'weak-box?', 'weak-set',
|
758
|
+
'weak-seteq', 'weak-seteqv', 'will-execute', 'will-executor?',
|
759
|
+
'will-register', 'will-try-execute', 'with-input-from-bytes',
|
760
|
+
'with-input-from-file', 'with-input-from-string',
|
761
|
+
'with-output-to-bytes', 'with-output-to-file', 'with-output-to-string',
|
762
|
+
'would-be-future', 'wrap-evt', 'wrapped-extra-arg-arrow',
|
763
|
+
'wrapped-extra-arg-arrow-extra-neg-party-argument',
|
764
|
+
'wrapped-extra-arg-arrow-real-func', 'wrapped-extra-arg-arrow?',
|
765
|
+
'writable<%>', 'write', 'write-byte', 'write-bytes',
|
476
766
|
'write-bytes-avail', 'write-bytes-avail*', 'write-bytes-avail-evt',
|
477
767
|
'write-bytes-avail/enable-break', 'write-char', 'write-special',
|
478
|
-
'write-special-avail*', 'write-special-evt', 'write-string',
|
768
|
+
'write-special-avail*', 'write-special-evt', 'write-string',
|
769
|
+
'write-to-file', 'xor', 'zero?', '~.a', '~.s', '~.v', '~a', '~e', '~r',
|
770
|
+
'~s', '~v'
|
479
771
|
]
|
480
772
|
|
481
|
-
|
482
|
-
|
773
|
+
_opening_parenthesis = r'[([{]'
|
774
|
+
_closing_parenthesis = r'[)\]}]'
|
775
|
+
_delimiters = r'()[\]{}",\'`;\s'
|
776
|
+
_symbol = r'(?u)(?:\|[^|]*\||\\[\w\W]|[^|\\%s]+)+' % _delimiters
|
777
|
+
_exact_decimal_prefix = r'(?:#e)?(?:#d)?(?:#e)?'
|
778
|
+
_exponent = r'(?:[defls][-+]?\d+)'
|
779
|
+
_inexact_simple_no_hashes = r'(?:\d+(?:/\d+|\.\d*)?|\.\d+)'
|
780
|
+
_inexact_simple = (r'(?:%s|(?:\d+#+(?:\.#*|/\d+#*)?|\.\d+#+|'
|
781
|
+
r'\d+(?:\.\d*#+|/\d+#+)))' % _inexact_simple_no_hashes)
|
782
|
+
_inexact_normal_no_hashes = r'(?:%s%s?)' % (_inexact_simple_no_hashes,
|
783
|
+
_exponent)
|
784
|
+
_inexact_normal = r'(?:%s%s?)' % (_inexact_simple, _exponent)
|
785
|
+
_inexact_special = r'(?:(?:inf|nan)\.[0f])'
|
786
|
+
_inexact_real = r'(?:[-+]?%s|[-+]%s)' % (_inexact_normal,
|
787
|
+
_inexact_special)
|
788
|
+
_inexact_unsigned = r'(?:%s|%s)' % (_inexact_normal, _inexact_special)
|
483
789
|
|
484
790
|
tokens = {
|
485
|
-
'root'
|
486
|
-
(
|
487
|
-
(r'
|
488
|
-
|
489
|
-
|
490
|
-
(r'
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
791
|
+
'root': [
|
792
|
+
(_closing_parenthesis, Error),
|
793
|
+
(r'(?!\Z)', Text, 'unquoted-datum')
|
794
|
+
],
|
795
|
+
'datum': [
|
796
|
+
(r'(?s)#;|#![ /]([^\\\n]|\\.)*', Comment),
|
797
|
+
(u';[^\\n\\r\x85\u2028\u2029]*', Comment.Single),
|
798
|
+
(r'#\|', Comment.Multiline, 'block-comment'),
|
799
|
+
|
800
|
+
# Whitespaces
|
801
|
+
(r'(?u)\s+', Text),
|
802
|
+
|
803
|
+
# Numbers: Keep in mind Racket reader hash prefixes, which
|
804
|
+
# can denote the base or the type. These don't map neatly
|
805
|
+
# onto Pygments token types; some judgment calls here.
|
806
|
+
|
807
|
+
# #d or no prefix
|
808
|
+
(r'(?i)%s[-+]?\d+(?=[%s])' % (_exact_decimal_prefix, _delimiters),
|
809
|
+
Number.Integer, '#pop'),
|
810
|
+
(r'(?i)%s[-+]?(\d+(\.\d*)?|\.\d+)([deflst][-+]?\d+)?(?=[%s])' %
|
811
|
+
(_exact_decimal_prefix, _delimiters), Number.Float, '#pop'),
|
812
|
+
(r'(?i)%s[-+]?(%s([-+]%s?i)?|[-+]%s?i)(?=[%s])' %
|
813
|
+
(_exact_decimal_prefix, _inexact_normal_no_hashes,
|
814
|
+
_inexact_normal_no_hashes, _inexact_normal_no_hashes,
|
815
|
+
_delimiters), Number, '#pop'),
|
816
|
+
|
817
|
+
# Inexact without explicit #i
|
818
|
+
(r'(?i)(#d)?(%s([-+]%s?i)?|[-+]%s?i|%s@%s)(?=[%s])' %
|
819
|
+
(_inexact_real, _inexact_unsigned, _inexact_unsigned,
|
820
|
+
_inexact_real, _inexact_real, _delimiters), Number.Float,
|
821
|
+
'#pop'),
|
822
|
+
|
823
|
+
# The remaining extflonums
|
824
|
+
(r'(?i)(([-+]?%st[-+]?\d+)|[-+](inf|nan)\.t)(?=[%s])' %
|
825
|
+
(_inexact_simple, _delimiters), Number.Float, '#pop'),
|
498
826
|
|
499
827
|
# #b
|
500
|
-
(r'#
|
501
|
-
(r'#b[01]+e[-+]?[01]+', Number.Float),
|
502
|
-
(r'#b[-+]?[01]/[01]+', Number),
|
503
|
-
(r'#b[-+]?[01]+', Number.Integer),
|
504
|
-
(r'#b\S*', Error),
|
505
|
-
|
506
|
-
# #d OR no hash prefix
|
507
|
-
(r'(#d)?[-+]?\d+\.\d+', Number.Float),
|
508
|
-
(r'(#d)?\d+e[-+]?\d+', Number.Float),
|
509
|
-
(r'(#d)?[-+]?\d+/\d+', Number),
|
510
|
-
(r'(#d)?[-+]?\d+', Number.Integer),
|
511
|
-
(r'#d\S*', Error),
|
512
|
-
|
513
|
-
# #e
|
514
|
-
(r'#e[-+]?\d+\.\d+', Number.Float),
|
515
|
-
(r'#e\d+e[-+]?\d+', Number.Float),
|
516
|
-
(r'#e[-+]?\d+/\d+', Number),
|
517
|
-
(r'#e[-+]?\d+', Number),
|
518
|
-
(r'#e\S*', Error),
|
519
|
-
|
520
|
-
# #i is always inexact-real, i.e. float
|
521
|
-
(r'#i[-+]?\d+\.\d+', Number.Float),
|
522
|
-
(r'#i\d+e[-+]?\d+', Number.Float),
|
523
|
-
(r'#i[-+]?\d+/\d+', Number.Float),
|
524
|
-
(r'#i[-+]?\d+', Number.Float),
|
525
|
-
(r'#i\S*', Error),
|
828
|
+
(r'(?i)(#[ei])?#b%s' % _symbol, Number.Bin, '#pop'),
|
526
829
|
|
527
830
|
# #o
|
528
|
-
(r'#
|
529
|
-
(r'#o[0-7]+e[-+]?[0-7]+', Number.Oct),
|
530
|
-
(r'#o[-+]?[0-7]+/[0-7]+', Number.Oct),
|
531
|
-
(r'#o[-+]?[0-7]+', Number.Oct),
|
532
|
-
(r'#o\S*', Error),
|
831
|
+
(r'(?i)(#[ei])?#o%s' % _symbol, Number.Oct, '#pop'),
|
533
832
|
|
534
833
|
# #x
|
535
|
-
(r'#
|
536
|
-
|
537
|
-
|
538
|
-
(r'#
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
(r'
|
544
|
-
(r
|
545
|
-
(r
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
(r'#
|
557
|
-
|
558
|
-
#
|
559
|
-
(r"('
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
),
|
566
|
-
|
567
|
-
#
|
568
|
-
|
569
|
-
|
570
|
-
(
|
571
|
-
|
572
|
-
|
573
|
-
(
|
574
|
-
|
575
|
-
|
576
|
-
),
|
577
|
-
|
578
|
-
|
579
|
-
(
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
834
|
+
(r'(?i)(#[ei])?#x%s' % _symbol, Number.Hex, '#pop'),
|
835
|
+
|
836
|
+
# #i is always inexact, i.e. float
|
837
|
+
(r'(?i)(#d)?#i%s' % _symbol, Number.Float, '#pop'),
|
838
|
+
|
839
|
+
# Strings and characters
|
840
|
+
(r'#?"', String.Double, ('#pop', 'string')),
|
841
|
+
(r'#<<(.+)\n(^(?!\1$).*$\n)*^\1$', String.Heredoc, '#pop'),
|
842
|
+
(r'#\\(u[\da-fA-F]{1,4}|U[\da-fA-F]{1,8})', String.Char, '#pop'),
|
843
|
+
(r'(?is)#\\([0-7]{3}|[a-z]+|.)', String.Char, '#pop'),
|
844
|
+
(r'(?s)#[pr]x#?"(\\?.)*?"', String.Regex, '#pop'),
|
845
|
+
|
846
|
+
# Constants
|
847
|
+
(r'#(true|false|[tTfF])', Name.Constant, '#pop'),
|
848
|
+
|
849
|
+
# Keyword argument names (e.g. #:keyword)
|
850
|
+
(r'#:%s' % _symbol, Keyword.Declaration, '#pop'),
|
851
|
+
|
852
|
+
# Reader extensions
|
853
|
+
(r'(#lang |#!)(\S+)',
|
854
|
+
bygroups(Keyword.Namespace, Name.Namespace)),
|
855
|
+
(r'#reader', Keyword.Namespace, 'quoted-datum'),
|
856
|
+
|
857
|
+
# Other syntax
|
858
|
+
(r"(?i)\.(?=[%s])|#c[is]|#['`]|#,@?" % _delimiters, Operator),
|
859
|
+
(r"'|#[s&]|#hash(eqv?)?|#\d*(?=%s)" % _opening_parenthesis,
|
860
|
+
Operator, ('#pop', 'quoted-datum'))
|
861
|
+
],
|
862
|
+
'datum*': [
|
863
|
+
(r'`|,@?', Operator),
|
864
|
+
(_symbol, String.Symbol, '#pop'),
|
865
|
+
(r'[|\\]', Error),
|
866
|
+
default('#pop')
|
867
|
+
],
|
868
|
+
'list': [
|
869
|
+
(_closing_parenthesis, Punctuation, '#pop')
|
870
|
+
],
|
871
|
+
'unquoted-datum': [
|
872
|
+
include('datum'),
|
873
|
+
(r'quote(?=[%s])' % _delimiters, Keyword,
|
874
|
+
('#pop', 'quoted-datum')),
|
875
|
+
(r'`', Operator, ('#pop', 'quasiquoted-datum')),
|
876
|
+
(r'quasiquote(?=[%s])' % _delimiters, Keyword,
|
877
|
+
('#pop', 'quasiquoted-datum')),
|
878
|
+
(_opening_parenthesis, Punctuation, ('#pop', 'unquoted-list')),
|
879
|
+
(r'(?u)(%s)(?=[%s])' % ('|'.join(
|
880
|
+
[re.escape(entry) for entry in _keywords]), _delimiters),
|
881
|
+
Keyword, '#pop'),
|
882
|
+
(r'(?u)(%s)(?=[%s])' % ('|'.join(
|
883
|
+
[re.escape(entry) for entry in _builtins]), _delimiters),
|
884
|
+
Name.Builtin, '#pop'),
|
885
|
+
(_symbol, Name, '#pop'),
|
886
|
+
include('datum*')
|
887
|
+
],
|
888
|
+
'unquoted-list': [
|
889
|
+
include('list'),
|
890
|
+
(r'(?!\Z)', Text, 'unquoted-datum')
|
891
|
+
],
|
892
|
+
'quasiquoted-datum': [
|
893
|
+
include('datum'),
|
894
|
+
(r',@?', Operator, ('#pop', 'unquoted-datum')),
|
895
|
+
(r'unquote(-splicing)?(?=[%s])' % _delimiters, Keyword,
|
896
|
+
('#pop', 'unquoted-datum')),
|
897
|
+
(_opening_parenthesis, Punctuation, ('#pop', 'quasiquoted-list')),
|
898
|
+
include('datum*')
|
899
|
+
],
|
900
|
+
'quasiquoted-list': [
|
901
|
+
include('list'),
|
902
|
+
(r'(?!\Z)', Text, 'quasiquoted-datum')
|
903
|
+
],
|
904
|
+
'quoted-datum': [
|
905
|
+
include('datum'),
|
906
|
+
(_opening_parenthesis, Punctuation, ('#pop', 'quoted-list')),
|
907
|
+
include('datum*')
|
908
|
+
],
|
909
|
+
'quoted-list': [
|
910
|
+
include('list'),
|
911
|
+
(r'(?!\Z)', Text, 'quoted-datum')
|
912
|
+
],
|
913
|
+
'block-comment': [
|
914
|
+
(r'#\|', Comment.Multiline, '#push'),
|
915
|
+
(r'\|#', Comment.Multiline, '#pop'),
|
916
|
+
(r'[^#|]+|.', Comment.Multiline)
|
586
917
|
],
|
918
|
+
'string': [
|
919
|
+
(r'"', String.Double, '#pop'),
|
920
|
+
(r'(?s)\\([0-7]{1,3}|x[\da-fA-F]{1,2}|u[\da-fA-F]{1,4}|'
|
921
|
+
r'U[\da-fA-F]{1,8}|.)', String.Escape),
|
922
|
+
(r'[^\\"]+', String.Double)
|
923
|
+
]
|
587
924
|
}
|
588
925
|
|
589
926
|
|
@@ -599,7 +936,7 @@ class SchemeLexer(RegexLexer):
|
|
599
936
|
|
600
937
|
It supports the full Scheme syntax as defined in R5RS.
|
601
938
|
|
602
|
-
|
939
|
+
.. versionadded:: 0.6
|
603
940
|
"""
|
604
941
|
name = 'Scheme'
|
605
942
|
aliases = ['scheme', 'scm']
|
@@ -662,9 +999,16 @@ class SchemeLexer(RegexLexer):
|
|
662
999
|
|
663
1000
|
tokens = {
|
664
1001
|
'root' : [
|
665
|
-
# the comments
|
1002
|
+
# the comments
|
666
1003
|
# and going to the end of the line
|
667
1004
|
(r';.*$', Comment.Single),
|
1005
|
+
# multi-line comment
|
1006
|
+
(r'#\|', Comment.Multiline, 'multiline-comment'),
|
1007
|
+
# commented form (entire sexpr folliwng)
|
1008
|
+
(r'#;\s*\(', Comment, 'commented-form'),
|
1009
|
+
# signifies that the program text that follows is written with the
|
1010
|
+
# lexical and datum syntax described in r6rs
|
1011
|
+
(r'#!r6rs', Comment),
|
668
1012
|
|
669
1013
|
# whitespaces - usually not relevant
|
670
1014
|
(r'\s+', Text),
|
@@ -713,6 +1057,17 @@ class SchemeLexer(RegexLexer):
|
|
713
1057
|
(r'(\(|\))', Punctuation),
|
714
1058
|
(r'(\[|\])', Punctuation),
|
715
1059
|
],
|
1060
|
+
'multiline-comment' : [
|
1061
|
+
(r'#\|', Comment.Multiline, '#push'),
|
1062
|
+
(r'\|#', Comment.Multiline, '#pop'),
|
1063
|
+
(r'[^|#]+', Comment.Multiline),
|
1064
|
+
(r'[|#]', Comment.Multiline),
|
1065
|
+
],
|
1066
|
+
'commented-form' : [
|
1067
|
+
(r'\(', Comment, '#push'),
|
1068
|
+
(r'\)', Comment, '#pop'),
|
1069
|
+
(r'[^()]+', Comment),
|
1070
|
+
],
|
716
1071
|
}
|
717
1072
|
|
718
1073
|
|
@@ -720,10 +1075,10 @@ class CommonLispLexer(RegexLexer):
|
|
720
1075
|
"""
|
721
1076
|
A Common Lisp lexer.
|
722
1077
|
|
723
|
-
|
1078
|
+
.. versionadded:: 0.9
|
724
1079
|
"""
|
725
1080
|
name = 'Common Lisp'
|
726
|
-
aliases = ['common-lisp', 'cl', 'lisp']
|
1081
|
+
aliases = ['common-lisp', 'cl', 'lisp', 'elisp', 'emacs', 'emacs-lisp']
|
727
1082
|
filenames = ['*.cl', '*.lisp', '*.el'] # use for Elisp too
|
728
1083
|
mimetypes = ['text/x-common-lisp']
|
729
1084
|
|
@@ -732,7 +1087,7 @@ class CommonLispLexer(RegexLexer):
|
|
732
1087
|
### couple of useful regexes
|
733
1088
|
|
734
1089
|
# characters that are not macro-characters and can be used to begin a symbol
|
735
|
-
nonmacro = r'\\.|[
|
1090
|
+
nonmacro = r'\\.|[\w!$%&*+-/<=>?@\[\]^{}~]'
|
736
1091
|
constituent = nonmacro + '|[#.:]'
|
737
1092
|
terminated = r'(?=[ "()\'\n,;`])' # whitespace or terminating macro characters
|
738
1093
|
|
@@ -844,16 +1199,16 @@ class CommonLispLexer(RegexLexer):
|
|
844
1199
|
(r'#\'', Name.Function),
|
845
1200
|
|
846
1201
|
# binary rational
|
847
|
-
(r'#[bB][+-]?[01]+(/[01]+)?', Number),
|
1202
|
+
(r'#[bB][+-]?[01]+(/[01]+)?', Number.Bin),
|
848
1203
|
|
849
1204
|
# octal rational
|
850
1205
|
(r'#[oO][+-]?[0-7]+(/[0-7]+)?', Number.Oct),
|
851
1206
|
|
852
1207
|
# hex rational
|
853
|
-
(r'#[xX][+-]?[0-9a-
|
1208
|
+
(r'#[xX][+-]?[0-9a-f]+(/[0-9a-f]+)?', Number.Hex),
|
854
1209
|
|
855
1210
|
# radix rational
|
856
|
-
(r'#\d+[rR][+-]?[0-9a-
|
1211
|
+
(r'#\d+[rR][+-]?[0-9a-z]+(/[0-9a-z]+)?', Number),
|
857
1212
|
|
858
1213
|
# complex
|
859
1214
|
(r'(#[cC])(\()', bygroups(Number, Punctuation), 'body'),
|
@@ -894,17 +1249,155 @@ class CommonLispLexer(RegexLexer):
|
|
894
1249
|
}
|
895
1250
|
|
896
1251
|
|
1252
|
+
class CryptolLexer(RegexLexer):
|
1253
|
+
"""
|
1254
|
+
FIXME: A Cryptol2 lexer based on the lexemes defined in the Haskell 98 Report.
|
1255
|
+
|
1256
|
+
.. versionadded:: 2.0
|
1257
|
+
"""
|
1258
|
+
name = 'Cryptol'
|
1259
|
+
aliases = ['cryptol', 'cry']
|
1260
|
+
filenames = ['*.cry']
|
1261
|
+
mimetypes = ['text/x-cryptol']
|
1262
|
+
|
1263
|
+
reserved = ['Arith','Bit','Cmp','False','Inf','True','else',
|
1264
|
+
'export','extern','fin','if','import','inf','lg2',
|
1265
|
+
'max','min','module','newtype','pragma','property',
|
1266
|
+
'then','type','where','width']
|
1267
|
+
ascii = ['NUL','SOH','[SE]TX','EOT','ENQ','ACK',
|
1268
|
+
'BEL','BS','HT','LF','VT','FF','CR','S[OI]','DLE',
|
1269
|
+
'DC[1-4]','NAK','SYN','ETB','CAN',
|
1270
|
+
'EM','SUB','ESC','[FGRU]S','SP','DEL']
|
1271
|
+
|
1272
|
+
tokens = {
|
1273
|
+
'root': [
|
1274
|
+
# Whitespace:
|
1275
|
+
(r'\s+', Text),
|
1276
|
+
#(r'--\s*|.*$', Comment.Doc),
|
1277
|
+
(r'//.*$', Comment.Single),
|
1278
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
1279
|
+
# Lexemes:
|
1280
|
+
# Identifiers
|
1281
|
+
(r'\bimport\b', Keyword.Reserved, 'import'),
|
1282
|
+
(r'\bmodule\b', Keyword.Reserved, 'module'),
|
1283
|
+
(r'\berror\b', Name.Exception),
|
1284
|
+
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
1285
|
+
(r'^[_a-z][\w\']*', Name.Function),
|
1286
|
+
(r"'?[_a-z][\w']*", Name),
|
1287
|
+
(r"('')?[A-Z][\w\']*", Keyword.Type),
|
1288
|
+
# Operators
|
1289
|
+
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
|
1290
|
+
(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
1291
|
+
(r':[:!#$%&*+.\\/<=>?@^|~-]*', Keyword.Type), # Constructor operators
|
1292
|
+
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator), # Other operators
|
1293
|
+
# Numbers
|
1294
|
+
(r'\d+[eE][+-]?\d+', Number.Float),
|
1295
|
+
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
1296
|
+
(r'0[oO][0-7]+', Number.Oct),
|
1297
|
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
1298
|
+
(r'\d+', Number.Integer),
|
1299
|
+
# Character/String Literals
|
1300
|
+
(r"'", String.Char, 'character'),
|
1301
|
+
(r'"', String, 'string'),
|
1302
|
+
# Special
|
1303
|
+
(r'\[\]', Keyword.Type),
|
1304
|
+
(r'\(\)', Name.Builtin),
|
1305
|
+
(r'[][(),;`{}]', Punctuation),
|
1306
|
+
],
|
1307
|
+
'import': [
|
1308
|
+
# Import statements
|
1309
|
+
(r'\s+', Text),
|
1310
|
+
(r'"', String, 'string'),
|
1311
|
+
# after "funclist" state
|
1312
|
+
(r'\)', Punctuation, '#pop'),
|
1313
|
+
(r'qualified\b', Keyword),
|
1314
|
+
# import X as Y
|
1315
|
+
(r'([A-Z][a-zA-Z0-9_.]*)(\s+)(as)(\s+)([A-Z][a-zA-Z0-9_.]*)',
|
1316
|
+
bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'),
|
1317
|
+
# import X hiding (functions)
|
1318
|
+
(r'([A-Z][a-zA-Z0-9_.]*)(\s+)(hiding)(\s+)(\()',
|
1319
|
+
bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'),
|
1320
|
+
# import X (functions)
|
1321
|
+
(r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()',
|
1322
|
+
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
1323
|
+
# import X
|
1324
|
+
(r'[a-zA-Z0-9_.]+', Name.Namespace, '#pop'),
|
1325
|
+
],
|
1326
|
+
'module': [
|
1327
|
+
(r'\s+', Text),
|
1328
|
+
(r'([A-Z][a-zA-Z0-9_.]*)(\s+)(\()',
|
1329
|
+
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
1330
|
+
(r'[A-Z][a-zA-Z0-9_.]*', Name.Namespace, '#pop'),
|
1331
|
+
],
|
1332
|
+
'funclist': [
|
1333
|
+
(r'\s+', Text),
|
1334
|
+
(r'[A-Z][a-zA-Z0-9_]*', Keyword.Type),
|
1335
|
+
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
|
1336
|
+
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
|
1337
|
+
(r'{-', Comment.Multiline, 'comment'),
|
1338
|
+
(r',', Punctuation),
|
1339
|
+
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
|
1340
|
+
# (HACK, but it makes sense to push two instances, believe me)
|
1341
|
+
(r'\(', Punctuation, ('funclist', 'funclist')),
|
1342
|
+
(r'\)', Punctuation, '#pop:2'),
|
1343
|
+
],
|
1344
|
+
'comment': [
|
1345
|
+
# Multiline Comments
|
1346
|
+
(r'[^/\*]+', Comment.Multiline),
|
1347
|
+
(r'/\*', Comment.Multiline, '#push'),
|
1348
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
1349
|
+
(r'[\*/]', Comment.Multiline),
|
1350
|
+
],
|
1351
|
+
'character': [
|
1352
|
+
# Allows multi-chars, incorrectly.
|
1353
|
+
(r"[^\\']'", String.Char, '#pop'),
|
1354
|
+
(r"\\", String.Escape, 'escape'),
|
1355
|
+
("'", String.Char, '#pop'),
|
1356
|
+
],
|
1357
|
+
'string': [
|
1358
|
+
(r'[^\\"]+', String),
|
1359
|
+
(r"\\", String.Escape, 'escape'),
|
1360
|
+
('"', String, '#pop'),
|
1361
|
+
],
|
1362
|
+
'escape': [
|
1363
|
+
(r'[abfnrtv"\'&\\]', String.Escape, '#pop'),
|
1364
|
+
(r'\^[][A-Z@\^_]', String.Escape, '#pop'),
|
1365
|
+
('|'.join(ascii), String.Escape, '#pop'),
|
1366
|
+
(r'o[0-7]+', String.Escape, '#pop'),
|
1367
|
+
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
1368
|
+
(r'\d+', String.Escape, '#pop'),
|
1369
|
+
(r'\s+\\', String.Escape, '#pop'),
|
1370
|
+
],
|
1371
|
+
}
|
1372
|
+
|
1373
|
+
EXTRA_KEYWORDS = ['join', 'split', 'reverse', 'transpose', 'width',
|
1374
|
+
'length', 'tail', '<<', '>>', '<<<', '>>>', 'const',
|
1375
|
+
'reg', 'par', 'seq', 'ASSERT', 'undefined', 'error',
|
1376
|
+
'trace']
|
1377
|
+
|
1378
|
+
def get_tokens_unprocessed(self, text):
|
1379
|
+
stack = ['root']
|
1380
|
+
for index, token, value in \
|
1381
|
+
RegexLexer.get_tokens_unprocessed(self, text, stack):
|
1382
|
+
if token is Name and value in self.EXTRA_KEYWORDS:
|
1383
|
+
yield index, Name.Builtin, value
|
1384
|
+
else:
|
1385
|
+
yield index, token, value
|
1386
|
+
|
1387
|
+
|
897
1388
|
class HaskellLexer(RegexLexer):
|
898
1389
|
"""
|
899
1390
|
A Haskell lexer based on the lexemes defined in the Haskell 98 Report.
|
900
1391
|
|
901
|
-
|
1392
|
+
.. versionadded:: 0.8
|
902
1393
|
"""
|
903
1394
|
name = 'Haskell'
|
904
1395
|
aliases = ['haskell', 'hs']
|
905
1396
|
filenames = ['*.hs']
|
906
1397
|
mimetypes = ['text/x-haskell']
|
907
1398
|
|
1399
|
+
flags = re.MULTILINE | re.UNICODE
|
1400
|
+
|
908
1401
|
reserved = ['case','class','data','default','deriving','do','else',
|
909
1402
|
'if','in','infix[lr]?','instance',
|
910
1403
|
'let','newtype','of','then','type','where','_']
|
@@ -926,9 +1419,9 @@ class HaskellLexer(RegexLexer):
|
|
926
1419
|
(r'\bmodule\b', Keyword.Reserved, 'module'),
|
927
1420
|
(r'\berror\b', Name.Exception),
|
928
1421
|
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
929
|
-
(r'^[
|
930
|
-
(r"'?[
|
931
|
-
(r"('')?[
|
1422
|
+
(r'^[_' + uni.Ll + r'][\w\']*', Name.Function),
|
1423
|
+
(r"'?[_" + uni.Ll + r"'][\w']*", Name),
|
1424
|
+
(r"('')?[" + uni.Lu + r"][\w\']*", Keyword.Type),
|
932
1425
|
# Operators
|
933
1426
|
(r'\\(?![:!#$%&*+.\\/<=>?@^|~-]+)', Name.Function), # lambda operator
|
934
1427
|
(r'(<-|::|->|=>|=)(?![:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
@@ -956,26 +1449,135 @@ class HaskellLexer(RegexLexer):
|
|
956
1449
|
(r'\)', Punctuation, '#pop'),
|
957
1450
|
(r'qualified\b', Keyword),
|
958
1451
|
# import X as Y
|
959
|
-
(r'([
|
1452
|
+
(r'([' + uni.Lu + r'][\w.]*)(\s+)(as)(\s+)([' + uni.Lu + r'][\w.]*)',
|
960
1453
|
bygroups(Name.Namespace, Text, Keyword, Text, Name), '#pop'),
|
961
1454
|
# import X hiding (functions)
|
962
|
-
(r'([
|
1455
|
+
(r'([' + uni.Lu + r'][\w.]*)(\s+)(hiding)(\s+)(\()',
|
963
1456
|
bygroups(Name.Namespace, Text, Keyword, Text, Punctuation), 'funclist'),
|
964
1457
|
# import X (functions)
|
965
|
-
(r'([
|
1458
|
+
(r'([' + uni.Lu + r'][\w.]*)(\s+)(\()',
|
966
1459
|
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
967
1460
|
# import X
|
968
|
-
(r'[
|
1461
|
+
(r'[\w.]+', Name.Namespace, '#pop'),
|
969
1462
|
],
|
970
1463
|
'module': [
|
971
1464
|
(r'\s+', Text),
|
972
|
-
(r'([
|
1465
|
+
(r'([' + uni.Lu + r'][\w.]*)(\s+)(\()',
|
973
1466
|
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
974
|
-
(r'[
|
1467
|
+
(r'[' + uni.Lu + r'][\w.]*', Name.Namespace, '#pop'),
|
975
1468
|
],
|
976
1469
|
'funclist': [
|
977
1470
|
(r'\s+', Text),
|
978
|
-
(r'[
|
1471
|
+
(r'[' + uni.Lu + r']\w*', Keyword.Type),
|
1472
|
+
(r'(_[\w\']+|[' + uni.Ll + r'][\w\']*)', Name.Function),
|
1473
|
+
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
|
1474
|
+
(r'{-', Comment.Multiline, 'comment'),
|
1475
|
+
(r',', Punctuation),
|
1476
|
+
(r'[:!#$%&*+.\\/<=>?@^|~-]+', Operator),
|
1477
|
+
# (HACK, but it makes sense to push two instances, believe me)
|
1478
|
+
(r'\(', Punctuation, ('funclist', 'funclist')),
|
1479
|
+
(r'\)', Punctuation, '#pop:2'),
|
1480
|
+
],
|
1481
|
+
# NOTE: the next four states are shared in the AgdaLexer; make sure
|
1482
|
+
# any change is compatible with Agda as well or copy over and change
|
1483
|
+
'comment': [
|
1484
|
+
# Multiline Comments
|
1485
|
+
(r'[^-{}]+', Comment.Multiline),
|
1486
|
+
(r'{-', Comment.Multiline, '#push'),
|
1487
|
+
(r'-}', Comment.Multiline, '#pop'),
|
1488
|
+
(r'[-{}]', Comment.Multiline),
|
1489
|
+
],
|
1490
|
+
'character': [
|
1491
|
+
# Allows multi-chars, incorrectly.
|
1492
|
+
(r"[^\\']'", String.Char, '#pop'),
|
1493
|
+
(r"\\", String.Escape, 'escape'),
|
1494
|
+
("'", String.Char, '#pop'),
|
1495
|
+
],
|
1496
|
+
'string': [
|
1497
|
+
(r'[^\\"]+', String),
|
1498
|
+
(r"\\", String.Escape, 'escape'),
|
1499
|
+
('"', String, '#pop'),
|
1500
|
+
],
|
1501
|
+
'escape': [
|
1502
|
+
(r'[abfnrtv"\'&\\]', String.Escape, '#pop'),
|
1503
|
+
(r'\^[][' + uni.Lu + r'@\^_]', String.Escape, '#pop'),
|
1504
|
+
('|'.join(ascii), String.Escape, '#pop'),
|
1505
|
+
(r'o[0-7]+', String.Escape, '#pop'),
|
1506
|
+
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
1507
|
+
(r'\d+', String.Escape, '#pop'),
|
1508
|
+
(r'\s+\\', String.Escape, '#pop'),
|
1509
|
+
],
|
1510
|
+
}
|
1511
|
+
|
1512
|
+
|
1513
|
+
class IdrisLexer(RegexLexer):
|
1514
|
+
"""
|
1515
|
+
A lexer for the dependently typed programming language Idris.
|
1516
|
+
|
1517
|
+
Based on the Haskell and Agda Lexer.
|
1518
|
+
|
1519
|
+
.. versionadded:: 2.0
|
1520
|
+
"""
|
1521
|
+
name = 'Idris'
|
1522
|
+
aliases = ['idris', 'idr']
|
1523
|
+
filenames = ['*.idr']
|
1524
|
+
mimetypes = ['text/x-idris']
|
1525
|
+
|
1526
|
+
reserved = ['case','class','data','default','using','do','else',
|
1527
|
+
'if','in','infix[lr]?','instance','rewrite','auto',
|
1528
|
+
'namespace','codata','mutual','private','public','abstract',
|
1529
|
+
'total','partial',
|
1530
|
+
'let','proof','of','then','static','where','_','with',
|
1531
|
+
'pattern', 'term', 'syntax','prefix',
|
1532
|
+
'postulate','parameters','record','dsl','impossible','implicit',
|
1533
|
+
'tactics','intros','intro','compute','refine','exaxt','trivial']
|
1534
|
+
|
1535
|
+
ascii = ['NUL','SOH','[SE]TX','EOT','ENQ','ACK',
|
1536
|
+
'BEL','BS','HT','LF','VT','FF','CR','S[OI]','DLE',
|
1537
|
+
'DC[1-4]','NAK','SYN','ETB','CAN',
|
1538
|
+
'EM','SUB','ESC','[FGRU]S','SP','DEL']
|
1539
|
+
|
1540
|
+
annotations = ['assert_total','lib','link','include','provide','access',
|
1541
|
+
'default']
|
1542
|
+
|
1543
|
+
tokens = {
|
1544
|
+
'root': [
|
1545
|
+
# Declaration
|
1546
|
+
(r'^(\s*)([^\s\(\)\{\}]+)(\s*)(:)(\s*)',
|
1547
|
+
bygroups(Text, Name.Function, Text, Operator.Word, Text)),
|
1548
|
+
# Comments
|
1549
|
+
(r'^(\s*)(%%%s)' % '|'.join(annotations),
|
1550
|
+
bygroups(Text, Keyword.Reserved)),
|
1551
|
+
(r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
|
1552
|
+
(r'{-', Comment.Multiline, 'comment'),
|
1553
|
+
# Identifiers
|
1554
|
+
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
1555
|
+
(r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'),
|
1556
|
+
(r"('')?[A-Z][\w\']*", Keyword.Type),
|
1557
|
+
(r'[a-z][\w\']*', Text),
|
1558
|
+
# Special Symbols
|
1559
|
+
(r'(<-|::|->|=>|=)', Operator.Word), # specials
|
1560
|
+
(r'([\(\)\{\}\[\]:!#$%&*+.\\/<=>?@^|~-]+)', Operator.Word), # specials
|
1561
|
+
# Numbers
|
1562
|
+
(r'\d+[eE][+-]?\d+', Number.Float),
|
1563
|
+
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
1564
|
+
(r'0[xX][\da-fA-F]+', Number.Hex),
|
1565
|
+
(r'\d+', Number.Integer),
|
1566
|
+
# Strings
|
1567
|
+
(r"'", String.Char, 'character'),
|
1568
|
+
(r'"', String, 'string'),
|
1569
|
+
(r'[^\s\(\)\{\}]+', Text),
|
1570
|
+
(r'\s+?', Text), # Whitespace
|
1571
|
+
],
|
1572
|
+
'module': [
|
1573
|
+
(r'\s+', Text),
|
1574
|
+
(r'([A-Z][\w.]*)(\s+)(\()',
|
1575
|
+
bygroups(Name.Namespace, Text, Punctuation), 'funclist'),
|
1576
|
+
(r'[A-Z][\w.]*', Name.Namespace, '#pop'),
|
1577
|
+
],
|
1578
|
+
'funclist': [
|
1579
|
+
(r'\s+', Text),
|
1580
|
+
(r'[A-Z]\w*', Keyword.Type),
|
979
1581
|
(r'(_[\w\']+|[a-z][\w\']*)', Name.Function),
|
980
1582
|
(r'--.*$', Comment.Single),
|
981
1583
|
(r'{-', Comment.Multiline, 'comment'),
|
@@ -1012,7 +1614,7 @@ class HaskellLexer(RegexLexer):
|
|
1012
1614
|
(r'o[0-7]+', String.Escape, '#pop'),
|
1013
1615
|
(r'x[\da-fA-F]+', String.Escape, '#pop'),
|
1014
1616
|
(r'\d+', String.Escape, '#pop'),
|
1015
|
-
(r'\s+\\', String.Escape, '#pop')
|
1617
|
+
(r'\s+\\', String.Escape, '#pop')
|
1016
1618
|
],
|
1017
1619
|
}
|
1018
1620
|
|
@@ -1022,7 +1624,7 @@ class AgdaLexer(RegexLexer):
|
|
1022
1624
|
For the `Agda <http://wiki.portal.chalmers.se/agda/pmwiki.php>`_
|
1023
1625
|
dependently typed functional programming language and proof assistant.
|
1024
1626
|
|
1025
|
-
|
1627
|
+
.. versionadded:: 2.0
|
1026
1628
|
"""
|
1027
1629
|
|
1028
1630
|
name = 'Agda'
|
@@ -1049,12 +1651,12 @@ class AgdaLexer(RegexLexer):
|
|
1049
1651
|
(r'{!', Comment.Directive, 'hole'),
|
1050
1652
|
# Lexemes:
|
1051
1653
|
# Identifiers
|
1052
|
-
(
|
1654
|
+
(r'\b(%s)(?!\')\b' % '|'.join(reserved), Keyword.Reserved),
|
1053
1655
|
(r'(import|module)(\s+)', bygroups(Keyword.Reserved, Text), 'module'),
|
1054
1656
|
(r'\b(Set|Prop)\b', Keyword.Type),
|
1055
1657
|
# Special Symbols
|
1056
1658
|
(r'(\(|\)|\{|\})', Operator),
|
1057
|
-
(
|
1659
|
+
(u'(\\.{1,3}|\\||\u039B|\u2200|\u2192|:|=|->)', Operator.Word),
|
1058
1660
|
# Numbers
|
1059
1661
|
(r'\d+[eE][+-]?\d+', Number.Float),
|
1060
1662
|
(r'\d+\.\d+([eE][+-]?\d+)?', Number.Float),
|
@@ -1075,7 +1677,7 @@ class AgdaLexer(RegexLexer):
|
|
1075
1677
|
],
|
1076
1678
|
'module': [
|
1077
1679
|
(r'{-', Comment.Multiline, 'comment'),
|
1078
|
-
(r'[a-zA-Z][
|
1680
|
+
(r'[a-zA-Z][\w.]*', Name, '#pop'),
|
1079
1681
|
(r'[^a-zA-Z]*', Text)
|
1080
1682
|
],
|
1081
1683
|
'comment': HaskellLexer.tokens['comment'],
|
@@ -1150,6 +1752,29 @@ class LiterateLexer(Lexer):
|
|
1150
1752
|
yield item
|
1151
1753
|
|
1152
1754
|
|
1755
|
+
class LiterateCryptolLexer(LiterateLexer):
|
1756
|
+
"""
|
1757
|
+
For Literate Cryptol (Bird-style or LaTeX) source.
|
1758
|
+
|
1759
|
+
Additional options accepted:
|
1760
|
+
|
1761
|
+
`litstyle`
|
1762
|
+
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
1763
|
+
is autodetected: if the first non-whitespace character in the source
|
1764
|
+
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1765
|
+
|
1766
|
+
.. versionadded:: 0.9
|
1767
|
+
"""
|
1768
|
+
name = 'Literate Cryptol'
|
1769
|
+
aliases = ['lcry', 'literate-cryptol', 'lcryptol']
|
1770
|
+
filenames = ['*.lcry']
|
1771
|
+
mimetypes = ['text/x-literate-cryptol']
|
1772
|
+
|
1773
|
+
def __init__(self, **options):
|
1774
|
+
crylexer = CryptolLexer(**options)
|
1775
|
+
LiterateLexer.__init__(self, crylexer, **options)
|
1776
|
+
|
1777
|
+
|
1153
1778
|
class LiterateHaskellLexer(LiterateLexer):
|
1154
1779
|
"""
|
1155
1780
|
For Literate Haskell (Bird-style or LaTeX) source.
|
@@ -1161,7 +1786,7 @@ class LiterateHaskellLexer(LiterateLexer):
|
|
1161
1786
|
is autodetected: if the first non-whitespace character in the source
|
1162
1787
|
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1163
1788
|
|
1164
|
-
|
1789
|
+
.. versionadded:: 0.9
|
1165
1790
|
"""
|
1166
1791
|
name = 'Literate Haskell'
|
1167
1792
|
aliases = ['lhs', 'literate-haskell', 'lhaskell']
|
@@ -1173,6 +1798,29 @@ class LiterateHaskellLexer(LiterateLexer):
|
|
1173
1798
|
LiterateLexer.__init__(self, hslexer, **options)
|
1174
1799
|
|
1175
1800
|
|
1801
|
+
class LiterateIdrisLexer(LiterateLexer):
|
1802
|
+
"""
|
1803
|
+
For Literate Idris (Bird-style or LaTeX) source.
|
1804
|
+
|
1805
|
+
Additional options accepted:
|
1806
|
+
|
1807
|
+
`litstyle`
|
1808
|
+
If given, must be ``"bird"`` or ``"latex"``. If not given, the style
|
1809
|
+
is autodetected: if the first non-whitespace character in the source
|
1810
|
+
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1811
|
+
|
1812
|
+
.. versionadded:: 2.0
|
1813
|
+
"""
|
1814
|
+
name = 'Literate Idris'
|
1815
|
+
aliases = ['lidr', 'literate-idris', 'lidris']
|
1816
|
+
filenames = ['*.lidr']
|
1817
|
+
mimetypes = ['text/x-literate-idris']
|
1818
|
+
|
1819
|
+
def __init__(self, **options):
|
1820
|
+
hslexer = IdrisLexer(**options)
|
1821
|
+
LiterateLexer.__init__(self, hslexer, **options)
|
1822
|
+
|
1823
|
+
|
1176
1824
|
class LiterateAgdaLexer(LiterateLexer):
|
1177
1825
|
"""
|
1178
1826
|
For Literate Agda source.
|
@@ -1184,7 +1832,7 @@ class LiterateAgdaLexer(LiterateLexer):
|
|
1184
1832
|
is autodetected: if the first non-whitespace character in the source
|
1185
1833
|
is a backslash or percent character, LaTeX is assumed, else Bird.
|
1186
1834
|
|
1187
|
-
|
1835
|
+
.. versionadded:: 2.0
|
1188
1836
|
"""
|
1189
1837
|
name = 'Literate Agda'
|
1190
1838
|
aliases = ['lagda', 'literate-agda']
|
@@ -1200,7 +1848,7 @@ class SMLLexer(RegexLexer):
|
|
1200
1848
|
"""
|
1201
1849
|
For the Standard ML language.
|
1202
1850
|
|
1203
|
-
|
1851
|
+
.. versionadded:: 1.5
|
1204
1852
|
"""
|
1205
1853
|
|
1206
1854
|
name = 'Standard ML'
|
@@ -1228,7 +1876,7 @@ class SMLLexer(RegexLexer):
|
|
1228
1876
|
|
1229
1877
|
nonid_reserved = [ '(', ')', '[', ']', '{', '}', ',', ';', '...', '_' ]
|
1230
1878
|
|
1231
|
-
alphanumid_re = r"[a-zA-Z][
|
1879
|
+
alphanumid_re = r"[a-zA-Z][\w']*"
|
1232
1880
|
symbolicid_re = r"[!%&$#+\-/:<=>?@\\~`^|*]+"
|
1233
1881
|
|
1234
1882
|
# A character constant is a sequence of the form #s, where s is a string
|
@@ -1318,7 +1966,7 @@ class SMLLexer(RegexLexer):
|
|
1318
1966
|
(r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'),
|
1319
1967
|
|
1320
1968
|
# Regular identifiers, long and otherwise
|
1321
|
-
(r'\'[
|
1969
|
+
(r'\'[\w\']*', Name.Decorator),
|
1322
1970
|
(r'(%s)(\.)' % alphanumid_re, long_id_callback, "dotted"),
|
1323
1971
|
(r'(%s)' % alphanumid_re, id_callback),
|
1324
1972
|
(r'(%s)' % symbolicid_re, id_callback),
|
@@ -1333,7 +1981,7 @@ class SMLLexer(RegexLexer):
|
|
1333
1981
|
|
1334
1982
|
|
1335
1983
|
# Main parser (prevents errors in files that have scoping errors)
|
1336
|
-
'root': [ (
|
1984
|
+
'root': [ default('main') ],
|
1337
1985
|
|
1338
1986
|
# In this scope, I expect '|' to not be followed by a function name,
|
1339
1987
|
# and I expect 'and' to be followed by a binding site
|
@@ -1386,7 +2034,7 @@ class SMLLexer(RegexLexer):
|
|
1386
2034
|
include('breakout'),
|
1387
2035
|
|
1388
2036
|
(r'(%s)' % alphanumid_re, Name.Namespace),
|
1389
|
-
(
|
2037
|
+
default('#pop'),
|
1390
2038
|
],
|
1391
2039
|
|
1392
2040
|
# Dealing with what comes after the 'fun' (or 'and' or '|') keyword
|
@@ -1399,7 +2047,7 @@ class SMLLexer(RegexLexer):
|
|
1399
2047
|
(r'(%s)' % symbolicid_re, Name.Function, '#pop'),
|
1400
2048
|
|
1401
2049
|
# Ignore interesting function declarations like "fun (x + y) = ..."
|
1402
|
-
(
|
2050
|
+
default('#pop'),
|
1403
2051
|
],
|
1404
2052
|
|
1405
2053
|
# Dealing with what comes after the 'val' (or 'and') keyword
|
@@ -1416,7 +2064,7 @@ class SMLLexer(RegexLexer):
|
|
1416
2064
|
(r'(%s)' % symbolicid_re, Name.Variable, '#pop'),
|
1417
2065
|
|
1418
2066
|
# Ignore interesting patterns like 'val (x, y)'
|
1419
|
-
(
|
2067
|
+
default('#pop'),
|
1420
2068
|
],
|
1421
2069
|
|
1422
2070
|
# Dealing with what comes after the 'type' (or 'and') keyword
|
@@ -1526,7 +2174,7 @@ class OcamlLexer(RegexLexer):
|
|
1526
2174
|
"""
|
1527
2175
|
For the OCaml language.
|
1528
2176
|
|
1529
|
-
|
2177
|
+
.. versionadded:: 0.7
|
1530
2178
|
"""
|
1531
2179
|
|
1532
2180
|
name = 'OCaml'
|
@@ -1565,9 +2213,9 @@ class OcamlLexer(RegexLexer):
|
|
1565
2213
|
'root': [
|
1566
2214
|
(r'\s+', Text),
|
1567
2215
|
(r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
|
1568
|
-
(r'\b([A-Z][
|
2216
|
+
(r'\b([A-Z][\w\']*)(?=\s*\.)',
|
1569
2217
|
Name.Namespace, 'dotted'),
|
1570
|
-
(r'\b([A-Z][
|
2218
|
+
(r'\b([A-Z][\w\']*)', Name.Class),
|
1571
2219
|
(r'\(\*(?![)])', Comment, 'comment'),
|
1572
2220
|
(r'\b(%s)\b' % '|'.join(keywords), Keyword),
|
1573
2221
|
(r'(%s)' % '|'.join(keyopts[::-1]), Operator),
|
@@ -1580,7 +2228,7 @@ class OcamlLexer(RegexLexer):
|
|
1580
2228
|
(r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
|
1581
2229
|
(r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
|
1582
2230
|
(r'0[oO][0-7][0-7_]*', Number.Oct),
|
1583
|
-
(r'0[bB][01][01_]*', Number.
|
2231
|
+
(r'0[bB][01][01_]*', Number.Bin),
|
1584
2232
|
(r'\d[\d_]*', Number.Integer),
|
1585
2233
|
|
1586
2234
|
(r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
|
@@ -1607,9 +2255,9 @@ class OcamlLexer(RegexLexer):
|
|
1607
2255
|
'dotted': [
|
1608
2256
|
(r'\s+', Text),
|
1609
2257
|
(r'\.', Punctuation),
|
1610
|
-
(r'[A-Z][
|
1611
|
-
(r'[A-Z][
|
1612
|
-
(r'[a-z_][
|
2258
|
+
(r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
|
2259
|
+
(r'[A-Z][\w\']*', Name.Class, '#pop'),
|
2260
|
+
(r'[a-z_][\w\']*', Name, '#pop'),
|
1613
2261
|
],
|
1614
2262
|
}
|
1615
2263
|
|
@@ -1620,7 +2268,7 @@ class ErlangLexer(RegexLexer):
|
|
1620
2268
|
|
1621
2269
|
Blame Jeremy Thurgood (http://jerith.za.net/).
|
1622
2270
|
|
1623
|
-
|
2271
|
+
.. versionadded:: 0.9
|
1624
2272
|
"""
|
1625
2273
|
|
1626
2274
|
name = 'Erlang'
|
@@ -1669,9 +2317,9 @@ class ErlangLexer(RegexLexer):
|
|
1669
2317
|
'div', 'not', 'or', 'orelse', 'rem', 'xor'
|
1670
2318
|
]
|
1671
2319
|
|
1672
|
-
atom_re = r"(?:[a-z]
|
2320
|
+
atom_re = r"(?:[a-z]\w*|'[^\n']*[^\\]')"
|
1673
2321
|
|
1674
|
-
variable_re = r'(?:[A-Z_]
|
2322
|
+
variable_re = r'(?:[A-Z_]\w*)'
|
1675
2323
|
|
1676
2324
|
escape_re = r'(?:\\(?:[bdefnrstv\'"\\/]|[0-7][0-7]?[0-7]?|\^[a-zA-Z]))'
|
1677
2325
|
|
@@ -1725,7 +2373,7 @@ class ErlangShellLexer(Lexer):
|
|
1725
2373
|
"""
|
1726
2374
|
Shell sessions in erl (for Erlang code).
|
1727
2375
|
|
1728
|
-
|
2376
|
+
.. versionadded:: 1.1
|
1729
2377
|
"""
|
1730
2378
|
name = 'Erlang erl session'
|
1731
2379
|
aliases = ['erl']
|
@@ -1768,7 +2416,7 @@ class OpaLexer(RegexLexer):
|
|
1768
2416
|
"""
|
1769
2417
|
Lexer for the Opa language (http://opalang.org).
|
1770
2418
|
|
1771
|
-
|
2419
|
+
.. versionadded:: 1.5
|
1772
2420
|
"""
|
1773
2421
|
|
1774
2422
|
name = 'Opa'
|
@@ -1828,7 +2476,7 @@ class OpaLexer(RegexLexer):
|
|
1828
2476
|
(r'-?\d+[eE][+\-]?\d+', Number.Float),
|
1829
2477
|
(r'0[xX][\da-fA-F]+', Number.Hex),
|
1830
2478
|
(r'0[oO][0-7]+', Number.Oct),
|
1831
|
-
(r'0[bB][01]+', Number.
|
2479
|
+
(r'0[bB][01]+', Number.Bin),
|
1832
2480
|
(r'\d+', Number.Integer),
|
1833
2481
|
# color literals
|
1834
2482
|
(r'#[\da-fA-F]{3,6}', Number.Integer),
|
@@ -1918,7 +2566,7 @@ class OpaLexer(RegexLexer):
|
|
1918
2566
|
'type': [
|
1919
2567
|
include('comments-and-spaces'),
|
1920
2568
|
(r'->', Keyword.Type),
|
1921
|
-
(
|
2569
|
+
default(('#pop', 'type-lhs-1', 'type-with-slash')),
|
1922
2570
|
],
|
1923
2571
|
|
1924
2572
|
# parses all the atomic or closed constructions in the syntax of type
|
@@ -1935,7 +2583,7 @@ class OpaLexer(RegexLexer):
|
|
1935
2583
|
# we think we are parsing types when in fact we are parsing
|
1936
2584
|
# some css, so we just pop the states until we get back into
|
1937
2585
|
# the root state
|
1938
|
-
(
|
2586
|
+
default('#pop'),
|
1939
2587
|
],
|
1940
2588
|
|
1941
2589
|
# type-with-slash is either:
|
@@ -1943,13 +2591,13 @@ class OpaLexer(RegexLexer):
|
|
1943
2591
|
# * type-1 (/ type-1)+
|
1944
2592
|
'type-with-slash': [
|
1945
2593
|
include('comments-and-spaces'),
|
1946
|
-
(
|
2594
|
+
default(('#pop', 'slash-type-1', 'type-1')),
|
1947
2595
|
],
|
1948
2596
|
'slash-type-1': [
|
1949
2597
|
include('comments-and-spaces'),
|
1950
2598
|
('/', Keyword.Type, ('#pop', 'type-1')),
|
1951
2599
|
# same remark as above
|
1952
|
-
(
|
2600
|
+
default('#pop'),
|
1953
2601
|
],
|
1954
2602
|
|
1955
2603
|
# we go in this state after having parsed a type-with-slash
|
@@ -1961,7 +2609,7 @@ class OpaLexer(RegexLexer):
|
|
1961
2609
|
include('comments-and-spaces'),
|
1962
2610
|
(r'->', Keyword.Type, ('#pop', 'type')),
|
1963
2611
|
(r'(?=,)', Keyword.Type, ('#pop', 'type-arrow')),
|
1964
|
-
(
|
2612
|
+
default('#pop'),
|
1965
2613
|
],
|
1966
2614
|
'type-arrow': [
|
1967
2615
|
include('comments-and-spaces'),
|
@@ -1970,7 +2618,7 @@ class OpaLexer(RegexLexer):
|
|
1970
2618
|
(r',(?=[^:]*?->)', Keyword.Type, 'type-with-slash'),
|
1971
2619
|
(r'->', Keyword.Type, ('#pop', 'type')),
|
1972
2620
|
# same remark as above
|
1973
|
-
(
|
2621
|
+
default('#pop'),
|
1974
2622
|
],
|
1975
2623
|
|
1976
2624
|
# no need to do precise parsing for tuples and records
|
@@ -1997,7 +2645,7 @@ class OpaLexer(RegexLexer):
|
|
1997
2645
|
# 'type-tuple': [
|
1998
2646
|
# include('comments-and-spaces'),
|
1999
2647
|
# (r'\)', Keyword.Type, '#pop'),
|
2000
|
-
# (
|
2648
|
+
# default(('#pop', 'type-tuple-1', 'type-1')),
|
2001
2649
|
# ],
|
2002
2650
|
# 'type-tuple-1': [
|
2003
2651
|
# include('comments-and-spaces'),
|
@@ -2091,7 +2739,7 @@ class CoqLexer(RegexLexer):
|
|
2091
2739
|
"""
|
2092
2740
|
For the `Coq <http://coq.inria.fr/>`_ theorem prover.
|
2093
2741
|
|
2094
|
-
|
2742
|
+
.. versionadded:: 1.5
|
2095
2743
|
"""
|
2096
2744
|
|
2097
2745
|
name = 'Coq'
|
@@ -2177,9 +2825,9 @@ class CoqLexer(RegexLexer):
|
|
2177
2825
|
(r'\b(%s)\b' % '|'.join(keywords4), Keyword),
|
2178
2826
|
(r'\b(%s)\b' % '|'.join(keywords5), Keyword.Pseudo),
|
2179
2827
|
(r'\b(%s)\b' % '|'.join(keywords6), Keyword.Reserved),
|
2180
|
-
(r'\b([A-Z][
|
2828
|
+
(r'\b([A-Z][\w\']*)(?=\s*\.)',
|
2181
2829
|
Name.Namespace, 'dotted'),
|
2182
|
-
(r'\b([A-Z][
|
2830
|
+
(r'\b([A-Z][\w\']*)', Name.Class),
|
2183
2831
|
(r'(%s)' % '|'.join(keyopts[::-1]), Operator),
|
2184
2832
|
(r'(%s|%s)?%s' % (infix_syms, prefix_syms, operators), Operator),
|
2185
2833
|
(r'\b(%s)\b' % '|'.join(word_operators), Operator.Word),
|
@@ -2190,7 +2838,7 @@ class CoqLexer(RegexLexer):
|
|
2190
2838
|
(r'\d[\d_]*', Number.Integer),
|
2191
2839
|
(r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
|
2192
2840
|
(r'0[oO][0-7][0-7_]*', Number.Oct),
|
2193
|
-
(r'0[bB][01][01_]*', Number.
|
2841
|
+
(r'0[bB][01][01_]*', Number.Bin),
|
2194
2842
|
(r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
|
2195
2843
|
|
2196
2844
|
(r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
|
@@ -2216,10 +2864,10 @@ class CoqLexer(RegexLexer):
|
|
2216
2864
|
'dotted': [
|
2217
2865
|
(r'\s+', Text),
|
2218
2866
|
(r'\.', Punctuation),
|
2219
|
-
(r'[A-Z][
|
2220
|
-
(r'[A-Z][
|
2867
|
+
(r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
|
2868
|
+
(r'[A-Z][\w\']*', Name.Class, '#pop'),
|
2221
2869
|
(r'[a-z][a-z0-9_\']*', Name, '#pop'),
|
2222
|
-
(
|
2870
|
+
default('#pop')
|
2223
2871
|
],
|
2224
2872
|
}
|
2225
2873
|
|
@@ -2232,7 +2880,7 @@ class NewLispLexer(RegexLexer):
|
|
2232
2880
|
"""
|
2233
2881
|
For `newLISP. <www.newlisp.org>`_ source code (version 10.3.0).
|
2234
2882
|
|
2235
|
-
|
2883
|
+
.. versionadded:: 1.5
|
2236
2884
|
"""
|
2237
2885
|
|
2238
2886
|
name = 'NewLisp'
|
@@ -2305,7 +2953,7 @@ class NewLispLexer(RegexLexer):
|
|
2305
2953
|
]
|
2306
2954
|
|
2307
2955
|
# valid names
|
2308
|
-
valid_name = r'([
|
2956
|
+
valid_name = r'([\w!$%&*+.,/<=>?@^~|-])+|(\[.*?\])+'
|
2309
2957
|
|
2310
2958
|
tokens = {
|
2311
2959
|
'root': [
|
@@ -2359,11 +3007,160 @@ class NewLispLexer(RegexLexer):
|
|
2359
3007
|
}
|
2360
3008
|
|
2361
3009
|
|
3010
|
+
class NixLexer(RegexLexer):
|
3011
|
+
"""
|
3012
|
+
For the `Nix language <http://nixos.org/nix/>`_.
|
3013
|
+
|
3014
|
+
.. versionadded:: 2.0
|
3015
|
+
"""
|
3016
|
+
|
3017
|
+
name = 'Nix'
|
3018
|
+
aliases = ['nixos', 'nix']
|
3019
|
+
filenames = ['*.nix']
|
3020
|
+
mimetypes = ['text/x-nix']
|
3021
|
+
|
3022
|
+
flags = re.MULTILINE | re.UNICODE
|
3023
|
+
|
3024
|
+
keywords = ['rec', 'with', 'let', 'in', 'inherit', 'assert', 'if',
|
3025
|
+
'else', 'then', '...']
|
3026
|
+
builtins = ['import', 'abort', 'baseNameOf', 'dirOf', 'isNull', 'builtins',
|
3027
|
+
'map', 'removeAttrs', 'throw', 'toString', 'derivation']
|
3028
|
+
operators = ['++', '+', '?', '.', '!', '//', '==',
|
3029
|
+
'!=', '&&', '||', '->', '=']
|
3030
|
+
|
3031
|
+
punctuations = ["(", ")", "[", "]", ";", "{", "}", ":", ",", "@"]
|
3032
|
+
|
3033
|
+
tokens = {
|
3034
|
+
'root': [
|
3035
|
+
# comments starting with #
|
3036
|
+
(r'#.*$', Comment.Single),
|
3037
|
+
|
3038
|
+
# multiline comments
|
3039
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
3040
|
+
|
3041
|
+
# whitespace
|
3042
|
+
(r'\s+', Text),
|
3043
|
+
|
3044
|
+
# keywords
|
3045
|
+
('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in keywords), Keyword),
|
3046
|
+
|
3047
|
+
# highlight the builtins
|
3048
|
+
('(%s)' % '|'.join(re.escape(entry) + '\\b' for entry in builtins),
|
3049
|
+
Name.Builtin),
|
3050
|
+
|
3051
|
+
(r'\b(true|false|null)\b', Name.Constant),
|
3052
|
+
|
3053
|
+
# operators
|
3054
|
+
('(%s)' % '|'.join(re.escape(entry) for entry in operators),
|
3055
|
+
Operator),
|
3056
|
+
|
3057
|
+
# word operators
|
3058
|
+
(r'\b(or|and)\b', Operator.Word),
|
3059
|
+
|
3060
|
+
# punctuations
|
3061
|
+
('(%s)' % '|'.join(re.escape(entry) for entry in punctuations), Punctuation),
|
3062
|
+
|
3063
|
+
# integers
|
3064
|
+
(r'[0-9]+', Number.Integer),
|
3065
|
+
|
3066
|
+
# strings
|
3067
|
+
(r'"', String.Double, 'doublequote'),
|
3068
|
+
(r"''", String.Single, 'singlequote'),
|
3069
|
+
|
3070
|
+
# paths
|
3071
|
+
(r'[\w.+-]*(\/[\w.+-]+)+', Literal),
|
3072
|
+
(r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal),
|
3073
|
+
|
3074
|
+
# urls
|
3075
|
+
(r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[\w%/?:@&=+$,\\.!~*\'-]+', Literal),
|
3076
|
+
|
3077
|
+
# names of variables
|
3078
|
+
(r'[\w-]+\s*=', String.Symbol),
|
3079
|
+
(r'[a-zA-Z_][\w\'-]*', Text),
|
3080
|
+
|
3081
|
+
],
|
3082
|
+
'comment': [
|
3083
|
+
(r'[^/\*]+', Comment.Multiline),
|
3084
|
+
(r'/\*', Comment.Multiline, '#push'),
|
3085
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
3086
|
+
(r'[\*/]', Comment.Multiline),
|
3087
|
+
],
|
3088
|
+
'singlequote': [
|
3089
|
+
(r"'''", String.Escape),
|
3090
|
+
(r"''\$\{", String.Escape),
|
3091
|
+
(r"''\n", String.Escape),
|
3092
|
+
(r"''\r", String.Escape),
|
3093
|
+
(r"''\t", String.Escape),
|
3094
|
+
(r"''", String.Single, '#pop'),
|
3095
|
+
(r'\$\{', String.Interpol, 'antiquote'),
|
3096
|
+
(r"[^']", String.Single),
|
3097
|
+
],
|
3098
|
+
'doublequote': [
|
3099
|
+
(r'\\', String.Escape),
|
3100
|
+
(r'\\"', String.Escape),
|
3101
|
+
(r'\\${', String.Escape),
|
3102
|
+
(r'"', String.Double, '#pop'),
|
3103
|
+
(r'\$\{', String.Interpol, 'antiquote'),
|
3104
|
+
(r'[^"]', String.Double),
|
3105
|
+
],
|
3106
|
+
'antiquote': [
|
3107
|
+
(r"}", String.Interpol, '#pop'),
|
3108
|
+
# TODO: we should probably escape also here ''${ \${
|
3109
|
+
(r"\$\{", String.Interpol, '#push'),
|
3110
|
+
include('root'),
|
3111
|
+
],
|
3112
|
+
}
|
3113
|
+
|
3114
|
+
def analyse_text(text):
|
3115
|
+
rv = 0.0
|
3116
|
+
# TODO: let/in
|
3117
|
+
if re.search(r'import.+?<[^>]+>', text):
|
3118
|
+
rv += 0.4
|
3119
|
+
if re.search(r'mkDerivation\s+(\(|\{|rec)', text):
|
3120
|
+
rv += 0.4
|
3121
|
+
if re.search(r'with\s+[a-zA-Z\.]+;', text):
|
3122
|
+
rv += 0.2
|
3123
|
+
if re.search(r'inherit\s+[a-zA-Z()\.];', text):
|
3124
|
+
rv += 0.2
|
3125
|
+
if re.search(r'=\s+mkIf\s+', text):
|
3126
|
+
rv += 0.4
|
3127
|
+
if re.search(r'\{[a-zA-Z,\s]+\}:', text):
|
3128
|
+
rv += 0.1
|
3129
|
+
return rv
|
3130
|
+
|
3131
|
+
|
3132
|
+
def gen_elixir_string_rules(name, symbol, token):
|
3133
|
+
states = {}
|
3134
|
+
states['string_' + name] = [
|
3135
|
+
(r'[^#%s\\]+' % (symbol,), token),
|
3136
|
+
include('escapes'),
|
3137
|
+
(r'\\.', token),
|
3138
|
+
(r'(%s)(:?)' % (symbol,), bygroups(token, Punctuation), "#pop"),
|
3139
|
+
include('interpol')
|
3140
|
+
]
|
3141
|
+
return states
|
3142
|
+
|
3143
|
+
def gen_elixir_sigstr_rules(term, token, interpol=True):
|
3144
|
+
if interpol:
|
3145
|
+
return [
|
3146
|
+
(r'[^#%s\\]+' % (term,), token),
|
3147
|
+
include('escapes'),
|
3148
|
+
(r'\\.', token),
|
3149
|
+
(r'%s[a-zA-Z]*' % (term,), token, '#pop'),
|
3150
|
+
include('interpol')
|
3151
|
+
]
|
3152
|
+
else:
|
3153
|
+
return [
|
3154
|
+
(r'[^%s\\]+' % (term,), token),
|
3155
|
+
(r'\\.', token),
|
3156
|
+
(r'%s[a-zA-Z]*' % (term,), token, '#pop'),
|
3157
|
+
]
|
3158
|
+
|
2362
3159
|
class ElixirLexer(RegexLexer):
|
2363
3160
|
"""
|
2364
3161
|
For the `Elixir language <http://elixir-lang.org>`_.
|
2365
3162
|
|
2366
|
-
|
3163
|
+
.. versionadded:: 1.5
|
2367
3164
|
"""
|
2368
3165
|
|
2369
3166
|
name = 'Elixir'
|
@@ -2371,89 +3168,228 @@ class ElixirLexer(RegexLexer):
|
|
2371
3168
|
filenames = ['*.ex', '*.exs']
|
2372
3169
|
mimetypes = ['text/x-elixir']
|
2373
3170
|
|
3171
|
+
KEYWORD = ['fn', 'do', 'end', 'after', 'else', 'rescue', 'catch']
|
3172
|
+
KEYWORD_OPERATOR = ['not', 'and', 'or', 'xor', 'when', 'in']
|
3173
|
+
BUILTIN = [
|
3174
|
+
'case', 'cond', 'for', 'if', 'unless', 'try', 'receive', 'raise',
|
3175
|
+
'quote', 'unquote', 'unquote_splicing', 'throw', 'super'
|
3176
|
+
]
|
3177
|
+
BUILTIN_DECLARATION = [
|
3178
|
+
'def', 'defp', 'defmodule', 'defprotocol', 'defmacro', 'defmacrop',
|
3179
|
+
'defdelegate', 'defexception', 'defstruct', 'defimpl', 'defcallback'
|
3180
|
+
]
|
3181
|
+
|
3182
|
+
BUILTIN_NAMESPACE = ['import', 'require', 'use', 'alias']
|
3183
|
+
CONSTANT = ['nil', 'true', 'false']
|
3184
|
+
|
3185
|
+
PSEUDO_VAR = ['_', '__MODULE__', '__DIR__', '__ENV__', '__CALLER__']
|
3186
|
+
|
3187
|
+
OPERATORS3 = ['<<<', '>>>', '|||', '&&&', '^^^', '~~~', '===', '!==']
|
3188
|
+
OPERATORS2 = [
|
3189
|
+
'==', '!=', '<=', '>=', '&&', '||', '<>', '++', '--', '|>', '=~'
|
3190
|
+
]
|
3191
|
+
OPERATORS1 = ['<', '>', '+', '-', '*', '/', '!', '^', '&']
|
3192
|
+
|
3193
|
+
PUNCTUATION = [
|
3194
|
+
'\\\\', '<<', '>>', '::', '->', '<-', '=>', '|', '(', ')',
|
3195
|
+
'{', '}', ';', ',', '.', '[', ']', '%', '='
|
3196
|
+
]
|
3197
|
+
|
3198
|
+
def get_tokens_unprocessed(self, text):
|
3199
|
+
for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
|
3200
|
+
if token is Name:
|
3201
|
+
if value in self.KEYWORD:
|
3202
|
+
yield index, Keyword, value
|
3203
|
+
elif value in self.KEYWORD_OPERATOR:
|
3204
|
+
yield index, Operator.Word, value
|
3205
|
+
elif value in self.BUILTIN:
|
3206
|
+
yield index, Keyword, value
|
3207
|
+
elif value in self.BUILTIN_DECLARATION:
|
3208
|
+
yield index, Keyword.Declaration, value
|
3209
|
+
elif value in self.BUILTIN_NAMESPACE:
|
3210
|
+
yield index, Keyword.Namespace, value
|
3211
|
+
elif value in self.CONSTANT:
|
3212
|
+
yield index, Name.Constant, value
|
3213
|
+
elif value in self.PSEUDO_VAR:
|
3214
|
+
yield index, Name.Builtin.Pseudo, value
|
3215
|
+
else:
|
3216
|
+
yield index, token, value
|
3217
|
+
else:
|
3218
|
+
yield index, token, value
|
3219
|
+
|
2374
3220
|
def gen_elixir_sigil_rules():
|
2375
|
-
|
2376
|
-
|
2377
|
-
|
2378
|
-
(r'
|
2379
|
-
(r
|
2380
|
-
(r'
|
2381
|
-
|
2382
|
-
|
2383
|
-
|
3221
|
+
# these braces are balanced inside the sigil string
|
3222
|
+
braces = [
|
3223
|
+
(r'\{', r'\}', 'cb'),
|
3224
|
+
(r'\[', r'\]', 'sb'),
|
3225
|
+
(r'\(', r'\)', 'pa'),
|
3226
|
+
(r'\<', r'\>', 'ab'),
|
3227
|
+
]
|
3228
|
+
|
3229
|
+
# these are also valid sigil terminators, they are not balanced
|
3230
|
+
terms = [
|
3231
|
+
(r'/', 'slas'), (r'\|', 'pipe'), ('"', 'quot'), ("'", 'apos'),
|
2384
3232
|
]
|
2385
3233
|
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
3234
|
+
# heredocs have slightly different rules, they are not balanced
|
3235
|
+
triquotes = [(r'"""', 'triquot'), (r"'''", 'triapos')]
|
3236
|
+
|
3237
|
+
token = String.Other
|
3238
|
+
states = {'sigils': []}
|
3239
|
+
|
3240
|
+
for term, name in triquotes:
|
3241
|
+
states['sigils'] += [
|
3242
|
+
(r'(~[a-z])(%s)' % (term,), bygroups(token, String.Heredoc),
|
3243
|
+
(name + '-end', name + '-intp')),
|
3244
|
+
(r'(~[A-Z])(%s)' % (term,), bygroups(token, String.Heredoc),
|
3245
|
+
(name + '-end', name + '-no-intp')),
|
3246
|
+
]
|
2390
3247
|
|
2391
|
-
states['
|
2392
|
-
|
2393
|
-
(r'
|
3248
|
+
states[name +'-end'] = [(r'[a-zA-Z]*', token, '#pop')]
|
3249
|
+
states[name +'-intp'] = [
|
3250
|
+
(r'^\s*' + term, String.Heredoc, '#pop'),
|
3251
|
+
include('heredoc_interpol'),
|
3252
|
+
]
|
3253
|
+
states[name +'-no-intp'] = [
|
3254
|
+
(r'^\s*' + term, String.Heredoc, '#pop'),
|
3255
|
+
include('heredoc_no_interpol'),
|
2394
3256
|
]
|
2395
3257
|
|
2396
|
-
|
2397
|
-
|
2398
|
-
|
3258
|
+
for term, name in terms:
|
3259
|
+
states['sigils'] += [
|
3260
|
+
(r'~[a-z]' + term, token, name + '-intp'),
|
3261
|
+
(r'~[A-Z]' + term, token, name + '-no-intp'),
|
2399
3262
|
]
|
2400
3263
|
|
2401
|
-
states
|
2402
|
-
|
3264
|
+
# Similar states to the braced sigils, but no balancing of
|
3265
|
+
# terminators
|
3266
|
+
states[name +'-intp'] = gen_elixir_sigstr_rules(term, token)
|
3267
|
+
states[name +'-no-intp'] = \
|
3268
|
+
gen_elixir_sigstr_rules(term, token, interpol=False)
|
3269
|
+
|
3270
|
+
for lbrace, rbrace, name in braces:
|
3271
|
+
states['sigils'] += [
|
3272
|
+
(r'~[a-z]' + lbrace, token, name + '-intp'),
|
3273
|
+
(r'~[A-Z]' + lbrace, token, name + '-no-intp')
|
2403
3274
|
]
|
2404
3275
|
|
3276
|
+
states[name +'-intp'] = [
|
3277
|
+
(r'\\.', token),
|
3278
|
+
(lbrace, token, '#push'),
|
3279
|
+
] + gen_elixir_sigstr_rules(rbrace, token)
|
3280
|
+
|
3281
|
+
states[name +'-no-intp'] = [
|
3282
|
+
(r'\\.', token),
|
3283
|
+
(lbrace, token, '#push'),
|
3284
|
+
] + gen_elixir_sigstr_rules(rbrace, token, interpol=False)
|
3285
|
+
|
2405
3286
|
return states
|
2406
3287
|
|
3288
|
+
op3_re = "|".join(re.escape(s) for s in OPERATORS3)
|
3289
|
+
op2_re = "|".join(re.escape(s) for s in OPERATORS2)
|
3290
|
+
op1_re = "|".join(re.escape(s) for s in OPERATORS1)
|
3291
|
+
ops_re = r'(?:%s|%s|%s)' % (op3_re, op2_re, op1_re)
|
3292
|
+
punctuation_re = "|".join(re.escape(s) for s in PUNCTUATION)
|
3293
|
+
name_re = r'[a-z_][a-zA-Z_0-9]*[!\?]?'
|
3294
|
+
modname_re = r'[A-Z][A-Za-z_]*(?:\.[A-Z][A-Za-z_]*)*'
|
3295
|
+
complex_name_re = r'(?:%s|%s|%s)' % (name_re, modname_re, ops_re)
|
3296
|
+
special_atom_re = r'(?:\.\.\.|<<>>|%{}|%|{})'
|
3297
|
+
|
2407
3298
|
tokens = {
|
2408
3299
|
'root': [
|
2409
3300
|
(r'\s+', Text),
|
2410
3301
|
(r'#.*$', Comment.Single),
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2417
|
-
|
2418
|
-
(r'
|
2419
|
-
|
2420
|
-
|
2421
|
-
|
2422
|
-
(r'
|
2423
|
-
|
2424
|
-
|
2425
|
-
(r':
|
2426
|
-
(r'
|
2427
|
-
(r'
|
2428
|
-
(r'
|
2429
|
-
|
2430
|
-
|
2431
|
-
(r'
|
2432
|
-
|
2433
|
-
|
2434
|
-
|
2435
|
-
|
2436
|
-
|
2437
|
-
|
2438
|
-
|
2439
|
-
|
2440
|
-
|
2441
|
-
(r'
|
2442
|
-
|
2443
|
-
|
3302
|
+
|
3303
|
+
# Various kinds of characters
|
3304
|
+
(r'(?i)(\?)(\\x{)([\da-f]+)(})',
|
3305
|
+
bygroups(String.Char,
|
3306
|
+
String.Escape, Number.Hex, String.Escape)),
|
3307
|
+
(r'(?i)(\?)(\\x[\da-f]{1,2})',
|
3308
|
+
bygroups(String.Char, String.Escape)),
|
3309
|
+
(r'(\?)(\\[0-7]{1,3})',
|
3310
|
+
bygroups(String.Char, String.Escape)),
|
3311
|
+
(r'(\?)(\\[abdefnrstv])',
|
3312
|
+
bygroups(String.Char, String.Escape)),
|
3313
|
+
(r'\?\\?.', String.Char),
|
3314
|
+
|
3315
|
+
# atoms
|
3316
|
+
(r':' + special_atom_re, String.Symbol),
|
3317
|
+
(r':' + complex_name_re, String.Symbol),
|
3318
|
+
(r':"', String.Symbol, 'string_double_atom'),
|
3319
|
+
(r":'", String.Symbol, 'string_single_atom'),
|
3320
|
+
|
3321
|
+
# [keywords: ...]
|
3322
|
+
(r'(%s|%s)(:)(?=\s|\n)' % (special_atom_re, complex_name_re),
|
3323
|
+
bygroups(String.Symbol, Punctuation)),
|
3324
|
+
|
3325
|
+
# @attributes
|
3326
|
+
(r'@' + name_re, Name.Attribute),
|
3327
|
+
|
3328
|
+
# operators and punctuation
|
3329
|
+
(op3_re, Operator),
|
3330
|
+
(op2_re, Operator),
|
3331
|
+
(punctuation_re, Punctuation),
|
3332
|
+
(r'&\d', Name.Entity), # anon func arguments
|
3333
|
+
(op1_re, Operator),
|
3334
|
+
|
3335
|
+
# identifiers
|
3336
|
+
(name_re, Name),
|
3337
|
+
(modname_re, Name.Class),
|
3338
|
+
|
3339
|
+
# numbers
|
3340
|
+
(r'0[bB][01]+', Number.Bin),
|
3341
|
+
(r'0[0-7]+', Number.Oct),
|
3342
|
+
(r'(?i)0x[\da-f]+', Number.Hex),
|
3343
|
+
(r'\d(_?\d)*\.\d(_?\d)*([eE][-+]?\d(_?\d)*)?', Number.Float),
|
3344
|
+
(r'\d(_?\d)*', Number.Integer),
|
3345
|
+
|
3346
|
+
# strings and heredocs
|
3347
|
+
(r'"""\s*', String.Heredoc, 'heredoc_double'),
|
3348
|
+
(r"'''\s*$", String.Heredoc, 'heredoc_single'),
|
3349
|
+
(r'"', String.Double, 'string_double'),
|
3350
|
+
(r"'", String.Single, 'string_single'),
|
3351
|
+
|
3352
|
+
include('sigils'),
|
3353
|
+
],
|
3354
|
+
'heredoc_double': [
|
3355
|
+
(r'^\s*"""', String.Heredoc, '#pop'),
|
3356
|
+
include('heredoc_interpol'),
|
3357
|
+
],
|
3358
|
+
'heredoc_single': [
|
3359
|
+
(r"^\s*'''", String.Heredoc, '#pop'),
|
3360
|
+
include('heredoc_interpol'),
|
3361
|
+
],
|
3362
|
+
'heredoc_interpol': [
|
3363
|
+
(r'[^#\\\n]+', String.Heredoc),
|
3364
|
+
include('escapes'),
|
3365
|
+
(r'\\.', String.Heredoc),
|
3366
|
+
(r'\n+', String.Heredoc),
|
3367
|
+
include('interpol'),
|
3368
|
+
],
|
3369
|
+
'heredoc_no_interpol': [
|
3370
|
+
(r'[^\\\n]+', String.Heredoc),
|
3371
|
+
(r'\\.', String.Heredoc),
|
3372
|
+
(r'\n+', String.Heredoc),
|
3373
|
+
],
|
3374
|
+
'escapes': [
|
3375
|
+
(r'(?i)(\\x{)([\da-f]+)(})',
|
3376
|
+
bygroups(String.Escape, Number.Hex, String.Escape)),
|
3377
|
+
(r'(?i)\\x[\da-f]{1,2}', String.Escape),
|
3378
|
+
(r'\\[0-7]{1,3}', String.Escape),
|
3379
|
+
(r'\\[abdefnrstv]', String.Escape),
|
3380
|
+
],
|
3381
|
+
'interpol': [
|
3382
|
+
(r'#{', String.Interpol, 'interpol_string'),
|
3383
|
+
],
|
3384
|
+
'interpol_string' : [
|
2444
3385
|
(r'}', String.Interpol, "#pop"),
|
2445
3386
|
include('root')
|
2446
3387
|
],
|
2447
|
-
'interpoling_symbol': [
|
2448
|
-
(r'"', String.Symbol, "#pop"),
|
2449
|
-
include('interpoling'),
|
2450
|
-
(r'[^#"]+', String.Symbol),
|
2451
|
-
],
|
2452
|
-
'enddoublestr' : [
|
2453
|
-
include('interpoling'),
|
2454
|
-
(r'[^#"]+', String.Double),
|
2455
|
-
]
|
2456
3388
|
}
|
3389
|
+
tokens.update(gen_elixir_string_rules('double', '"', String.Double))
|
3390
|
+
tokens.update(gen_elixir_string_rules('single', "'", String.Single))
|
3391
|
+
tokens.update(gen_elixir_string_rules('double_atom', '"', String.Symbol))
|
3392
|
+
tokens.update(gen_elixir_string_rules('single_atom', "'", String.Symbol))
|
2457
3393
|
tokens.update(gen_elixir_sigil_rules())
|
2458
3394
|
|
2459
3395
|
|
@@ -2474,29 +3410,32 @@ class ElixirConsoleLexer(Lexer):
|
|
2474
3410
|
iex> length [head | tail]
|
2475
3411
|
3
|
2476
3412
|
|
2477
|
-
|
3413
|
+
.. versionadded:: 1.5
|
2478
3414
|
"""
|
2479
3415
|
|
2480
3416
|
name = 'Elixir iex session'
|
2481
3417
|
aliases = ['iex']
|
2482
3418
|
mimetypes = ['text/x-elixir-shellsession']
|
2483
3419
|
|
2484
|
-
_prompt_re = re.compile('(iex|\.{3})
|
3420
|
+
_prompt_re = re.compile('(iex|\.{3})(\(\d+\))?> ')
|
2485
3421
|
|
2486
3422
|
def get_tokens_unprocessed(self, text):
|
2487
3423
|
exlexer = ElixirLexer(**self.options)
|
2488
3424
|
|
2489
3425
|
curcode = ''
|
3426
|
+
in_error = False
|
2490
3427
|
insertions = []
|
2491
3428
|
for match in line_re.finditer(text):
|
2492
3429
|
line = match.group()
|
2493
3430
|
if line.startswith(u'** '):
|
3431
|
+
in_error = True
|
2494
3432
|
insertions.append((len(curcode),
|
2495
3433
|
[(0, Generic.Error, line[:-1])]))
|
2496
3434
|
curcode += line[-1:]
|
2497
3435
|
else:
|
2498
3436
|
m = self._prompt_re.match(line)
|
2499
3437
|
if m is not None:
|
3438
|
+
in_error = False
|
2500
3439
|
end = m.end()
|
2501
3440
|
insertions.append((len(curcode),
|
2502
3441
|
[(0, Generic.Prompt, line[:end])]))
|
@@ -2504,14 +3443,15 @@ class ElixirConsoleLexer(Lexer):
|
|
2504
3443
|
else:
|
2505
3444
|
if curcode:
|
2506
3445
|
for item in do_insertions(insertions,
|
2507
|
-
|
3446
|
+
exlexer.get_tokens_unprocessed(curcode)):
|
2508
3447
|
yield item
|
2509
3448
|
curcode = ''
|
2510
3449
|
insertions = []
|
2511
|
-
|
3450
|
+
token = Generic.Error if in_error else Generic.Output
|
3451
|
+
yield match.start(), token, line
|
2512
3452
|
if curcode:
|
2513
3453
|
for item in do_insertions(insertions,
|
2514
|
-
|
3454
|
+
exlexer.get_tokens_unprocessed(curcode)):
|
2515
3455
|
yield item
|
2516
3456
|
|
2517
3457
|
|
@@ -2520,7 +3460,7 @@ class KokaLexer(RegexLexer):
|
|
2520
3460
|
Lexer for the `Koka <http://koka.codeplex.com>`_
|
2521
3461
|
language.
|
2522
3462
|
|
2523
|
-
|
3463
|
+
.. versionadded:: 1.6
|
2524
3464
|
"""
|
2525
3465
|
|
2526
3466
|
name = 'Koka'
|
@@ -2690,7 +3630,7 @@ class KokaLexer(RegexLexer):
|
|
2690
3630
|
(r'::|\->|[\.:|]', tokenType),
|
2691
3631
|
|
2692
3632
|
#catchall
|
2693
|
-
(
|
3633
|
+
default('#pop')
|
2694
3634
|
],
|
2695
3635
|
|
2696
3636
|
# comments and literals
|