1 # -*- coding: utf-8 -*- |
|
2 """ |
|
3 pygments.lexers.lisp |
|
4 ~~~~~~~~~~~~~~~~~~~~ |
|
5 |
|
6 Lexers for Lispy languages. |
|
7 |
|
8 :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. |
|
9 :license: BSD, see LICENSE for details. |
|
10 """ |
|
11 |
|
12 import re |
|
13 |
|
14 from pygments.lexer import RegexLexer, include, bygroups, words, default |
|
15 from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ |
|
16 Number, Punctuation, Literal, Error |
|
17 |
|
18 from pygments.lexers.python import PythonLexer |
|
19 |
|
20 __all__ = ['SchemeLexer', 'CommonLispLexer', 'HyLexer', 'RacketLexer', |
|
21 'NewLispLexer', 'EmacsLispLexer', 'ShenLexer', 'CPSALexer', |
|
22 'XtlangLexer', 'FennelLexer'] |
|
23 |
|
24 |
|
25 class SchemeLexer(RegexLexer): |
|
26 """ |
|
27 A Scheme lexer, parsing a stream and outputting the tokens |
|
28 needed to highlight scheme code. |
|
29 This lexer could be most probably easily subclassed to parse |
|
30 other LISP-Dialects like Common Lisp, Emacs Lisp or AutoLisp. |
|
31 |
|
32 This parser is checked with pastes from the LISP pastebin |
|
33 at http://paste.lisp.org/ to cover as much syntax as possible. |
|
34 |
|
35 It supports the full Scheme syntax as defined in R5RS. |
|
36 |
|
37 .. versionadded:: 0.6 |
|
38 """ |
|
39 name = 'Scheme' |
|
40 aliases = ['scheme', 'scm'] |
|
41 filenames = ['*.scm', '*.ss'] |
|
42 mimetypes = ['text/x-scheme', 'application/x-scheme'] |
|
43 |
|
44 # list of known keywords and builtins taken form vim 6.4 scheme.vim |
|
45 # syntax file. |
|
46 keywords = ( |
|
47 'lambda', 'define', 'if', 'else', 'cond', 'and', 'or', 'case', 'let', |
|
48 'let*', 'letrec', 'begin', 'do', 'delay', 'set!', '=>', 'quote', |
|
49 'quasiquote', 'unquote', 'unquote-splicing', 'define-syntax', |
|
50 'let-syntax', 'letrec-syntax', 'syntax-rules' |
|
51 ) |
|
52 builtins = ( |
|
53 '*', '+', '-', '/', '<', '<=', '=', '>', '>=', 'abs', 'acos', 'angle', |
|
54 'append', 'apply', 'asin', 'assoc', 'assq', 'assv', 'atan', |
|
55 'boolean?', 'caaaar', 'caaadr', 'caaar', 'caadar', 'caaddr', 'caadr', |
|
56 'caar', 'cadaar', 'cadadr', 'cadar', 'caddar', 'cadddr', 'caddr', |
|
57 'cadr', 'call-with-current-continuation', 'call-with-input-file', |
|
58 'call-with-output-file', 'call-with-values', 'call/cc', 'car', |
|
59 'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar', |
|
60 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', 'cddr', |
|
61 'cdr', 'ceiling', 'char->integer', 'char-alphabetic?', 'char-ci<=?', |
|
62 'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?', 'char-downcase', |
|
63 'char-lower-case?', 'char-numeric?', 'char-ready?', 'char-upcase', |
|
64 'char-upper-case?', 'char-whitespace?', 'char<=?', 'char<?', 'char=?', |
|
65 'char>=?', 'char>?', 'char?', 'close-input-port', 'close-output-port', |
|
66 'complex?', 'cons', 'cos', 'current-input-port', 'current-output-port', |
|
67 'denominator', 'display', 'dynamic-wind', 'eof-object?', 'eq?', |
|
68 'equal?', 'eqv?', 'eval', 'even?', 'exact->inexact', 'exact?', 'exp', |
|
69 'expt', 'floor', 'for-each', 'force', 'gcd', 'imag-part', |
|
70 'inexact->exact', 'inexact?', 'input-port?', 'integer->char', |
|
71 'integer?', 'interaction-environment', 'lcm', 'length', 'list', |
|
72 'list->string', 'list->vector', 'list-ref', 'list-tail', 'list?', |
|
73 'load', 'log', 'magnitude', 'make-polar', 'make-rectangular', |
|
74 'make-string', 'make-vector', 'map', 'max', 'member', 'memq', 'memv', |
|
75 'min', 'modulo', 'negative?', 'newline', 'not', 'null-environment', |
|
76 'null?', 'number->string', 'number?', 'numerator', 'odd?', |
|
77 'open-input-file', 'open-output-file', 'output-port?', 'pair?', |
|
78 'peek-char', 'port?', 'positive?', 'procedure?', 'quotient', |
|
79 'rational?', 'rationalize', 'read', 'read-char', 'real-part', 'real?', |
|
80 'remainder', 'reverse', 'round', 'scheme-report-environment', |
|
81 'set-car!', 'set-cdr!', 'sin', 'sqrt', 'string', 'string->list', |
|
82 'string->number', 'string->symbol', 'string-append', 'string-ci<=?', |
|
83 'string-ci<?', 'string-ci=?', 'string-ci>=?', 'string-ci>?', |
|
84 'string-copy', 'string-fill!', 'string-length', 'string-ref', |
|
85 'string-set!', 'string<=?', 'string<?', 'string=?', 'string>=?', |
|
86 'string>?', 'string?', 'substring', 'symbol->string', 'symbol?', |
|
87 'tan', 'transcript-off', 'transcript-on', 'truncate', 'values', |
|
88 'vector', 'vector->list', 'vector-fill!', 'vector-length', |
|
89 'vector-ref', 'vector-set!', 'vector?', 'with-input-from-file', |
|
90 'with-output-to-file', 'write', 'write-char', 'zero?' |
|
91 ) |
|
92 |
|
93 # valid names for identifiers |
|
94 # well, names can only not consist fully of numbers |
|
95 # but this should be good enough for now |
|
96 valid_name = r'[\w!$%&*+,/:<=>?@^~|-]+' |
|
97 |
|
98 tokens = { |
|
99 'root': [ |
|
100 # the comments |
|
101 # and going to the end of the line |
|
102 (r';.*$', Comment.Single), |
|
103 # multi-line comment |
|
104 (r'#\|', Comment.Multiline, 'multiline-comment'), |
|
105 # commented form (entire sexpr folliwng) |
|
106 (r'#;\s*\(', Comment, 'commented-form'), |
|
107 # signifies that the program text that follows is written with the |
|
108 # lexical and datum syntax described in r6rs |
|
109 (r'#!r6rs', Comment), |
|
110 |
|
111 # whitespaces - usually not relevant |
|
112 (r'\s+', Text), |
|
113 |
|
114 # numbers |
|
115 (r'-?\d+\.\d+', Number.Float), |
|
116 (r'-?\d+', Number.Integer), |
|
117 # support for uncommon kinds of numbers - |
|
118 # have to figure out what the characters mean |
|
119 # (r'(#e|#i|#b|#o|#d|#x)[\d.]+', Number), |
|
120 |
|
121 # strings, symbols and characters |
|
122 (r'"(\\\\|\\[^\\]|[^"\\])*"', String), |
|
123 (r"'" + valid_name, String.Symbol), |
|
124 (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char), |
|
125 |
|
126 # constants |
|
127 (r'(#t|#f)', Name.Constant), |
|
128 |
|
129 # special operators |
|
130 (r"('|#|`|,@|,|\.)", Operator), |
|
131 |
|
132 # highlight the keywords |
|
133 ('(%s)' % '|'.join(re.escape(entry) + ' ' for entry in keywords), |
|
134 Keyword), |
|
135 |
|
136 # first variable in a quoted string like |
|
137 # '(this is syntactic sugar) |
|
138 (r"(?<='\()" + valid_name, Name.Variable), |
|
139 (r"(?<=#\()" + valid_name, Name.Variable), |
|
140 |
|
141 # highlight the builtins |
|
142 (r"(?<=\()(%s)" % '|'.join(re.escape(entry) + ' ' for entry in builtins), |
|
143 Name.Builtin), |
|
144 |
|
145 # the remaining functions |
|
146 (r'(?<=\()' + valid_name, Name.Function), |
|
147 # find the remaining variables |
|
148 (valid_name, Name.Variable), |
|
149 |
|
150 # the famous parentheses! |
|
151 (r'(\(|\))', Punctuation), |
|
152 (r'(\[|\])', Punctuation), |
|
153 ], |
|
154 'multiline-comment': [ |
|
155 (r'#\|', Comment.Multiline, '#push'), |
|
156 (r'\|#', Comment.Multiline, '#pop'), |
|
157 (r'[^|#]+', Comment.Multiline), |
|
158 (r'[|#]', Comment.Multiline), |
|
159 ], |
|
160 'commented-form': [ |
|
161 (r'\(', Comment, '#push'), |
|
162 (r'\)', Comment, '#pop'), |
|
163 (r'[^()]+', Comment), |
|
164 ], |
|
165 } |
|
166 |
|
167 |
|
168 class CommonLispLexer(RegexLexer): |
|
169 """ |
|
170 A Common Lisp lexer. |
|
171 |
|
172 .. versionadded:: 0.9 |
|
173 """ |
|
174 name = 'Common Lisp' |
|
175 aliases = ['common-lisp', 'cl', 'lisp'] |
|
176 filenames = ['*.cl', '*.lisp'] |
|
177 mimetypes = ['text/x-common-lisp'] |
|
178 |
|
179 flags = re.IGNORECASE | re.MULTILINE |
|
180 |
|
181 # couple of useful regexes |
|
182 |
|
183 # characters that are not macro-characters and can be used to begin a symbol |
|
184 nonmacro = r'\\.|[\w!$%&*+-/<=>?@\[\]^{}~]' |
|
185 constituent = nonmacro + '|[#.:]' |
|
186 terminated = r'(?=[ "()\'\n,;`])' # whitespace or terminating macro characters |
|
187 |
|
188 # symbol token, reverse-engineered from hyperspec |
|
189 # Take a deep breath... |
|
190 symbol = r'(\|[^|]+\||(?:%s)(?:%s)*)' % (nonmacro, constituent) |
|
191 |
|
192 def __init__(self, **options): |
|
193 from pygments.lexers._cl_builtins import BUILTIN_FUNCTIONS, \ |
|
194 SPECIAL_FORMS, MACROS, LAMBDA_LIST_KEYWORDS, DECLARATIONS, \ |
|
195 BUILTIN_TYPES, BUILTIN_CLASSES |
|
196 self.builtin_function = BUILTIN_FUNCTIONS |
|
197 self.special_forms = SPECIAL_FORMS |
|
198 self.macros = MACROS |
|
199 self.lambda_list_keywords = LAMBDA_LIST_KEYWORDS |
|
200 self.declarations = DECLARATIONS |
|
201 self.builtin_types = BUILTIN_TYPES |
|
202 self.builtin_classes = BUILTIN_CLASSES |
|
203 RegexLexer.__init__(self, **options) |
|
204 |
|
205 def get_tokens_unprocessed(self, text): |
|
206 stack = ['root'] |
|
207 for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack): |
|
208 if token is Name.Variable: |
|
209 if value in self.builtin_function: |
|
210 yield index, Name.Builtin, value |
|
211 continue |
|
212 if value in self.special_forms: |
|
213 yield index, Keyword, value |
|
214 continue |
|
215 if value in self.macros: |
|
216 yield index, Name.Builtin, value |
|
217 continue |
|
218 if value in self.lambda_list_keywords: |
|
219 yield index, Keyword, value |
|
220 continue |
|
221 if value in self.declarations: |
|
222 yield index, Keyword, value |
|
223 continue |
|
224 if value in self.builtin_types: |
|
225 yield index, Keyword.Type, value |
|
226 continue |
|
227 if value in self.builtin_classes: |
|
228 yield index, Name.Class, value |
|
229 continue |
|
230 yield index, token, value |
|
231 |
|
232 tokens = { |
|
233 'root': [ |
|
234 default('body'), |
|
235 ], |
|
236 'multiline-comment': [ |
|
237 (r'#\|', Comment.Multiline, '#push'), # (cf. Hyperspec 2.4.8.19) |
|
238 (r'\|#', Comment.Multiline, '#pop'), |
|
239 (r'[^|#]+', Comment.Multiline), |
|
240 (r'[|#]', Comment.Multiline), |
|
241 ], |
|
242 'commented-form': [ |
|
243 (r'\(', Comment.Preproc, '#push'), |
|
244 (r'\)', Comment.Preproc, '#pop'), |
|
245 (r'[^()]+', Comment.Preproc), |
|
246 ], |
|
247 'body': [ |
|
248 # whitespace |
|
249 (r'\s+', Text), |
|
250 |
|
251 # single-line comment |
|
252 (r';.*$', Comment.Single), |
|
253 |
|
254 # multi-line comment |
|
255 (r'#\|', Comment.Multiline, 'multiline-comment'), |
|
256 |
|
257 # encoding comment (?) |
|
258 (r'#\d*Y.*$', Comment.Special), |
|
259 |
|
260 # strings and characters |
|
261 (r'"(\\.|\\\n|[^"\\])*"', String), |
|
262 # quoting |
|
263 (r":" + symbol, String.Symbol), |
|
264 (r"::" + symbol, String.Symbol), |
|
265 (r":#" + symbol, String.Symbol), |
|
266 (r"'" + symbol, String.Symbol), |
|
267 (r"'", Operator), |
|
268 (r"`", Operator), |
|
269 |
|
270 # decimal numbers |
|
271 (r'[-+]?\d+\.?' + terminated, Number.Integer), |
|
272 (r'[-+]?\d+/\d+' + terminated, Number), |
|
273 (r'[-+]?(\d*\.\d+([defls][-+]?\d+)?|\d+(\.\d*)?[defls][-+]?\d+)' + |
|
274 terminated, Number.Float), |
|
275 |
|
276 # sharpsign strings and characters |
|
277 (r"#\\." + terminated, String.Char), |
|
278 (r"#\\" + symbol, String.Char), |
|
279 |
|
280 # vector |
|
281 (r'#\(', Operator, 'body'), |
|
282 |
|
283 # bitstring |
|
284 (r'#\d*\*[01]*', Literal.Other), |
|
285 |
|
286 # uninterned symbol |
|
287 (r'#:' + symbol, String.Symbol), |
|
288 |
|
289 # read-time and load-time evaluation |
|
290 (r'#[.,]', Operator), |
|
291 |
|
292 # function shorthand |
|
293 (r'#\'', Name.Function), |
|
294 |
|
295 # binary rational |
|
296 (r'#b[+-]?[01]+(/[01]+)?', Number.Bin), |
|
297 |
|
298 # octal rational |
|
299 (r'#o[+-]?[0-7]+(/[0-7]+)?', Number.Oct), |
|
300 |
|
301 # hex rational |
|
302 (r'#x[+-]?[0-9a-f]+(/[0-9a-f]+)?', Number.Hex), |
|
303 |
|
304 # radix rational |
|
305 (r'#\d+r[+-]?[0-9a-z]+(/[0-9a-z]+)?', Number), |
|
306 |
|
307 # complex |
|
308 (r'(#c)(\()', bygroups(Number, Punctuation), 'body'), |
|
309 |
|
310 # array |
|
311 (r'(#\d+a)(\()', bygroups(Literal.Other, Punctuation), 'body'), |
|
312 |
|
313 # structure |
|
314 (r'(#s)(\()', bygroups(Literal.Other, Punctuation), 'body'), |
|
315 |
|
316 # path |
|
317 (r'#p?"(\\.|[^"])*"', Literal.Other), |
|
318 |
|
319 # reference |
|
320 (r'#\d+=', Operator), |
|
321 (r'#\d+#', Operator), |
|
322 |
|
323 # read-time comment |
|
324 (r'#+nil' + terminated + r'\s*\(', Comment.Preproc, 'commented-form'), |
|
325 |
|
326 # read-time conditional |
|
327 (r'#[+-]', Operator), |
|
328 |
|
329 # special operators that should have been parsed already |
|
330 (r'(,@|,|\.)', Operator), |
|
331 |
|
332 # special constants |
|
333 (r'(t|nil)' + terminated, Name.Constant), |
|
334 |
|
335 # functions and variables |
|
336 (r'\*' + symbol + r'\*', Name.Variable.Global), |
|
337 (symbol, Name.Variable), |
|
338 |
|
339 # parentheses |
|
340 (r'\(', Punctuation, 'body'), |
|
341 (r'\)', Punctuation, '#pop'), |
|
342 ], |
|
343 } |
|
344 |
|
345 |
|
346 class HyLexer(RegexLexer): |
|
347 """ |
|
348 Lexer for `Hy <http://hylang.org/>`_ source code. |
|
349 |
|
350 .. versionadded:: 2.0 |
|
351 """ |
|
352 name = 'Hy' |
|
353 aliases = ['hylang'] |
|
354 filenames = ['*.hy'] |
|
355 mimetypes = ['text/x-hy', 'application/x-hy'] |
|
356 |
|
357 special_forms = ( |
|
358 'cond', 'for', '->', '->>', 'car', |
|
359 'cdr', 'first', 'rest', 'let', 'when', 'unless', |
|
360 'import', 'do', 'progn', 'get', 'slice', 'assoc', 'with-decorator', |
|
361 ',', 'list_comp', 'kwapply', '~', 'is', 'in', 'is-not', 'not-in', |
|
362 'quasiquote', 'unquote', 'unquote-splice', 'quote', '|', '<<=', '>>=', |
|
363 'foreach', 'while', |
|
364 'eval-and-compile', 'eval-when-compile' |
|
365 ) |
|
366 |
|
367 declarations = ( |
|
368 'def', 'defn', 'defun', 'defmacro', 'defclass', 'lambda', 'fn', 'setv' |
|
369 ) |
|
370 |
|
371 hy_builtins = () |
|
372 |
|
373 hy_core = ( |
|
374 'cycle', 'dec', 'distinct', 'drop', 'even?', 'filter', 'inc', |
|
375 'instance?', 'iterable?', 'iterate', 'iterator?', 'neg?', |
|
376 'none?', 'nth', 'numeric?', 'odd?', 'pos?', 'remove', 'repeat', |
|
377 'repeatedly', 'take', 'take_nth', 'take_while', 'zero?' |
|
378 ) |
|
379 |
|
380 builtins = hy_builtins + hy_core |
|
381 |
|
382 # valid names for identifiers |
|
383 # well, names can only not consist fully of numbers |
|
384 # but this should be good enough for now |
|
385 valid_name = r'(?!#)[\w!$%*+<=>?/.#:-]+' |
|
386 |
|
387 def _multi_escape(entries): |
|
388 return words(entries, suffix=' ') |
|
389 |
|
390 tokens = { |
|
391 'root': [ |
|
392 # the comments - always starting with semicolon |
|
393 # and going to the end of the line |
|
394 (r';.*$', Comment.Single), |
|
395 |
|
396 # whitespaces - usually not relevant |
|
397 (r'[,\s]+', Text), |
|
398 |
|
399 # numbers |
|
400 (r'-?\d+\.\d+', Number.Float), |
|
401 (r'-?\d+', Number.Integer), |
|
402 (r'0[0-7]+j?', Number.Oct), |
|
403 (r'0[xX][a-fA-F0-9]+', Number.Hex), |
|
404 |
|
405 # strings, symbols and characters |
|
406 (r'"(\\\\|\\[^\\]|[^"\\])*"', String), |
|
407 (r"'" + valid_name, String.Symbol), |
|
408 (r"\\(.|[a-z]+)", String.Char), |
|
409 (r'^(\s*)([rRuU]{,2}"""(?:.|\n)*?""")', bygroups(Text, String.Doc)), |
|
410 (r"^(\s*)([rRuU]{,2}'''(?:.|\n)*?''')", bygroups(Text, String.Doc)), |
|
411 |
|
412 # keywords |
|
413 (r'::?' + valid_name, String.Symbol), |
|
414 |
|
415 # special operators |
|
416 (r'~@|[`\'#^~&@]', Operator), |
|
417 |
|
418 include('py-keywords'), |
|
419 include('py-builtins'), |
|
420 |
|
421 # highlight the special forms |
|
422 (_multi_escape(special_forms), Keyword), |
|
423 |
|
424 # Technically, only the special forms are 'keywords'. The problem |
|
425 # is that only treating them as keywords means that things like |
|
426 # 'defn' and 'ns' need to be highlighted as builtins. This is ugly |
|
427 # and weird for most styles. So, as a compromise we're going to |
|
428 # highlight them as Keyword.Declarations. |
|
429 (_multi_escape(declarations), Keyword.Declaration), |
|
430 |
|
431 # highlight the builtins |
|
432 (_multi_escape(builtins), Name.Builtin), |
|
433 |
|
434 # the remaining functions |
|
435 (r'(?<=\()' + valid_name, Name.Function), |
|
436 |
|
437 # find the remaining variables |
|
438 (valid_name, Name.Variable), |
|
439 |
|
440 # Hy accepts vector notation |
|
441 (r'(\[|\])', Punctuation), |
|
442 |
|
443 # Hy accepts map notation |
|
444 (r'(\{|\})', Punctuation), |
|
445 |
|
446 # the famous parentheses! |
|
447 (r'(\(|\))', Punctuation), |
|
448 |
|
449 ], |
|
450 'py-keywords': PythonLexer.tokens['keywords'], |
|
451 'py-builtins': PythonLexer.tokens['builtins'], |
|
452 } |
|
453 |
|
454 def analyse_text(text): |
|
455 if '(import ' in text or '(defn ' in text: |
|
456 return 0.9 |
|
457 |
|
458 |
|
459 class RacketLexer(RegexLexer): |
|
460 """ |
|
461 Lexer for `Racket <http://racket-lang.org/>`_ source code (formerly |
|
462 known as PLT Scheme). |
|
463 |
|
464 .. versionadded:: 1.6 |
|
465 """ |
|
466 |
|
467 name = 'Racket' |
|
468 aliases = ['racket', 'rkt'] |
|
469 filenames = ['*.rkt', '*.rktd', '*.rktl'] |
|
470 mimetypes = ['text/x-racket', 'application/x-racket'] |
|
471 |
|
472 # Generated by example.rkt |
|
473 _keywords = ( |
|
474 '#%app', '#%datum', '#%declare', '#%expression', '#%module-begin', |
|
475 '#%plain-app', '#%plain-lambda', '#%plain-module-begin', |
|
476 '#%printing-module-begin', '#%provide', '#%require', |
|
477 '#%stratified-body', '#%top', '#%top-interaction', |
|
478 '#%variable-reference', '->', '->*', '->*m', '->d', '->dm', '->i', |
|
479 '->m', '...', ':do-in', '==', '=>', '_', 'absent', 'abstract', |
|
480 'all-defined-out', 'all-from-out', 'and', 'any', 'augment', 'augment*', |
|
481 'augment-final', 'augment-final*', 'augride', 'augride*', 'begin', |
|
482 'begin-for-syntax', 'begin0', 'case', 'case->', 'case->m', |
|
483 'case-lambda', 'class', 'class*', 'class-field-accessor', |
|
484 'class-field-mutator', 'class/c', 'class/derived', 'combine-in', |
|
485 'combine-out', 'command-line', 'compound-unit', 'compound-unit/infer', |
|
486 'cond', 'cons/dc', 'contract', 'contract-out', 'contract-struct', |
|
487 'contracted', 'define', 'define-compound-unit', |
|
488 'define-compound-unit/infer', 'define-contract-struct', |
|
489 'define-custom-hash-types', 'define-custom-set-types', |
|
490 'define-for-syntax', 'define-local-member-name', 'define-logger', |
|
491 'define-match-expander', 'define-member-name', |
|
492 'define-module-boundary-contract', 'define-namespace-anchor', |
|
493 'define-opt/c', 'define-sequence-syntax', 'define-serializable-class', |
|
494 'define-serializable-class*', 'define-signature', |
|
495 'define-signature-form', 'define-struct', 'define-struct/contract', |
|
496 'define-struct/derived', 'define-syntax', 'define-syntax-rule', |
|
497 'define-syntaxes', 'define-unit', 'define-unit-binding', |
|
498 'define-unit-from-context', 'define-unit/contract', |
|
499 'define-unit/new-import-export', 'define-unit/s', 'define-values', |
|
500 'define-values-for-export', 'define-values-for-syntax', |
|
501 'define-values/invoke-unit', 'define-values/invoke-unit/infer', |
|
502 'define/augment', 'define/augment-final', 'define/augride', |
|
503 'define/contract', 'define/final-prop', 'define/match', |
|
504 'define/overment', 'define/override', 'define/override-final', |
|
505 'define/private', 'define/public', 'define/public-final', |
|
506 'define/pubment', 'define/subexpression-pos-prop', |
|
507 'define/subexpression-pos-prop/name', 'delay', 'delay/idle', |
|
508 'delay/name', 'delay/strict', 'delay/sync', 'delay/thread', 'do', |
|
509 'else', 'except', 'except-in', 'except-out', 'export', 'extends', |
|
510 'failure-cont', 'false', 'false/c', 'field', 'field-bound?', 'file', |
|
511 'flat-murec-contract', 'flat-rec-contract', 'for', 'for*', 'for*/and', |
|
512 'for*/async', 'for*/first', 'for*/fold', 'for*/fold/derived', |
|
513 'for*/hash', 'for*/hasheq', 'for*/hasheqv', 'for*/last', 'for*/list', |
|
514 'for*/lists', 'for*/mutable-set', 'for*/mutable-seteq', |
|
515 'for*/mutable-seteqv', 'for*/or', 'for*/product', 'for*/set', |
|
516 'for*/seteq', 'for*/seteqv', 'for*/stream', 'for*/sum', 'for*/vector', |
|
517 'for*/weak-set', 'for*/weak-seteq', 'for*/weak-seteqv', 'for-label', |
|
518 'for-meta', 'for-syntax', 'for-template', 'for/and', 'for/async', |
|
519 'for/first', 'for/fold', 'for/fold/derived', 'for/hash', 'for/hasheq', |
|
520 'for/hasheqv', 'for/last', 'for/list', 'for/lists', 'for/mutable-set', |
|
521 'for/mutable-seteq', 'for/mutable-seteqv', 'for/or', 'for/product', |
|
522 'for/set', 'for/seteq', 'for/seteqv', 'for/stream', 'for/sum', |
|
523 'for/vector', 'for/weak-set', 'for/weak-seteq', 'for/weak-seteqv', |
|
524 'gen:custom-write', 'gen:dict', 'gen:equal+hash', 'gen:set', |
|
525 'gen:stream', 'generic', 'get-field', 'hash/dc', 'if', 'implies', |
|
526 'import', 'include', 'include-at/relative-to', |
|
527 'include-at/relative-to/reader', 'include/reader', 'inherit', |
|
528 'inherit-field', 'inherit/inner', 'inherit/super', 'init', |
|
529 'init-depend', 'init-field', 'init-rest', 'inner', 'inspect', |
|
530 'instantiate', 'interface', 'interface*', 'invariant-assertion', |
|
531 'invoke-unit', 'invoke-unit/infer', 'lambda', 'lazy', 'let', 'let*', |
|
532 'let*-values', 'let-syntax', 'let-syntaxes', 'let-values', 'let/cc', |
|
533 'let/ec', 'letrec', 'letrec-syntax', 'letrec-syntaxes', |
|
534 'letrec-syntaxes+values', 'letrec-values', 'lib', 'link', 'local', |
|
535 'local-require', 'log-debug', 'log-error', 'log-fatal', 'log-info', |
|
536 'log-warning', 'match', 'match*', 'match*/derived', 'match-define', |
|
537 'match-define-values', 'match-lambda', 'match-lambda*', |
|
538 'match-lambda**', 'match-let', 'match-let*', 'match-let*-values', |
|
539 'match-let-values', 'match-letrec', 'match-letrec-values', |
|
540 'match/derived', 'match/values', 'member-name-key', 'mixin', 'module', |
|
541 'module*', 'module+', 'nand', 'new', 'nor', 'object-contract', |
|
542 'object/c', 'only', 'only-in', 'only-meta-in', 'open', 'opt/c', 'or', |
|
543 'overment', 'overment*', 'override', 'override*', 'override-final', |
|
544 'override-final*', 'parameterize', 'parameterize*', |
|
545 'parameterize-break', 'parametric->/c', 'place', 'place*', |
|
546 'place/context', 'planet', 'prefix', 'prefix-in', 'prefix-out', |
|
547 'private', 'private*', 'prompt-tag/c', 'protect-out', 'provide', |
|
548 'provide-signature-elements', 'provide/contract', 'public', 'public*', |
|
549 'public-final', 'public-final*', 'pubment', 'pubment*', 'quasiquote', |
|
550 'quasisyntax', 'quasisyntax/loc', 'quote', 'quote-syntax', |
|
551 'quote-syntax/prune', 'recontract-out', 'recursive-contract', |
|
552 'relative-in', 'rename', 'rename-in', 'rename-inner', 'rename-out', |
|
553 'rename-super', 'require', 'send', 'send*', 'send+', 'send-generic', |
|
554 'send/apply', 'send/keyword-apply', 'set!', 'set!-values', |
|
555 'set-field!', 'shared', 'stream', 'stream*', 'stream-cons', 'struct', |
|
556 'struct*', 'struct-copy', 'struct-field-index', 'struct-out', |
|
557 'struct/c', 'struct/ctc', 'struct/dc', 'submod', 'super', |
|
558 'super-instantiate', 'super-make-object', 'super-new', 'syntax', |
|
559 'syntax-case', 'syntax-case*', 'syntax-id-rules', 'syntax-rules', |
|
560 'syntax/loc', 'tag', 'this', 'this%', 'thunk', 'thunk*', 'time', |
|
561 'unconstrained-domain->', 'unit', 'unit-from-context', 'unit/c', |
|
562 'unit/new-import-export', 'unit/s', 'unless', 'unquote', |
|
563 'unquote-splicing', 'unsyntax', 'unsyntax-splicing', 'values/drop', |
|
564 'when', 'with-continuation-mark', 'with-contract', |
|
565 'with-contract-continuation-mark', 'with-handlers', 'with-handlers*', |
|
566 'with-method', 'with-syntax', 'λ' |
|
567 ) |
|
568 |
|
569 # Generated by example.rkt |
|
570 _builtins = ( |
|
571 '*', '*list/c', '+', '-', '/', '<', '</c', '<=', '<=/c', '=', '=/c', |
|
572 '>', '>/c', '>=', '>=/c', 'abort-current-continuation', 'abs', |
|
573 'absolute-path?', 'acos', 'add-between', 'add1', 'alarm-evt', |
|
574 'always-evt', 'and/c', 'andmap', 'angle', 'any/c', 'append', 'append*', |
|
575 'append-map', 'apply', 'argmax', 'argmin', 'arithmetic-shift', |
|
576 'arity-at-least', 'arity-at-least-value', 'arity-at-least?', |
|
577 'arity-checking-wrapper', 'arity-includes?', 'arity=?', |
|
578 'arrow-contract-info', 'arrow-contract-info-accepts-arglist', |
|
579 'arrow-contract-info-chaperone-procedure', |
|
580 'arrow-contract-info-check-first-order', 'arrow-contract-info?', |
|
581 'asin', 'assf', 'assoc', 'assq', 'assv', 'atan', |
|
582 'bad-number-of-results', 'banner', 'base->-doms/c', 'base->-rngs/c', |
|
583 'base->?', 'between/c', 'bitwise-and', 'bitwise-bit-field', |
|
584 'bitwise-bit-set?', 'bitwise-ior', 'bitwise-not', 'bitwise-xor', |
|
585 'blame-add-car-context', 'blame-add-cdr-context', 'blame-add-context', |
|
586 'blame-add-missing-party', 'blame-add-nth-arg-context', |
|
587 'blame-add-range-context', 'blame-add-unknown-context', |
|
588 'blame-context', 'blame-contract', 'blame-fmt->-string', |
|
589 'blame-missing-party?', 'blame-negative', 'blame-original?', |
|
590 'blame-positive', 'blame-replace-negative', 'blame-source', |
|
591 'blame-swap', 'blame-swapped?', 'blame-update', 'blame-value', |
|
592 'blame?', 'boolean=?', 'boolean?', 'bound-identifier=?', 'box', |
|
593 'box-cas!', 'box-immutable', 'box-immutable/c', 'box/c', 'box?', |
|
594 'break-enabled', 'break-parameterization?', 'break-thread', |
|
595 'build-chaperone-contract-property', 'build-compound-type-name', |
|
596 'build-contract-property', 'build-flat-contract-property', |
|
597 'build-list', 'build-path', 'build-path/convention-type', |
|
598 'build-string', 'build-vector', 'byte-pregexp', 'byte-pregexp?', |
|
599 'byte-ready?', 'byte-regexp', 'byte-regexp?', 'byte?', 'bytes', |
|
600 'bytes->immutable-bytes', 'bytes->list', 'bytes->path', |
|
601 'bytes->path-element', 'bytes->string/latin-1', 'bytes->string/locale', |
|
602 'bytes->string/utf-8', 'bytes-append', 'bytes-append*', |
|
603 'bytes-close-converter', 'bytes-convert', 'bytes-convert-end', |
|
604 'bytes-converter?', 'bytes-copy', 'bytes-copy!', |
|
605 'bytes-environment-variable-name?', 'bytes-fill!', 'bytes-join', |
|
606 'bytes-length', 'bytes-no-nuls?', 'bytes-open-converter', 'bytes-ref', |
|
607 'bytes-set!', 'bytes-utf-8-index', 'bytes-utf-8-length', |
|
608 'bytes-utf-8-ref', 'bytes<?', 'bytes=?', 'bytes>?', 'bytes?', 'caaaar', |
|
609 'caaadr', 'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar', |
|
610 'cadadr', 'cadar', 'caddar', 'cadddr', 'caddr', 'cadr', |
|
611 'call-in-nested-thread', 'call-with-atomic-output-file', |
|
612 'call-with-break-parameterization', |
|
613 'call-with-composable-continuation', 'call-with-continuation-barrier', |
|
614 'call-with-continuation-prompt', 'call-with-current-continuation', |
|
615 'call-with-default-reading-parameterization', |
|
616 'call-with-escape-continuation', 'call-with-exception-handler', |
|
617 'call-with-file-lock/timeout', 'call-with-immediate-continuation-mark', |
|
618 'call-with-input-bytes', 'call-with-input-file', |
|
619 'call-with-input-file*', 'call-with-input-string', |
|
620 'call-with-output-bytes', 'call-with-output-file', |
|
621 'call-with-output-file*', 'call-with-output-string', |
|
622 'call-with-parameterization', 'call-with-semaphore', |
|
623 'call-with-semaphore/enable-break', 'call-with-values', 'call/cc', |
|
624 'call/ec', 'car', 'cartesian-product', 'cdaaar', 'cdaadr', 'cdaar', |
|
625 'cdadar', 'cdaddr', 'cdadr', 'cdar', 'cddaar', 'cddadr', 'cddar', |
|
626 'cdddar', 'cddddr', 'cdddr', 'cddr', 'cdr', 'ceiling', 'channel-get', |
|
627 'channel-put', 'channel-put-evt', 'channel-put-evt?', |
|
628 'channel-try-get', 'channel/c', 'channel?', 'chaperone-box', |
|
629 'chaperone-channel', 'chaperone-continuation-mark-key', |
|
630 'chaperone-contract-property?', 'chaperone-contract?', 'chaperone-evt', |
|
631 'chaperone-hash', 'chaperone-hash-set', 'chaperone-of?', |
|
632 'chaperone-procedure', 'chaperone-procedure*', 'chaperone-prompt-tag', |
|
633 'chaperone-struct', 'chaperone-struct-type', 'chaperone-vector', |
|
634 'chaperone?', 'char->integer', 'char-alphabetic?', 'char-blank?', |
|
635 'char-ci<=?', 'char-ci<?', 'char-ci=?', 'char-ci>=?', 'char-ci>?', |
|
636 'char-downcase', 'char-foldcase', 'char-general-category', |
|
637 'char-graphic?', 'char-in', 'char-in/c', 'char-iso-control?', |
|
638 'char-lower-case?', 'char-numeric?', 'char-punctuation?', |
|
639 'char-ready?', 'char-symbolic?', 'char-title-case?', 'char-titlecase', |
|
640 'char-upcase', 'char-upper-case?', 'char-utf-8-length', |
|
641 'char-whitespace?', 'char<=?', 'char<?', 'char=?', 'char>=?', 'char>?', |
|
642 'char?', 'check-duplicate-identifier', 'check-duplicates', |
|
643 'checked-procedure-check-and-extract', 'choice-evt', |
|
644 'class->interface', 'class-info', 'class-seal', 'class-unseal', |
|
645 'class?', 'cleanse-path', 'close-input-port', 'close-output-port', |
|
646 'coerce-chaperone-contract', 'coerce-chaperone-contracts', |
|
647 'coerce-contract', 'coerce-contract/f', 'coerce-contracts', |
|
648 'coerce-flat-contract', 'coerce-flat-contracts', 'collect-garbage', |
|
649 'collection-file-path', 'collection-path', 'combinations', 'compile', |
|
650 'compile-allow-set!-undefined', 'compile-context-preservation-enabled', |
|
651 'compile-enforce-module-constants', 'compile-syntax', |
|
652 'compiled-expression-recompile', 'compiled-expression?', |
|
653 'compiled-module-expression?', 'complete-path?', 'complex?', 'compose', |
|
654 'compose1', 'conjoin', 'conjugate', 'cons', 'cons/c', 'cons?', 'const', |
|
655 'continuation-mark-key/c', 'continuation-mark-key?', |
|
656 'continuation-mark-set->context', 'continuation-mark-set->list', |
|
657 'continuation-mark-set->list*', 'continuation-mark-set-first', |
|
658 'continuation-mark-set?', 'continuation-marks', |
|
659 'continuation-prompt-available?', 'continuation-prompt-tag?', |
|
660 'continuation?', 'contract-continuation-mark-key', |
|
661 'contract-custom-write-property-proc', 'contract-exercise', |
|
662 'contract-first-order', 'contract-first-order-passes?', |
|
663 'contract-late-neg-projection', 'contract-name', 'contract-proc', |
|
664 'contract-projection', 'contract-property?', |
|
665 'contract-random-generate', 'contract-random-generate-fail', |
|
666 'contract-random-generate-fail?', |
|
667 'contract-random-generate-get-current-environment', |
|
668 'contract-random-generate-stash', 'contract-random-generate/choose', |
|
669 'contract-stronger?', 'contract-struct-exercise', |
|
670 'contract-struct-generate', 'contract-struct-late-neg-projection', |
|
671 'contract-struct-list-contract?', 'contract-val-first-projection', |
|
672 'contract?', 'convert-stream', 'copy-directory/files', 'copy-file', |
|
673 'copy-port', 'cos', 'cosh', 'count', 'current-blame-format', |
|
674 'current-break-parameterization', 'current-code-inspector', |
|
675 'current-command-line-arguments', 'current-compile', |
|
676 'current-compiled-file-roots', 'current-continuation-marks', |
|
677 'current-contract-region', 'current-custodian', 'current-directory', |
|
678 'current-directory-for-user', 'current-drive', |
|
679 'current-environment-variables', 'current-error-port', 'current-eval', |
|
680 'current-evt-pseudo-random-generator', |
|
681 'current-force-delete-permissions', 'current-future', |
|
682 'current-gc-milliseconds', 'current-get-interaction-input-port', |
|
683 'current-inexact-milliseconds', 'current-input-port', |
|
684 'current-inspector', 'current-library-collection-links', |
|
685 'current-library-collection-paths', 'current-load', |
|
686 'current-load-extension', 'current-load-relative-directory', |
|
687 'current-load/use-compiled', 'current-locale', 'current-logger', |
|
688 'current-memory-use', 'current-milliseconds', |
|
689 'current-module-declare-name', 'current-module-declare-source', |
|
690 'current-module-name-resolver', 'current-module-path-for-load', |
|
691 'current-namespace', 'current-output-port', 'current-parameterization', |
|
692 'current-plumber', 'current-preserved-thread-cell-values', |
|
693 'current-print', 'current-process-milliseconds', 'current-prompt-read', |
|
694 'current-pseudo-random-generator', 'current-read-interaction', |
|
695 'current-reader-guard', 'current-readtable', 'current-seconds', |
|
696 'current-security-guard', 'current-subprocess-custodian-mode', |
|
697 'current-thread', 'current-thread-group', |
|
698 'current-thread-initial-stack-size', |
|
699 'current-write-relative-directory', 'curry', 'curryr', |
|
700 'custodian-box-value', 'custodian-box?', 'custodian-limit-memory', |
|
701 'custodian-managed-list', 'custodian-memory-accounting-available?', |
|
702 'custodian-require-memory', 'custodian-shutdown-all', 'custodian?', |
|
703 'custom-print-quotable-accessor', 'custom-print-quotable?', |
|
704 'custom-write-accessor', 'custom-write-property-proc', 'custom-write?', |
|
705 'date', 'date*', 'date*-nanosecond', 'date*-time-zone-name', 'date*?', |
|
706 'date-day', 'date-dst?', 'date-hour', 'date-minute', 'date-month', |
|
707 'date-second', 'date-time-zone-offset', 'date-week-day', 'date-year', |
|
708 'date-year-day', 'date?', 'datum->syntax', 'datum-intern-literal', |
|
709 'default-continuation-prompt-tag', 'degrees->radians', |
|
710 'delete-directory', 'delete-directory/files', 'delete-file', |
|
711 'denominator', 'dict->list', 'dict-can-functional-set?', |
|
712 'dict-can-remove-keys?', 'dict-clear', 'dict-clear!', 'dict-copy', |
|
713 'dict-count', 'dict-empty?', 'dict-for-each', 'dict-has-key?', |
|
714 'dict-implements/c', 'dict-implements?', 'dict-iter-contract', |
|
715 'dict-iterate-first', 'dict-iterate-key', 'dict-iterate-next', |
|
716 'dict-iterate-value', 'dict-key-contract', 'dict-keys', 'dict-map', |
|
717 'dict-mutable?', 'dict-ref', 'dict-ref!', 'dict-remove', |
|
718 'dict-remove!', 'dict-set', 'dict-set!', 'dict-set*', 'dict-set*!', |
|
719 'dict-update', 'dict-update!', 'dict-value-contract', 'dict-values', |
|
720 'dict?', 'directory-exists?', 'directory-list', 'disjoin', 'display', |
|
721 'display-lines', 'display-lines-to-file', 'display-to-file', |
|
722 'displayln', 'double-flonum?', 'drop', 'drop-common-prefix', |
|
723 'drop-right', 'dropf', 'dropf-right', 'dump-memory-stats', |
|
724 'dup-input-port', 'dup-output-port', 'dynamic->*', 'dynamic-get-field', |
|
725 'dynamic-object/c', 'dynamic-place', 'dynamic-place*', |
|
726 'dynamic-require', 'dynamic-require-for-syntax', 'dynamic-send', |
|
727 'dynamic-set-field!', 'dynamic-wind', 'eighth', 'empty', |
|
728 'empty-sequence', 'empty-stream', 'empty?', |
|
729 'environment-variables-copy', 'environment-variables-names', |
|
730 'environment-variables-ref', 'environment-variables-set!', |
|
731 'environment-variables?', 'eof', 'eof-evt', 'eof-object?', |
|
732 'ephemeron-value', 'ephemeron?', 'eprintf', 'eq-contract-val', |
|
733 'eq-contract?', 'eq-hash-code', 'eq?', 'equal-contract-val', |
|
734 'equal-contract?', 'equal-hash-code', 'equal-secondary-hash-code', |
|
735 'equal<%>', 'equal?', 'equal?/recur', 'eqv-hash-code', 'eqv?', 'error', |
|
736 'error-display-handler', 'error-escape-handler', |
|
737 'error-print-context-length', 'error-print-source-location', |
|
738 'error-print-width', 'error-value->string-handler', 'eval', |
|
739 'eval-jit-enabled', 'eval-syntax', 'even?', 'evt/c', 'evt?', |
|
740 'exact->inexact', 'exact-ceiling', 'exact-floor', 'exact-integer?', |
|
741 'exact-nonnegative-integer?', 'exact-positive-integer?', 'exact-round', |
|
742 'exact-truncate', 'exact?', 'executable-yield-handler', 'exit', |
|
743 'exit-handler', 'exn', 'exn-continuation-marks', 'exn-message', |
|
744 'exn:break', 'exn:break-continuation', 'exn:break:hang-up', |
|
745 'exn:break:hang-up?', 'exn:break:terminate', 'exn:break:terminate?', |
|
746 'exn:break?', 'exn:fail', 'exn:fail:contract', |
|
747 'exn:fail:contract:arity', 'exn:fail:contract:arity?', |
|
748 'exn:fail:contract:blame', 'exn:fail:contract:blame-object', |
|
749 'exn:fail:contract:blame?', 'exn:fail:contract:continuation', |
|
750 'exn:fail:contract:continuation?', 'exn:fail:contract:divide-by-zero', |
|
751 'exn:fail:contract:divide-by-zero?', |
|
752 'exn:fail:contract:non-fixnum-result', |
|
753 'exn:fail:contract:non-fixnum-result?', 'exn:fail:contract:variable', |
|
754 'exn:fail:contract:variable-id', 'exn:fail:contract:variable?', |
|
755 'exn:fail:contract?', 'exn:fail:filesystem', |
|
756 'exn:fail:filesystem:errno', 'exn:fail:filesystem:errno-errno', |
|
757 'exn:fail:filesystem:errno?', 'exn:fail:filesystem:exists', |
|
758 'exn:fail:filesystem:exists?', 'exn:fail:filesystem:missing-module', |
|
759 'exn:fail:filesystem:missing-module-path', |
|
760 'exn:fail:filesystem:missing-module?', 'exn:fail:filesystem:version', |
|
761 'exn:fail:filesystem:version?', 'exn:fail:filesystem?', |
|
762 'exn:fail:network', 'exn:fail:network:errno', |
|
763 'exn:fail:network:errno-errno', 'exn:fail:network:errno?', |
|
764 'exn:fail:network?', 'exn:fail:object', 'exn:fail:object?', |
|
765 'exn:fail:out-of-memory', 'exn:fail:out-of-memory?', 'exn:fail:read', |
|
766 'exn:fail:read-srclocs', 'exn:fail:read:eof', 'exn:fail:read:eof?', |
|
767 'exn:fail:read:non-char', 'exn:fail:read:non-char?', 'exn:fail:read?', |
|
768 'exn:fail:syntax', 'exn:fail:syntax-exprs', |
|
769 'exn:fail:syntax:missing-module', |
|
770 'exn:fail:syntax:missing-module-path', |
|
771 'exn:fail:syntax:missing-module?', 'exn:fail:syntax:unbound', |
|
772 'exn:fail:syntax:unbound?', 'exn:fail:syntax?', 'exn:fail:unsupported', |
|
773 'exn:fail:unsupported?', 'exn:fail:user', 'exn:fail:user?', |
|
774 'exn:fail?', 'exn:misc:match?', 'exn:missing-module-accessor', |
|
775 'exn:missing-module?', 'exn:srclocs-accessor', 'exn:srclocs?', 'exn?', |
|
776 'exp', 'expand', 'expand-once', 'expand-syntax', 'expand-syntax-once', |
|
777 'expand-syntax-to-top-form', 'expand-to-top-form', 'expand-user-path', |
|
778 'explode-path', 'expt', 'externalizable<%>', 'failure-result/c', |
|
779 'false?', 'field-names', 'fifth', 'file->bytes', 'file->bytes-lines', |
|
780 'file->lines', 'file->list', 'file->string', 'file->value', |
|
781 'file-exists?', 'file-name-from-path', 'file-or-directory-identity', |
|
782 'file-or-directory-modify-seconds', 'file-or-directory-permissions', |
|
783 'file-position', 'file-position*', 'file-size', |
|
784 'file-stream-buffer-mode', 'file-stream-port?', 'file-truncate', |
|
785 'filename-extension', 'filesystem-change-evt', |
|
786 'filesystem-change-evt-cancel', 'filesystem-change-evt?', |
|
787 'filesystem-root-list', 'filter', 'filter-map', 'filter-not', |
|
788 'filter-read-input-port', 'find-executable-path', 'find-files', |
|
789 'find-library-collection-links', 'find-library-collection-paths', |
|
790 'find-relative-path', 'find-system-path', 'findf', 'first', |
|
791 'first-or/c', 'fixnum?', 'flat-contract', 'flat-contract-predicate', |
|
792 'flat-contract-property?', 'flat-contract?', 'flat-named-contract', |
|
793 'flatten', 'floating-point-bytes->real', 'flonum?', 'floor', |
|
794 'flush-output', 'fold-files', 'foldl', 'foldr', 'for-each', 'force', |
|
795 'format', 'fourth', 'fprintf', 'free-identifier=?', |
|
796 'free-label-identifier=?', 'free-template-identifier=?', |
|
797 'free-transformer-identifier=?', 'fsemaphore-count', 'fsemaphore-post', |
|
798 'fsemaphore-try-wait?', 'fsemaphore-wait', 'fsemaphore?', 'future', |
|
799 'future?', 'futures-enabled?', 'gcd', 'generate-member-key', |
|
800 'generate-temporaries', 'generic-set?', 'generic?', 'gensym', |
|
801 'get-output-bytes', 'get-output-string', 'get-preference', |
|
802 'get/build-late-neg-projection', 'get/build-val-first-projection', |
|
803 'getenv', 'global-port-print-handler', 'group-by', 'group-execute-bit', |
|
804 'group-read-bit', 'group-write-bit', 'guard-evt', 'handle-evt', |
|
805 'handle-evt?', 'has-blame?', 'has-contract?', 'hash', 'hash->list', |
|
806 'hash-clear', 'hash-clear!', 'hash-copy', 'hash-copy-clear', |
|
807 'hash-count', 'hash-empty?', 'hash-eq?', 'hash-equal?', 'hash-eqv?', |
|
808 'hash-for-each', 'hash-has-key?', 'hash-iterate-first', |
|
809 'hash-iterate-key', 'hash-iterate-key+value', 'hash-iterate-next', |
|
810 'hash-iterate-pair', 'hash-iterate-value', 'hash-keys', 'hash-map', |
|
811 'hash-placeholder?', 'hash-ref', 'hash-ref!', 'hash-remove', |
|
812 'hash-remove!', 'hash-set', 'hash-set!', 'hash-set*', 'hash-set*!', |
|
813 'hash-update', 'hash-update!', 'hash-values', 'hash-weak?', 'hash/c', |
|
814 'hash?', 'hasheq', 'hasheqv', 'identifier-binding', |
|
815 'identifier-binding-symbol', 'identifier-label-binding', |
|
816 'identifier-prune-lexical-context', |
|
817 'identifier-prune-to-source-module', |
|
818 'identifier-remove-from-definition-context', |
|
819 'identifier-template-binding', 'identifier-transformer-binding', |
|
820 'identifier?', 'identity', 'if/c', 'imag-part', 'immutable?', |
|
821 'impersonate-box', 'impersonate-channel', |
|
822 'impersonate-continuation-mark-key', 'impersonate-hash', |
|
823 'impersonate-hash-set', 'impersonate-procedure', |
|
824 'impersonate-procedure*', 'impersonate-prompt-tag', |
|
825 'impersonate-struct', 'impersonate-vector', 'impersonator-contract?', |
|
826 'impersonator-ephemeron', 'impersonator-of?', |
|
827 'impersonator-prop:application-mark', 'impersonator-prop:blame', |
|
828 'impersonator-prop:contracted', |
|
829 'impersonator-property-accessor-procedure?', 'impersonator-property?', |
|
830 'impersonator?', 'implementation?', 'implementation?/c', 'in-bytes', |
|
831 'in-bytes-lines', 'in-combinations', 'in-cycle', 'in-dict', |
|
832 'in-dict-keys', 'in-dict-pairs', 'in-dict-values', 'in-directory', |
|
833 'in-hash', 'in-hash-keys', 'in-hash-pairs', 'in-hash-values', |
|
834 'in-immutable-hash', 'in-immutable-hash-keys', |
|
835 'in-immutable-hash-pairs', 'in-immutable-hash-values', |
|
836 'in-immutable-set', 'in-indexed', 'in-input-port-bytes', |
|
837 'in-input-port-chars', 'in-lines', 'in-list', 'in-mlist', |
|
838 'in-mutable-hash', 'in-mutable-hash-keys', 'in-mutable-hash-pairs', |
|
839 'in-mutable-hash-values', 'in-mutable-set', 'in-naturals', |
|
840 'in-parallel', 'in-permutations', 'in-port', 'in-producer', 'in-range', |
|
841 'in-sequences', 'in-set', 'in-slice', 'in-stream', 'in-string', |
|
842 'in-syntax', 'in-value', 'in-values*-sequence', 'in-values-sequence', |
|
843 'in-vector', 'in-weak-hash', 'in-weak-hash-keys', 'in-weak-hash-pairs', |
|
844 'in-weak-hash-values', 'in-weak-set', 'inexact->exact', |
|
845 'inexact-real?', 'inexact?', 'infinite?', 'input-port-append', |
|
846 'input-port?', 'inspector?', 'instanceof/c', 'integer->char', |
|
847 'integer->integer-bytes', 'integer-bytes->integer', 'integer-in', |
|
848 'integer-length', 'integer-sqrt', 'integer-sqrt/remainder', 'integer?', |
|
849 'interface->method-names', 'interface-extension?', 'interface?', |
|
850 'internal-definition-context-binding-identifiers', |
|
851 'internal-definition-context-introduce', |
|
852 'internal-definition-context-seal', 'internal-definition-context?', |
|
853 'is-a?', 'is-a?/c', 'keyword->string', 'keyword-apply', 'keyword<?', |
|
854 'keyword?', 'keywords-match', 'kill-thread', 'last', 'last-pair', |
|
855 'lcm', 'length', 'liberal-define-context?', 'link-exists?', 'list', |
|
856 'list*', 'list*of', 'list->bytes', 'list->mutable-set', |
|
857 'list->mutable-seteq', 'list->mutable-seteqv', 'list->set', |
|
858 'list->seteq', 'list->seteqv', 'list->string', 'list->vector', |
|
859 'list->weak-set', 'list->weak-seteq', 'list->weak-seteqv', |
|
860 'list-contract?', 'list-prefix?', 'list-ref', 'list-set', 'list-tail', |
|
861 'list-update', 'list/c', 'list?', 'listen-port-number?', 'listof', |
|
862 'load', 'load-extension', 'load-on-demand-enabled', 'load-relative', |
|
863 'load-relative-extension', 'load/cd', 'load/use-compiled', |
|
864 'local-expand', 'local-expand/capture-lifts', |
|
865 'local-transformer-expand', 'local-transformer-expand/capture-lifts', |
|
866 'locale-string-encoding', 'log', 'log-all-levels', 'log-level-evt', |
|
867 'log-level?', 'log-max-level', 'log-message', 'log-receiver?', |
|
868 'logger-name', 'logger?', 'magnitude', 'make-arity-at-least', |
|
869 'make-base-empty-namespace', 'make-base-namespace', 'make-bytes', |
|
870 'make-channel', 'make-chaperone-contract', |
|
871 'make-continuation-mark-key', 'make-continuation-prompt-tag', |
|
872 'make-contract', 'make-custodian', 'make-custodian-box', |
|
873 'make-custom-hash', 'make-custom-hash-types', 'make-custom-set', |
|
874 'make-custom-set-types', 'make-date', 'make-date*', |
|
875 'make-derived-parameter', 'make-directory', 'make-directory*', |
|
876 'make-do-sequence', 'make-empty-namespace', |
|
877 'make-environment-variables', 'make-ephemeron', 'make-exn', |
|
878 'make-exn:break', 'make-exn:break:hang-up', 'make-exn:break:terminate', |
|
879 'make-exn:fail', 'make-exn:fail:contract', |
|
880 'make-exn:fail:contract:arity', 'make-exn:fail:contract:blame', |
|
881 'make-exn:fail:contract:continuation', |
|
882 'make-exn:fail:contract:divide-by-zero', |
|
883 'make-exn:fail:contract:non-fixnum-result', |
|
884 'make-exn:fail:contract:variable', 'make-exn:fail:filesystem', |
|
885 'make-exn:fail:filesystem:errno', 'make-exn:fail:filesystem:exists', |
|
886 'make-exn:fail:filesystem:missing-module', |
|
887 'make-exn:fail:filesystem:version', 'make-exn:fail:network', |
|
888 'make-exn:fail:network:errno', 'make-exn:fail:object', |
|
889 'make-exn:fail:out-of-memory', 'make-exn:fail:read', |
|
890 'make-exn:fail:read:eof', 'make-exn:fail:read:non-char', |
|
891 'make-exn:fail:syntax', 'make-exn:fail:syntax:missing-module', |
|
892 'make-exn:fail:syntax:unbound', 'make-exn:fail:unsupported', |
|
893 'make-exn:fail:user', 'make-file-or-directory-link', |
|
894 'make-flat-contract', 'make-fsemaphore', 'make-generic', |
|
895 'make-handle-get-preference-locked', 'make-hash', |
|
896 'make-hash-placeholder', 'make-hasheq', 'make-hasheq-placeholder', |
|
897 'make-hasheqv', 'make-hasheqv-placeholder', |
|
898 'make-immutable-custom-hash', 'make-immutable-hash', |
|
899 'make-immutable-hasheq', 'make-immutable-hasheqv', |
|
900 'make-impersonator-property', 'make-input-port', |
|
901 'make-input-port/read-to-peek', 'make-inspector', |
|
902 'make-keyword-procedure', 'make-known-char-range-list', |
|
903 'make-limited-input-port', 'make-list', 'make-lock-file-name', |
|
904 'make-log-receiver', 'make-logger', 'make-mixin-contract', |
|
905 'make-mutable-custom-set', 'make-none/c', 'make-object', |
|
906 'make-output-port', 'make-parameter', 'make-parent-directory*', |
|
907 'make-phantom-bytes', 'make-pipe', 'make-pipe-with-specials', |
|
908 'make-placeholder', 'make-plumber', 'make-polar', 'make-prefab-struct', |
|
909 'make-primitive-class', 'make-proj-contract', |
|
910 'make-pseudo-random-generator', 'make-reader-graph', 'make-readtable', |
|
911 'make-rectangular', 'make-rename-transformer', |
|
912 'make-resolved-module-path', 'make-security-guard', 'make-semaphore', |
|
913 'make-set!-transformer', 'make-shared-bytes', 'make-sibling-inspector', |
|
914 'make-special-comment', 'make-srcloc', 'make-string', |
|
915 'make-struct-field-accessor', 'make-struct-field-mutator', |
|
916 'make-struct-type', 'make-struct-type-property', |
|
917 'make-syntax-delta-introducer', 'make-syntax-introducer', |
|
918 'make-temporary-file', 'make-tentative-pretty-print-output-port', |
|
919 'make-thread-cell', 'make-thread-group', 'make-vector', |
|
920 'make-weak-box', 'make-weak-custom-hash', 'make-weak-custom-set', |
|
921 'make-weak-hash', 'make-weak-hasheq', 'make-weak-hasheqv', |
|
922 'make-will-executor', 'map', 'match-equality-test', |
|
923 'matches-arity-exactly?', 'max', 'mcar', 'mcdr', 'mcons', 'member', |
|
924 'member-name-key-hash-code', 'member-name-key=?', 'member-name-key?', |
|
925 'memf', 'memq', 'memv', 'merge-input', 'method-in-interface?', 'min', |
|
926 'mixin-contract', 'module->exports', 'module->imports', |
|
927 'module->language-info', 'module->namespace', |
|
928 'module-compiled-cross-phase-persistent?', 'module-compiled-exports', |
|
929 'module-compiled-imports', 'module-compiled-language-info', |
|
930 'module-compiled-name', 'module-compiled-submodules', |
|
931 'module-declared?', 'module-path-index-join', |
|
932 'module-path-index-resolve', 'module-path-index-split', |
|
933 'module-path-index-submodule', 'module-path-index?', 'module-path?', |
|
934 'module-predefined?', 'module-provide-protected?', 'modulo', 'mpair?', |
|
935 'mutable-set', 'mutable-seteq', 'mutable-seteqv', 'n->th', |
|
936 'nack-guard-evt', 'namespace-anchor->empty-namespace', |
|
937 'namespace-anchor->namespace', 'namespace-anchor?', |
|
938 'namespace-attach-module', 'namespace-attach-module-declaration', |
|
939 'namespace-base-phase', 'namespace-mapped-symbols', |
|
940 'namespace-module-identifier', 'namespace-module-registry', |
|
941 'namespace-require', 'namespace-require/constant', |
|
942 'namespace-require/copy', 'namespace-require/expansion-time', |
|
943 'namespace-set-variable-value!', 'namespace-symbol->identifier', |
|
944 'namespace-syntax-introduce', 'namespace-undefine-variable!', |
|
945 'namespace-unprotect-module', 'namespace-variable-value', 'namespace?', |
|
946 'nan?', 'natural-number/c', 'negate', 'negative?', 'never-evt', |
|
947 'new-∀/c', 'new-∃/c', 'newline', 'ninth', 'non-empty-listof', |
|
948 'non-empty-string?', 'none/c', 'normal-case-path', 'normalize-arity', |
|
949 'normalize-path', 'normalized-arity?', 'not', 'not/c', 'null', 'null?', |
|
950 'number->string', 'number?', 'numerator', 'object%', 'object->vector', |
|
951 'object-info', 'object-interface', 'object-method-arity-includes?', |
|
952 'object-name', 'object-or-false=?', 'object=?', 'object?', 'odd?', |
|
953 'one-of/c', 'open-input-bytes', 'open-input-file', |
|
954 'open-input-output-file', 'open-input-string', 'open-output-bytes', |
|
955 'open-output-file', 'open-output-nowhere', 'open-output-string', |
|
956 'or/c', 'order-of-magnitude', 'ormap', 'other-execute-bit', |
|
957 'other-read-bit', 'other-write-bit', 'output-port?', 'pair?', |
|
958 'parameter-procedure=?', 'parameter/c', 'parameter?', |
|
959 'parameterization?', 'parse-command-line', 'partition', 'path->bytes', |
|
960 'path->complete-path', 'path->directory-path', 'path->string', |
|
961 'path-add-suffix', 'path-convention-type', 'path-element->bytes', |
|
962 'path-element->string', 'path-element?', 'path-for-some-system?', |
|
963 'path-list-string->path-list', 'path-only', 'path-replace-suffix', |
|
964 'path-string?', 'path<?', 'path?', 'pathlist-closure', 'peek-byte', |
|
965 'peek-byte-or-special', 'peek-bytes', 'peek-bytes!', 'peek-bytes!-evt', |
|
966 'peek-bytes-avail!', 'peek-bytes-avail!*', 'peek-bytes-avail!-evt', |
|
967 'peek-bytes-avail!/enable-break', 'peek-bytes-evt', 'peek-char', |
|
968 'peek-char-or-special', 'peek-string', 'peek-string!', |
|
969 'peek-string!-evt', 'peek-string-evt', 'peeking-input-port', |
|
970 'permutations', 'phantom-bytes?', 'pi', 'pi.f', 'pipe-content-length', |
|
971 'place-break', 'place-channel', 'place-channel-get', |
|
972 'place-channel-put', 'place-channel-put/get', 'place-channel?', |
|
973 'place-dead-evt', 'place-enabled?', 'place-kill', 'place-location?', |
|
974 'place-message-allowed?', 'place-sleep', 'place-wait', 'place?', |
|
975 'placeholder-get', 'placeholder-set!', 'placeholder?', |
|
976 'plumber-add-flush!', 'plumber-flush-all', |
|
977 'plumber-flush-handle-remove!', 'plumber-flush-handle?', 'plumber?', |
|
978 'poll-guard-evt', 'port->bytes', 'port->bytes-lines', 'port->lines', |
|
979 'port->list', 'port->string', 'port-closed-evt', 'port-closed?', |
|
980 'port-commit-peeked', 'port-count-lines!', 'port-count-lines-enabled', |
|
981 'port-counts-lines?', 'port-display-handler', 'port-file-identity', |
|
982 'port-file-unlock', 'port-next-location', 'port-number?', |
|
983 'port-print-handler', 'port-progress-evt', |
|
984 'port-provides-progress-evts?', 'port-read-handler', |
|
985 'port-try-file-lock?', 'port-write-handler', 'port-writes-atomic?', |
|
986 'port-writes-special?', 'port?', 'positive?', 'predicate/c', |
|
987 'prefab-key->struct-type', 'prefab-key?', 'prefab-struct-key', |
|
988 'preferences-lock-file-mode', 'pregexp', 'pregexp?', 'pretty-display', |
|
989 'pretty-format', 'pretty-print', 'pretty-print-.-symbol-without-bars', |
|
990 'pretty-print-abbreviate-read-macros', 'pretty-print-columns', |
|
991 'pretty-print-current-style-table', 'pretty-print-depth', |
|
992 'pretty-print-exact-as-decimal', 'pretty-print-extend-style-table', |
|
993 'pretty-print-handler', 'pretty-print-newline', |
|
994 'pretty-print-post-print-hook', 'pretty-print-pre-print-hook', |
|
995 'pretty-print-print-hook', 'pretty-print-print-line', |
|
996 'pretty-print-remap-stylable', 'pretty-print-show-inexactness', |
|
997 'pretty-print-size-hook', 'pretty-print-style-table?', |
|
998 'pretty-printing', 'pretty-write', 'primitive-closure?', |
|
999 'primitive-result-arity', 'primitive?', 'print', 'print-as-expression', |
|
1000 'print-boolean-long-form', 'print-box', 'print-graph', |
|
1001 'print-hash-table', 'print-mpair-curly-braces', |
|
1002 'print-pair-curly-braces', 'print-reader-abbreviations', |
|
1003 'print-struct', 'print-syntax-width', 'print-unreadable', |
|
1004 'print-vector-length', 'printable/c', 'printable<%>', 'printf', |
|
1005 'println', 'procedure->method', 'procedure-arity', |
|
1006 'procedure-arity-includes/c', 'procedure-arity-includes?', |
|
1007 'procedure-arity?', 'procedure-closure-contents-eq?', |
|
1008 'procedure-extract-target', 'procedure-keywords', |
|
1009 'procedure-reduce-arity', 'procedure-reduce-keyword-arity', |
|
1010 'procedure-rename', 'procedure-result-arity', 'procedure-specialize', |
|
1011 'procedure-struct-type?', 'procedure?', 'process', 'process*', |
|
1012 'process*/ports', 'process/ports', 'processor-count', 'progress-evt?', |
|
1013 'promise-forced?', 'promise-running?', 'promise/c', 'promise/name?', |
|
1014 'promise?', 'prop:arity-string', 'prop:arrow-contract', |
|
1015 'prop:arrow-contract-get-info', 'prop:arrow-contract?', 'prop:blame', |
|
1016 'prop:chaperone-contract', 'prop:checked-procedure', 'prop:contract', |
|
1017 'prop:contracted', 'prop:custom-print-quotable', 'prop:custom-write', |
|
1018 'prop:dict', 'prop:dict/contract', 'prop:equal+hash', 'prop:evt', |
|
1019 'prop:exn:missing-module', 'prop:exn:srclocs', |
|
1020 'prop:expansion-contexts', 'prop:flat-contract', |
|
1021 'prop:impersonator-of', 'prop:input-port', |
|
1022 'prop:liberal-define-context', 'prop:object-name', |
|
1023 'prop:opt-chaperone-contract', 'prop:opt-chaperone-contract-get-test', |
|
1024 'prop:opt-chaperone-contract?', 'prop:orc-contract', |
|
1025 'prop:orc-contract-get-subcontracts', 'prop:orc-contract?', |
|
1026 'prop:output-port', 'prop:place-location', 'prop:procedure', |
|
1027 'prop:recursive-contract', 'prop:recursive-contract-unroll', |
|
1028 'prop:recursive-contract?', 'prop:rename-transformer', 'prop:sequence', |
|
1029 'prop:set!-transformer', 'prop:stream', 'proper-subset?', |
|
1030 'pseudo-random-generator->vector', 'pseudo-random-generator-vector?', |
|
1031 'pseudo-random-generator?', 'put-preferences', 'putenv', 'quotient', |
|
1032 'quotient/remainder', 'radians->degrees', 'raise', |
|
1033 'raise-argument-error', 'raise-arguments-error', 'raise-arity-error', |
|
1034 'raise-blame-error', 'raise-contract-error', 'raise-mismatch-error', |
|
1035 'raise-not-cons-blame-error', 'raise-range-error', |
|
1036 'raise-result-error', 'raise-syntax-error', 'raise-type-error', |
|
1037 'raise-user-error', 'random', 'random-seed', 'range', 'rational?', |
|
1038 'rationalize', 'read', 'read-accept-bar-quote', 'read-accept-box', |
|
1039 'read-accept-compiled', 'read-accept-dot', 'read-accept-graph', |
|
1040 'read-accept-infix-dot', 'read-accept-lang', 'read-accept-quasiquote', |
|
1041 'read-accept-reader', 'read-byte', 'read-byte-or-special', |
|
1042 'read-bytes', 'read-bytes!', 'read-bytes!-evt', 'read-bytes-avail!', |
|
1043 'read-bytes-avail!*', 'read-bytes-avail!-evt', |
|
1044 'read-bytes-avail!/enable-break', 'read-bytes-evt', 'read-bytes-line', |
|
1045 'read-bytes-line-evt', 'read-case-sensitive', 'read-cdot', 'read-char', |
|
1046 'read-char-or-special', 'read-curly-brace-as-paren', |
|
1047 'read-curly-brace-with-tag', 'read-decimal-as-inexact', |
|
1048 'read-eval-print-loop', 'read-language', 'read-line', 'read-line-evt', |
|
1049 'read-on-demand-source', 'read-square-bracket-as-paren', |
|
1050 'read-square-bracket-with-tag', 'read-string', 'read-string!', |
|
1051 'read-string!-evt', 'read-string-evt', 'read-syntax', |
|
1052 'read-syntax/recursive', 'read/recursive', 'readtable-mapping', |
|
1053 'readtable?', 'real->decimal-string', 'real->double-flonum', |
|
1054 'real->floating-point-bytes', 'real->single-flonum', 'real-in', |
|
1055 'real-part', 'real?', 'reencode-input-port', 'reencode-output-port', |
|
1056 'regexp', 'regexp-match', 'regexp-match*', 'regexp-match-evt', |
|
1057 'regexp-match-exact?', 'regexp-match-peek', |
|
1058 'regexp-match-peek-immediate', 'regexp-match-peek-positions', |
|
1059 'regexp-match-peek-positions*', |
|
1060 'regexp-match-peek-positions-immediate', |
|
1061 'regexp-match-peek-positions-immediate/end', |
|
1062 'regexp-match-peek-positions/end', 'regexp-match-positions', |
|
1063 'regexp-match-positions*', 'regexp-match-positions/end', |
|
1064 'regexp-match/end', 'regexp-match?', 'regexp-max-lookbehind', |
|
1065 'regexp-quote', 'regexp-replace', 'regexp-replace*', |
|
1066 'regexp-replace-quote', 'regexp-replaces', 'regexp-split', |
|
1067 'regexp-try-match', 'regexp?', 'relative-path?', 'relocate-input-port', |
|
1068 'relocate-output-port', 'remainder', 'remf', 'remf*', 'remove', |
|
1069 'remove*', 'remove-duplicates', 'remq', 'remq*', 'remv', 'remv*', |
|
1070 'rename-contract', 'rename-file-or-directory', |
|
1071 'rename-transformer-target', 'rename-transformer?', 'replace-evt', |
|
1072 'reroot-path', 'resolve-path', 'resolved-module-path-name', |
|
1073 'resolved-module-path?', 'rest', 'reverse', 'round', 'second', |
|
1074 'seconds->date', 'security-guard?', 'semaphore-peek-evt', |
|
1075 'semaphore-peek-evt?', 'semaphore-post', 'semaphore-try-wait?', |
|
1076 'semaphore-wait', 'semaphore-wait/enable-break', 'semaphore?', |
|
1077 'sequence->list', 'sequence->stream', 'sequence-add-between', |
|
1078 'sequence-andmap', 'sequence-append', 'sequence-count', |
|
1079 'sequence-filter', 'sequence-fold', 'sequence-for-each', |
|
1080 'sequence-generate', 'sequence-generate*', 'sequence-length', |
|
1081 'sequence-map', 'sequence-ormap', 'sequence-ref', 'sequence-tail', |
|
1082 'sequence/c', 'sequence?', 'set', 'set!-transformer-procedure', |
|
1083 'set!-transformer?', 'set->list', 'set->stream', 'set-add', 'set-add!', |
|
1084 'set-box!', 'set-clear', 'set-clear!', 'set-copy', 'set-copy-clear', |
|
1085 'set-count', 'set-empty?', 'set-eq?', 'set-equal?', 'set-eqv?', |
|
1086 'set-first', 'set-for-each', 'set-implements/c', 'set-implements?', |
|
1087 'set-intersect', 'set-intersect!', 'set-map', 'set-mcar!', 'set-mcdr!', |
|
1088 'set-member?', 'set-mutable?', 'set-phantom-bytes!', |
|
1089 'set-port-next-location!', 'set-remove', 'set-remove!', 'set-rest', |
|
1090 'set-some-basic-contracts!', 'set-subtract', 'set-subtract!', |
|
1091 'set-symmetric-difference', 'set-symmetric-difference!', 'set-union', |
|
1092 'set-union!', 'set-weak?', 'set/c', 'set=?', 'set?', 'seteq', 'seteqv', |
|
1093 'seventh', 'sgn', 'shared-bytes', 'shell-execute', 'shrink-path-wrt', |
|
1094 'shuffle', 'simple-form-path', 'simplify-path', 'sin', |
|
1095 'single-flonum?', 'sinh', 'sixth', 'skip-projection-wrapper?', 'sleep', |
|
1096 'some-system-path->string', 'sort', 'special-comment-value', |
|
1097 'special-comment?', 'special-filter-input-port', 'split-at', |
|
1098 'split-at-right', 'split-common-prefix', 'split-path', 'splitf-at', |
|
1099 'splitf-at-right', 'sqr', 'sqrt', 'srcloc', 'srcloc->string', |
|
1100 'srcloc-column', 'srcloc-line', 'srcloc-position', 'srcloc-source', |
|
1101 'srcloc-span', 'srcloc?', 'stop-after', 'stop-before', 'stream->list', |
|
1102 'stream-add-between', 'stream-andmap', 'stream-append', 'stream-count', |
|
1103 'stream-empty?', 'stream-filter', 'stream-first', 'stream-fold', |
|
1104 'stream-for-each', 'stream-length', 'stream-map', 'stream-ormap', |
|
1105 'stream-ref', 'stream-rest', 'stream-tail', 'stream/c', 'stream?', |
|
1106 'string', 'string->bytes/latin-1', 'string->bytes/locale', |
|
1107 'string->bytes/utf-8', 'string->immutable-string', 'string->keyword', |
|
1108 'string->list', 'string->number', 'string->path', |
|
1109 'string->path-element', 'string->some-system-path', 'string->symbol', |
|
1110 'string->uninterned-symbol', 'string->unreadable-symbol', |
|
1111 'string-append', 'string-append*', 'string-ci<=?', 'string-ci<?', |
|
1112 'string-ci=?', 'string-ci>=?', 'string-ci>?', 'string-contains?', |
|
1113 'string-copy', 'string-copy!', 'string-downcase', |
|
1114 'string-environment-variable-name?', 'string-fill!', 'string-foldcase', |
|
1115 'string-join', 'string-len/c', 'string-length', 'string-locale-ci<?', |
|
1116 'string-locale-ci=?', 'string-locale-ci>?', 'string-locale-downcase', |
|
1117 'string-locale-upcase', 'string-locale<?', 'string-locale=?', |
|
1118 'string-locale>?', 'string-no-nuls?', 'string-normalize-nfc', |
|
1119 'string-normalize-nfd', 'string-normalize-nfkc', |
|
1120 'string-normalize-nfkd', 'string-normalize-spaces', 'string-port?', |
|
1121 'string-prefix?', 'string-ref', 'string-replace', 'string-set!', |
|
1122 'string-split', 'string-suffix?', 'string-titlecase', 'string-trim', |
|
1123 'string-upcase', 'string-utf-8-length', 'string<=?', 'string<?', |
|
1124 'string=?', 'string>=?', 'string>?', 'string?', 'struct->vector', |
|
1125 'struct-accessor-procedure?', 'struct-constructor-procedure?', |
|
1126 'struct-info', 'struct-mutator-procedure?', |
|
1127 'struct-predicate-procedure?', 'struct-type-info', |
|
1128 'struct-type-make-constructor', 'struct-type-make-predicate', |
|
1129 'struct-type-property-accessor-procedure?', 'struct-type-property/c', |
|
1130 'struct-type-property?', 'struct-type?', 'struct:arity-at-least', |
|
1131 'struct:arrow-contract-info', 'struct:date', 'struct:date*', |
|
1132 'struct:exn', 'struct:exn:break', 'struct:exn:break:hang-up', |
|
1133 'struct:exn:break:terminate', 'struct:exn:fail', |
|
1134 'struct:exn:fail:contract', 'struct:exn:fail:contract:arity', |
|
1135 'struct:exn:fail:contract:blame', |
|
1136 'struct:exn:fail:contract:continuation', |
|
1137 'struct:exn:fail:contract:divide-by-zero', |
|
1138 'struct:exn:fail:contract:non-fixnum-result', |
|
1139 'struct:exn:fail:contract:variable', 'struct:exn:fail:filesystem', |
|
1140 'struct:exn:fail:filesystem:errno', |
|
1141 'struct:exn:fail:filesystem:exists', |
|
1142 'struct:exn:fail:filesystem:missing-module', |
|
1143 'struct:exn:fail:filesystem:version', 'struct:exn:fail:network', |
|
1144 'struct:exn:fail:network:errno', 'struct:exn:fail:object', |
|
1145 'struct:exn:fail:out-of-memory', 'struct:exn:fail:read', |
|
1146 'struct:exn:fail:read:eof', 'struct:exn:fail:read:non-char', |
|
1147 'struct:exn:fail:syntax', 'struct:exn:fail:syntax:missing-module', |
|
1148 'struct:exn:fail:syntax:unbound', 'struct:exn:fail:unsupported', |
|
1149 'struct:exn:fail:user', 'struct:srcloc', |
|
1150 'struct:wrapped-extra-arg-arrow', 'struct?', 'sub1', 'subbytes', |
|
1151 'subclass?', 'subclass?/c', 'subprocess', 'subprocess-group-enabled', |
|
1152 'subprocess-kill', 'subprocess-pid', 'subprocess-status', |
|
1153 'subprocess-wait', 'subprocess?', 'subset?', 'substring', 'suggest/c', |
|
1154 'symbol->string', 'symbol-interned?', 'symbol-unreadable?', 'symbol<?', |
|
1155 'symbol=?', 'symbol?', 'symbols', 'sync', 'sync/enable-break', |
|
1156 'sync/timeout', 'sync/timeout/enable-break', 'syntax->datum', |
|
1157 'syntax->list', 'syntax-arm', 'syntax-column', 'syntax-debug-info', |
|
1158 'syntax-disarm', 'syntax-e', 'syntax-line', |
|
1159 'syntax-local-bind-syntaxes', 'syntax-local-certifier', |
|
1160 'syntax-local-context', 'syntax-local-expand-expression', |
|
1161 'syntax-local-get-shadower', 'syntax-local-identifier-as-binding', |
|
1162 'syntax-local-introduce', 'syntax-local-lift-context', |
|
1163 'syntax-local-lift-expression', 'syntax-local-lift-module', |
|
1164 'syntax-local-lift-module-end-declaration', |
|
1165 'syntax-local-lift-provide', 'syntax-local-lift-require', |
|
1166 'syntax-local-lift-values-expression', |
|
1167 'syntax-local-make-definition-context', |
|
1168 'syntax-local-make-delta-introducer', |
|
1169 'syntax-local-module-defined-identifiers', |
|
1170 'syntax-local-module-exports', |
|
1171 'syntax-local-module-required-identifiers', 'syntax-local-name', |
|
1172 'syntax-local-phase-level', 'syntax-local-submodules', |
|
1173 'syntax-local-transforming-module-provides?', 'syntax-local-value', |
|
1174 'syntax-local-value/immediate', 'syntax-original?', 'syntax-position', |
|
1175 'syntax-property', 'syntax-property-preserved?', |
|
1176 'syntax-property-symbol-keys', 'syntax-protect', 'syntax-rearm', |
|
1177 'syntax-recertify', 'syntax-shift-phase-level', 'syntax-source', |
|
1178 'syntax-source-module', 'syntax-span', 'syntax-taint', |
|
1179 'syntax-tainted?', 'syntax-track-origin', |
|
1180 'syntax-transforming-module-expression?', |
|
1181 'syntax-transforming-with-lifts?', 'syntax-transforming?', 'syntax/c', |
|
1182 'syntax?', 'system', 'system*', 'system*/exit-code', |
|
1183 'system-big-endian?', 'system-idle-evt', 'system-language+country', |
|
1184 'system-library-subpath', 'system-path-convention-type', 'system-type', |
|
1185 'system/exit-code', 'tail-marks-match?', 'take', 'take-common-prefix', |
|
1186 'take-right', 'takef', 'takef-right', 'tan', 'tanh', |
|
1187 'tcp-abandon-port', 'tcp-accept', 'tcp-accept-evt', |
|
1188 'tcp-accept-ready?', 'tcp-accept/enable-break', 'tcp-addresses', |
|
1189 'tcp-close', 'tcp-connect', 'tcp-connect/enable-break', 'tcp-listen', |
|
1190 'tcp-listener?', 'tcp-port?', 'tentative-pretty-print-port-cancel', |
|
1191 'tentative-pretty-print-port-transfer', 'tenth', 'terminal-port?', |
|
1192 'the-unsupplied-arg', 'third', 'thread', 'thread-cell-ref', |
|
1193 'thread-cell-set!', 'thread-cell-values?', 'thread-cell?', |
|
1194 'thread-dead-evt', 'thread-dead?', 'thread-group?', 'thread-receive', |
|
1195 'thread-receive-evt', 'thread-resume', 'thread-resume-evt', |
|
1196 'thread-rewind-receive', 'thread-running?', 'thread-send', |
|
1197 'thread-suspend', 'thread-suspend-evt', 'thread-try-receive', |
|
1198 'thread-wait', 'thread/suspend-to-kill', 'thread?', 'time-apply', |
|
1199 'touch', 'transplant-input-port', 'transplant-output-port', 'true', |
|
1200 'truncate', 'udp-addresses', 'udp-bind!', 'udp-bound?', 'udp-close', |
|
1201 'udp-connect!', 'udp-connected?', 'udp-multicast-interface', |
|
1202 'udp-multicast-join-group!', 'udp-multicast-leave-group!', |
|
1203 'udp-multicast-loopback?', 'udp-multicast-set-interface!', |
|
1204 'udp-multicast-set-loopback!', 'udp-multicast-set-ttl!', |
|
1205 'udp-multicast-ttl', 'udp-open-socket', 'udp-receive!', |
|
1206 'udp-receive!*', 'udp-receive!-evt', 'udp-receive!/enable-break', |
|
1207 'udp-receive-ready-evt', 'udp-send', 'udp-send*', 'udp-send-evt', |
|
1208 'udp-send-ready-evt', 'udp-send-to', 'udp-send-to*', 'udp-send-to-evt', |
|
1209 'udp-send-to/enable-break', 'udp-send/enable-break', 'udp?', 'unbox', |
|
1210 'uncaught-exception-handler', 'unit?', 'unspecified-dom', |
|
1211 'unsupplied-arg?', 'use-collection-link-paths', |
|
1212 'use-compiled-file-paths', 'use-user-specific-search-paths', |
|
1213 'user-execute-bit', 'user-read-bit', 'user-write-bit', 'value-blame', |
|
1214 'value-contract', 'values', 'variable-reference->empty-namespace', |
|
1215 'variable-reference->module-base-phase', |
|
1216 'variable-reference->module-declaration-inspector', |
|
1217 'variable-reference->module-path-index', |
|
1218 'variable-reference->module-source', 'variable-reference->namespace', |
|
1219 'variable-reference->phase', |
|
1220 'variable-reference->resolved-module-path', |
|
1221 'variable-reference-constant?', 'variable-reference?', 'vector', |
|
1222 'vector->immutable-vector', 'vector->list', |
|
1223 'vector->pseudo-random-generator', 'vector->pseudo-random-generator!', |
|
1224 'vector->values', 'vector-append', 'vector-argmax', 'vector-argmin', |
|
1225 'vector-copy', 'vector-copy!', 'vector-count', 'vector-drop', |
|
1226 'vector-drop-right', 'vector-fill!', 'vector-filter', |
|
1227 'vector-filter-not', 'vector-immutable', 'vector-immutable/c', |
|
1228 'vector-immutableof', 'vector-length', 'vector-map', 'vector-map!', |
|
1229 'vector-member', 'vector-memq', 'vector-memv', 'vector-ref', |
|
1230 'vector-set!', 'vector-set*!', 'vector-set-performance-stats!', |
|
1231 'vector-split-at', 'vector-split-at-right', 'vector-take', |
|
1232 'vector-take-right', 'vector/c', 'vector?', 'vectorof', 'version', |
|
1233 'void', 'void?', 'weak-box-value', 'weak-box?', 'weak-set', |
|
1234 'weak-seteq', 'weak-seteqv', 'will-execute', 'will-executor?', |
|
1235 'will-register', 'will-try-execute', 'with-input-from-bytes', |
|
1236 'with-input-from-file', 'with-input-from-string', |
|
1237 'with-output-to-bytes', 'with-output-to-file', 'with-output-to-string', |
|
1238 'would-be-future', 'wrap-evt', 'wrapped-extra-arg-arrow', |
|
1239 'wrapped-extra-arg-arrow-extra-neg-party-argument', |
|
1240 'wrapped-extra-arg-arrow-real-func', 'wrapped-extra-arg-arrow?', |
|
1241 'writable<%>', 'write', 'write-byte', 'write-bytes', |
|
1242 'write-bytes-avail', 'write-bytes-avail*', 'write-bytes-avail-evt', |
|
1243 'write-bytes-avail/enable-break', 'write-char', 'write-special', |
|
1244 'write-special-avail*', 'write-special-evt', 'write-string', |
|
1245 'write-to-file', 'writeln', 'xor', 'zero?', '~.a', '~.s', '~.v', '~a', |
|
1246 '~e', '~r', '~s', '~v' |
|
1247 ) |
|
1248 |
|
1249 _opening_parenthesis = r'[([{]' |
|
1250 _closing_parenthesis = r'[)\]}]' |
|
1251 _delimiters = r'()[\]{}",\'`;\s' |
|
1252 _symbol = r'(?:\|[^|]*\||\\[\w\W]|[^|\\%s]+)+' % _delimiters |
|
1253 _exact_decimal_prefix = r'(?:#e)?(?:#d)?(?:#e)?' |
|
1254 _exponent = r'(?:[defls][-+]?\d+)' |
|
1255 _inexact_simple_no_hashes = r'(?:\d+(?:/\d+|\.\d*)?|\.\d+)' |
|
1256 _inexact_simple = (r'(?:%s|(?:\d+#+(?:\.#*|/\d+#*)?|\.\d+#+|' |
|
1257 r'\d+(?:\.\d*#+|/\d+#+)))' % _inexact_simple_no_hashes) |
|
1258 _inexact_normal_no_hashes = r'(?:%s%s?)' % (_inexact_simple_no_hashes, |
|
1259 _exponent) |
|
1260 _inexact_normal = r'(?:%s%s?)' % (_inexact_simple, _exponent) |
|
1261 _inexact_special = r'(?:(?:inf|nan)\.[0f])' |
|
1262 _inexact_real = r'(?:[-+]?%s|[-+]%s)' % (_inexact_normal, |
|
1263 _inexact_special) |
|
1264 _inexact_unsigned = r'(?:%s|%s)' % (_inexact_normal, _inexact_special) |
|
1265 |
|
1266 tokens = { |
|
1267 'root': [ |
|
1268 (_closing_parenthesis, Error), |
|
1269 (r'(?!\Z)', Text, 'unquoted-datum') |
|
1270 ], |
|
1271 'datum': [ |
|
1272 (r'(?s)#;|#*', Comment), |
|
1273 (r';[^\n\r\x85\u2028\u2029]*', Comment.Single), |
|
1274 (r'#\|', Comment.Multiline, 'block-comment'), |
|
1275 |
|
1276 # Whitespaces |
|
1277 (r'(?u)\s+', Text), |
|
1278 |
|
1279 # Numbers: Keep in mind Racket reader hash prefixes, which |
|
1280 # can denote the base or the type. These don't map neatly |
|
1281 # onto Pygments token types; some judgment calls here. |
|
1282 |
|
1283 # #d or no prefix |
|
1284 (r'(?i)%s[-+]?\d+(?=[%s])' % (_exact_decimal_prefix, _delimiters), |
|
1285 Number.Integer, '#pop'), |
|
1286 (r'(?i)%s[-+]?(\d+(\.\d*)?|\.\d+)([deflst][-+]?\d+)?(?=[%s])' % |
|
1287 (_exact_decimal_prefix, _delimiters), Number.Float, '#pop'), |
|
1288 (r'(?i)%s[-+]?(%s([-+]%s?i)?|[-+]%s?i)(?=[%s])' % |
|
1289 (_exact_decimal_prefix, _inexact_normal_no_hashes, |
|
1290 _inexact_normal_no_hashes, _inexact_normal_no_hashes, |
|
1291 _delimiters), Number, '#pop'), |
|
1292 |
|
1293 # Inexact without explicit #i |
|
1294 (r'(?i)(#d)?(%s([-+]%s?i)?|[-+]%s?i|%s@%s)(?=[%s])' % |
|
1295 (_inexact_real, _inexact_unsigned, _inexact_unsigned, |
|
1296 _inexact_real, _inexact_real, _delimiters), Number.Float, |
|
1297 '#pop'), |
|
1298 |
|
1299 # The remaining extflonums |
|
1300 (r'(?i)(([-+]?%st[-+]?\d+)|[-+](inf|nan)\.t)(?=[%s])' % |
|
1301 (_inexact_simple, _delimiters), Number.Float, '#pop'), |
|
1302 |
|
1303 # #b |
|
1304 (r'(?iu)(#[ei])?#b%s' % _symbol, Number.Bin, '#pop'), |
|
1305 |
|
1306 # #o |
|
1307 (r'(?iu)(#[ei])?#o%s' % _symbol, Number.Oct, '#pop'), |
|
1308 |
|
1309 # #x |
|
1310 (r'(?iu)(#[ei])?#x%s' % _symbol, Number.Hex, '#pop'), |
|
1311 |
|
1312 # #i is always inexact, i.e. float |
|
1313 (r'(?iu)(#d)?#i%s' % _symbol, Number.Float, '#pop'), |
|
1314 |
|
1315 # Strings and characters |
|
1316 (r'#?"', String.Double, ('#pop', 'string')), |
|
1317 (r'#<<(.+)\n(^(?!\1$).*$\n)*^\1$', String.Heredoc, '#pop'), |
|
1318 (r'#\\(u[\da-fA-F]{1,4}|U[\da-fA-F]{1,8})', String.Char, '#pop'), |
|
1319 (r'(?is)#\\([0-7]{3}|[a-z]+|.)', String.Char, '#pop'), |
|
1320 (r'(?s)#[pr]x#?"(\\?.)*?"', String.Regex, '#pop'), |
|
1321 |
|
1322 # Constants |
|
1323 (r'#(true|false|[tTfF])', Name.Constant, '#pop'), |
|
1324 |
|
1325 # Keyword argument names (e.g. #:keyword) |
|
1326 (r'(?u)#:%s' % _symbol, Keyword.Declaration, '#pop'), |
|
1327 |
|
1328 # Reader extensions |
|
1329 (r'(#lang |#!)(\S+)', |
|
1330 bygroups(Keyword.Namespace, Name.Namespace)), |
|
1331 (r'#reader', Keyword.Namespace, 'quoted-datum'), |
|
1332 |
|
1333 # Other syntax |
|
1334 (r"(?i)\.(?=[%s])|#c[is]|#['`]|#,@?" % _delimiters, Operator), |
|
1335 (r"'|#[s&]|#hash(eqv?)?|#\d*(?=%s)" % _opening_parenthesis, |
|
1336 Operator, ('#pop', 'quoted-datum')) |
|
1337 ], |
|
1338 'datum*': [ |
|
1339 (r'`|,@?', Operator), |
|
1340 (_symbol, String.Symbol, '#pop'), |
|
1341 (r'[|\\]', Error), |
|
1342 default('#pop') |
|
1343 ], |
|
1344 'list': [ |
|
1345 (_closing_parenthesis, Punctuation, '#pop') |
|
1346 ], |
|
1347 'unquoted-datum': [ |
|
1348 include('datum'), |
|
1349 (r'quote(?=[%s])' % _delimiters, Keyword, |
|
1350 ('#pop', 'quoted-datum')), |
|
1351 (r'`', Operator, ('#pop', 'quasiquoted-datum')), |
|
1352 (r'quasiquote(?=[%s])' % _delimiters, Keyword, |
|
1353 ('#pop', 'quasiquoted-datum')), |
|
1354 (_opening_parenthesis, Punctuation, ('#pop', 'unquoted-list')), |
|
1355 (words(_keywords, prefix='(?u)', suffix='(?=[%s])' % _delimiters), |
|
1356 Keyword, '#pop'), |
|
1357 (words(_builtins, prefix='(?u)', suffix='(?=[%s])' % _delimiters), |
|
1358 Name.Builtin, '#pop'), |
|
1359 (_symbol, Name, '#pop'), |
|
1360 include('datum*') |
|
1361 ], |
|
1362 'unquoted-list': [ |
|
1363 include('list'), |
|
1364 (r'(?!\Z)', Text, 'unquoted-datum') |
|
1365 ], |
|
1366 'quasiquoted-datum': [ |
|
1367 include('datum'), |
|
1368 (r',@?', Operator, ('#pop', 'unquoted-datum')), |
|
1369 (r'unquote(-splicing)?(?=[%s])' % _delimiters, Keyword, |
|
1370 ('#pop', 'unquoted-datum')), |
|
1371 (_opening_parenthesis, Punctuation, ('#pop', 'quasiquoted-list')), |
|
1372 include('datum*') |
|
1373 ], |
|
1374 'quasiquoted-list': [ |
|
1375 include('list'), |
|
1376 (r'(?!\Z)', Text, 'quasiquoted-datum') |
|
1377 ], |
|
1378 'quoted-datum': [ |
|
1379 include('datum'), |
|
1380 (_opening_parenthesis, Punctuation, ('#pop', 'quoted-list')), |
|
1381 include('datum*') |
|
1382 ], |
|
1383 'quoted-list': [ |
|
1384 include('list'), |
|
1385 (r'(?!\Z)', Text, 'quoted-datum') |
|
1386 ], |
|
1387 'block-comment': [ |
|
1388 (r'#\|', Comment.Multiline, '#push'), |
|
1389 (r'\|#', Comment.Multiline, '#pop'), |
|
1390 (r'[^#|]+|.', Comment.Multiline) |
|
1391 ], |
|
1392 'string': [ |
|
1393 (r'"', String.Double, '#pop'), |
|
1394 (r'(?s)\\([0-7]{1,3}|x[\da-fA-F]{1,2}|u[\da-fA-F]{1,4}|' |
|
1395 r'U[\da-fA-F]{1,8}|.)', String.Escape), |
|
1396 (r'[^\\"]+', String.Double) |
|
1397 ] |
|
1398 } |
|
1399 |
|
1400 |
|
1401 class NewLispLexer(RegexLexer): |
|
1402 """ |
|
1403 For `newLISP. <http://www.newlisp.org/>`_ source code (version 10.3.0). |
|
1404 |
|
1405 .. versionadded:: 1.5 |
|
1406 """ |
|
1407 |
|
1408 name = 'NewLisp' |
|
1409 aliases = ['newlisp'] |
|
1410 filenames = ['*.lsp', '*.nl', '*.kif'] |
|
1411 mimetypes = ['text/x-newlisp', 'application/x-newlisp'] |
|
1412 |
|
1413 flags = re.IGNORECASE | re.MULTILINE | re.UNICODE |
|
1414 |
|
1415 # list of built-in functions for newLISP version 10.3 |
|
1416 builtins = ( |
|
1417 '^', '--', '-', ':', '!', '!=', '?', '@', '*', '/', '&', '%', '+', '++', |
|
1418 '<', '<<', '<=', '=', '>', '>=', '>>', '|', '~', '$', '$0', '$1', '$10', |
|
1419 '$11', '$12', '$13', '$14', '$15', '$2', '$3', '$4', '$5', '$6', '$7', |
|
1420 '$8', '$9', '$args', '$idx', '$it', '$main-args', 'abort', 'abs', |
|
1421 'acos', 'acosh', 'add', 'address', 'amb', 'and', 'append-file', |
|
1422 'append', 'apply', 'args', 'array-list', 'array?', 'array', 'asin', |
|
1423 'asinh', 'assoc', 'atan', 'atan2', 'atanh', 'atom?', 'base64-dec', |
|
1424 'base64-enc', 'bayes-query', 'bayes-train', 'begin', |
|
1425 'beta', 'betai', 'bind', 'binomial', 'bits', 'callback', |
|
1426 'case', 'catch', 'ceil', 'change-dir', 'char', 'chop', 'Class', 'clean', |
|
1427 'close', 'command-event', 'cond', 'cons', 'constant', |
|
1428 'context?', 'context', 'copy-file', 'copy', 'cos', 'cosh', 'count', |
|
1429 'cpymem', 'crc32', 'crit-chi2', 'crit-z', 'current-line', 'curry', |
|
1430 'date-list', 'date-parse', 'date-value', 'date', 'debug', 'dec', |
|
1431 'def-new', 'default', 'define-macro', 'define', |
|
1432 'delete-file', 'delete-url', 'delete', 'destroy', 'det', 'device', |
|
1433 'difference', 'directory?', 'directory', 'div', 'do-until', 'do-while', |
|
1434 'doargs', 'dolist', 'dostring', 'dotimes', 'dotree', 'dump', 'dup', |
|
1435 'empty?', 'encrypt', 'ends-with', 'env', 'erf', 'error-event', |
|
1436 'eval-string', 'eval', 'exec', 'exists', 'exit', 'exp', 'expand', |
|
1437 'explode', 'extend', 'factor', 'fft', 'file-info', 'file?', 'filter', |
|
1438 'find-all', 'find', 'first', 'flat', 'float?', 'float', 'floor', 'flt', |
|
1439 'fn', 'for-all', 'for', 'fork', 'format', 'fv', 'gammai', 'gammaln', |
|
1440 'gcd', 'get-char', 'get-float', 'get-int', 'get-long', 'get-string', |
|
1441 'get-url', 'global?', 'global', 'if-not', 'if', 'ifft', 'import', 'inc', |
|
1442 'index', 'inf?', 'int', 'integer?', 'integer', 'intersect', 'invert', |
|
1443 'irr', 'join', 'lambda-macro', 'lambda?', 'lambda', 'last-error', |
|
1444 'last', 'legal?', 'length', 'let', 'letex', 'letn', |
|
1445 'list?', 'list', 'load', 'local', 'log', 'lookup', |
|
1446 'lower-case', 'macro?', 'main-args', 'MAIN', 'make-dir', 'map', 'mat', |
|
1447 'match', 'max', 'member', 'min', 'mod', 'module', 'mul', 'multiply', |
|
1448 'NaN?', 'net-accept', 'net-close', 'net-connect', 'net-error', |
|
1449 'net-eval', 'net-interface', 'net-ipv', 'net-listen', 'net-local', |
|
1450 'net-lookup', 'net-packet', 'net-peek', 'net-peer', 'net-ping', |
|
1451 'net-receive-from', 'net-receive-udp', 'net-receive', 'net-select', |
|
1452 'net-send-to', 'net-send-udp', 'net-send', 'net-service', |
|
1453 'net-sessions', 'new', 'nil?', 'nil', 'normal', 'not', 'now', 'nper', |
|
1454 'npv', 'nth', 'null?', 'number?', 'open', 'or', 'ostype', 'pack', |
|
1455 'parse-date', 'parse', 'peek', 'pipe', 'pmt', 'pop-assoc', 'pop', |
|
1456 'post-url', 'pow', 'prefix', 'pretty-print', 'primitive?', 'print', |
|
1457 'println', 'prob-chi2', 'prob-z', 'process', 'prompt-event', |
|
1458 'protected?', 'push', 'put-url', 'pv', 'quote?', 'quote', 'rand', |
|
1459 'random', 'randomize', 'read', 'read-char', 'read-expr', 'read-file', |
|
1460 'read-key', 'read-line', 'read-utf8', 'reader-event', |
|
1461 'real-path', 'receive', 'ref-all', 'ref', 'regex-comp', 'regex', |
|
1462 'remove-dir', 'rename-file', 'replace', 'reset', 'rest', 'reverse', |
|
1463 'rotate', 'round', 'save', 'search', 'seed', 'seek', 'select', 'self', |
|
1464 'semaphore', 'send', 'sequence', 'series', 'set-locale', 'set-ref-all', |
|
1465 'set-ref', 'set', 'setf', 'setq', 'sgn', 'share', 'signal', 'silent', |
|
1466 'sin', 'sinh', 'sleep', 'slice', 'sort', 'source', 'spawn', 'sqrt', |
|
1467 'starts-with', 'string?', 'string', 'sub', 'swap', 'sym', 'symbol?', |
|
1468 'symbols', 'sync', 'sys-error', 'sys-info', 'tan', 'tanh', 'term', |
|
1469 'throw-error', 'throw', 'time-of-day', 'time', 'timer', 'title-case', |
|
1470 'trace-highlight', 'trace', 'transpose', 'Tree', 'trim', 'true?', |
|
1471 'true', 'unicode', 'unify', 'unique', 'unless', 'unpack', 'until', |
|
1472 'upper-case', 'utf8', 'utf8len', 'uuid', 'wait-pid', 'when', 'while', |
|
1473 'write', 'write-char', 'write-file', 'write-line', |
|
1474 'xfer-event', 'xml-error', 'xml-parse', 'xml-type-tags', 'zero?', |
|
1475 ) |
|
1476 |
|
1477 # valid names |
|
1478 valid_name = r'([\w!$%&*+.,/<=>?@^~|-])+|(\[.*?\])+' |
|
1479 |
|
1480 tokens = { |
|
1481 'root': [ |
|
1482 # shebang |
|
1483 (r'#!(.*?)$', Comment.Preproc), |
|
1484 # comments starting with semicolon |
|
1485 (r';.*$', Comment.Single), |
|
1486 # comments starting with # |
|
1487 (r'#.*$', Comment.Single), |
|
1488 |
|
1489 # whitespace |
|
1490 (r'\s+', Text), |
|
1491 |
|
1492 # strings, symbols and characters |
|
1493 (r'"(\\\\|\\[^\\]|[^"\\])*"', String), |
|
1494 |
|
1495 # braces |
|
1496 (r'\{', String, "bracestring"), |
|
1497 |
|
1498 # [text] ... [/text] delimited strings |
|
1499 (r'\[text\]*', String, "tagstring"), |
|
1500 |
|
1501 # 'special' operators... |
|
1502 (r"('|:)", Operator), |
|
1503 |
|
1504 # highlight the builtins |
|
1505 (words(builtins, suffix=r'\b'), |
|
1506 Keyword), |
|
1507 |
|
1508 # the remaining functions |
|
1509 (r'(?<=\()' + valid_name, Name.Variable), |
|
1510 |
|
1511 # the remaining variables |
|
1512 (valid_name, String.Symbol), |
|
1513 |
|
1514 # parentheses |
|
1515 (r'(\(|\))', Punctuation), |
|
1516 ], |
|
1517 |
|
1518 # braced strings... |
|
1519 'bracestring': [ |
|
1520 (r'\{', String, "#push"), |
|
1521 (r'\}', String, "#pop"), |
|
1522 ('[^{}]+', String), |
|
1523 ], |
|
1524 |
|
1525 # tagged [text]...[/text] delimited strings... |
|
1526 'tagstring': [ |
|
1527 (r'(?s)(.*?)(\[/text\])', String, '#pop'), |
|
1528 ], |
|
1529 } |
|
1530 |
|
1531 |
|
1532 class EmacsLispLexer(RegexLexer): |
|
1533 """ |
|
1534 An ELisp lexer, parsing a stream and outputting the tokens |
|
1535 needed to highlight elisp code. |
|
1536 |
|
1537 .. versionadded:: 2.1 |
|
1538 """ |
|
1539 name = 'EmacsLisp' |
|
1540 aliases = ['emacs', 'elisp', 'emacs-lisp'] |
|
1541 filenames = ['*.el'] |
|
1542 mimetypes = ['text/x-elisp', 'application/x-elisp'] |
|
1543 |
|
1544 flags = re.MULTILINE |
|
1545 |
|
1546 # couple of useful regexes |
|
1547 |
|
1548 # characters that are not macro-characters and can be used to begin a symbol |
|
1549 nonmacro = r'\\.|[\w!$%&*+-/<=>?@^{}~|]' |
|
1550 constituent = nonmacro + '|[#.:]' |
|
1551 terminated = r'(?=[ "()\]\'\n,;`])' # whitespace or terminating macro characters |
|
1552 |
|
1553 # symbol token, reverse-engineered from hyperspec |
|
1554 # Take a deep breath... |
|
1555 symbol = r'((?:%s)(?:%s)*)' % (nonmacro, constituent) |
|
1556 |
|
1557 macros = { |
|
1558 'atomic-change-group', 'case', 'block', 'cl-block', 'cl-callf', 'cl-callf2', |
|
1559 'cl-case', 'cl-decf', 'cl-declaim', 'cl-declare', |
|
1560 'cl-define-compiler-macro', 'cl-defmacro', 'cl-defstruct', |
|
1561 'cl-defsubst', 'cl-deftype', 'cl-defun', 'cl-destructuring-bind', |
|
1562 'cl-do', 'cl-do*', 'cl-do-all-symbols', 'cl-do-symbols', 'cl-dolist', |
|
1563 'cl-dotimes', 'cl-ecase', 'cl-etypecase', 'eval-when', 'cl-eval-when', 'cl-flet', |
|
1564 'cl-flet*', 'cl-function', 'cl-incf', 'cl-labels', 'cl-letf', |
|
1565 'cl-letf*', 'cl-load-time-value', 'cl-locally', 'cl-loop', |
|
1566 'cl-macrolet', 'cl-multiple-value-bind', 'cl-multiple-value-setq', |
|
1567 'cl-progv', 'cl-psetf', 'cl-psetq', 'cl-pushnew', 'cl-remf', |
|
1568 'cl-return', 'cl-return-from', 'cl-rotatef', 'cl-shiftf', |
|
1569 'cl-symbol-macrolet', 'cl-tagbody', 'cl-the', 'cl-typecase', |
|
1570 'combine-after-change-calls', 'condition-case-unless-debug', 'decf', |
|
1571 'declaim', 'declare', 'declare-function', 'def-edebug-spec', |
|
1572 'defadvice', 'defclass', 'defcustom', 'defface', 'defgeneric', |
|
1573 'defgroup', 'define-advice', 'define-alternatives', |
|
1574 'define-compiler-macro', 'define-derived-mode', 'define-generic-mode', |
|
1575 'define-global-minor-mode', 'define-globalized-minor-mode', |
|
1576 'define-minor-mode', 'define-modify-macro', |
|
1577 'define-obsolete-face-alias', 'define-obsolete-function-alias', |
|
1578 'define-obsolete-variable-alias', 'define-setf-expander', |
|
1579 'define-skeleton', 'defmacro', 'defmethod', 'defsetf', 'defstruct', |
|
1580 'defsubst', 'deftheme', 'deftype', 'defun', 'defvar-local', |
|
1581 'delay-mode-hooks', 'destructuring-bind', 'do', 'do*', |
|
1582 'do-all-symbols', 'do-symbols', 'dolist', 'dont-compile', 'dotimes', |
|
1583 'dotimes-with-progress-reporter', 'ecase', 'ert-deftest', 'etypecase', |
|
1584 'eval-and-compile', 'eval-when-compile', 'flet', 'ignore-errors', |
|
1585 'incf', 'labels', 'lambda', 'letrec', 'lexical-let', 'lexical-let*', |
|
1586 'loop', 'multiple-value-bind', 'multiple-value-setq', 'noreturn', |
|
1587 'oref', 'oref-default', 'oset', 'oset-default', 'pcase', |
|
1588 'pcase-defmacro', 'pcase-dolist', 'pcase-exhaustive', 'pcase-let', |
|
1589 'pcase-let*', 'pop', 'psetf', 'psetq', 'push', 'pushnew', 'remf', |
|
1590 'return', 'rotatef', 'rx', 'save-match-data', 'save-selected-window', |
|
1591 'save-window-excursion', 'setf', 'setq-local', 'shiftf', |
|
1592 'track-mouse', 'typecase', 'unless', 'use-package', 'when', |
|
1593 'while-no-input', 'with-case-table', 'with-category-table', |
|
1594 'with-coding-priority', 'with-current-buffer', 'with-demoted-errors', |
|
1595 'with-eval-after-load', 'with-file-modes', 'with-local-quit', |
|
1596 'with-output-to-string', 'with-output-to-temp-buffer', |
|
1597 'with-parsed-tramp-file-name', 'with-selected-frame', |
|
1598 'with-selected-window', 'with-silent-modifications', 'with-slots', |
|
1599 'with-syntax-table', 'with-temp-buffer', 'with-temp-file', |
|
1600 'with-temp-message', 'with-timeout', 'with-tramp-connection-property', |
|
1601 'with-tramp-file-property', 'with-tramp-progress-reporter', |
|
1602 'with-wrapper-hook', 'load-time-value', 'locally', 'macrolet', 'progv', |
|
1603 'return-from', |
|
1604 } |
|
1605 |
|
1606 special_forms = { |
|
1607 'and', 'catch', 'cond', 'condition-case', 'defconst', 'defvar', |
|
1608 'function', 'if', 'interactive', 'let', 'let*', 'or', 'prog1', |
|
1609 'prog2', 'progn', 'quote', 'save-current-buffer', 'save-excursion', |
|
1610 'save-restriction', 'setq', 'setq-default', 'subr-arity', |
|
1611 'unwind-protect', 'while', |
|
1612 } |
|
1613 |
|
1614 builtin_function = { |
|
1615 '%', '*', '+', '-', '/', '/=', '1+', '1-', '<', '<=', '=', '>', '>=', |
|
1616 'Snarf-documentation', 'abort-recursive-edit', 'abs', |
|
1617 'accept-process-output', 'access-file', 'accessible-keymaps', 'acos', |
|
1618 'active-minibuffer-window', 'add-face-text-property', |
|
1619 'add-name-to-file', 'add-text-properties', 'all-completions', |
|
1620 'append', 'apply', 'apropos-internal', 'aref', 'arrayp', 'aset', |
|
1621 'ash', 'asin', 'assoc', 'assoc-string', 'assq', 'atan', 'atom', |
|
1622 'autoload', 'autoload-do-load', 'backtrace', 'backtrace--locals', |
|
1623 'backtrace-debug', 'backtrace-eval', 'backtrace-frame', |
|
1624 'backward-char', 'backward-prefix-chars', 'barf-if-buffer-read-only', |
|
1625 'base64-decode-region', 'base64-decode-string', |
|
1626 'base64-encode-region', 'base64-encode-string', 'beginning-of-line', |
|
1627 'bidi-find-overridden-directionality', 'bidi-resolved-levels', |
|
1628 'bitmap-spec-p', 'bobp', 'bolp', 'bool-vector', |
|
1629 'bool-vector-count-consecutive', 'bool-vector-count-population', |
|
1630 'bool-vector-exclusive-or', 'bool-vector-intersection', |
|
1631 'bool-vector-not', 'bool-vector-p', 'bool-vector-set-difference', |
|
1632 'bool-vector-subsetp', 'bool-vector-union', 'boundp', |
|
1633 'buffer-base-buffer', 'buffer-chars-modified-tick', |
|
1634 'buffer-enable-undo', 'buffer-file-name', 'buffer-has-markers-at', |
|
1635 'buffer-list', 'buffer-live-p', 'buffer-local-value', |
|
1636 'buffer-local-variables', 'buffer-modified-p', 'buffer-modified-tick', |
|
1637 'buffer-name', 'buffer-size', 'buffer-string', 'buffer-substring', |
|
1638 'buffer-substring-no-properties', 'buffer-swap-text', 'bufferp', |
|
1639 'bury-buffer-internal', 'byte-code', 'byte-code-function-p', |
|
1640 'byte-to-position', 'byte-to-string', 'byteorder', |
|
1641 'call-interactively', 'call-last-kbd-macro', 'call-process', |
|
1642 'call-process-region', 'cancel-kbd-macro-events', 'capitalize', |
|
1643 'capitalize-region', 'capitalize-word', 'car', 'car-less-than-car', |
|
1644 'car-safe', 'case-table-p', 'category-docstring', |
|
1645 'category-set-mnemonics', 'category-table', 'category-table-p', |
|
1646 'ccl-execute', 'ccl-execute-on-string', 'ccl-program-p', 'cdr', |
|
1647 'cdr-safe', 'ceiling', 'char-after', 'char-before', |
|
1648 'char-category-set', 'char-charset', 'char-equal', 'char-or-string-p', |
|
1649 'char-resolve-modifiers', 'char-syntax', 'char-table-extra-slot', |
|
1650 'char-table-p', 'char-table-parent', 'char-table-range', |
|
1651 'char-table-subtype', 'char-to-string', 'char-width', 'characterp', |
|
1652 'charset-after', 'charset-id-internal', 'charset-plist', |
|
1653 'charset-priority-list', 'charsetp', 'check-coding-system', |
|
1654 'check-coding-systems-region', 'clear-buffer-auto-save-failure', |
|
1655 'clear-charset-maps', 'clear-face-cache', 'clear-font-cache', |
|
1656 'clear-image-cache', 'clear-string', 'clear-this-command-keys', |
|
1657 'close-font', 'clrhash', 'coding-system-aliases', |
|
1658 'coding-system-base', 'coding-system-eol-type', 'coding-system-p', |
|
1659 'coding-system-plist', 'coding-system-priority-list', |
|
1660 'coding-system-put', 'color-distance', 'color-gray-p', |
|
1661 'color-supported-p', 'combine-after-change-execute', |
|
1662 'command-error-default-function', 'command-remapping', 'commandp', |
|
1663 'compare-buffer-substrings', 'compare-strings', |
|
1664 'compare-window-configurations', 'completing-read', |
|
1665 'compose-region-internal', 'compose-string-internal', |
|
1666 'composition-get-gstring', 'compute-motion', 'concat', 'cons', |
|
1667 'consp', 'constrain-to-field', 'continue-process', |
|
1668 'controlling-tty-p', 'coordinates-in-window-p', 'copy-alist', |
|
1669 'copy-category-table', 'copy-file', 'copy-hash-table', 'copy-keymap', |
|
1670 'copy-marker', 'copy-sequence', 'copy-syntax-table', 'copysign', |
|
1671 'cos', 'current-active-maps', 'current-bidi-paragraph-direction', |
|
1672 'current-buffer', 'current-case-table', 'current-column', |
|
1673 'current-global-map', 'current-idle-time', 'current-indentation', |
|
1674 'current-input-mode', 'current-local-map', 'current-message', |
|
1675 'current-minor-mode-maps', 'current-time', 'current-time-string', |
|
1676 'current-time-zone', 'current-window-configuration', |
|
1677 'cygwin-convert-file-name-from-windows', |
|
1678 'cygwin-convert-file-name-to-windows', 'daemon-initialized', |
|
1679 'daemonp', 'dbus--init-bus', 'dbus-get-unique-name', |
|
1680 'dbus-message-internal', 'debug-timer-check', 'declare-equiv-charset', |
|
1681 'decode-big5-char', 'decode-char', 'decode-coding-region', |
|
1682 'decode-coding-string', 'decode-sjis-char', 'decode-time', |
|
1683 'default-boundp', 'default-file-modes', 'default-printer-name', |
|
1684 'default-toplevel-value', 'default-value', 'define-category', |
|
1685 'define-charset-alias', 'define-charset-internal', |
|
1686 'define-coding-system-alias', 'define-coding-system-internal', |
|
1687 'define-fringe-bitmap', 'define-hash-table-test', 'define-key', |
|
1688 'define-prefix-command', 'delete', |
|
1689 'delete-all-overlays', 'delete-and-extract-region', 'delete-char', |
|
1690 'delete-directory-internal', 'delete-field', 'delete-file', |
|
1691 'delete-frame', 'delete-other-windows-internal', 'delete-overlay', |
|
1692 'delete-process', 'delete-region', 'delete-terminal', |
|
1693 'delete-window-internal', 'delq', 'describe-buffer-bindings', |
|
1694 'describe-vector', 'destroy-fringe-bitmap', 'detect-coding-region', |
|
1695 'detect-coding-string', 'ding', 'directory-file-name', |
|
1696 'directory-files', 'directory-files-and-attributes', 'discard-input', |
|
1697 'display-supports-face-attributes-p', 'do-auto-save', 'documentation', |
|
1698 'documentation-property', 'downcase', 'downcase-region', |
|
1699 'downcase-word', 'draw-string', 'dump-colors', 'dump-emacs', |
|
1700 'dump-face', 'dump-frame-glyph-matrix', 'dump-glyph-matrix', |
|
1701 'dump-glyph-row', 'dump-redisplay-history', 'dump-tool-bar-row', |
|
1702 'elt', 'emacs-pid', 'encode-big5-char', 'encode-char', |
|
1703 'encode-coding-region', 'encode-coding-string', 'encode-sjis-char', |
|
1704 'encode-time', 'end-kbd-macro', 'end-of-line', 'eobp', 'eolp', 'eq', |
|
1705 'eql', 'equal', 'equal-including-properties', 'erase-buffer', |
|
1706 'error-message-string', 'eval', 'eval-buffer', 'eval-region', |
|
1707 'event-convert-list', 'execute-kbd-macro', 'exit-recursive-edit', |
|
1708 'exp', 'expand-file-name', 'expt', 'external-debugging-output', |
|
1709 'face-attribute-relative-p', 'face-attributes-as-vector', 'face-font', |
|
1710 'fboundp', 'fceiling', 'fetch-bytecode', 'ffloor', |
|
1711 'field-beginning', 'field-end', 'field-string', |
|
1712 'field-string-no-properties', 'file-accessible-directory-p', |
|
1713 'file-acl', 'file-attributes', 'file-attributes-lessp', |
|
1714 'file-directory-p', 'file-executable-p', 'file-exists-p', |
|
1715 'file-locked-p', 'file-modes', 'file-name-absolute-p', |
|
1716 'file-name-all-completions', 'file-name-as-directory', |
|
1717 'file-name-completion', 'file-name-directory', |
|
1718 'file-name-nondirectory', 'file-newer-than-file-p', 'file-readable-p', |
|
1719 'file-regular-p', 'file-selinux-context', 'file-symlink-p', |
|
1720 'file-system-info', 'file-system-info', 'file-writable-p', |
|
1721 'fillarray', 'find-charset-region', 'find-charset-string', |
|
1722 'find-coding-systems-region-internal', 'find-composition-internal', |
|
1723 'find-file-name-handler', 'find-font', 'find-operation-coding-system', |
|
1724 'float', 'float-time', 'floatp', 'floor', 'fmakunbound', |
|
1725 'following-char', 'font-at', 'font-drive-otf', 'font-face-attributes', |
|
1726 'font-family-list', 'font-get', 'font-get-glyphs', |
|
1727 'font-get-system-font', 'font-get-system-normal-font', 'font-info', |
|
1728 'font-match-p', 'font-otf-alternates', 'font-put', |
|
1729 'font-shape-gstring', 'font-spec', 'font-variation-glyphs', |
|
1730 'font-xlfd-name', 'fontp', 'fontset-font', 'fontset-info', |
|
1731 'fontset-list', 'fontset-list-all', 'force-mode-line-update', |
|
1732 'force-window-update', 'format', 'format-mode-line', |
|
1733 'format-network-address', 'format-time-string', 'forward-char', |
|
1734 'forward-comment', 'forward-line', 'forward-word', |
|
1735 'frame-border-width', 'frame-bottom-divider-width', |
|
1736 'frame-can-run-window-configuration-change-hook', 'frame-char-height', |
|
1737 'frame-char-width', 'frame-face-alist', 'frame-first-window', |
|
1738 'frame-focus', 'frame-font-cache', 'frame-fringe-width', 'frame-list', |
|
1739 'frame-live-p', 'frame-or-buffer-changed-p', 'frame-parameter', |
|
1740 'frame-parameters', 'frame-pixel-height', 'frame-pixel-width', |
|
1741 'frame-pointer-visible-p', 'frame-right-divider-width', |
|
1742 'frame-root-window', 'frame-scroll-bar-height', |
|
1743 'frame-scroll-bar-width', 'frame-selected-window', 'frame-terminal', |
|
1744 'frame-text-cols', 'frame-text-height', 'frame-text-lines', |
|
1745 'frame-text-width', 'frame-total-cols', 'frame-total-lines', |
|
1746 'frame-visible-p', 'framep', 'frexp', 'fringe-bitmaps-at-pos', |
|
1747 'fround', 'fset', 'ftruncate', 'funcall', 'funcall-interactively', |
|
1748 'function-equal', 'functionp', 'gap-position', 'gap-size', |
|
1749 'garbage-collect', 'gc-status', 'generate-new-buffer-name', 'get', |
|
1750 'get-buffer', 'get-buffer-create', 'get-buffer-process', |
|
1751 'get-buffer-window', 'get-byte', 'get-char-property', |
|
1752 'get-char-property-and-overlay', 'get-file-buffer', 'get-file-char', |
|
1753 'get-internal-run-time', 'get-load-suffixes', 'get-pos-property', |
|
1754 'get-process', 'get-screen-color', 'get-text-property', |
|
1755 'get-unicode-property-internal', 'get-unused-category', |
|
1756 'get-unused-iso-final-char', 'getenv-internal', 'gethash', |
|
1757 'gfile-add-watch', 'gfile-rm-watch', 'global-key-binding', |
|
1758 'gnutls-available-p', 'gnutls-boot', 'gnutls-bye', 'gnutls-deinit', |
|
1759 'gnutls-error-fatalp', 'gnutls-error-string', 'gnutls-errorp', |
|
1760 'gnutls-get-initstage', 'gnutls-peer-status', |
|
1761 'gnutls-peer-status-warning-describe', 'goto-char', 'gpm-mouse-start', |
|
1762 'gpm-mouse-stop', 'group-gid', 'group-real-gid', |
|
1763 'handle-save-session', 'handle-switch-frame', 'hash-table-count', |
|
1764 'hash-table-p', 'hash-table-rehash-size', |
|
1765 'hash-table-rehash-threshold', 'hash-table-size', 'hash-table-test', |
|
1766 'hash-table-weakness', 'iconify-frame', 'identity', 'image-flush', |
|
1767 'image-mask-p', 'image-metadata', 'image-size', 'imagemagick-types', |
|
1768 'imagep', 'indent-to', 'indirect-function', 'indirect-variable', |
|
1769 'init-image-library', 'inotify-add-watch', 'inotify-rm-watch', |
|
1770 'input-pending-p', 'insert', 'insert-and-inherit', |
|
1771 'insert-before-markers', 'insert-before-markers-and-inherit', |
|
1772 'insert-buffer-substring', 'insert-byte', 'insert-char', |
|
1773 'insert-file-contents', 'insert-startup-screen', 'int86', |
|
1774 'integer-or-marker-p', 'integerp', 'interactive-form', 'intern', |
|
1775 'intern-soft', 'internal--track-mouse', 'internal-char-font', |
|
1776 'internal-complete-buffer', 'internal-copy-lisp-face', |
|
1777 'internal-default-process-filter', |
|
1778 'internal-default-process-sentinel', 'internal-describe-syntax-value', |
|
1779 'internal-event-symbol-parse-modifiers', |
|
1780 'internal-face-x-get-resource', 'internal-get-lisp-face-attribute', |
|
1781 'internal-lisp-face-attribute-values', 'internal-lisp-face-empty-p', |
|
1782 'internal-lisp-face-equal-p', 'internal-lisp-face-p', |
|
1783 'internal-make-lisp-face', 'internal-make-var-non-special', |
|
1784 'internal-merge-in-global-face', |
|
1785 'internal-set-alternative-font-family-alist', |
|
1786 'internal-set-alternative-font-registry-alist', |
|
1787 'internal-set-font-selection-order', |
|
1788 'internal-set-lisp-face-attribute', |
|
1789 'internal-set-lisp-face-attribute-from-resource', |
|
1790 'internal-show-cursor', 'internal-show-cursor-p', 'interrupt-process', |
|
1791 'invisible-p', 'invocation-directory', 'invocation-name', 'isnan', |
|
1792 'iso-charset', 'key-binding', 'key-description', |
|
1793 'keyboard-coding-system', 'keymap-parent', 'keymap-prompt', 'keymapp', |
|
1794 'keywordp', 'kill-all-local-variables', 'kill-buffer', 'kill-emacs', |
|
1795 'kill-local-variable', 'kill-process', 'last-nonminibuffer-frame', |
|
1796 'lax-plist-get', 'lax-plist-put', 'ldexp', 'length', |
|
1797 'libxml-parse-html-region', 'libxml-parse-xml-region', |
|
1798 'line-beginning-position', 'line-end-position', 'line-pixel-height', |
|
1799 'list', 'list-fonts', 'list-system-processes', 'listp', 'load', |
|
1800 'load-average', 'local-key-binding', 'local-variable-if-set-p', |
|
1801 'local-variable-p', 'locale-info', 'locate-file-internal', |
|
1802 'lock-buffer', 'log', 'logand', 'logb', 'logior', 'lognot', 'logxor', |
|
1803 'looking-at', 'lookup-image', 'lookup-image-map', 'lookup-key', |
|
1804 'lower-frame', 'lsh', 'macroexpand', 'make-bool-vector', |
|
1805 'make-byte-code', 'make-category-set', 'make-category-table', |
|
1806 'make-char', 'make-char-table', 'make-directory-internal', |
|
1807 'make-frame-invisible', 'make-frame-visible', 'make-hash-table', |
|
1808 'make-indirect-buffer', 'make-keymap', 'make-list', |
|
1809 'make-local-variable', 'make-marker', 'make-network-process', |
|
1810 'make-overlay', 'make-serial-process', 'make-sparse-keymap', |
|
1811 'make-string', 'make-symbol', 'make-symbolic-link', 'make-temp-name', |
|
1812 'make-terminal-frame', 'make-variable-buffer-local', |
|
1813 'make-variable-frame-local', 'make-vector', 'makunbound', |
|
1814 'map-char-table', 'map-charset-chars', 'map-keymap', |
|
1815 'map-keymap-internal', 'mapatoms', 'mapc', 'mapcar', 'mapconcat', |
|
1816 'maphash', 'mark-marker', 'marker-buffer', 'marker-insertion-type', |
|
1817 'marker-position', 'markerp', 'match-beginning', 'match-data', |
|
1818 'match-end', 'matching-paren', 'max', 'max-char', 'md5', 'member', |
|
1819 'memory-info', 'memory-limit', 'memory-use-counts', 'memq', 'memql', |
|
1820 'menu-bar-menu-at-x-y', 'menu-or-popup-active-p', |
|
1821 'menu-or-popup-active-p', 'merge-face-attribute', 'message', |
|
1822 'message-box', 'message-or-box', 'min', |
|
1823 'minibuffer-completion-contents', 'minibuffer-contents', |
|
1824 'minibuffer-contents-no-properties', 'minibuffer-depth', |
|
1825 'minibuffer-prompt', 'minibuffer-prompt-end', |
|
1826 'minibuffer-selected-window', 'minibuffer-window', 'minibufferp', |
|
1827 'minor-mode-key-binding', 'mod', 'modify-category-entry', |
|
1828 'modify-frame-parameters', 'modify-syntax-entry', |
|
1829 'mouse-pixel-position', 'mouse-position', 'move-overlay', |
|
1830 'move-point-visually', 'move-to-column', 'move-to-window-line', |
|
1831 'msdos-downcase-filename', 'msdos-long-file-names', 'msdos-memget', |
|
1832 'msdos-memput', 'msdos-mouse-disable', 'msdos-mouse-enable', |
|
1833 'msdos-mouse-init', 'msdos-mouse-p', 'msdos-remember-default-colors', |
|
1834 'msdos-set-keyboard', 'msdos-set-mouse-buttons', |
|
1835 'multibyte-char-to-unibyte', 'multibyte-string-p', 'narrow-to-region', |
|
1836 'natnump', 'nconc', 'network-interface-info', |
|
1837 'network-interface-list', 'new-fontset', 'newline-cache-check', |
|
1838 'next-char-property-change', 'next-frame', 'next-overlay-change', |
|
1839 'next-property-change', 'next-read-file-uses-dialog-p', |
|
1840 'next-single-char-property-change', 'next-single-property-change', |
|
1841 'next-window', 'nlistp', 'nreverse', 'nth', 'nthcdr', 'null', |
|
1842 'number-or-marker-p', 'number-to-string', 'numberp', |
|
1843 'open-dribble-file', 'open-font', 'open-termscript', |
|
1844 'optimize-char-table', 'other-buffer', 'other-window-for-scrolling', |
|
1845 'overlay-buffer', 'overlay-end', 'overlay-get', 'overlay-lists', |
|
1846 'overlay-properties', 'overlay-put', 'overlay-recenter', |
|
1847 'overlay-start', 'overlayp', 'overlays-at', 'overlays-in', |
|
1848 'parse-partial-sexp', 'play-sound-internal', 'plist-get', |
|
1849 'plist-member', 'plist-put', 'point', 'point-marker', 'point-max', |
|
1850 'point-max-marker', 'point-min', 'point-min-marker', |
|
1851 'pos-visible-in-window-p', 'position-bytes', 'posix-looking-at', |
|
1852 'posix-search-backward', 'posix-search-forward', 'posix-string-match', |
|
1853 'posn-at-point', 'posn-at-x-y', 'preceding-char', |
|
1854 'prefix-numeric-value', 'previous-char-property-change', |
|
1855 'previous-frame', 'previous-overlay-change', |
|
1856 'previous-property-change', 'previous-single-char-property-change', |
|
1857 'previous-single-property-change', 'previous-window', 'prin1', |
|
1858 'prin1-to-string', 'princ', 'print', 'process-attributes', |
|
1859 'process-buffer', 'process-coding-system', 'process-command', |
|
1860 'process-connection', 'process-contact', 'process-datagram-address', |
|
1861 'process-exit-status', 'process-filter', 'process-filter-multibyte-p', |
|
1862 'process-id', 'process-inherit-coding-system-flag', 'process-list', |
|
1863 'process-mark', 'process-name', 'process-plist', |
|
1864 'process-query-on-exit-flag', 'process-running-child-p', |
|
1865 'process-send-eof', 'process-send-region', 'process-send-string', |
|
1866 'process-sentinel', 'process-status', 'process-tty-name', |
|
1867 'process-type', 'processp', 'profiler-cpu-log', |
|
1868 'profiler-cpu-running-p', 'profiler-cpu-start', 'profiler-cpu-stop', |
|
1869 'profiler-memory-log', 'profiler-memory-running-p', |
|
1870 'profiler-memory-start', 'profiler-memory-stop', 'propertize', |
|
1871 'purecopy', 'put', 'put-text-property', |
|
1872 'put-unicode-property-internal', 'puthash', 'query-font', |
|
1873 'query-fontset', 'quit-process', 'raise-frame', 'random', 'rassoc', |
|
1874 'rassq', 're-search-backward', 're-search-forward', 'read', |
|
1875 'read-buffer', 'read-char', 'read-char-exclusive', |
|
1876 'read-coding-system', 'read-command', 'read-event', |
|
1877 'read-from-minibuffer', 'read-from-string', 'read-function', |
|
1878 'read-key-sequence', 'read-key-sequence-vector', |
|
1879 'read-no-blanks-input', 'read-non-nil-coding-system', 'read-string', |
|
1880 'read-variable', 'recent-auto-save-p', 'recent-doskeys', |
|
1881 'recent-keys', 'recenter', 'recursion-depth', 'recursive-edit', |
|
1882 'redirect-debugging-output', 'redirect-frame-focus', 'redisplay', |
|
1883 'redraw-display', 'redraw-frame', 'regexp-quote', 'region-beginning', |
|
1884 'region-end', 'register-ccl-program', 'register-code-conversion-map', |
|
1885 'remhash', 'remove-list-of-text-properties', 'remove-text-properties', |
|
1886 'rename-buffer', 'rename-file', 'replace-match', |
|
1887 'reset-this-command-lengths', 'resize-mini-window-internal', |
|
1888 'restore-buffer-modified-p', 'resume-tty', 'reverse', 'round', |
|
1889 'run-hook-with-args', 'run-hook-with-args-until-failure', |
|
1890 'run-hook-with-args-until-success', 'run-hook-wrapped', 'run-hooks', |
|
1891 'run-window-configuration-change-hook', 'run-window-scroll-functions', |
|
1892 'safe-length', 'scan-lists', 'scan-sexps', 'scroll-down', |
|
1893 'scroll-left', 'scroll-other-window', 'scroll-right', 'scroll-up', |
|
1894 'search-backward', 'search-forward', 'secure-hash', 'select-frame', |
|
1895 'select-window', 'selected-frame', 'selected-window', |
|
1896 'self-insert-command', 'send-string-to-terminal', 'sequencep', |
|
1897 'serial-process-configure', 'set', 'set-buffer', |
|
1898 'set-buffer-auto-saved', 'set-buffer-major-mode', |
|
1899 'set-buffer-modified-p', 'set-buffer-multibyte', 'set-case-table', |
|
1900 'set-category-table', 'set-char-table-extra-slot', |
|
1901 'set-char-table-parent', 'set-char-table-range', 'set-charset-plist', |
|
1902 'set-charset-priority', 'set-coding-system-priority', |
|
1903 'set-cursor-size', 'set-default', 'set-default-file-modes', |
|
1904 'set-default-toplevel-value', 'set-file-acl', 'set-file-modes', |
|
1905 'set-file-selinux-context', 'set-file-times', 'set-fontset-font', |
|
1906 'set-frame-height', 'set-frame-position', 'set-frame-selected-window', |
|
1907 'set-frame-size', 'set-frame-width', 'set-fringe-bitmap-face', |
|
1908 'set-input-interrupt-mode', 'set-input-meta-mode', 'set-input-mode', |
|
1909 'set-keyboard-coding-system-internal', 'set-keymap-parent', |
|
1910 'set-marker', 'set-marker-insertion-type', 'set-match-data', |
|
1911 'set-message-beep', 'set-minibuffer-window', |
|
1912 'set-mouse-pixel-position', 'set-mouse-position', |
|
1913 'set-network-process-option', 'set-output-flow-control', |
|
1914 'set-process-buffer', 'set-process-coding-system', |
|
1915 'set-process-datagram-address', 'set-process-filter', |
|
1916 'set-process-filter-multibyte', |
|
1917 'set-process-inherit-coding-system-flag', 'set-process-plist', |
|
1918 'set-process-query-on-exit-flag', 'set-process-sentinel', |
|
1919 'set-process-window-size', 'set-quit-char', |
|
1920 'set-safe-terminal-coding-system-internal', 'set-screen-color', |
|
1921 'set-standard-case-table', 'set-syntax-table', |
|
1922 'set-terminal-coding-system-internal', 'set-terminal-local-value', |
|
1923 'set-terminal-parameter', 'set-text-properties', 'set-time-zone-rule', |
|
1924 'set-visited-file-modtime', 'set-window-buffer', |
|
1925 'set-window-combination-limit', 'set-window-configuration', |
|
1926 'set-window-dedicated-p', 'set-window-display-table', |
|
1927 'set-window-fringes', 'set-window-hscroll', 'set-window-margins', |
|
1928 'set-window-new-normal', 'set-window-new-pixel', |
|
1929 'set-window-new-total', 'set-window-next-buffers', |
|
1930 'set-window-parameter', 'set-window-point', 'set-window-prev-buffers', |
|
1931 'set-window-redisplay-end-trigger', 'set-window-scroll-bars', |
|
1932 'set-window-start', 'set-window-vscroll', 'setcar', 'setcdr', |
|
1933 'setplist', 'show-face-resources', 'signal', 'signal-process', 'sin', |
|
1934 'single-key-description', 'skip-chars-backward', 'skip-chars-forward', |
|
1935 'skip-syntax-backward', 'skip-syntax-forward', 'sleep-for', 'sort', |
|
1936 'sort-charsets', 'special-variable-p', 'split-char', |
|
1937 'split-window-internal', 'sqrt', 'standard-case-table', |
|
1938 'standard-category-table', 'standard-syntax-table', 'start-kbd-macro', |
|
1939 'start-process', 'stop-process', 'store-kbd-macro-event', 'string', |
|
1940 'string=', 'string<', 'string>', 'string-as-multibyte', |
|
1941 'string-as-unibyte', 'string-bytes', 'string-collate-equalp', |
|
1942 'string-collate-lessp', 'string-equal', 'string-greaterp', |
|
1943 'string-lessp', 'string-make-multibyte', 'string-make-unibyte', |
|
1944 'string-match', 'string-to-char', 'string-to-multibyte', |
|
1945 'string-to-number', 'string-to-syntax', 'string-to-unibyte', |
|
1946 'string-width', 'stringp', 'subr-name', 'subrp', |
|
1947 'subst-char-in-region', 'substitute-command-keys', |
|
1948 'substitute-in-file-name', 'substring', 'substring-no-properties', |
|
1949 'suspend-emacs', 'suspend-tty', 'suspicious-object', 'sxhash', |
|
1950 'symbol-function', 'symbol-name', 'symbol-plist', 'symbol-value', |
|
1951 'symbolp', 'syntax-table', 'syntax-table-p', 'system-groups', |
|
1952 'system-move-file-to-trash', 'system-name', 'system-users', 'tan', |
|
1953 'terminal-coding-system', 'terminal-list', 'terminal-live-p', |
|
1954 'terminal-local-value', 'terminal-name', 'terminal-parameter', |
|
1955 'terminal-parameters', 'terpri', 'test-completion', |
|
1956 'text-char-description', 'text-properties-at', 'text-property-any', |
|
1957 'text-property-not-all', 'this-command-keys', |
|
1958 'this-command-keys-vector', 'this-single-command-keys', |
|
1959 'this-single-command-raw-keys', 'time-add', 'time-less-p', |
|
1960 'time-subtract', 'tool-bar-get-system-style', 'tool-bar-height', |
|
1961 'tool-bar-pixel-width', 'top-level', 'trace-redisplay', |
|
1962 'trace-to-stderr', 'translate-region-internal', 'transpose-regions', |
|
1963 'truncate', 'try-completion', 'tty-display-color-cells', |
|
1964 'tty-display-color-p', 'tty-no-underline', |
|
1965 'tty-suppress-bold-inverse-default-colors', 'tty-top-frame', |
|
1966 'tty-type', 'type-of', 'undo-boundary', 'unencodable-char-position', |
|
1967 'unhandled-file-name-directory', 'unibyte-char-to-multibyte', |
|
1968 'unibyte-string', 'unicode-property-table-internal', 'unify-charset', |
|
1969 'unintern', 'unix-sync', 'unlock-buffer', 'upcase', 'upcase-initials', |
|
1970 'upcase-initials-region', 'upcase-region', 'upcase-word', |
|
1971 'use-global-map', 'use-local-map', 'user-full-name', |
|
1972 'user-login-name', 'user-real-login-name', 'user-real-uid', |
|
1973 'user-uid', 'variable-binding-locus', 'vconcat', 'vector', |
|
1974 'vector-or-char-table-p', 'vectorp', 'verify-visited-file-modtime', |
|
1975 'vertical-motion', 'visible-frame-list', 'visited-file-modtime', |
|
1976 'w16-get-clipboard-data', 'w16-selection-exists-p', |
|
1977 'w16-set-clipboard-data', 'w32-battery-status', |
|
1978 'w32-default-color-map', 'w32-define-rgb-color', |
|
1979 'w32-display-monitor-attributes-list', 'w32-frame-menu-bar-size', |
|
1980 'w32-frame-rect', 'w32-get-clipboard-data', |
|
1981 'w32-get-codepage-charset', 'w32-get-console-codepage', |
|
1982 'w32-get-console-output-codepage', 'w32-get-current-locale-id', |
|
1983 'w32-get-default-locale-id', 'w32-get-keyboard-layout', |
|
1984 'w32-get-locale-info', 'w32-get-valid-codepages', |
|
1985 'w32-get-valid-keyboard-layouts', 'w32-get-valid-locale-ids', |
|
1986 'w32-has-winsock', 'w32-long-file-name', 'w32-reconstruct-hot-key', |
|
1987 'w32-register-hot-key', 'w32-registered-hot-keys', |
|
1988 'w32-selection-exists-p', 'w32-send-sys-command', |
|
1989 'w32-set-clipboard-data', 'w32-set-console-codepage', |
|
1990 'w32-set-console-output-codepage', 'w32-set-current-locale', |
|
1991 'w32-set-keyboard-layout', 'w32-set-process-priority', |
|
1992 'w32-shell-execute', 'w32-short-file-name', 'w32-toggle-lock-key', |
|
1993 'w32-unload-winsock', 'w32-unregister-hot-key', 'w32-window-exists-p', |
|
1994 'w32notify-add-watch', 'w32notify-rm-watch', |
|
1995 'waiting-for-user-input-p', 'where-is-internal', 'widen', |
|
1996 'widget-apply', 'widget-get', 'widget-put', |
|
1997 'window-absolute-pixel-edges', 'window-at', 'window-body-height', |
|
1998 'window-body-width', 'window-bottom-divider-width', 'window-buffer', |
|
1999 'window-combination-limit', 'window-configuration-frame', |
|
2000 'window-configuration-p', 'window-dedicated-p', |
|
2001 'window-display-table', 'window-edges', 'window-end', 'window-frame', |
|
2002 'window-fringes', 'window-header-line-height', 'window-hscroll', |
|
2003 'window-inside-absolute-pixel-edges', 'window-inside-edges', |
|
2004 'window-inside-pixel-edges', 'window-left-child', |
|
2005 'window-left-column', 'window-line-height', 'window-list', |
|
2006 'window-list-1', 'window-live-p', 'window-margins', |
|
2007 'window-minibuffer-p', 'window-mode-line-height', 'window-new-normal', |
|
2008 'window-new-pixel', 'window-new-total', 'window-next-buffers', |
|
2009 'window-next-sibling', 'window-normal-size', 'window-old-point', |
|
2010 'window-parameter', 'window-parameters', 'window-parent', |
|
2011 'window-pixel-edges', 'window-pixel-height', 'window-pixel-left', |
|
2012 'window-pixel-top', 'window-pixel-width', 'window-point', |
|
2013 'window-prev-buffers', 'window-prev-sibling', |
|
2014 'window-redisplay-end-trigger', 'window-resize-apply', |
|
2015 'window-resize-apply-total', 'window-right-divider-width', |
|
2016 'window-scroll-bar-height', 'window-scroll-bar-width', |
|
2017 'window-scroll-bars', 'window-start', 'window-system', |
|
2018 'window-text-height', 'window-text-pixel-size', 'window-text-width', |
|
2019 'window-top-child', 'window-top-line', 'window-total-height', |
|
2020 'window-total-width', 'window-use-time', 'window-valid-p', |
|
2021 'window-vscroll', 'windowp', 'write-char', 'write-region', |
|
2022 'x-backspace-delete-keys-p', 'x-change-window-property', |
|
2023 'x-change-window-property', 'x-close-connection', |
|
2024 'x-close-connection', 'x-create-frame', 'x-create-frame', |
|
2025 'x-delete-window-property', 'x-delete-window-property', |
|
2026 'x-disown-selection-internal', 'x-display-backing-store', |
|
2027 'x-display-backing-store', 'x-display-color-cells', |
|
2028 'x-display-color-cells', 'x-display-grayscale-p', |
|
2029 'x-display-grayscale-p', 'x-display-list', 'x-display-list', |
|
2030 'x-display-mm-height', 'x-display-mm-height', 'x-display-mm-width', |
|
2031 'x-display-mm-width', 'x-display-monitor-attributes-list', |
|
2032 'x-display-pixel-height', 'x-display-pixel-height', |
|
2033 'x-display-pixel-width', 'x-display-pixel-width', 'x-display-planes', |
|
2034 'x-display-planes', 'x-display-save-under', 'x-display-save-under', |
|
2035 'x-display-screens', 'x-display-screens', 'x-display-visual-class', |
|
2036 'x-display-visual-class', 'x-family-fonts', 'x-file-dialog', |
|
2037 'x-file-dialog', 'x-file-dialog', 'x-focus-frame', 'x-frame-geometry', |
|
2038 'x-frame-geometry', 'x-get-atom-name', 'x-get-resource', |
|
2039 'x-get-selection-internal', 'x-hide-tip', 'x-hide-tip', |
|
2040 'x-list-fonts', 'x-load-color-file', 'x-menu-bar-open-internal', |
|
2041 'x-menu-bar-open-internal', 'x-open-connection', 'x-open-connection', |
|
2042 'x-own-selection-internal', 'x-parse-geometry', 'x-popup-dialog', |
|
2043 'x-popup-menu', 'x-register-dnd-atom', 'x-select-font', |
|
2044 'x-select-font', 'x-selection-exists-p', 'x-selection-owner-p', |
|
2045 'x-send-client-message', 'x-server-max-request-size', |
|
2046 'x-server-max-request-size', 'x-server-vendor', 'x-server-vendor', |
|
2047 'x-server-version', 'x-server-version', 'x-show-tip', 'x-show-tip', |
|
2048 'x-synchronize', 'x-synchronize', 'x-uses-old-gtk-dialog', |
|
2049 'x-window-property', 'x-window-property', 'x-wm-set-size-hint', |
|
2050 'xw-color-defined-p', 'xw-color-defined-p', 'xw-color-values', |
|
2051 'xw-color-values', 'xw-display-color-p', 'xw-display-color-p', |
|
2052 'yes-or-no-p', 'zlib-available-p', 'zlib-decompress-region', |
|
2053 'forward-point', |
|
2054 } |
|
2055 |
|
2056 builtin_function_highlighted = { |
|
2057 'defvaralias', 'provide', 'require', |
|
2058 'with-no-warnings', 'define-widget', 'with-electric-help', |
|
2059 'throw', 'defalias', 'featurep' |
|
2060 } |
|
2061 |
|
2062 lambda_list_keywords = { |
|
2063 '&allow-other-keys', '&aux', '&body', '&environment', '&key', '&optional', |
|
2064 '&rest', '&whole', |
|
2065 } |
|
2066 |
|
2067 error_keywords = { |
|
2068 'cl-assert', 'cl-check-type', 'error', 'signal', |
|
2069 'user-error', 'warn', |
|
2070 } |
|
2071 |
|
2072 def get_tokens_unprocessed(self, text): |
|
2073 stack = ['root'] |
|
2074 for index, token, value in RegexLexer.get_tokens_unprocessed(self, text, stack): |
|
2075 if token is Name.Variable: |
|
2076 if value in EmacsLispLexer.builtin_function: |
|
2077 yield index, Name.Function, value |
|
2078 continue |
|
2079 if value in EmacsLispLexer.special_forms: |
|
2080 yield index, Keyword, value |
|
2081 continue |
|
2082 if value in EmacsLispLexer.error_keywords: |
|
2083 yield index, Name.Exception, value |
|
2084 continue |
|
2085 if value in EmacsLispLexer.builtin_function_highlighted: |
|
2086 yield index, Name.Builtin, value |
|
2087 continue |
|
2088 if value in EmacsLispLexer.macros: |
|
2089 yield index, Name.Builtin, value |
|
2090 continue |
|
2091 if value in EmacsLispLexer.lambda_list_keywords: |
|
2092 yield index, Keyword.Pseudo, value |
|
2093 continue |
|
2094 yield index, token, value |
|
2095 |
|
2096 tokens = { |
|
2097 'root': [ |
|
2098 default('body'), |
|
2099 ], |
|
2100 'body': [ |
|
2101 # whitespace |
|
2102 (r'\s+', Text), |
|
2103 |
|
2104 # single-line comment |
|
2105 (r';.*$', Comment.Single), |
|
2106 |
|
2107 # strings and characters |
|
2108 (r'"', String, 'string'), |
|
2109 (r'\?([^\\]|\\.)', String.Char), |
|
2110 # quoting |
|
2111 (r":" + symbol, Name.Builtin), |
|
2112 (r"::" + symbol, String.Symbol), |
|
2113 (r"'" + symbol, String.Symbol), |
|
2114 (r"'", Operator), |
|
2115 (r"`", Operator), |
|
2116 |
|
2117 # decimal numbers |
|
2118 (r'[-+]?\d+\.?' + terminated, Number.Integer), |
|
2119 (r'[-+]?\d+/\d+' + terminated, Number), |
|
2120 (r'[-+]?(\d*\.\d+([defls][-+]?\d+)?|\d+(\.\d*)?[defls][-+]?\d+)' + |
|
2121 terminated, Number.Float), |
|
2122 |
|
2123 # vectors |
|
2124 (r'\[|\]', Punctuation), |
|
2125 |
|
2126 # uninterned symbol |
|
2127 (r'#:' + symbol, String.Symbol), |
|
2128 |
|
2129 # read syntax for char tables |
|
2130 (r'#\^\^?', Operator), |
|
2131 |
|
2132 # function shorthand |
|
2133 (r'#\'', Name.Function), |
|
2134 |
|
2135 # binary rational |
|
2136 (r'#[bB][+-]?[01]+(/[01]+)?', Number.Bin), |
|
2137 |
|
2138 # octal rational |
|
2139 (r'#[oO][+-]?[0-7]+(/[0-7]+)?', Number.Oct), |
|
2140 |
|
2141 # hex rational |
|
2142 (r'#[xX][+-]?[0-9a-fA-F]+(/[0-9a-fA-F]+)?', Number.Hex), |
|
2143 |
|
2144 # radix rational |
|
2145 (r'#\d+r[+-]?[0-9a-zA-Z]+(/[0-9a-zA-Z]+)?', Number), |
|
2146 |
|
2147 # reference |
|
2148 (r'#\d+=', Operator), |
|
2149 (r'#\d+#', Operator), |
|
2150 |
|
2151 # special operators that should have been parsed already |
|
2152 (r'(,@|,|\.|:)', Operator), |
|
2153 |
|
2154 # special constants |
|
2155 (r'(t|nil)' + terminated, Name.Constant), |
|
2156 |
|
2157 # functions and variables |
|
2158 (r'\*' + symbol + r'\*', Name.Variable.Global), |
|
2159 (symbol, Name.Variable), |
|
2160 |
|
2161 # parentheses |
|
2162 (r'#\(', Operator, 'body'), |
|
2163 (r'\(', Punctuation, 'body'), |
|
2164 (r'\)', Punctuation, '#pop'), |
|
2165 ], |
|
2166 'string': [ |
|
2167 (r'[^"\\`]+', String), |
|
2168 (r'`%s\'' % symbol, String.Symbol), |
|
2169 (r'`', String), |
|
2170 (r'\\.', String), |
|
2171 (r'\\\n', String), |
|
2172 (r'"', String, '#pop'), |
|
2173 ], |
|
2174 } |
|
2175 |
|
2176 |
|
2177 class ShenLexer(RegexLexer): |
|
2178 """ |
|
2179 Lexer for `Shen <http://shenlanguage.org/>`_ source code. |
|
2180 |
|
2181 .. versionadded:: 2.1 |
|
2182 """ |
|
2183 name = 'Shen' |
|
2184 aliases = ['shen'] |
|
2185 filenames = ['*.shen'] |
|
2186 mimetypes = ['text/x-shen', 'application/x-shen'] |
|
2187 |
|
2188 DECLARATIONS = ( |
|
2189 'datatype', 'define', 'defmacro', 'defprolog', 'defcc', |
|
2190 'synonyms', 'declare', 'package', 'type', 'function', |
|
2191 ) |
|
2192 |
|
2193 SPECIAL_FORMS = ( |
|
2194 'lambda', 'get', 'let', 'if', 'cases', 'cond', 'put', 'time', 'freeze', |
|
2195 'value', 'load', '$', 'protect', 'or', 'and', 'not', 'do', 'output', |
|
2196 'prolog?', 'trap-error', 'error', 'make-string', '/.', 'set', '@p', |
|
2197 '@s', '@v', |
|
2198 ) |
|
2199 |
|
2200 BUILTINS = ( |
|
2201 '==', '=', '*', '+', '-', '/', '<', '>', '>=', '<=', '<-address', |
|
2202 '<-vector', 'abort', 'absvector', 'absvector?', 'address->', 'adjoin', |
|
2203 'append', 'arity', 'assoc', 'bind', 'boolean?', 'bound?', 'call', 'cd', |
|
2204 'close', 'cn', 'compile', 'concat', 'cons', 'cons?', 'cut', 'destroy', |
|
2205 'difference', 'element?', 'empty?', 'enable-type-theory', |
|
2206 'error-to-string', 'eval', 'eval-kl', 'exception', 'explode', 'external', |
|
2207 'fail', 'fail-if', 'file', 'findall', 'fix', 'fst', 'fwhen', 'gensym', |
|
2208 'get-time', 'hash', 'hd', 'hdstr', 'hdv', 'head', 'identical', |
|
2209 'implementation', 'in', 'include', 'include-all-but', 'inferences', |
|
2210 'input', 'input+', 'integer?', 'intern', 'intersection', 'is', 'kill', |
|
2211 'language', 'length', 'limit', 'lineread', 'loaded', 'macro', 'macroexpand', |
|
2212 'map', 'mapcan', 'maxinferences', 'mode', 'n->string', 'nl', 'nth', 'null', |
|
2213 'number?', 'occurrences', 'occurs-check', 'open', 'os', 'out', 'port', |
|
2214 'porters', 'pos', 'pr', 'preclude', 'preclude-all-but', 'print', 'profile', |
|
2215 'profile-results', 'ps', 'quit', 'read', 'read+', 'read-byte', 'read-file', |
|
2216 'read-file-as-bytelist', 'read-file-as-string', 'read-from-string', |
|
2217 'release', 'remove', 'return', 'reverse', 'run', 'save', 'set', |
|
2218 'simple-error', 'snd', 'specialise', 'spy', 'step', 'stinput', 'stoutput', |
|
2219 'str', 'string->n', 'string->symbol', 'string?', 'subst', 'symbol?', |
|
2220 'systemf', 'tail', 'tc', 'tc?', 'thaw', 'tl', 'tlstr', 'tlv', 'track', |
|
2221 'tuple?', 'undefmacro', 'unify', 'unify!', 'union', 'unprofile', |
|
2222 'unspecialise', 'untrack', 'variable?', 'vector', 'vector->', 'vector?', |
|
2223 'verified', 'version', 'warn', 'when', 'write-byte', 'write-to-file', |
|
2224 'y-or-n?', |
|
2225 ) |
|
2226 |
|
2227 BUILTINS_ANYWHERE = ('where', 'skip', '>>', '_', '!', '<e>', '<!>') |
|
2228 |
|
2229 MAPPINGS = {s: Keyword for s in DECLARATIONS} |
|
2230 MAPPINGS.update((s, Name.Builtin) for s in BUILTINS) |
|
2231 MAPPINGS.update((s, Keyword) for s in SPECIAL_FORMS) |
|
2232 |
|
2233 valid_symbol_chars = r'[\w!$%*+,<=>?/.\'@&#:-]' |
|
2234 valid_name = '%s+' % valid_symbol_chars |
|
2235 symbol_name = r'[a-z!$%%*+,<=>?/.\'@&#_-]%s*' % valid_symbol_chars |
|
2236 variable = r'[A-Z]%s*' % valid_symbol_chars |
|
2237 |
|
2238 tokens = { |
|
2239 'string': [ |
|
2240 (r'"', String, '#pop'), |
|
2241 (r'c#\d{1,3};', String.Escape), |
|
2242 (r'~[ARS%]', String.Interpol), |
|
2243 (r'(?s).', String), |
|
2244 ], |
|
2245 |
|
2246 'root': [ |
|
2247 (r'(?s)\\\*.*?\*\\', Comment.Multiline), # \* ... *\ |
|
2248 (r'\\\\.*', Comment.Single), # \\ ... |
|
2249 (r'\s+', Text), |
|
2250 (r'_{5,}', Punctuation), |
|
2251 (r'={5,}', Punctuation), |
|
2252 (r'(;|:=|\||--?>|<--?)', Punctuation), |
|
2253 (r'(:-|:|\{|\})', Literal), |
|
2254 (r'[+-]*\d*\.\d+(e[+-]?\d+)?', Number.Float), |
|
2255 (r'[+-]*\d+', Number.Integer), |
|
2256 (r'"', String, 'string'), |
|
2257 (variable, Name.Variable), |
|
2258 (r'(true|false|<>|\[\])', Keyword.Pseudo), |
|
2259 (symbol_name, Literal), |
|
2260 (r'(\[|\]|\(|\))', Punctuation), |
|
2261 ], |
|
2262 } |
|
2263 |
|
2264 def get_tokens_unprocessed(self, text): |
|
2265 tokens = RegexLexer.get_tokens_unprocessed(self, text) |
|
2266 tokens = self._process_symbols(tokens) |
|
2267 tokens = self._process_declarations(tokens) |
|
2268 return tokens |
|
2269 |
|
2270 def _relevant(self, token): |
|
2271 return token not in (Text, Comment.Single, Comment.Multiline) |
|
2272 |
|
2273 def _process_declarations(self, tokens): |
|
2274 opening_paren = False |
|
2275 for index, token, value in tokens: |
|
2276 yield index, token, value |
|
2277 if self._relevant(token): |
|
2278 if opening_paren and token == Keyword and value in self.DECLARATIONS: |
|
2279 declaration = value |
|
2280 yield from self._process_declaration(declaration, tokens) |
|
2281 opening_paren = value == '(' and token == Punctuation |
|
2282 |
|
2283 def _process_symbols(self, tokens): |
|
2284 opening_paren = False |
|
2285 for index, token, value in tokens: |
|
2286 if opening_paren and token in (Literal, Name.Variable): |
|
2287 token = self.MAPPINGS.get(value, Name.Function) |
|
2288 elif token == Literal and value in self.BUILTINS_ANYWHERE: |
|
2289 token = Name.Builtin |
|
2290 opening_paren = value == '(' and token == Punctuation |
|
2291 yield index, token, value |
|
2292 |
|
2293 def _process_declaration(self, declaration, tokens): |
|
2294 for index, token, value in tokens: |
|
2295 if self._relevant(token): |
|
2296 break |
|
2297 yield index, token, value |
|
2298 |
|
2299 if declaration == 'datatype': |
|
2300 prev_was_colon = False |
|
2301 token = Keyword.Type if token == Literal else token |
|
2302 yield index, token, value |
|
2303 for index, token, value in tokens: |
|
2304 if prev_was_colon and token == Literal: |
|
2305 token = Keyword.Type |
|
2306 yield index, token, value |
|
2307 if self._relevant(token): |
|
2308 prev_was_colon = token == Literal and value == ':' |
|
2309 elif declaration == 'package': |
|
2310 token = Name.Namespace if token == Literal else token |
|
2311 yield index, token, value |
|
2312 elif declaration == 'define': |
|
2313 token = Name.Function if token == Literal else token |
|
2314 yield index, token, value |
|
2315 for index, token, value in tokens: |
|
2316 if self._relevant(token): |
|
2317 break |
|
2318 yield index, token, value |
|
2319 if value == '{' and token == Literal: |
|
2320 yield index, Punctuation, value |
|
2321 for index, token, value in self._process_signature(tokens): |
|
2322 yield index, token, value |
|
2323 else: |
|
2324 yield index, token, value |
|
2325 else: |
|
2326 token = Name.Function if token == Literal else token |
|
2327 yield index, token, value |
|
2328 |
|
2329 return |
|
2330 |
|
2331 def _process_signature(self, tokens): |
|
2332 for index, token, value in tokens: |
|
2333 if token == Literal and value == '}': |
|
2334 yield index, Punctuation, value |
|
2335 return |
|
2336 elif token in (Literal, Name.Function): |
|
2337 token = Name.Variable if value.istitle() else Keyword.Type |
|
2338 yield index, token, value |
|
2339 |
|
2340 |
|
2341 class CPSALexer(SchemeLexer): |
|
2342 """ |
|
2343 A CPSA lexer based on the CPSA language as of version 2.2.12 |
|
2344 |
|
2345 .. versionadded:: 2.1 |
|
2346 """ |
|
2347 name = 'CPSA' |
|
2348 aliases = ['cpsa'] |
|
2349 filenames = ['*.cpsa'] |
|
2350 mimetypes = [] |
|
2351 |
|
2352 # list of known keywords and builtins taken form vim 6.4 scheme.vim |
|
2353 # syntax file. |
|
2354 _keywords = ( |
|
2355 'herald', 'vars', 'defmacro', 'include', 'defprotocol', 'defrole', |
|
2356 'defskeleton', 'defstrand', 'deflistener', 'non-orig', 'uniq-orig', |
|
2357 'pen-non-orig', 'precedes', 'trace', 'send', 'recv', 'name', 'text', |
|
2358 'skey', 'akey', 'data', 'mesg', |
|
2359 ) |
|
2360 _builtins = ( |
|
2361 'cat', 'enc', 'hash', 'privk', 'pubk', 'invk', 'ltk', 'gen', 'exp', |
|
2362 ) |
|
2363 |
|
2364 # valid names for identifiers |
|
2365 # well, names can only not consist fully of numbers |
|
2366 # but this should be good enough for now |
|
2367 valid_name = r'[\w!$%&*+,/:<=>?@^~|-]+' |
|
2368 |
|
2369 tokens = { |
|
2370 'root': [ |
|
2371 # the comments - always starting with semicolon |
|
2372 # and going to the end of the line |
|
2373 (r';.*$', Comment.Single), |
|
2374 |
|
2375 # whitespaces - usually not relevant |
|
2376 (r'\s+', Text), |
|
2377 |
|
2378 # numbers |
|
2379 (r'-?\d+\.\d+', Number.Float), |
|
2380 (r'-?\d+', Number.Integer), |
|
2381 # support for uncommon kinds of numbers - |
|
2382 # have to figure out what the characters mean |
|
2383 # (r'(#e|#i|#b|#o|#d|#x)[\d.]+', Number), |
|
2384 |
|
2385 # strings, symbols and characters |
|
2386 (r'"(\\\\|\\[^\\]|[^"\\])*"', String), |
|
2387 (r"'" + valid_name, String.Symbol), |
|
2388 (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char), |
|
2389 |
|
2390 # constants |
|
2391 (r'(#t|#f)', Name.Constant), |
|
2392 |
|
2393 # special operators |
|
2394 (r"('|#|`|,@|,|\.)", Operator), |
|
2395 |
|
2396 # highlight the keywords |
|
2397 (words(_keywords, suffix=r'\b'), Keyword), |
|
2398 |
|
2399 # first variable in a quoted string like |
|
2400 # '(this is syntactic sugar) |
|
2401 (r"(?<='\()" + valid_name, Name.Variable), |
|
2402 (r"(?<=#\()" + valid_name, Name.Variable), |
|
2403 |
|
2404 # highlight the builtins |
|
2405 (words(_builtins, prefix=r'(?<=\()', suffix=r'\b'), Name.Builtin), |
|
2406 |
|
2407 # the remaining functions |
|
2408 (r'(?<=\()' + valid_name, Name.Function), |
|
2409 # find the remaining variables |
|
2410 (valid_name, Name.Variable), |
|
2411 |
|
2412 # the famous parentheses! |
|
2413 (r'(\(|\))', Punctuation), |
|
2414 (r'(\[|\])', Punctuation), |
|
2415 ], |
|
2416 } |
|
2417 |
|
2418 |
|
2419 class XtlangLexer(RegexLexer): |
|
2420 """An xtlang lexer for the `Extempore programming environment |
|
2421 <http://extempore.moso.com.au>`_. |
|
2422 |
|
2423 This is a mixture of Scheme and xtlang, really. Keyword lists are |
|
2424 taken from the Extempore Emacs mode |
|
2425 (https://github.com/extemporelang/extempore-emacs-mode) |
|
2426 |
|
2427 .. versionadded:: 2.2 |
|
2428 """ |
|
2429 name = 'xtlang' |
|
2430 aliases = ['extempore'] |
|
2431 filenames = ['*.xtm'] |
|
2432 mimetypes = [] |
|
2433 |
|
2434 common_keywords = ( |
|
2435 'lambda', 'define', 'if', 'else', 'cond', 'and', |
|
2436 'or', 'let', 'begin', 'set!', 'map', 'for-each', |
|
2437 ) |
|
2438 scheme_keywords = ( |
|
2439 'do', 'delay', 'quasiquote', 'unquote', 'unquote-splicing', 'eval', |
|
2440 'case', 'let*', 'letrec', 'quote', |
|
2441 ) |
|
2442 xtlang_bind_keywords = ( |
|
2443 'bind-func', 'bind-val', 'bind-lib', 'bind-type', 'bind-alias', |
|
2444 'bind-poly', 'bind-dylib', 'bind-lib-func', 'bind-lib-val', |
|
2445 ) |
|
2446 xtlang_keywords = ( |
|
2447 'letz', 'memzone', 'cast', 'convert', 'dotimes', 'doloop', |
|
2448 ) |
|
2449 common_functions = ( |
|
2450 '*', '+', '-', '/', '<', '<=', '=', '>', '>=', '%', 'abs', 'acos', |
|
2451 'angle', 'append', 'apply', 'asin', 'assoc', 'assq', 'assv', |
|
2452 'atan', 'boolean?', 'caaaar', 'caaadr', 'caaar', 'caadar', |
|
2453 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr', 'cadar', |
|
2454 'caddar', 'cadddr', 'caddr', 'cadr', 'car', 'cdaaar', |
|
2455 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar', |
|
2456 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', |
|
2457 'cddr', 'cdr', 'ceiling', 'cons', 'cos', 'floor', 'length', |
|
2458 'list', 'log', 'max', 'member', 'min', 'modulo', 'not', |
|
2459 'reverse', 'round', 'sin', 'sqrt', 'substring', 'tan', |
|
2460 'println', 'random', 'null?', 'callback', 'now', |
|
2461 ) |
|
2462 scheme_functions = ( |
|
2463 'call-with-current-continuation', 'call-with-input-file', |
|
2464 'call-with-output-file', 'call-with-values', 'call/cc', |
|
2465 'char->integer', 'char-alphabetic?', 'char-ci<=?', 'char-ci<?', |
|
2466 'char-ci=?', 'char-ci>=?', 'char-ci>?', 'char-downcase', |
|
2467 'char-lower-case?', 'char-numeric?', 'char-ready?', |
|
2468 'char-upcase', 'char-upper-case?', 'char-whitespace?', |
|
2469 'char<=?', 'char<?', 'char=?', 'char>=?', 'char>?', 'char?', |
|
2470 'close-input-port', 'close-output-port', 'complex?', |
|
2471 'current-input-port', 'current-output-port', 'denominator', |
|
2472 'display', 'dynamic-wind', 'eof-object?', 'eq?', 'equal?', |
|
2473 'eqv?', 'even?', 'exact->inexact', 'exact?', 'exp', 'expt', |
|
2474 'force', 'gcd', 'imag-part', 'inexact->exact', 'inexact?', |
|
2475 'input-port?', 'integer->char', 'integer?', |
|
2476 'interaction-environment', 'lcm', 'list->string', |
|
2477 'list->vector', 'list-ref', 'list-tail', 'list?', 'load', |
|
2478 'magnitude', 'make-polar', 'make-rectangular', 'make-string', |
|
2479 'make-vector', 'memq', 'memv', 'negative?', 'newline', |
|
2480 'null-environment', 'number->string', 'number?', |
|
2481 'numerator', 'odd?', 'open-input-file', 'open-output-file', |
|
2482 'output-port?', 'pair?', 'peek-char', 'port?', 'positive?', |
|
2483 'procedure?', 'quotient', 'rational?', 'rationalize', 'read', |
|
2484 'read-char', 'real-part', 'real?', |
|
2485 'remainder', 'scheme-report-environment', 'set-car!', 'set-cdr!', |
|
2486 'string', 'string->list', 'string->number', 'string->symbol', |
|
2487 'string-append', 'string-ci<=?', 'string-ci<?', 'string-ci=?', |
|
2488 'string-ci>=?', 'string-ci>?', 'string-copy', 'string-fill!', |
|
2489 'string-length', 'string-ref', 'string-set!', 'string<=?', |
|
2490 'string<?', 'string=?', 'string>=?', 'string>?', 'string?', |
|
2491 'symbol->string', 'symbol?', 'transcript-off', 'transcript-on', |
|
2492 'truncate', 'values', 'vector', 'vector->list', 'vector-fill!', |
|
2493 'vector-length', 'vector?', |
|
2494 'with-input-from-file', 'with-output-to-file', 'write', |
|
2495 'write-char', 'zero?', |
|
2496 ) |
|
2497 xtlang_functions = ( |
|
2498 'toString', 'afill!', 'pfill!', 'tfill!', 'tbind', 'vfill!', |
|
2499 'array-fill!', 'pointer-fill!', 'tuple-fill!', 'vector-fill!', 'free', |
|
2500 'array', 'tuple', 'list', '~', 'cset!', 'cref', '&', 'bor', |
|
2501 'ang-names', '<<', '>>', 'nil', 'printf', 'sprintf', 'null', 'now', |
|
2502 'pset!', 'pref-ptr', 'vset!', 'vref', 'aset!', 'aref', 'aref-ptr', |
|
2503 'tset!', 'tref', 'tref-ptr', 'salloc', 'halloc', 'zalloc', 'alloc', |
|
2504 'schedule', 'exp', 'log', 'sin', 'cos', 'tan', 'asin', 'acos', 'atan', |
|
2505 'sqrt', 'expt', 'floor', 'ceiling', 'truncate', 'round', |
|
2506 'llvm_printf', 'push_zone', 'pop_zone', 'memzone', 'callback', |
|
2507 'llvm_sprintf', 'make-array', 'array-set!', 'array-ref', |
|
2508 'array-ref-ptr', 'pointer-set!', 'pointer-ref', 'pointer-ref-ptr', |
|
2509 'stack-alloc', 'heap-alloc', 'zone-alloc', 'make-tuple', 'tuple-set!', |
|
2510 'tuple-ref', 'tuple-ref-ptr', 'closure-set!', 'closure-ref', 'pref', |
|
2511 'pdref', 'impc_null', 'bitcast', 'void', 'ifret', 'ret->', 'clrun->', |
|
2512 'make-env-zone', 'make-env', '<>', 'dtof', 'ftod', 'i1tof', |
|
2513 'i1tod', 'i1toi8', 'i1toi32', 'i1toi64', 'i8tof', 'i8tod', |
|
2514 'i8toi1', 'i8toi32', 'i8toi64', 'i32tof', 'i32tod', 'i32toi1', |
|
2515 'i32toi8', 'i32toi64', 'i64tof', 'i64tod', 'i64toi1', |
|
2516 'i64toi8', 'i64toi32', |
|
2517 ) |
|
2518 |
|
2519 # valid names for Scheme identifiers (names cannot consist fully |
|
2520 # of numbers, but this should be good enough for now) |
|
2521 valid_scheme_name = r'[\w!$%&*+,/:<=>?@^~|-]+' |
|
2522 |
|
2523 # valid characters in xtlang names & types |
|
2524 valid_xtlang_name = r'[\w.!-]+' |
|
2525 valid_xtlang_type = r'[]{}[\w<>,*/|!-]+' |
|
2526 |
|
2527 tokens = { |
|
2528 # keep track of when we're exiting the xtlang form |
|
2529 'xtlang': [ |
|
2530 (r'\(', Punctuation, '#push'), |
|
2531 (r'\)', Punctuation, '#pop'), |
|
2532 |
|
2533 (r'(?<=bind-func\s)' + valid_xtlang_name, Name.Function), |
|
2534 (r'(?<=bind-val\s)' + valid_xtlang_name, Name.Function), |
|
2535 (r'(?<=bind-type\s)' + valid_xtlang_name, Name.Function), |
|
2536 (r'(?<=bind-alias\s)' + valid_xtlang_name, Name.Function), |
|
2537 (r'(?<=bind-poly\s)' + valid_xtlang_name, Name.Function), |
|
2538 (r'(?<=bind-lib\s)' + valid_xtlang_name, Name.Function), |
|
2539 (r'(?<=bind-dylib\s)' + valid_xtlang_name, Name.Function), |
|
2540 (r'(?<=bind-lib-func\s)' + valid_xtlang_name, Name.Function), |
|
2541 (r'(?<=bind-lib-val\s)' + valid_xtlang_name, Name.Function), |
|
2542 |
|
2543 # type annotations |
|
2544 (r':' + valid_xtlang_type, Keyword.Type), |
|
2545 |
|
2546 # types |
|
2547 (r'(<' + valid_xtlang_type + r'>|\|' + valid_xtlang_type + r'\||/' + |
|
2548 valid_xtlang_type + r'/|' + valid_xtlang_type + r'\*)\**', |
|
2549 Keyword.Type), |
|
2550 |
|
2551 # keywords |
|
2552 (words(xtlang_keywords, prefix=r'(?<=\()'), Keyword), |
|
2553 |
|
2554 # builtins |
|
2555 (words(xtlang_functions, prefix=r'(?<=\()'), Name.Function), |
|
2556 |
|
2557 include('common'), |
|
2558 |
|
2559 # variables |
|
2560 (valid_xtlang_name, Name.Variable), |
|
2561 ], |
|
2562 'scheme': [ |
|
2563 # quoted symbols |
|
2564 (r"'" + valid_scheme_name, String.Symbol), |
|
2565 |
|
2566 # char literals |
|
2567 (r"#\\([()/'\"._!§$%& ?=+-]|[a-zA-Z0-9]+)", String.Char), |
|
2568 |
|
2569 # special operators |
|
2570 (r"('|#|`|,@|,|\.)", Operator), |
|
2571 |
|
2572 # keywords |
|
2573 (words(scheme_keywords, prefix=r'(?<=\()'), Keyword), |
|
2574 |
|
2575 # builtins |
|
2576 (words(scheme_functions, prefix=r'(?<=\()'), Name.Function), |
|
2577 |
|
2578 include('common'), |
|
2579 |
|
2580 # variables |
|
2581 (valid_scheme_name, Name.Variable), |
|
2582 ], |
|
2583 # common to both xtlang and Scheme |
|
2584 'common': [ |
|
2585 # comments |
|
2586 (r';.*$', Comment.Single), |
|
2587 |
|
2588 # whitespaces - usually not relevant |
|
2589 (r'\s+', Text), |
|
2590 |
|
2591 # numbers |
|
2592 (r'-?\d+\.\d+', Number.Float), |
|
2593 (r'-?\d+', Number.Integer), |
|
2594 |
|
2595 # binary/oct/hex literals |
|
2596 (r'(#b|#o|#x)[\d.]+', Number), |
|
2597 |
|
2598 # strings |
|
2599 (r'"(\\\\|\\[^\\]|[^"\\])*"', String), |
|
2600 |
|
2601 # true/false constants |
|
2602 (r'(#t|#f)', Name.Constant), |
|
2603 |
|
2604 # keywords |
|
2605 (words(common_keywords, prefix=r'(?<=\()'), Keyword), |
|
2606 |
|
2607 # builtins |
|
2608 (words(common_functions, prefix=r'(?<=\()'), Name.Function), |
|
2609 |
|
2610 # the famous parentheses! |
|
2611 (r'(\(|\))', Punctuation), |
|
2612 ], |
|
2613 'root': [ |
|
2614 # go into xtlang mode |
|
2615 (words(xtlang_bind_keywords, prefix=r'(?<=\()', suffix=r'\b'), |
|
2616 Keyword, 'xtlang'), |
|
2617 |
|
2618 include('scheme') |
|
2619 ], |
|
2620 } |
|
2621 |
|
2622 |
|
2623 class FennelLexer(RegexLexer): |
|
2624 """A lexer for the `Fennel programming language <https://fennel-lang.org>`_. |
|
2625 |
|
2626 Fennel compiles to Lua, so all the Lua builtins are recognized as well |
|
2627 as the special forms that are particular to the Fennel compiler. |
|
2628 |
|
2629 .. versionadded:: 2.3 |
|
2630 """ |
|
2631 name = 'Fennel' |
|
2632 aliases = ['fennel', 'fnl'] |
|
2633 filenames = ['*.fnl'] |
|
2634 |
|
2635 # these two lists are taken from fennel-mode.el: |
|
2636 # https://gitlab.com/technomancy/fennel-mode |
|
2637 # this list is current as of Fennel version 0.6.0. |
|
2638 special_forms = ( |
|
2639 'require-macros', 'eval-compiler', 'doc', 'lua', 'hashfn', |
|
2640 'macro', 'macros', 'import-macros', 'pick-args', 'pick-values', |
|
2641 'macroexpand', 'macrodebug', 'do', 'values', 'if', 'when', |
|
2642 'each', 'for', 'fn', 'lambda', 'λ', 'partial', 'while', |
|
2643 'set', 'global', 'var', 'local', 'let', 'tset', 'set-forcibly!', |
|
2644 'doto', 'match', 'or', 'and', 'true', 'false', 'nil', 'not', |
|
2645 'not=', '.', '+', '..', '^', '-', '*', '%', '/', '>', |
|
2646 '<', '>=', '<=', '=', '...', ':', '->', '->>', '-?>', |
|
2647 '-?>>', 'rshift', 'lshift', 'bor', 'band', 'bnot', 'bxor', |
|
2648 'with-open', 'length' |
|
2649 ) |
|
2650 |
|
2651 # Might be nicer to use the list from _lua_builtins.py but it's unclear how? |
|
2652 builtins = ( |
|
2653 '_G', '_VERSION', 'arg', 'assert', 'bit32', 'collectgarbage', |
|
2654 'coroutine', 'debug', 'dofile', 'error', 'getfenv', |
|
2655 'getmetatable', 'io', 'ipairs', 'load', 'loadfile', 'loadstring', |
|
2656 'math', 'next', 'os', 'package', 'pairs', 'pcall', 'print', |
|
2657 'rawequal', 'rawget', 'rawlen', 'rawset', 'require', 'select', |
|
2658 'setfenv', 'setmetatable', 'string', 'table', 'tonumber', |
|
2659 'tostring', 'type', 'unpack', 'xpcall' |
|
2660 ) |
|
2661 |
|
2662 # based on the scheme definition, but disallowing leading digits and |
|
2663 # commas, and @ is not allowed. |
|
2664 valid_name = r'[a-zA-Z_!$%&*+/:<=>?^~|-][\w!$%&*+/:<=>?^~|\.-]*' |
|
2665 |
|
2666 tokens = { |
|
2667 'root': [ |
|
2668 # the only comment form is a semicolon; goes to the end of the line |
|
2669 (r';.*$', Comment.Single), |
|
2670 |
|
2671 (r'[,\s]+', Text), |
|
2672 (r'-?\d+\.\d+', Number.Float), |
|
2673 (r'-?\d+', Number.Integer), |
|
2674 |
|
2675 (r'"(\\\\|\\[^\\]|[^"\\])*"', String), |
|
2676 |
|
2677 # these are technically strings, but it's worth visually |
|
2678 # distinguishing them because their intent is different |
|
2679 # from regular strings. |
|
2680 (r':' + valid_name, String.Symbol), |
|
2681 |
|
2682 # special forms are keywords |
|
2683 (words(special_forms, suffix=' '), Keyword), |
|
2684 # lua standard library are builtins |
|
2685 (words(builtins, suffix=' '), Name.Builtin), |
|
2686 # special-case the vararg symbol |
|
2687 (r'\.\.\.', Name.Variable), |
|
2688 # regular identifiers |
|
2689 (valid_name, Name.Variable), |
|
2690 |
|
2691 # all your normal paired delimiters for your programming enjoyment |
|
2692 (r'(\(|\))', Punctuation), |
|
2693 (r'(\[|\])', Punctuation), |
|
2694 (r'(\{|\})', Punctuation), |
|
2695 |
|
2696 # the # symbol is shorthand for a lambda function |
|
2697 (r'#', Punctuation), |
|
2698 ] |
|
2699 } |
|