_cl_builtins.py 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. # -*- coding: utf-8 -*-
  2. """
  3. pygments.lexers._cl_builtins
  4. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  5. ANSI Common Lisp builtins.
  6. :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
  7. :license: BSD, see LICENSE for details.
  8. """
  9. BUILTIN_FUNCTIONS = { # 638 functions
  10. '<', '<=', '=', '>', '>=', '-', '/', '/=', '*', '+', '1-', '1+',
  11. 'abort', 'abs', 'acons', 'acos', 'acosh', 'add-method', 'adjoin',
  12. 'adjustable-array-p', 'adjust-array', 'allocate-instance',
  13. 'alpha-char-p', 'alphanumericp', 'append', 'apply', 'apropos',
  14. 'apropos-list', 'aref', 'arithmetic-error-operands',
  15. 'arithmetic-error-operation', 'array-dimension', 'array-dimensions',
  16. 'array-displacement', 'array-element-type', 'array-has-fill-pointer-p',
  17. 'array-in-bounds-p', 'arrayp', 'array-rank', 'array-row-major-index',
  18. 'array-total-size', 'ash', 'asin', 'asinh', 'assoc', 'assoc-if',
  19. 'assoc-if-not', 'atan', 'atanh', 'atom', 'bit', 'bit-and', 'bit-andc1',
  20. 'bit-andc2', 'bit-eqv', 'bit-ior', 'bit-nand', 'bit-nor', 'bit-not',
  21. 'bit-orc1', 'bit-orc2', 'bit-vector-p', 'bit-xor', 'boole',
  22. 'both-case-p', 'boundp', 'break', 'broadcast-stream-streams',
  23. 'butlast', 'byte', 'byte-position', 'byte-size', 'caaaar', 'caaadr',
  24. 'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr',
  25. 'cadar', 'caddar', 'cadddr', 'caddr', 'cadr', 'call-next-method', 'car',
  26. 'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar',
  27. 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', 'cddr', 'cdr',
  28. 'ceiling', 'cell-error-name', 'cerror', 'change-class', 'char', 'char<',
  29. 'char<=', 'char=', 'char>', 'char>=', 'char/=', 'character',
  30. 'characterp', 'char-code', 'char-downcase', 'char-equal',
  31. 'char-greaterp', 'char-int', 'char-lessp', 'char-name',
  32. 'char-not-equal', 'char-not-greaterp', 'char-not-lessp', 'char-upcase',
  33. 'cis', 'class-name', 'class-of', 'clear-input', 'clear-output',
  34. 'close', 'clrhash', 'code-char', 'coerce', 'compile',
  35. 'compiled-function-p', 'compile-file', 'compile-file-pathname',
  36. 'compiler-macro-function', 'complement', 'complex', 'complexp',
  37. 'compute-applicable-methods', 'compute-restarts', 'concatenate',
  38. 'concatenated-stream-streams', 'conjugate', 'cons', 'consp',
  39. 'constantly', 'constantp', 'continue', 'copy-alist', 'copy-list',
  40. 'copy-pprint-dispatch', 'copy-readtable', 'copy-seq', 'copy-structure',
  41. 'copy-symbol', 'copy-tree', 'cos', 'cosh', 'count', 'count-if',
  42. 'count-if-not', 'decode-float', 'decode-universal-time', 'delete',
  43. 'delete-duplicates', 'delete-file', 'delete-if', 'delete-if-not',
  44. 'delete-package', 'denominator', 'deposit-field', 'describe',
  45. 'describe-object', 'digit-char', 'digit-char-p', 'directory',
  46. 'directory-namestring', 'disassemble', 'documentation', 'dpb',
  47. 'dribble', 'echo-stream-input-stream', 'echo-stream-output-stream',
  48. 'ed', 'eighth', 'elt', 'encode-universal-time', 'endp',
  49. 'enough-namestring', 'ensure-directories-exist',
  50. 'ensure-generic-function', 'eq', 'eql', 'equal', 'equalp', 'error',
  51. 'eval', 'evenp', 'every', 'exp', 'export', 'expt', 'fboundp',
  52. 'fceiling', 'fdefinition', 'ffloor', 'fifth', 'file-author',
  53. 'file-error-pathname', 'file-length', 'file-namestring',
  54. 'file-position', 'file-string-length', 'file-write-date',
  55. 'fill', 'fill-pointer', 'find', 'find-all-symbols', 'find-class',
  56. 'find-if', 'find-if-not', 'find-method', 'find-package', 'find-restart',
  57. 'find-symbol', 'finish-output', 'first', 'float', 'float-digits',
  58. 'floatp', 'float-precision', 'float-radix', 'float-sign', 'floor',
  59. 'fmakunbound', 'force-output', 'format', 'fourth', 'fresh-line',
  60. 'fround', 'ftruncate', 'funcall', 'function-keywords',
  61. 'function-lambda-expression', 'functionp', 'gcd', 'gensym', 'gentemp',
  62. 'get', 'get-decoded-time', 'get-dispatch-macro-character', 'getf',
  63. 'gethash', 'get-internal-real-time', 'get-internal-run-time',
  64. 'get-macro-character', 'get-output-stream-string', 'get-properties',
  65. 'get-setf-expansion', 'get-universal-time', 'graphic-char-p',
  66. 'hash-table-count', 'hash-table-p', 'hash-table-rehash-size',
  67. 'hash-table-rehash-threshold', 'hash-table-size', 'hash-table-test',
  68. 'host-namestring', 'identity', 'imagpart', 'import',
  69. 'initialize-instance', 'input-stream-p', 'inspect',
  70. 'integer-decode-float', 'integer-length', 'integerp',
  71. 'interactive-stream-p', 'intern', 'intersection',
  72. 'invalid-method-error', 'invoke-debugger', 'invoke-restart',
  73. 'invoke-restart-interactively', 'isqrt', 'keywordp', 'last', 'lcm',
  74. 'ldb', 'ldb-test', 'ldiff', 'length', 'lisp-implementation-type',
  75. 'lisp-implementation-version', 'list', 'list*', 'list-all-packages',
  76. 'listen', 'list-length', 'listp', 'load',
  77. 'load-logical-pathname-translations', 'log', 'logand', 'logandc1',
  78. 'logandc2', 'logbitp', 'logcount', 'logeqv', 'logical-pathname',
  79. 'logical-pathname-translations', 'logior', 'lognand', 'lognor',
  80. 'lognot', 'logorc1', 'logorc2', 'logtest', 'logxor', 'long-site-name',
  81. 'lower-case-p', 'machine-instance', 'machine-type', 'machine-version',
  82. 'macroexpand', 'macroexpand-1', 'macro-function', 'make-array',
  83. 'make-broadcast-stream', 'make-concatenated-stream', 'make-condition',
  84. 'make-dispatch-macro-character', 'make-echo-stream', 'make-hash-table',
  85. 'make-instance', 'make-instances-obsolete', 'make-list',
  86. 'make-load-form', 'make-load-form-saving-slots', 'make-package',
  87. 'make-pathname', 'make-random-state', 'make-sequence', 'make-string',
  88. 'make-string-input-stream', 'make-string-output-stream', 'make-symbol',
  89. 'make-synonym-stream', 'make-two-way-stream', 'makunbound', 'map',
  90. 'mapc', 'mapcan', 'mapcar', 'mapcon', 'maphash', 'map-into', 'mapl',
  91. 'maplist', 'mask-field', 'max', 'member', 'member-if', 'member-if-not',
  92. 'merge', 'merge-pathnames', 'method-combination-error',
  93. 'method-qualifiers', 'min', 'minusp', 'mismatch', 'mod',
  94. 'muffle-warning', 'name-char', 'namestring', 'nbutlast', 'nconc',
  95. 'next-method-p', 'nintersection', 'ninth', 'no-applicable-method',
  96. 'no-next-method', 'not', 'notany', 'notevery', 'nreconc', 'nreverse',
  97. 'nset-difference', 'nset-exclusive-or', 'nstring-capitalize',
  98. 'nstring-downcase', 'nstring-upcase', 'nsublis', 'nsubst', 'nsubst-if',
  99. 'nsubst-if-not', 'nsubstitute', 'nsubstitute-if', 'nsubstitute-if-not',
  100. 'nth', 'nthcdr', 'null', 'numberp', 'numerator', 'nunion', 'oddp',
  101. 'open', 'open-stream-p', 'output-stream-p', 'package-error-package',
  102. 'package-name', 'package-nicknames', 'packagep',
  103. 'package-shadowing-symbols', 'package-used-by-list', 'package-use-list',
  104. 'pairlis', 'parse-integer', 'parse-namestring', 'pathname',
  105. 'pathname-device', 'pathname-directory', 'pathname-host',
  106. 'pathname-match-p', 'pathname-name', 'pathnamep', 'pathname-type',
  107. 'pathname-version', 'peek-char', 'phase', 'plusp', 'position',
  108. 'position-if', 'position-if-not', 'pprint', 'pprint-dispatch',
  109. 'pprint-fill', 'pprint-indent', 'pprint-linear', 'pprint-newline',
  110. 'pprint-tab', 'pprint-tabular', 'prin1', 'prin1-to-string', 'princ',
  111. 'princ-to-string', 'print', 'print-object', 'probe-file', 'proclaim',
  112. 'provide', 'random', 'random-state-p', 'rassoc', 'rassoc-if',
  113. 'rassoc-if-not', 'rational', 'rationalize', 'rationalp', 'read',
  114. 'read-byte', 'read-char', 'read-char-no-hang', 'read-delimited-list',
  115. 'read-from-string', 'read-line', 'read-preserving-whitespace',
  116. 'read-sequence', 'readtable-case', 'readtablep', 'realp', 'realpart',
  117. 'reduce', 'reinitialize-instance', 'rem', 'remhash', 'remove',
  118. 'remove-duplicates', 'remove-if', 'remove-if-not', 'remove-method',
  119. 'remprop', 'rename-file', 'rename-package', 'replace', 'require',
  120. 'rest', 'restart-name', 'revappend', 'reverse', 'room', 'round',
  121. 'row-major-aref', 'rplaca', 'rplacd', 'sbit', 'scale-float', 'schar',
  122. 'search', 'second', 'set', 'set-difference',
  123. 'set-dispatch-macro-character', 'set-exclusive-or',
  124. 'set-macro-character', 'set-pprint-dispatch', 'set-syntax-from-char',
  125. 'seventh', 'shadow', 'shadowing-import', 'shared-initialize',
  126. 'short-site-name', 'signal', 'signum', 'simple-bit-vector-p',
  127. 'simple-condition-format-arguments', 'simple-condition-format-control',
  128. 'simple-string-p', 'simple-vector-p', 'sin', 'sinh', 'sixth', 'sleep',
  129. 'slot-boundp', 'slot-exists-p', 'slot-makunbound', 'slot-missing',
  130. 'slot-unbound', 'slot-value', 'software-type', 'software-version',
  131. 'some', 'sort', 'special-operator-p', 'sqrt', 'stable-sort',
  132. 'standard-char-p', 'store-value', 'stream-element-type',
  133. 'stream-error-stream', 'stream-external-format', 'streamp', 'string',
  134. 'string<', 'string<=', 'string=', 'string>', 'string>=', 'string/=',
  135. 'string-capitalize', 'string-downcase', 'string-equal',
  136. 'string-greaterp', 'string-left-trim', 'string-lessp',
  137. 'string-not-equal', 'string-not-greaterp', 'string-not-lessp',
  138. 'stringp', 'string-right-trim', 'string-trim', 'string-upcase',
  139. 'sublis', 'subseq', 'subsetp', 'subst', 'subst-if', 'subst-if-not',
  140. 'substitute', 'substitute-if', 'substitute-if-not', 'subtypep','svref',
  141. 'sxhash', 'symbol-function', 'symbol-name', 'symbolp', 'symbol-package',
  142. 'symbol-plist', 'symbol-value', 'synonym-stream-symbol', 'syntax:',
  143. 'tailp', 'tan', 'tanh', 'tenth', 'terpri', 'third',
  144. 'translate-logical-pathname', 'translate-pathname', 'tree-equal',
  145. 'truename', 'truncate', 'two-way-stream-input-stream',
  146. 'two-way-stream-output-stream', 'type-error-datum',
  147. 'type-error-expected-type', 'type-of', 'typep', 'unbound-slot-instance',
  148. 'unexport', 'unintern', 'union', 'unread-char', 'unuse-package',
  149. 'update-instance-for-different-class',
  150. 'update-instance-for-redefined-class', 'upgraded-array-element-type',
  151. 'upgraded-complex-part-type', 'upper-case-p', 'use-package',
  152. 'user-homedir-pathname', 'use-value', 'values', 'values-list', 'vector',
  153. 'vectorp', 'vector-pop', 'vector-push', 'vector-push-extend', 'warn',
  154. 'wild-pathname-p', 'write', 'write-byte', 'write-char', 'write-line',
  155. 'write-sequence', 'write-string', 'write-to-string', 'yes-or-no-p',
  156. 'y-or-n-p', 'zerop',
  157. }
  158. SPECIAL_FORMS = {
  159. 'block', 'catch', 'declare', 'eval-when', 'flet', 'function', 'go', 'if',
  160. 'labels', 'lambda', 'let', 'let*', 'load-time-value', 'locally', 'macrolet',
  161. 'multiple-value-call', 'multiple-value-prog1', 'progn', 'progv', 'quote',
  162. 'return-from', 'setq', 'symbol-macrolet', 'tagbody', 'the', 'throw',
  163. 'unwind-protect',
  164. }
  165. MACROS = {
  166. 'and', 'assert', 'call-method', 'case', 'ccase', 'check-type', 'cond',
  167. 'ctypecase', 'decf', 'declaim', 'defclass', 'defconstant', 'defgeneric',
  168. 'define-compiler-macro', 'define-condition', 'define-method-combination',
  169. 'define-modify-macro', 'define-setf-expander', 'define-symbol-macro',
  170. 'defmacro', 'defmethod', 'defpackage', 'defparameter', 'defsetf',
  171. 'defstruct', 'deftype', 'defun', 'defvar', 'destructuring-bind', 'do',
  172. 'do*', 'do-all-symbols', 'do-external-symbols', 'dolist', 'do-symbols',
  173. 'dotimes', 'ecase', 'etypecase', 'formatter', 'handler-bind',
  174. 'handler-case', 'ignore-errors', 'incf', 'in-package', 'lambda', 'loop',
  175. 'loop-finish', 'make-method', 'multiple-value-bind', 'multiple-value-list',
  176. 'multiple-value-setq', 'nth-value', 'or', 'pop',
  177. 'pprint-exit-if-list-exhausted', 'pprint-logical-block', 'pprint-pop',
  178. 'print-unreadable-object', 'prog', 'prog*', 'prog1', 'prog2', 'psetf',
  179. 'psetq', 'push', 'pushnew', 'remf', 'restart-bind', 'restart-case',
  180. 'return', 'rotatef', 'setf', 'shiftf', 'step', 'time', 'trace', 'typecase',
  181. 'unless', 'untrace', 'when', 'with-accessors', 'with-compilation-unit',
  182. 'with-condition-restarts', 'with-hash-table-iterator',
  183. 'with-input-from-string', 'with-open-file', 'with-open-stream',
  184. 'with-output-to-string', 'with-package-iterator', 'with-simple-restart',
  185. 'with-slots', 'with-standard-io-syntax',
  186. }
  187. LAMBDA_LIST_KEYWORDS = {
  188. '&allow-other-keys', '&aux', '&body', '&environment', '&key', '&optional',
  189. '&rest', '&whole',
  190. }
  191. DECLARATIONS = {
  192. 'dynamic-extent', 'ignore', 'optimize', 'ftype', 'inline', 'special',
  193. 'ignorable', 'notinline', 'type',
  194. }
  195. BUILTIN_TYPES = {
  196. 'atom', 'boolean', 'base-char', 'base-string', 'bignum', 'bit',
  197. 'compiled-function', 'extended-char', 'fixnum', 'keyword', 'nil',
  198. 'signed-byte', 'short-float', 'single-float', 'double-float', 'long-float',
  199. 'simple-array', 'simple-base-string', 'simple-bit-vector', 'simple-string',
  200. 'simple-vector', 'standard-char', 'unsigned-byte',
  201. # Condition Types
  202. 'arithmetic-error', 'cell-error', 'condition', 'control-error',
  203. 'division-by-zero', 'end-of-file', 'error', 'file-error',
  204. 'floating-point-inexact', 'floating-point-overflow',
  205. 'floating-point-underflow', 'floating-point-invalid-operation',
  206. 'parse-error', 'package-error', 'print-not-readable', 'program-error',
  207. 'reader-error', 'serious-condition', 'simple-condition', 'simple-error',
  208. 'simple-type-error', 'simple-warning', 'stream-error', 'storage-condition',
  209. 'style-warning', 'type-error', 'unbound-variable', 'unbound-slot',
  210. 'undefined-function', 'warning',
  211. }
  212. BUILTIN_CLASSES = {
  213. 'array', 'broadcast-stream', 'bit-vector', 'built-in-class', 'character',
  214. 'class', 'complex', 'concatenated-stream', 'cons', 'echo-stream',
  215. 'file-stream', 'float', 'function', 'generic-function', 'hash-table',
  216. 'integer', 'list', 'logical-pathname', 'method-combination', 'method',
  217. 'null', 'number', 'package', 'pathname', 'ratio', 'rational', 'readtable',
  218. 'real', 'random-state', 'restart', 'sequence', 'standard-class',
  219. 'standard-generic-function', 'standard-method', 'standard-object',
  220. 'string-stream', 'stream', 'string', 'structure-class', 'structure-object',
  221. 'symbol', 'synonym-stream', 't', 'two-way-stream', 'vector',
  222. }