pygments.rb 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. data/README.md +6 -1
  2. data/lexers +0 -0
  3. data/lib/pygments/version.rb +1 -1
  4. data/vendor/pygments-main/AUTHORS +15 -0
  5. data/vendor/pygments-main/CHANGES +28 -1
  6. data/vendor/pygments-main/LICENSE +1 -1
  7. data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +121 -0
  8. data/vendor/pygments-main/pygments/cmdline.py +1 -1
  9. data/vendor/pygments-main/pygments/filters/__init__.py +0 -1
  10. data/vendor/pygments-main/pygments/formatters/_mapping.py +2 -2
  11. data/vendor/pygments-main/pygments/formatters/img.py +1 -1
  12. data/vendor/pygments-main/pygments/formatters/latex.py +8 -8
  13. data/vendor/pygments-main/pygments/formatters/other.py +0 -2
  14. data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5413 -0
  15. data/vendor/pygments-main/pygments/lexers/_mapping.py +36 -11
  16. data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +551 -0
  17. data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +0 -1
  18. data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +546 -0
  19. data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
  20. data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +174 -0
  21. data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -3
  22. data/vendor/pygments-main/pygments/lexers/agile.py +145 -33
  23. data/vendor/pygments-main/pygments/lexers/asm.py +2 -2
  24. data/vendor/pygments-main/pygments/lexers/compiled.py +328 -36
  25. data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
  26. data/vendor/pygments-main/pygments/lexers/dotnet.py +8 -14
  27. data/vendor/pygments-main/pygments/lexers/functional.py +773 -8
  28. data/vendor/pygments-main/pygments/lexers/jvm.py +184 -36
  29. data/vendor/pygments-main/pygments/lexers/math.py +349 -23
  30. data/vendor/pygments-main/pygments/lexers/other.py +315 -492
  31. data/vendor/pygments-main/pygments/lexers/parsers.py +83 -1
  32. data/vendor/pygments-main/pygments/lexers/shell.py +4 -1
  33. data/vendor/pygments-main/pygments/lexers/templates.py +112 -2
  34. data/vendor/pygments-main/pygments/lexers/text.py +52 -3
  35. data/vendor/pygments-main/pygments/lexers/web.py +382 -36
  36. data/vendor/pygments-main/pygments/unistring.py +35 -25
  37. data/vendor/pygments-main/pygments/util.py +45 -0
  38. data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
  39. data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
  40. data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
  41. data/vendor/pygments-main/tests/examplefiles/example.ceylon +33 -0
  42. data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
  43. data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
  44. data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
  45. data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
  46. data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
  47. data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
  48. data/vendor/pygments-main/tests/examplefiles/example.stan +97 -0
  49. data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
  50. data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
  51. data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +123 -0
  52. data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
  53. data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
  54. data/vendor/pygments-main/tests/examplefiles/http_request_example +2 -1
  55. data/vendor/pygments-main/tests/examplefiles/http_response_example +4 -2
  56. data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
  57. data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
  58. data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
  59. data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
  60. data/vendor/pygments-main/tests/examplefiles/matlab_sample +5 -2
  61. data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
  62. data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
  63. data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
  64. data/vendor/pygments-main/tests/examplefiles/rust_example.rs +743 -0
  65. data/vendor/pygments-main/tests/examplefiles/test.R +149 -115
  66. data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
  67. data/vendor/pygments-main/tests/test_basic_api.py +1 -1
  68. data/vendor/pygments-main/tests/test_util.py +18 -0
  69. metadata +34 -3
  70. data/vendor/pygments-main/REVISION +0 -1
@@ -0,0 +1,104 @@
1
+ # -*- coding: utf-8 -*-
2
+ """
3
+ pygments.lexers.dalvik
4
+ ~~~~~~~~~~~~~~~~~~~~~~
5
+
6
+ Pygments lexers for Dalvik VM-related languages.
7
+
8
+ :copyright: Copyright 2011-2012 by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ from pygments.lexer import RegexLexer, include, bygroups, using
13
+ from pygments.token import Keyword, Text, Comment, Name, String, Number, \
14
+ Punctuation
15
+
16
+ __all__ = ['SmaliLexer']
17
+
18
+
19
+ class SmaliLexer(RegexLexer):
20
+ """
21
+ For `Smali <http://code.google.com/p/smali/>`_ (Android/Dalvik) assembly
22
+ code.
23
+
24
+ *New in Pygments 1.6.*
25
+ """
26
+ name = 'Smali'
27
+ aliases = ['smali']
28
+ filenames = ['*.smali']
29
+ mimetypes = ['text/smali']
30
+
31
+ tokens = {
32
+ 'root': [
33
+ include('comment'),
34
+ include('label'),
35
+ include('field'),
36
+ include('method'),
37
+ include('class'),
38
+ include('directive'),
39
+ include('access-modifier'),
40
+ include('instruction'),
41
+ include('literal'),
42
+ include('punctuation'),
43
+ include('type'),
44
+ include('whitespace')
45
+ ],
46
+ 'directive': [
47
+ (r'^[ \t]*\.(class|super|implements|field|subannotation|annotation|'
48
+ r'enum|method|registers|locals|array-data|packed-switch|'
49
+ r'sparse-switch|catchall|catch|line|parameter|local|prologue|'
50
+ r'epilogue|source)', Keyword),
51
+ (r'^[ \t]*\.end (field|subannotation|annotation|method|array-data|'
52
+ 'packed-switch|sparse-switch|parameter|local)', Keyword),
53
+ (r'^[ \t]*\.restart local', Keyword),
54
+ ],
55
+ 'access-modifier': [
56
+ (r'(public|private|protected|static|final|synchronized|bridge|'
57
+ r'varargs|native|abstract|strictfp|synthetic|constructor|'
58
+ r'declared-synchronized|interface|enum|annotation|volatile|'
59
+ r'transient)', Keyword),
60
+ ],
61
+ 'whitespace': [
62
+ (r'\n', Text),
63
+ (r'\s+', Text),
64
+ ],
65
+ 'instruction': [
66
+ (r'\b[vp]\d+\b', Name.Builtin), # registers
67
+ (r'\b[a-z][A-Za-z0-9/-]+\s+', Text), # instructions
68
+ ],
69
+ 'literal': [
70
+ (r'".*"', String),
71
+ (r'0x[0-9A-Fa-f]+t?', Number.Hex),
72
+ (r'[0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
73
+ (r'[0-9]+L?', Number.Integer),
74
+ ],
75
+ 'field': [
76
+ (r'(\$?\b)([A-Za-z0-9_$]*)(:)',
77
+ bygroups(Punctuation, Name.Variable, Punctuation)),
78
+ ],
79
+ 'method': [
80
+ (r'<(?:cl)?init>', Name.Function), # constructor
81
+ (r'(\$?\b)([A-Za-z0-9_$]*)(\()',
82
+ bygroups(Punctuation, Name.Function, Punctuation)),
83
+ ],
84
+ 'label': [
85
+ (r':[A-Za-z0-9_]+', Name.Label),
86
+ ],
87
+ 'class': [
88
+ # class names in the form Lcom/namespace/ClassName;
89
+ # I only want to color the ClassName part, so the namespace part is
90
+ # treated as 'Text'
91
+ (r'(L)((?:[A-Za-z0-9_$]+/)*)([A-Za-z0-9_$]+)(;)',
92
+ bygroups(Keyword.Type, Text, Name.Class, Text)),
93
+ ],
94
+ 'punctuation': [
95
+ (r'->', Punctuation),
96
+ (r'[{},\(\):=\.-]', Punctuation),
97
+ ],
98
+ 'type': [
99
+ (r'[ZBSCIJFDV\[]+', Keyword.Type),
100
+ ],
101
+ 'comment': [
102
+ (r'#.*?\n', Comment),
103
+ ],
104
+ }
@@ -23,10 +23,6 @@ __all__ = ['CSharpLexer', 'NemerleLexer', 'BooLexer', 'VbNetLexer',
23
23
  'CSharpAspxLexer', 'VbNetAspxLexer', 'FSharpLexer']
24
24
 
25
25
 
26
- def _escape(st):
27
- return st.replace(u'\\', ur'\\').replace(u'-', ur'\-').\
28
- replace(u'[', ur'\[').replace(u']', ur'\]')
29
-
30
26
  class CSharpLexer(RegexLexer):
31
27
  """
