"Fossies" - the Fresh Open Source Software Archive

Member "eric6-20.9/eric/eric6/ThirdParty/Pygments/pygments/lexers/lisp.py" (2 May 2020, 143609 Bytes) of package /linux/misc/eric6-20.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

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