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