32
28
  For `C# <http://msdn2.microsoft.com/en-us/vcsharp/default.aspx>`_
@@ -67,10 +63,9 @@ class CSharpLexer(RegexLexer):
67
63
  '[' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl +
68
64
  uni.Nd + uni.Pc + uni.Cf + uni.Mn + uni.Mc + ']*'),
69
65
  'full': ('@?(?:_|[^' +
70
- _escape(uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl')) + '])'
71
- + '[^' + _escape(uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo',
72
- 'Nl', 'Nd', 'Pc', 'Cf', 'Mn',
73
- 'Mc')) + ']*'),
66
+ uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])'
67
+ + '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
68
+ 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
74
69
  }
75
70
 
76
71
  tokens = {}
@@ -88,7 +83,7 @@ class CSharpLexer(RegexLexer):
88
83
  (r'[^\S\n]+', Text),
89
84
  (r'\\\n', Text), # line continuation
90
85
  (r'//.*?\n', Comment.Single),
91
- (r'/[*](.|\n)*?[*]/', Comment.Multiline),
86
+ (r'/[*].*?[*]/', Comment.Multiline),
92
87
  (r'\n', Text),
93
88
  (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
94
89
  (r'[{}]', Punctuation),
@@ -179,11 +174,10 @@ class NemerleLexer(RegexLexer):
179
174
  basic = ('@?[_' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl + ']' +
180
175
  '[' + uni.Lu + uni.Ll + uni.Lt + uni.Lm + uni.Nl +
181
176
  uni.Nd + uni.Pc + uni.Cf + uni.Mn + uni.Mc + ']*'),
182
- full = ('@?(?:_|[^' + _escape(uni.allexcept('Lu', 'Ll', 'Lt', 'Lm',
183
- 'Lo', 'Nl')) + '])'
184
- + '[^' + _escape(uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo',
185
- 'Nl', 'Nd', 'Pc', 'Cf', 'Mn',
186
- 'Mc')) + ']*'),
177
+ full = ('@?(?:_|[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo',
178
+ 'Nl') + '])'
179
+ + '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
180
+ 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
187
181
  )
188
182
 
189
183
  tokens = {}
@@ -15,10 +15,572 @@ from pygments.lexer import Lexer, RegexLexer, bygroups, include, do_insertions
15
15
  from pygments.token import Text, Comment, Operator, Keyword, Name, \
16
16
  String, Number, Punctuation, Literal, Generic, Error
17
17
 
18
- __all__ = ['SchemeLexer', 'CommonLispLexer', 'HaskellLexer',
18
+ __all__ = ['RacketLexer', 'SchemeLexer', 'CommonLispLexer', 'HaskellLexer',
19
19
  'LiterateHaskellLexer', 'SMLLexer', 'OcamlLexer', 'ErlangLexer',
20
20
  'ErlangShellLexer', 'OpaLexer', 'CoqLexer', 'NewLispLexer',
21
- 'ElixirLexer', 'ElixirConsoleLexer']
21
+ 'ElixirLexer', 'ElixirConsoleLexer', 'KokaLexer']
22
+
23
+
24
+ class RacketLexer(RegexLexer):
25
+ """
26
+ Lexer for `Racket <http://racket-lang.org/>`_ source code (formerly known as
27
+ PLT Scheme).
28
+
29
+ *New in Pygments 1.6.*
30
+ """
31
+
32
+ name = 'Racket'
33
+ aliases = ['racket', 'rkt']
34
+ filenames = ['*.rkt', '*.rktl']
35
+ mimetypes = ['text/x-racket', 'application/x-racket']
36
+
37
+ # From namespace-mapped-symbols
38
+ keywords = [
39
+ '#%app', '#%datum', '#%expression', '#%module-begin',
40
+ '#%plain-app', '#%plain-lambda', '#%plain-module-begin',
41
+ '#%provide', '#%require', '#%stratified-body', '#%top',
42
+ '#%top-interaction', '#%variable-reference', '...', 'and', 'begin',
43
+ 'begin-for-syntax', 'begin0', 'case', 'case-lambda', 'cond',
44
+ 'datum->syntax-object', 'define', 'define-for-syntax',
45
+ 'define-struct', 'define-syntax', 'define-syntax-rule',
46
+ 'define-syntaxes', 'define-values', 'define-values-for-syntax',
47
+ 'delay', 'do', 'expand-path', 'fluid-let', 'hash-table-copy',
48
+ 'hash-table-count', 'hash-table-for-each', 'hash-table-get',
49
+ 'hash-table-iterate-first', 'hash-table-iterate-key',
50
+ 'hash-table-iterate-next', 'hash-table-iterate-value',
51
+ 'hash-table-map', 'hash-table-put!', 'hash-table-remove!',
52
+ 'hash-table?', 'if', 'lambda', 'let', 'let*', 'let*-values',
53
+ 'let-struct', 'let-syntax', 'let-syntaxes', 'let-values', 'let/cc',
54
+ 'let/ec', 'letrec', 'letrec-syntax', 'letrec-syntaxes',
55
+ 'letrec-syntaxes+values', 'letrec-values', 'list-immutable',
56
+ 'make-hash-table', 'make-immutable-hash-table', 'make-namespace',
57
+ 'module', 'module-identifier=?', 'module-label-identifier=?',
58
+ 'module-template-identifier=?', 'module-transformer-identifier=?',
59
+ 'namespace-transformer-require', 'or', 'parameterize',
60
+ 'parameterize*', 'parameterize-break', 'provide',
61
+ 'provide-for-label', 'provide-for-syntax', 'quasiquote',
62
+ 'quasisyntax', 'quasisyntax/loc', 'quote', 'quote-syntax',
63
+ 'quote-syntax/prune', 'require', 'require-for-label',
64
+ 'require-for-syntax', 'require-for-template', 'set!',
65
+ 'set!-values', 'syntax', 'syntax-case', 'syntax-case*',
66
+ 'syntax-id-rules', 'syntax-object->datum', 'syntax-rules',
67
+ 'syntax/loc', 'time', 'transcript-off', 'transcript-on', 'unless',
68
+ 'unquote', 'unquote-splicing', 'unsyntax', 'unsyntax-splicing',
69
+ 'when', 'with-continuation-mark', 'with-handlers',
70
+ 'with-handlers*', 'with-syntax', 'λ'
71
+ ]
72
+
73
+ # From namespace-mapped-symbols
74
+ builtins = [
75
+ '*', '+', '-', '/', '<', '<=', '=', '>', '>=',
76
+ 'abort-current-continuation', 'abs', 'absolute-path?', 'acos',
77
+ 'add1', 'alarm-evt', 'always-evt', 'andmap', 'angle', 'append',
78
+ 'apply', 'arithmetic-shift', 'arity-at-least',
79
+ 'arity-at-least-value', 'arity-at-least?', 'asin', 'assoc', 'assq',
80
+ 'assv', 'atan', 'banner', 'bitwise-and', 'bitwise-bit-field',
81
+ 'bitwise-bit-set?', 'bitwise-ior', 'bitwise-not', 'bitwise-xor',
82
+ 'boolean?', 'bound-identifier=?', 'box', 'box-immutable', 'box?',
83
+ 'break-enabled', 'break-thread', 'build-path',
84
+ 'build-path/convention-type', 'byte-pregexp', 'byte-pregexp?',
85
+ 'byte-ready?', 'byte-regexp', 'byte-regexp?', 'byte?', 'bytes',
86
+ 'bytes->immutable-bytes', 'bytes->list', 'bytes->path',
87
+ 'bytes->path-element', 'bytes->string/latin-1',
88
+ 'bytes->string/locale', 'bytes->string/utf-8', 'bytes-append',
89
+ 'bytes-close-converter', 'bytes-convert', 'bytes-convert-end',
90
+ 'bytes-converter?', 'bytes-copy', 'bytes-copy!', 'bytes-fill!',
91
+ 'bytes-length', 'bytes-open-converter', 'bytes-ref', 'bytes-set!',
92
+ 'bytes-utf-8-index', 'bytes-utf-8-length', 'bytes-utf-8-ref',
93
+ 'bytes<?', 'bytes=?', 'bytes>?', 'bytes?', 'caaaar', 'caaadr',
94
+ 'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr',
95
+ 'cadar', 'caddar', 'cadddr', 'caddr', 'cadr',
96
+ 'call-in-nested-thread', 'call-with-break-parameterization',
97
+ 'call-with-composable-continuation',
98
+ 'call-with-continuation-barrier', 'call-with-continuation-prompt',
99
+ 'call-with-current-continuation', 'call-with-escape-continuation',
100
+ 'call-with-exception-handler',
101
+ 'call-with-immediate-continuation-mark', 'call-with-input-file',
102
+ 'call-with-output-file', 'call-with-parameterization',
103
+ 'call-with-semaphore', 'call-with-semaphore/enable-break',
104
+ 'call-with-values', 'call/cc', 'call/ec', 'car', 'cdaaar',
105
+ 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar', 'cddaar',
106
+ 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', 'cddr', 'cdr',
107
+ 'ceiling', 'channel-get', 'channel-put', 'channel-put-evt',
108
+ 'channel-try-get', 'channel?', 'chaperone-box', 'chaperone-evt',
109
+ 'chaperone-hash', 'chaperone-of?', 'chaperone-procedure',
110
+ 'chaperone-struct', 'chaperone-struct-type', 'chaperone-vector',
111
+ 'chaperone?', 'char->integer', 'char-alphabetic?', 'char-blank?',
112
+ 'char-ci<=?', 'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?',
113
+ 'char-downcase', 'char-foldcase', 'char-general-category',
114
+ 'char-graphic?', 'char-iso-control?', 'char-lower-case?',
115
+ 'char-numeric?', 'char-punctuation?', 'char-ready?',
116
+ 'char-symbolic?', 'char-title-case?', 'char-titlecase',
117
+ 'char-upcase', 'char-upper-case?', 'char-utf-8-length',
118
+ 'char-whitespace?', 'char<=?', 'char<?', 'char=?', 'char>=?',
119
+ 'char>?', 'char?', 'check-duplicate-identifier',
120
+ 'checked-procedure-check-and-extract', 'choice-evt',
121
+ 'cleanse-path', 'close-input-port', 'close-output-port',
122
+ 'collect-garbage', 'collection-file-path', 'collection-path',
123
+ 'compile', 'compile-allow-set!-undefined',
124
+ 'compile-context-preservation-enabled',
125
+ 'compile-enforce-module-constants', 'compile-syntax',
126
+ 'compiled-expression?', 'compiled-module-expression?',
127
+ 'complete-path?', 'complex?', 'cons',
128
+ 'continuation-mark-set->context', 'continuation-mark-set->list',
129
+ 'continuation-mark-set->list*', 'continuation-mark-set-first',
130
+ 'continuation-mark-set?', 'continuation-marks',
131
+ 'continuation-prompt-available?', 'continuation-prompt-tag?',
132
+ 'continuation?', 'copy-file', 'cos',
133
+ 'current-break-parameterization', 'current-code-inspector',
134
+ 'current-command-line-arguments', 'current-compile',
135
+ 'current-continuation-marks', 'current-custodian',
136
+ 'current-directory', 'current-drive', 'current-error-port',
137
+ 'current-eval', 'current-evt-pseudo-random-generator',
138
+ 'current-gc-milliseconds', 'current-get-interaction-input-port',
139
+ 'current-inexact-milliseconds', 'current-input-port',
140
+ 'current-inspector', 'current-library-collection-paths',
141
+ 'current-load', 'current-load-extension',
142
+ 'current-load-relative-directory', 'current-load/use-compiled',
143
+ 'current-locale', 'current-memory-use', 'current-milliseconds',
144
+ 'current-module-declare-name', 'current-module-declare-source',
145
+ 'current-module-name-resolver', 'current-namespace',
146
+ 'current-output-port', 'current-parameterization',
147
+ 'current-preserved-thread-cell-values', 'current-print',
148
+ 'current-process-milliseconds', 'current-prompt-read',
149
+ 'current-pseudo-random-generator', 'current-read-interaction',
150
+ 'current-reader-guard', 'current-readtable', 'current-seconds',
151
+ 'current-security-guard', 'current-subprocess-custodian-mode',
152
+ 'current-thread', 'current-thread-group',
153
+ 'current-thread-initial-stack-size',
154
+ 'current-write-relative-directory', 'custodian-box-value',
155
+ 'custodian-box?', 'custodian-limit-memory',
156
+ 'custodian-managed-list', 'custodian-memory-accounting-available?',
157
+ 'custodian-require-memory', 'custodian-shutdown-all', 'custodian?',
158
+ 'custom-print-quotable-accessor', 'custom-print-quotable?',
159
+ 'custom-write-accessor', 'custom-write?', 'date', 'date*',
160
+ 'date*-nanosecond', 'date*-time-zone-name', 'date*?', 'date-day',
161
+ 'date-dst?', 'date-hour', 'date-minute', 'date-month',
162
+ 'date-second', 'date-time-zone-offset', 'date-week-day',
163
+ 'date-year', 'date-year-day', 'date?', 'datum-intern-literal',
164
+ 'default-continuation-prompt-tag', 'delete-directory',
165
+ 'delete-file', 'denominator', 'directory-exists?',
166
+ 'directory-list', 'display', 'displayln', 'dump-memory-stats',
167
+ 'dynamic-require', 'dynamic-require-for-syntax', 'dynamic-wind',
168
+ 'eof', 'eof-object?', 'ephemeron-value', 'ephemeron?', 'eprintf',
169
+ 'eq-hash-code', 'eq?', 'equal-hash-code',
170
+ 'equal-secondary-hash-code', 'equal?', 'equal?/recur',
171
+ 'eqv-hash-code', 'eqv?', 'error', 'error-display-handler',
172
+ 'error-escape-handler', 'error-print-context-length',
173
+ 'error-print-source-location', 'error-print-width',
174
+ 'error-value->string-handler', 'eval', 'eval-jit-enabled',
175
+ 'eval-syntax', 'even?', 'evt?', 'exact->inexact', 'exact-integer?',
176
+ 'exact-nonnegative-integer?', 'exact-positive-integer?', 'exact?',
177
+ 'executable-yield-handler', 'exit', 'exit-handler', 'exn',
178
+ 'exn-continuation-marks', 'exn-message', 'exn:break',
179
+ 'exn:break-continuation', 'exn:break?', 'exn:fail',
180
+ 'exn:fail:contract', 'exn:fail:contract:arity',
181
+ 'exn:fail:contract:arity?', 'exn:fail:contract:continuation',
182
+ 'exn:fail:contract:continuation?',
183
+ 'exn:fail:contract:divide-by-zero',
184
+ 'exn:fail:contract:divide-by-zero?',
185
+ 'exn:fail:contract:non-fixnum-result',
186
+ 'exn:fail:contract:non-fixnum-result?',
187
+ 'exn:fail:contract:variable', 'exn:fail:contract:variable-id',
188
+ 'exn:fail:contract:variable?', 'exn:fail:contract?',
189
+ 'exn:fail:filesystem', 'exn:fail:filesystem:exists',
190
+ 'exn:fail:filesystem:exists?', 'exn:fail:filesystem:version',
191
+ 'exn:fail:filesystem:version?', 'exn:fail:filesystem?',
192
+ 'exn:fail:network', 'exn:fail:network?', 'exn:fail:out-of-memory',
193
+ 'exn:fail:out-of-memory?', 'exn:fail:read',
194
+ 'exn:fail:read-srclocs', 'exn:fail:read:eof', 'exn:fail:read:eof?',
195
+ 'exn:fail:read:non-char', 'exn:fail:read:non-char?',
196
+ 'exn:fail:read?', 'exn:fail:syntax', 'exn:fail:syntax-exprs',
197
+ 'exn:fail:syntax:unbound', 'exn:fail:syntax:unbound?',
198
+ 'exn:fail:syntax?', 'exn:fail:unsupported',
199
+ 'exn:fail:unsupported?', 'exn:fail:user', 'exn:fail:user?',
200
+ 'exn:fail?', 'exn:srclocs-accessor', 'exn:srclocs?', 'exn?', 'exp',
201
+ 'expand', 'expand-once', 'expand-syntax', 'expand-syntax-once',
202
+ 'expand-syntax-to-top-form', 'expand-to-top-form',
203
+ 'expand-user-path', 'expt', 'file-exists?',
204
+ 'file-or-directory-identity', 'file-or-directory-modify-seconds',
205
+ 'file-or-directory-permissions', 'file-position', 'file-size',
206
+ 'file-stream-buffer-mode', 'file-stream-port?',
207
+ 'filesystem-root-list', 'find-executable-path',
208
+ 'find-library-collection-paths', 'find-system-path', 'fixnum?',
209
+ 'floating-point-bytes->real', 'flonum?', 'floor', 'flush-output',
210
+ 'for-each', 'force', 'format', 'fprintf', 'free-identifier=?',
211
+ 'gcd', 'generate-temporaries', 'gensym', 'get-output-bytes',
212
+ 'get-output-string', 'getenv', 'global-port-print-handler',
213
+ 'guard-evt', 'handle-evt', 'handle-evt?', 'hash', 'hash-equal?',
214
+ 'hash-eqv?', 'hash-has-key?', 'hash-placeholder?', 'hash-ref!',
215
+ 'hasheq', 'hasheqv', 'identifier-binding',
216
+ 'identifier-label-binding', 'identifier-prune-lexical-context',
217
+ 'identifier-prune-to-source-module',
218
+ 'identifier-remove-from-definition-context',
219
+ 'identifier-template-binding', 'identifier-transformer-binding',
220
+ 'identifier?', 'imag-part', 'immutable?', 'impersonate-box',
221
+ 'impersonate-hash', 'impersonate-procedure', 'impersonate-struct',
222
+ 'impersonate-vector', 'impersonator-of?',
223
+ 'impersonator-prop:application-mark',
224
+ 'impersonator-property-accessor-procedure?',
225
+ 'impersonator-property?', 'impersonator?', 'inexact->exact',
226
+ 'inexact-real?', 'inexact?', 'input-port?', 'inspector?',
227
+ 'integer->char', 'integer->integer-bytes',
228
+ 'integer-bytes->integer', 'integer-length', 'integer-sqrt',
229
+ 'integer-sqrt/remainder', 'integer?',
230
+ 'internal-definition-context-seal', 'internal-definition-context?',
231
+ 'keyword->string', 'keyword<?', 'keyword?', 'kill-thread', 'lcm',
232
+ 'length', 'liberal-define-context?', 'link-exists?', 'list',
233
+ 'list*', 'list->bytes', 'list->string', 'list->vector', 'list-ref',
234
+ 'list-tail', 'list?', 'load', 'load-extension',
235
+ 'load-on-demand-enabled', 'load-relative',
236
+ 'load-relative-extension', 'load/cd', 'load/use-compiled',
237
+ 'local-expand', 'local-expand/capture-lifts',
238
+ 'local-transformer-expand',
239
+ 'local-transformer-expand/capture-lifts', 'locale-string-encoding',
240
+ 'log', 'magnitude', 'make-arity-at-least', 'make-bytes',
241
+ 'make-channel', 'make-continuation-prompt-tag', 'make-custodian',
242
+ 'make-custodian-box', 'make-date', 'make-date*',
243
+ 'make-derived-parameter', 'make-directory', 'make-ephemeron',
244
+ 'make-exn', 'make-exn:break', 'make-exn:fail',
245
+ 'make-exn:fail:contract', 'make-exn:fail:contract:arity',
246
+ 'make-exn:fail:contract:continuation',
247
+ 'make-exn:fail:contract:divide-by-zero',
248
+ 'make-exn:fail:contract:non-fixnum-result',
249
+ 'make-exn:fail:contract:variable', 'make-exn:fail:filesystem',
250
+ 'make-exn:fail:filesystem:exists',
251
+ 'make-exn:fail:filesystem:version', 'make-exn:fail:network',
252
+ 'make-exn:fail:out-of-memory', 'make-exn:fail:read',
253
+ 'make-exn:fail:read:eof', 'make-exn:fail:read:non-char',
254
+ 'make-exn:fail:syntax', 'make-exn:fail:syntax:unbound',
255
+ 'make-exn:fail:unsupported', 'make-exn:fail:user',
256
+ 'make-file-or-directory-link', 'make-hash-placeholder',
257
+ 'make-hasheq-placeholder', 'make-hasheqv',
258
+ 'make-hasheqv-placeholder', 'make-immutable-hasheqv',
259
+ 'make-impersonator-property', 'make-input-port', 'make-inspector',
260
+ 'make-known-char-range-list', 'make-output-port', 'make-parameter',
261
+ 'make-pipe', 'make-placeholder', 'make-polar',
262
+ 'make-prefab-struct', 'make-pseudo-random-generator',
263
+ 'make-reader-graph', 'make-readtable', 'make-rectangular',
264
+ 'make-rename-transformer', 'make-resolved-module-path',
265
+ 'make-security-guard', 'make-semaphore', 'make-set!-transformer',
266
+ 'make-shared-bytes', 'make-sibling-inspector',
267
+ 'make-special-comment', 'make-srcloc', 'make-string',
268
+ 'make-struct-field-accessor', 'make-struct-field-mutator',
269
+ 'make-struct-type', 'make-struct-type-property',
270
+ 'make-syntax-delta-introducer', 'make-syntax-introducer',
271
+ 'make-thread-cell', 'make-thread-group', 'make-vector',
272
+ 'make-weak-box', 'make-weak-hasheqv', 'make-will-executor', 'map',
273
+ 'max', 'mcar', 'mcdr', 'mcons', 'member', 'memq', 'memv', 'min',
274
+ 'module->exports', 'module->imports', 'module->language-info',
275
+ 'module->namespace', 'module-compiled-exports',
276
+ 'module-compiled-imports', 'module-compiled-language-info',
277
+ 'module-compiled-name', 'module-path-index-join',
278
+ 'module-path-index-resolve', 'module-path-index-split',
279
+ 'module-path-index?', 'module-path?', 'module-predefined?',
280
+ 'module-provide-protected?', 'modulo', 'mpair?', 'nack-guard-evt',
281
+ 'namespace-attach-module', 'namespace-attach-module-declaration',
282
+ 'namespace-base-phase', 'namespace-mapped-symbols',
283
+ 'namespace-module-identifier', 'namespace-module-registry',
284
+ 'namespace-require', 'namespace-require/constant',
285
+ 'namespace-require/copy', 'namespace-require/expansion-time',
286
+ 'namespace-set-variable-value!', 'namespace-symbol->identifier',
287
+ 'namespace-syntax-introduce', 'namespace-undefine-variable!',
288
+ 'namespace-unprotect-module', 'namespace-variable-value',
289
+ 'namespace?', 'negative?', 'never-evt', 'newline',
290
+ 'normal-case-path', 'not', 'null', 'null?', 'number->string',
291
+ 'number?', 'numerator', 'object-name', 'odd?', 'open-input-bytes',
292
+ 'open-input-file', 'open-input-output-file', 'open-input-string',
293
+ 'open-output-bytes', 'open-output-file', 'open-output-string',
294
+ 'ormap', 'output-port?', 'pair?', 'parameter-procedure=?',
295
+ 'parameter?', 'parameterization?', 'path->bytes',
296
+ 'path->complete-path', 'path->directory-path', 'path->string',
297
+ 'path-add-suffix', 'path-convention-type', 'path-element->bytes',
298
+ 'path-element->string', 'path-for-some-system?',
299
+ 'path-list-string->path-list', 'path-replace-suffix',
300
+ 'path-string?', 'path?', 'peek-byte', 'peek-byte-or-special',
301
+ 'peek-bytes', 'peek-bytes!', 'peek-bytes-avail!',
302
+ 'peek-bytes-avail!*', 'peek-bytes-avail!/enable-break',
303
+ 'peek-char', 'peek-char-or-special', 'peek-string', 'peek-string!',
304
+ 'pipe-content-length', 'placeholder-get', 'placeholder-set!',
305
+ 'placeholder?', 'poll-guard-evt', 'port-closed-evt',
306
+ 'port-closed?', 'port-commit-peeked', 'port-count-lines!',
307
+ 'port-count-lines-enabled', 'port-display-handler',
308
+ 'port-file-identity', 'port-file-unlock', 'port-next-location',
309
+ 'port-print-handler', 'port-progress-evt',
310
+ 'port-provides-progress-evts?', 'port-read-handler',
311
+ 'port-try-file-lock?', 'port-write-handler', 'port-writes-atomic?',
312
+ 'port-writes-special?', 'port?', 'positive?',
313
+ 'prefab-key->struct-type', 'prefab-struct-key', 'pregexp',
314
+ 'pregexp?', 'primitive-closure?', 'primitive-result-arity',
315
+ 'primitive?', 'print', 'print-as-expression',
316
+ 'print-boolean-long-form', 'print-box', 'print-graph',
317
+ 'print-hash-table', 'print-mpair-curly-braces',
318
+ 'print-pair-curly-braces', 'print-reader-abbreviations',
319
+ 'print-struct', 'print-syntax-width', 'print-unreadable',
320
+ 'print-vector-length', 'printf', 'procedure->method',
321
+ 'procedure-arity', 'procedure-arity-includes?', 'procedure-arity?',
322
+ 'procedure-closure-contents-eq?', 'procedure-extract-target',
323
+ 'procedure-reduce-arity', 'procedure-rename',
324
+ 'procedure-struct-type?', 'procedure?', 'promise?',
325
+ 'prop:arity-string', 'prop:checked-procedure',
326
+ 'prop:custom-print-quotable', 'prop:custom-write',
327
+ 'prop:equal+hash', 'prop:evt', 'prop:exn:srclocs',
328
+ 'prop:impersonator-of', 'prop:input-port',
329
+ 'prop:liberal-define-context', 'prop:output-port',
330
+ 'prop:procedure', 'prop:rename-transformer',
331
+ 'prop:set!-transformer', 'pseudo-random-generator->vector',
332
+ 'pseudo-random-generator-vector?', 'pseudo-random-generator?',
333
+ 'putenv', 'quotient', 'quotient/remainder', 'raise',
334
+ 'raise-arity-error', 'raise-mismatch-error', 'raise-syntax-error',
335
+ 'raise-type-error', 'raise-user-error', 'random', 'random-seed',
336
+ 'rational?', 'rationalize', 'read', 'read-accept-bar-quote',
337
+ 'read-accept-box', 'read-accept-compiled', 'read-accept-dot',
338
+ 'read-accept-graph', 'read-accept-infix-dot', 'read-accept-lang',
339
+ 'read-accept-quasiquote', 'read-accept-reader', 'read-byte',
340
+ 'read-byte-or-special', 'read-bytes', 'read-bytes!',
341
+ 'read-bytes-avail!', 'read-bytes-avail!*',
342
+ 'read-bytes-avail!/enable-break', 'read-bytes-line',
343
+ 'read-case-sensitive', 'read-char', 'read-char-or-special',
344
+ 'read-curly-brace-as-paren', 'read-decimal-as-inexact',
345
+ 'read-eval-print-loop', 'read-language', 'read-line',
346
+ 'read-on-demand-source', 'read-square-bracket-as-paren',
347
+ 'read-string', 'read-string!', 'read-syntax',
348
+ 'read-syntax/recursive', 'read/recursive', 'readtable-mapping',
349
+ 'readtable?', 'real->double-flonum', 'real->floating-point-bytes',
350
+ 'real->single-flonum', 'real-part', 'real?', 'regexp',
351
+ 'regexp-match', 'regexp-match-peek', 'regexp-match-peek-immediate',
352
+ 'regexp-match-peek-positions',
353
+ 'regexp-match-peek-positions-immediate',
354
+ 'regexp-match-peek-positions-immediate/end',
355
+ 'regexp-match-peek-positions/end', 'regexp-match-positions',
356
+ 'regexp-match-positions/end', 'regexp-match/end', 'regexp-match?',
357
+ 'regexp-max-lookbehind', 'regexp-replace', 'regexp-replace*',
358
+ 'regexp?', 'relative-path?', 'remainder',
359
+ 'rename-file-or-directory', 'rename-transformer-target',
360
+ 'rename-transformer?', 'resolve-path', 'resolved-module-path-name',
361
+ 'resolved-module-path?', 'reverse', 'round', 'seconds->date',
362
+ 'security-guard?', 'semaphore-peek-evt', 'semaphore-post',
363
+ 'semaphore-try-wait?', 'semaphore-wait',
364
+ 'semaphore-wait/enable-break', 'semaphore?',
365
+ 'set!-transformer-procedure', 'set!-transformer?', 'set-box!',
366
+ 'set-mcar!', 'set-mcdr!', 'set-port-next-location!',
367
+ 'shared-bytes', 'shell-execute', 'simplify-path', 'sin',
368
+ 'single-flonum?', 'sleep', 'special-comment-value',
369
+ 'special-comment?', 'split-path', 'sqrt', 'srcloc',
370
+ 'srcloc-column', 'srcloc-line', 'srcloc-position', 'srcloc-source',
371
+ 'srcloc-span', 'srcloc?', 'string', 'string->bytes/latin-1',
372
+ 'string->bytes/locale', 'string->bytes/utf-8',
373
+ 'string->immutable-string', 'string->keyword', 'string->list',
374
+ 'string->number', 'string->path', 'string->path-element',
375
+ 'string->symbol', 'string->uninterned-symbol',
376
+ 'string->unreadable-symbol', 'string-append', 'string-ci<=?',
377
+ 'string-ci<?', 'string-ci=?', 'string-ci>=?', 'string-ci>?',
378
+ 'string-copy', 'string-copy!', 'string-downcase', 'string-fill!',
379
+ 'string-foldcase', 'string-length', 'string-locale-ci<?',
380
+ 'string-locale-ci=?', 'string-locale-ci>?',
381
+ 'string-locale-downcase', 'string-locale-upcase',
382
+ 'string-locale<?', 'string-locale=?', 'string-locale>?',
383
+ 'string-normalize-nfc', 'string-normalize-nfd',
384
+ 'string-normalize-nfkc', 'string-normalize-nfkd', 'string-ref',
385
+ 'string-set!', 'string-titlecase', 'string-upcase',
386
+ 'string-utf-8-length', 'string<=?', 'string<?', 'string=?',
387
+ 'string>=?', 'string>?', 'string?', 'struct->vector',
388
+ 'struct-accessor-procedure?', 'struct-constructor-procedure?',
389
+ 'struct-info', 'struct-mutator-procedure?',
390
+ 'struct-predicate-procedure?', 'struct-type-info',
391
+ 'struct-type-make-constructor', 'struct-type-make-predicate',
392
+ 'struct-type-property-accessor-procedure?',
393
+ 'struct-type-property?', 'struct-type?', 'struct:arity-at-least',
394
+ 'struct:date', 'struct:date*', 'struct:exn', 'struct:exn:break',
395
+ 'struct:exn:fail', 'struct:exn:fail:contract',
396
+ 'struct:exn:fail:contract:arity',
397
+ 'struct:exn:fail:contract:continuation',
398
+ 'struct:exn:fail:contract:divide-by-zero',
399
+ 'struct:exn:fail:contract:non-fixnum-result',
400
+ 'struct:exn:fail:contract:variable', 'struct:exn:fail:filesystem',
401
+ 'struct:exn:fail:filesystem:exists',
402
+ 'struct:exn:fail:filesystem:version', 'struct:exn:fail:network',
403
+ 'struct:exn:fail:out-of-memory', 'struct:exn:fail:read',
404
+ 'struct:exn:fail:read:eof', 'struct:exn:fail:read:non-char',
405
+ 'struct:exn:fail:syntax', 'struct:exn:fail:syntax:unbound',
406
+ 'struct:exn:fail:unsupported', 'struct:exn:fail:user',
407
+ 'struct:srcloc', 'struct?', 'sub1', 'subbytes', 'subprocess',
408
+ 'subprocess-group-enabled', 'subprocess-kill', 'subprocess-pid',
409
+ 'subprocess-status', 'subprocess-wait', 'subprocess?', 'substring',
410
+ 'symbol->string', 'symbol-interned?', 'symbol-unreadable?',
411
+ 'symbol?', 'sync', 'sync/enable-break', 'sync/timeout',
412
+ 'sync/timeout/enable-break', 'syntax->list', 'syntax-arm',
413
+ 'syntax-column', 'syntax-disarm', 'syntax-e', 'syntax-line',
414
+ 'syntax-local-bind-syntaxes', 'syntax-local-certifier',
415
+ 'syntax-local-context', 'syntax-local-expand-expression',
416
+ 'syntax-local-get-shadower', 'syntax-local-introduce',
417
+ 'syntax-local-lift-context', 'syntax-local-lift-expression',
418
+ 'syntax-local-lift-module-end-declaration',
419
+ 'syntax-local-lift-provide', 'syntax-local-lift-require',
420
+ 'syntax-local-lift-values-expression',
421
+ 'syntax-local-make-definition-context',
422
+ 'syntax-local-make-delta-introducer',
423
+ 'syntax-local-module-defined-identifiers',
424
+ 'syntax-local-module-exports',
425
+ 'syntax-local-module-required-identifiers', 'syntax-local-name',
426
+ 'syntax-local-phase-level',
427
+ 'syntax-local-transforming-module-provides?', 'syntax-local-value',
428
+ 'syntax-local-value/immediate', 'syntax-original?',
429
+ 'syntax-position', 'syntax-property',
430
+ 'syntax-property-symbol-keys', 'syntax-protect', 'syntax-rearm',
431
+ 'syntax-recertify', 'syntax-shift-phase-level', 'syntax-source',
432
+ 'syntax-source-module', 'syntax-span', 'syntax-taint',
433
+ 'syntax-tainted?', 'syntax-track-origin',
434
+ 'syntax-transforming-module-expression?', 'syntax-transforming?',
435
+ 'syntax?', 'system-big-endian?', 'system-idle-evt',
436
+ 'system-language+country', 'system-library-subpath',
437
+ 'system-path-convention-type', 'system-type', 'tan',
438
+ 'tcp-abandon-port', 'tcp-accept', 'tcp-accept-evt',
439
+ 'tcp-accept-ready?', 'tcp-accept/enable-break', 'tcp-addresses',
440
+ 'tcp-close', 'tcp-connect', 'tcp-connect/enable-break',
441
+ 'tcp-listen', 'tcp-listener?', 'tcp-port?', 'terminal-port?',
442
+ 'thread', 'thread-cell-ref', 'thread-cell-set!', 'thread-cell?',
443
+ 'thread-dead-evt', 'thread-dead?', 'thread-group?',
444
+ 'thread-resume', 'thread-resume-evt', 'thread-rewind-receive',
445
+ 'thread-running?', 'thread-suspend', 'thread-suspend-evt',
446
+ 'thread-wait', 'thread/suspend-to-kill', 'thread?', 'time-apply',
447
+ 'truncate', 'udp-addresses', 'udp-bind!', 'udp-bound?',
448
+ 'udp-close', 'udp-connect!', 'udp-connected?', 'udp-open-socket',
449
+ 'udp-receive!', 'udp-receive!*', 'udp-receive!-evt',
450
+ 'udp-receive!/enable-break', 'udp-receive-ready-evt', 'udp-send',
451
+ 'udp-send*', 'udp-send-evt', 'udp-send-ready-evt', 'udp-send-to',
452
+ 'udp-send-to*', 'udp-send-to-evt', 'udp-send-to/enable-break',
453
+ 'udp-send/enable-break', 'udp?', 'unbox',
454
+ 'uncaught-exception-handler', 'use-collection-link-paths',
455
+ 'use-compiled-file-paths', 'use-user-specific-search-paths',
456
+ 'values', 'variable-reference->empty-namespace',
457
+ 'variable-reference->module-base-phase',
458
+ 'variable-reference->module-declaration-inspector',
459
+ 'variable-reference->module-source',
460
+ 'variable-reference->namespace', 'variable-reference->phase',
461
+ 'variable-reference->resolved-module-path',
462
+ 'variable-reference-constant?', 'variable-reference?', 'vector',
463
+ 'vector->immutable-vector', 'vector->list',
464
+ 'vector->pseudo-random-generator',
465
+ 'vector->pseudo-random-generator!', 'vector->values',
466
+ 'vector-fill!', 'vector-immutable', 'vector-length', 'vector-ref',
467
+ 'vector-set!', 'vector-set-performance-stats!', 'vector?',
468
+ 'version', 'void', 'void?', 'weak-box-value', 'weak-box?',
469
+ 'will-execute', 'will-executor?', 'will-register',
470
+ 'will-try-execute', 'with-input-from-file', 'with-output-to-file',
471
+ 'wrap-evt', 'write', 'write-byte', 'write-bytes',
472
+ 'write-bytes-avail', 'write-bytes-avail*', 'write-bytes-avail-evt',
473
+ 'write-bytes-avail/enable-break', 'write-char', 'write-special',
474
+ 'write-special-avail*', 'write-special-evt', 'write-string', 'zero?'
475
+ ]
476
+
477
+ # From SchemeLexer
478
+ valid_name = r'[a-zA-Z0-9!$%&*+,/:<=>?@^_~|-]+'
479
+
480
+ tokens = {
481
+ 'root' : [
482
+ (r';.*$', Comment.Single),
483
+ (r'#\|[^|]+\|#', Comment.Multiline),
484
+
485
+ # whitespaces - usually not relevant
486
+ (r'\s+', Text),
487
+
488
+ ## numbers: Keep in mind Racket reader hash prefixes,
489
+ ## which can denote the base or the type. These don't map
490
+ ## neatly onto pygments token types; some judgment calls
491
+ ## here. Note that none of these regexps attempt to
492
+ ## exclude identifiers that start with a number, such as a
493
+ ## variable named "100-Continue".
494
+
495
+ # #b
496
+ (r'#b[-+]?[01]+\.[01]+', Number.Float),
497
+ (r'#b[01]+e[-+]?[01]+', Number.Float),
498
+ (r'#b[-+]?[01]/[01]+', Number),
499
+ (r'#b[-+]?[01]+', Number.Integer),
500
+ (r'#b\S*', Error),
501
+
502
+ # #d OR no hash prefix
503
+ (r'(#d)?[-+]?\d+\.\d+', Number.Float),
504
+ (r'(#d)?\d+e[-+]?\d+', Number.Float),
505
+ (r'(#d)?[-+]?\d+/\d+', Number),
506
+ (r'(#d)?[-+]?\d+', Number.Integer),
507
+ (r'#d\S*', Error),
508
+
509
+ # #e
510
+ (r'#e[-+]?\d+\.\d+', Number.Float),
511
+ (r'#e\d+e[-+]?\d+', Number.Float),
512
+ (r'#e[-+]?\d+/\d+', Number),
513
+ (r'#e[-+]?\d+', Number),
514
+ (r'#e\S*', Error),
515
+
516
+ # #i is always inexact-real, i.e. float
517
+ (r'#i[-+]?\d+\.\d+', Number.Float),
518
+ (r'#i\d+e[-+]?\d+', Number.Float),
519
+ (r'#i[-+]?\d+/\d+', Number.Float),
520
+ (r'#i[-+]?\d+', Number.Float),
521
+ (r'#i\S*', Error),
522
+
523
+ # #o
524
+ (r'#o[-+]?[0-7]+\.[0-7]+', Number.Oct),
525
+ (r'#o[0-7]+e[-+]?[0-7]+', Number.Oct),
526
+ (r'#o[-+]?[0-7]+/[0-7]+', Number.Oct),
527
+ (r'#o[-+]?[0-7]+', Number.Oct),
528
+ (r'#o\S*', Error),
529
+
530
+ # #x
531
+ (r'#x[-+]?[0-9a-fA-F]+\.[0-9a-fA-F]+', Number.Hex),
532
+ # the exponent variation (e.g. #x1e1) is N/A
533
+ (r'#x[-+]?[0-9a-fA-F]+/[0-9a-fA-F]+', Number.Hex),
534
+ (r'#x[-+]?[0-9a-fA-F]+', Number.Hex),
535
+ (r'#x\S*', Error),
536
+
537
+
538
+ # strings, symbols and characters
539
+ (r'"(\\\\|\\"|[^"])*"', String),
540
+ (r"'" + valid_name, String.Symbol),
541
+ (r"#\\([()/'\"._!§$%& ?=+-]{1}|[a-zA-Z0-9]+)", String.Char),
542
+ (r'#rx".+"', String.Regex),
543
+ (r'#px".+"', String.Regex),
544
+
545
+ # constants
546
+ (r'(#t|#f)', Name.Constant),
547
+
548
+ # keyword argument names (e.g. #:keyword)
549
+ (r'#:\S+', Keyword.Declaration),
550
+
551
+ # #lang
552
+ (r'#lang \S+', Keyword.Namespace),
553
+
554
+ # special operators
555
+ (r"('|#|`|,@|,|\.)", Operator),
556
+
557
+ # highlight the keywords
558
+ ('(%s)' % '|'.join([
559
+ re.escape(entry) + ' ' for entry in keywords]),
560
+ Keyword
561
+ ),
562
+
563
+ # first variable in a quoted string like
564
+ # '(this is syntactic sugar)
565
+ (r"(?<='\()" + valid_name, Name.Variable),
566
+ (r"(?<=#\()" + valid_name, Name.Variable),
567
+
568
+ # highlight the builtins
569
+ ("(?<=\()(%s)" % '|'.join([
570
+ re.escape(entry) + ' ' for entry in builtins]),
571
+ Name.Builtin
572
+ ),
573
+
574
+ # the remaining functions; handle both ( and [
575
+ (r'(?<=(\(|\[|\{))' + valid_name, Name.Function),
576
+
577
+ # find the remaining variables
578
+ (valid_name, Name.Variable),
579
+
580
+ # the famous parentheses!
581
+ (r'(\(|\)|\[|\]|\{|\})', Punctuation),
582
+ ],
583
+ }
22
584
 
23
585
 
24
586
  class SchemeLexer(RegexLexer):
@@ -37,7 +599,7 @@ class SchemeLexer(RegexLexer):
37
599
  """
38
600
  name = 'Scheme'
39
601
  aliases = ['scheme', 'scm']
40
- filenames = ['*.scm', '*.ss', '*.rkt']
602
+ filenames = ['*.scm', '*.ss']
41
603
  mimetypes = ['text/x-scheme', 'application/x-scheme']
42
604
 
43
605
  # list of known keywords and builtins taken form vim 6.4 scheme.vim
@@ -145,6 +707,7 @@ class SchemeLexer(RegexLexer):
145
707
 
146
708
  # the famous parentheses!
147
709
  (r'(\(|\))', Punctuation),
710
+ (r'(\[|\])', Punctuation),
148
711
  ],
149
712
  }
150
713
 
@@ -242,7 +805,7 @@ class CommonLispLexer(RegexLexer):
242
805
  (r'#\d*Y.*$', Comment.Special),
243
806
 
244
807
  # strings and characters
245
- (r'"(\\.|[^"\\])*"', String),
808
+ (r'"(\\.|\\\n|[^"\\])*"', String),
246
809
  # quoting
247
810
  (r":" + symbol, String.Symbol),
248
811
  (r"'" + symbol, String.Symbol),
@@ -349,7 +912,7 @@ class HaskellLexer(RegexLexer):
349
912
  # Whitespace:
350
913
  (r'\s+', Text),
351
914
  #(r'--\s*|.*$', Comment.Doc),
352
- (r'--(?![!#$%&*+./<=>?@\^|_~]).*?$', Comment.Single),
915
+ (r'--(?![!#$%&*+./<=>?@\^|_~:\\]).*?$', Comment.Single),
353
916
  (r'{-', Comment.Multiline, 'comment'),
354
917
  # Lexemes:
355
918
  # Identifiers
@@ -861,7 +1424,7 @@ class OcamlLexer(RegexLexer):
861
1424
  'inherit', 'initializer', 'lazy', 'let', 'match', 'method',
862
1425
  'module', 'mutable', 'new', 'object', 'of', 'open', 'private',
863
1426
  'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try',
864
- 'type', 'val', 'virtual', 'when', 'while', 'with'
1427
+ 'type', 'value', 'val', 'virtual', 'when', 'while', 'with',
865
1428
  ]
866
1429
  keyopts = [
867
1430
  '!=','#','&','&&','\(','\)','\*','\+',',','-',
@@ -1011,8 +1574,9 @@ class ErlangLexer(RegexLexer):
1011
1574
  (r'"', String, 'string'),
1012
1575
  (r'<<', Name.Label),
1013
1576
  (r'>>', Name.Label),
1014
- (r'('+atom_re+')(:)', bygroups(Name.Namespace, Punctuation)),
1015
- (r'^('+atom_re+r')(\s*)(\()', bygroups(Name.Function, Text, Punctuation)),
1577
+ ('(' + atom_re + ')(:)', bygroups(Name.Namespace, Punctuation)),
1578
+ ('(?:^|(?<=:))(' + atom_re + r')(\s*)(\()',
1579
+ bygroups(Name.Function, Text, Punctuation)),
1016
1580
  (r'[+-]?'+base_re+r'#[0-9a-zA-Z]+', Number.Integer),
1017
1581
  (r'[+-]?\d+', Number.Integer),
1018
1582
  (r'[+-]?\d+.\d+', Number.Float),
@@ -1830,3 +2394,204 @@ class ElixirConsoleLexer(Lexer):
1830
2394
  for item in do_insertions(insertions,
1831
2395
  exlexer.get_tokens_unprocessed(curcode)):
1832
2396
  yield item
2397
+
2398
+
2399
+ class KokaLexer(RegexLexer):
2400
+ """
2401
+ Lexer for the `Koka <http://research.microsoft.com/en-us/projects/koka/>`_
2402
+ language.
2403
+
2404
+ *New in Pygments 1.6.*
2405
+ """
2406
+
2407
+ name = 'Koka'
2408
+ aliases = ['koka']
2409
+ filenames = ['*.kk', '*.kki']
2410
+ mimetypes = ['text/x-koka']
2411
+
2412
+ keywords = [
2413
+ 'infix', 'infixr', 'infixl', 'prefix', 'postfix',
2414
+ 'type', 'cotype', 'rectype', 'alias',
2415
+ 'struct', 'con',
2416
+ 'fun', 'function', 'val', 'var',
2417
+ 'external',
2418
+ 'if', 'then', 'else', 'elif', 'return', 'match',
2419
+ 'private', 'public', 'private',
2420
+ 'module', 'import', 'as',
2421
+ 'include', 'inline',
2422
+ 'rec',
2423
+ 'try', 'yield', 'enum',
2424
+ 'interface', 'instance',
2425
+ ]
2426
+
2427
+ # keywords that are followed by a type
2428
+ typeStartKeywords = [
2429
+ 'type', 'cotype', 'rectype', 'alias', 'struct', 'enum',
2430
+ ]
2431
+
2432
+ # keywords valid in a type
2433
+ typekeywords = [
2434
+ 'forall', 'exists', 'some', 'with',
2435
+ ]
2436
+
2437
+ # builtin names and special names
2438
+ builtin = [
2439
+ 'for', 'while', 'repeat',
2440
+ 'foreach', 'foreach-indexed',
2441
+ 'error', 'catch', 'finally',
2442
+ 'cs', 'js', 'file', 'ref', 'assigned',
2443
+ ]
2444
+
2445
+ # symbols that can be in an operator
2446
+ symbols = '[\$%&\*\+@!/\\\^~=\.:\-\?\|<>]+'
2447
+
2448
+ # symbol boundary: an operator keyword should not be followed by any of these
2449
+ sboundary = '(?!'+symbols+')'
2450
+
2451
+ # name boundary: a keyword should not be followed by any of these
2452
+ boundary = '(?![a-zA-Z0-9_\\-])'
2453
+
2454
+ # main lexer
2455
+ tokens = {
2456
+ 'root': [
2457
+ include('whitespace'),
2458
+
2459
+ # go into type mode
2460
+ (r'::?' + sboundary, Keyword.Type, 'type'),
2461
+ (r'alias' + boundary, Keyword, 'alias-type'),
2462
+ (r'struct' + boundary, Keyword, 'struct-type'),
2463
+ (r'(%s)' % '|'.join(typeStartKeywords) + boundary, Keyword, 'type'),
2464
+
2465
+ # special sequences of tokens (we use ?: for non-capturing group as
2466
+ # required by 'bygroups')
2467
+ (r'(module)(\s*)((?:interface)?)(\s*)'
2468
+ r'((?:[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*\.)*'
2469
+ r'[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)',
2470
+ bygroups(Keyword, Text, Keyword, Text, Name.Namespace)),
2471
+ (r'(import)(\s+)((?:[a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*\.)*[a-z]'
2472
+ r'(?:[a-zA-Z0-9_]|\-[a-zA-Z])*)(\s*)((?:as)?)'
2473
+ r'((?:[A-Z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)?)',
2474
+ bygroups(Keyword, Text, Name.Namespace, Text, Keyword,
2475
+ Name.Namespace)),
2476
+
2477
+ # keywords
2478
+ (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type),
2479
+ (r'(%s)' % '|'.join(keywords) + boundary, Keyword),
2480
+ (r'(%s)' % '|'.join(builtin) + boundary, Keyword.Pseudo),
2481
+ (r'::|:=|\->|[=\.:]' + sboundary, Keyword),
2482
+ (r'\-' + sboundary, Generic.Strong),
2483
+
2484
+ # names
2485
+ (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?=\.)', Name.Namespace),
2486
+ (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?!\.)', Name.Class),
2487
+ (r'[a-z]([a-zA-Z0-9_]|\-[a-zA-Z])*', Name),
2488
+ (r'_([a-zA-Z0-9_]|\-[a-zA-Z])*', Name.Variable),
2489
+
2490
+ # literal string
2491
+ (r'@"', String.Double, 'litstring'),
2492
+
2493
+ # operators
2494
+ (symbols, Operator),
2495
+ (r'`', Operator),
2496
+ (r'[\{\}\(\)\[\];,]', Punctuation),
2497
+
2498
+ # literals. No check for literal characters with len > 1
2499
+ (r'[0-9]+\.[0-9]+([eE][\-\+]?[0-9]+)?', Number.Float),
2500
+ (r'0[xX][0-9a-fA-F]+', Number.Hex),
2501
+ (r'[0-9]+', Number.Integer),
2502
+
2503
+ (r"'", String.Char, 'char'),
2504
+ (r'"', String.Double, 'string'),
2505
+ ],
2506
+
2507
+ # type started by alias
2508
+ 'alias-type': [
2509
+ (r'=',Keyword),
2510
+ include('type')
2511
+ ],
2512
+
2513
+ # type started by struct
2514
+ 'struct-type': [
2515
+ (r'(?=\((?!,*\)))',Punctuation, '#pop'),
2516
+ include('type')
2517
+ ],
2518
+
2519
+ # type started by colon
2520
+ 'type': [
2521
+ (r'[\(\[<]', Keyword.Type, 'type-nested'),
2522
+ include('type-content')
2523
+ ],
2524
+
2525
+ # type nested in brackets: can contain parameters, comma etc.
2526
+ 'type-nested': [
2527
+ (r'[\)\]>]', Keyword.Type, '#pop'),
2528
+ (r'[\(\[<]', Keyword.Type, 'type-nested'),
2529
+ (r',', Keyword.Type),
2530
+ (r'([a-z](?:[a-zA-Z0-9_]|\-[a-zA-Z])*)(\s*)(:)(?!:)',
2531
+ bygroups(Name.Variable,Text,Keyword.Type)), # parameter name
2532
+ include('type-content')
2533
+ ],
2534
+
2535
+ # shared contents of a type
2536
+ 'type-content': [
2537
+ include('whitespace'),
2538
+
2539
+ # keywords
2540
+ (r'(%s)' % '|'.join(typekeywords) + boundary, Keyword.Type),
2541
+ (r'(?=((%s)' % '|'.join(keywords) + boundary + '))',
2542
+ Keyword, '#pop'), # need to match because names overlap...
2543
+
2544
+ # kinds
2545
+ (r'[EPH]' + boundary, Keyword.Type),
2546
+ (r'[*!]', Keyword.Type),
2547
+
2548
+ # type names
2549
+ (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?=\.)', Name.Namespace),
2550
+ (r'[A-Z]([a-zA-Z0-9_]|\-[a-zA-Z])*(?!\.)', Name.Class),
2551
+ (r'[a-z][0-9]*(?![a-zA-Z_\-])', Keyword.Type), # Generic.Emph
2552
+ (r'_([a-zA-Z0-9_]|\-[a-zA-Z])*', Keyword.Type), # Generic.Emph
2553
+ (r'[a-z]([a-zA-Z0-9_]|\-[a-zA-Z])*', Keyword.Type),
2554
+
2555
+ # type keyword operators
2556
+ (r'::|\->|[\.:|]', Keyword.Type),
2557
+
2558
+ #catchall
2559
+ (r'', Text, '#pop')
2560
+ ],
2561
+
2562
+ # comments and literals
2563
+ 'whitespace': [
2564
+ (r'\s+', Text),
2565
+ (r'/\*', Comment.Multiline, 'comment'),
2566
+ (r'//.*$', Comment.Single)
2567
+ ],
2568
+ 'comment': [
2569
+ (r'[^/\*]+', Comment.Multiline),
2570
+ (r'/\*', Comment.Multiline, '#push'),
2571
+ (r'\*/', Comment.Multiline, '#pop'),
2572
+ (r'[\*/]', Comment.Multiline),
2573
+ ],
2574
+ 'litstring': [
2575
+ (r'[^"]+', String.Double),
2576
+ (r'""', String.Escape),
2577
+ (r'"', String.Double, '#pop'),
2578
+ ],
2579
+ 'string': [
2580
+ (r'[^\\"\n]+', String.Double),
2581
+ include('escape-sequence'),
2582
+ (r'["\n]', String.Double, '#pop'),
2583
+ ],
2584
+ 'char': [
2585
+ (r'[^\\\'\n]+', String.Char),
2586
+ include('escape-sequence'),
2587
+ (r'[\'\n]', String.Char, '#pop'),
2588
+ ],
2589
+ 'escape-sequence': [
2590
+ (r'\\[abfnrtv0\\\"\'\?]', String.Escape),
2591
+ (r'\\x[0-9a-fA-F]{2}', String.Escape),
2592
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
2593
+ # Yes, \U literals are 6 hex digits.
2594
+ (r'\\U[0-9a-fA-F]{6}', String.Escape)
2595
+ ]
2596
+ }
2597
+