pygmentize 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +19 -0
- data/lib/pygments.rb +23 -0
- data/pygmentize.gemspec +11 -0
- data/test/pygments.rb +19 -0
- data/vendor/pygmentize.py +7 -0
- data/vendor/pygments/AUTHORS +73 -0
- data/vendor/pygments/LICENSE +25 -0
- data/vendor/pygments/__init__.py +91 -0
- data/vendor/pygments/__init__.pyc +0 -0
- data/vendor/pygments/cmdline.py +430 -0
- data/vendor/pygments/cmdline.pyc +0 -0
- data/vendor/pygments/console.py +74 -0
- data/vendor/pygments/console.pyc +0 -0
- data/vendor/pygments/filter.py +74 -0
- data/vendor/pygments/filter.pyc +0 -0
- data/vendor/pygments/filters/__init__.py +357 -0
- data/vendor/pygments/filters/__init__.pyc +0 -0
- data/vendor/pygments/formatter.py +92 -0
- data/vendor/pygments/formatter.pyc +0 -0
- data/vendor/pygments/formatters/__init__.py +68 -0
- data/vendor/pygments/formatters/__init__.pyc +0 -0
- data/vendor/pygments/formatters/_mapping.py +92 -0
- data/vendor/pygments/formatters/_mapping.pyc +0 -0
- data/vendor/pygments/formatters/bbcode.py +109 -0
- data/vendor/pygments/formatters/bbcode.pyc +0 -0
- data/vendor/pygments/formatters/html.py +723 -0
- data/vendor/pygments/formatters/html.pyc +0 -0
- data/vendor/pygments/formatters/img.py +553 -0
- data/vendor/pygments/formatters/img.pyc +0 -0
- data/vendor/pygments/formatters/latex.py +354 -0
- data/vendor/pygments/formatters/latex.pyc +0 -0
- data/vendor/pygments/formatters/other.py +117 -0
- data/vendor/pygments/formatters/other.pyc +0 -0
- data/vendor/pygments/formatters/rtf.py +136 -0
- data/vendor/pygments/formatters/rtf.pyc +0 -0
- data/vendor/pygments/formatters/svg.py +154 -0
- data/vendor/pygments/formatters/svg.pyc +0 -0
- data/vendor/pygments/formatters/terminal.py +109 -0
- data/vendor/pygments/formatters/terminal.pyc +0 -0
- data/vendor/pygments/formatters/terminal256.py +219 -0
- data/vendor/pygments/formatters/terminal256.pyc +0 -0
- data/vendor/pygments/lexer.py +660 -0
- data/vendor/pygments/lexer.pyc +0 -0
- data/vendor/pygments/lexers/__init__.py +226 -0
- data/vendor/pygments/lexers/__init__.pyc +0 -0
- data/vendor/pygments/lexers/_asybuiltins.py +1645 -0
- data/vendor/pygments/lexers/_clbuiltins.py +232 -0
- data/vendor/pygments/lexers/_luabuiltins.py +256 -0
- data/vendor/pygments/lexers/_mapping.py +234 -0
- data/vendor/pygments/lexers/_mapping.pyc +0 -0
- data/vendor/pygments/lexers/_phpbuiltins.py +3389 -0
- data/vendor/pygments/lexers/_vimbuiltins.py +3 -0
- data/vendor/pygments/lexers/agile.py +1485 -0
- data/vendor/pygments/lexers/agile.pyc +0 -0
- data/vendor/pygments/lexers/asm.py +353 -0
- data/vendor/pygments/lexers/compiled.py +2365 -0
- data/vendor/pygments/lexers/dotnet.py +355 -0
- data/vendor/pygments/lexers/functional.py +756 -0
- data/vendor/pygments/lexers/functional.pyc +0 -0
- data/vendor/pygments/lexers/math.py +461 -0
- data/vendor/pygments/lexers/other.py +2297 -0
- data/vendor/pygments/lexers/parsers.py +695 -0
- data/vendor/pygments/lexers/special.py +100 -0
- data/vendor/pygments/lexers/special.pyc +0 -0
- data/vendor/pygments/lexers/templates.py +1387 -0
- data/vendor/pygments/lexers/text.py +1586 -0
- data/vendor/pygments/lexers/web.py +1619 -0
- data/vendor/pygments/lexers/web.pyc +0 -0
- data/vendor/pygments/plugin.py +74 -0
- data/vendor/pygments/plugin.pyc +0 -0
- data/vendor/pygments/scanner.py +104 -0
- data/vendor/pygments/style.py +117 -0
- data/vendor/pygments/style.pyc +0 -0
- data/vendor/pygments/styles/__init__.py +68 -0
- data/vendor/pygments/styles/__init__.pyc +0 -0
- data/vendor/pygments/styles/autumn.py +65 -0
- data/vendor/pygments/styles/borland.py +51 -0
- data/vendor/pygments/styles/bw.py +49 -0
- data/vendor/pygments/styles/colorful.py +81 -0
- data/vendor/pygments/styles/default.py +73 -0
- data/vendor/pygments/styles/default.pyc +0 -0
- data/vendor/pygments/styles/emacs.py +72 -0
- data/vendor/pygments/styles/friendly.py +72 -0
- data/vendor/pygments/styles/fruity.py +43 -0
- data/vendor/pygments/styles/manni.py +75 -0
- data/vendor/pygments/styles/monokai.py +106 -0
- data/vendor/pygments/styles/murphy.py +80 -0
- data/vendor/pygments/styles/native.py +65 -0
- data/vendor/pygments/styles/pastie.py +75 -0
- data/vendor/pygments/styles/perldoc.py +69 -0
- data/vendor/pygments/styles/tango.py +141 -0
- data/vendor/pygments/styles/trac.py +63 -0
- data/vendor/pygments/styles/vim.py +63 -0
- data/vendor/pygments/styles/vs.py +38 -0
- data/vendor/pygments/token.py +198 -0
- data/vendor/pygments/token.pyc +0 -0
- data/vendor/pygments/unistring.py +130 -0
- data/vendor/pygments/unistring.pyc +0 -0
- data/vendor/pygments/util.py +226 -0
- data/vendor/pygments/util.pyc +0 -0
- metadata +166 -0
@@ -0,0 +1,232 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers._clbuiltins
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
ANSI Common Lisp builtins.
|
7
|
+
|
8
|
+
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
|
9
|
+
:license: BSD, see LICENSE for details.
|
10
|
+
"""
|
11
|
+
|
12
|
+
BUILTIN_FUNCTIONS = [ # 638 functions
|
13
|
+
'<', '<=', '=', '>', '>=', '-', '/', '/=', '*', '+', '1-', '1+',
|
14
|
+
'abort', 'abs', 'acons', 'acos', 'acosh', 'add-method', 'adjoin',
|
15
|
+
'adjustable-array-p', 'adjust-array', 'allocate-instance',
|
16
|
+
'alpha-char-p', 'alphanumericp', 'append', 'apply', 'apropos',
|
17
|
+
'apropos-list', 'aref', 'arithmetic-error-operands',
|
18
|
+
'arithmetic-error-operation', 'array-dimension', 'array-dimensions',
|
19
|
+
'array-displacement', 'array-element-type', 'array-has-fill-pointer-p',
|
20
|
+
'array-in-bounds-p', 'arrayp', 'array-rank', 'array-row-major-index',
|
21
|
+
'array-total-size', 'ash', 'asin', 'asinh', 'assoc', 'assoc-if',
|
22
|
+
'assoc-if-not', 'atan', 'atanh', 'atom', 'bit', 'bit-and', 'bit-andc1',
|
23
|
+
'bit-andc2', 'bit-eqv', 'bit-ior', 'bit-nand', 'bit-nor', 'bit-not',
|
24
|
+
'bit-orc1', 'bit-orc2', 'bit-vector-p', 'bit-xor', 'boole',
|
25
|
+
'both-case-p', 'boundp', 'break', 'broadcast-stream-streams',
|
26
|
+
'butlast', 'byte', 'byte-position', 'byte-size', 'caaaar', 'caaadr',
|
27
|
+
'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr',
|
28
|
+
'cadar', 'caddar', 'cadddr', 'caddr', 'cadr', 'call-next-method', 'car',
|
29
|
+
'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar',
|
30
|
+
'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', 'cddr', 'cdr',
|
31
|
+
'ceiling', 'cell-error-name', 'cerror', 'change-class', 'char', 'char<',
|
32
|
+
'char<=', 'char=', 'char>', 'char>=', 'char/=', 'character',
|
33
|
+
'characterp', 'char-code', 'char-downcase', 'char-equal',
|
34
|
+
'char-greaterp', 'char-int', 'char-lessp', 'char-name',
|
35
|
+
'char-not-equal', 'char-not-greaterp', 'char-not-lessp', 'char-upcase',
|
36
|
+
'cis', 'class-name', 'class-of', 'clear-input', 'clear-output',
|
37
|
+
'close', 'clrhash', 'code-char', 'coerce', 'compile',
|
38
|
+
'compiled-function-p', 'compile-file', 'compile-file-pathname',
|
39
|
+
'compiler-macro-function', 'complement', 'complex', 'complexp',
|
40
|
+
'compute-applicable-methods', 'compute-restarts', 'concatenate',
|
41
|
+
'concatenated-stream-streams', 'conjugate', 'cons', 'consp',
|
42
|
+
'constantly', 'constantp', 'continue', 'copy-alist', 'copy-list',
|
43
|
+
'copy-pprint-dispatch', 'copy-readtable', 'copy-seq', 'copy-structure',
|
44
|
+
'copy-symbol', 'copy-tree', 'cos', 'cosh', 'count', 'count-if',
|
45
|
+
'count-if-not', 'decode-float', 'decode-universal-time', 'delete',
|
46
|
+
'delete-duplicates', 'delete-file', 'delete-if', 'delete-if-not',
|
47
|
+
'delete-package', 'denominator', 'deposit-field', 'describe',
|
48
|
+
'describe-object', 'digit-char', 'digit-char-p', 'directory',
|
49
|
+
'directory-namestring', 'disassemble', 'documentation', 'dpb',
|
50
|
+
'dribble', 'echo-stream-input-stream', 'echo-stream-output-stream',
|
51
|
+
'ed', 'eighth', 'elt', 'encode-universal-time', 'endp',
|
52
|
+
'enough-namestring', 'ensure-directories-exist',
|
53
|
+
'ensure-generic-function', 'eq', 'eql', 'equal', 'equalp', 'error',
|
54
|
+
'eval', 'evenp', 'every', 'exp', 'export', 'expt', 'fboundp',
|
55
|
+
'fceiling', 'fdefinition', 'ffloor', 'fifth', 'file-author',
|
56
|
+
'file-error-pathname', 'file-length', 'file-namestring',
|
57
|
+
'file-position', 'file-string-length', 'file-write-date',
|
58
|
+
'fill', 'fill-pointer', 'find', 'find-all-symbols', 'find-class',
|
59
|
+
'find-if', 'find-if-not', 'find-method', 'find-package', 'find-restart',
|
60
|
+
'find-symbol', 'finish-output', 'first', 'float', 'float-digits',
|
61
|
+
'floatp', 'float-precision', 'float-radix', 'float-sign', 'floor',
|
62
|
+
'fmakunbound', 'force-output', 'format', 'fourth', 'fresh-line',
|
63
|
+
'fround', 'ftruncate', 'funcall', 'function-keywords',
|
64
|
+
'function-lambda-expression', 'functionp', 'gcd', 'gensym', 'gentemp',
|
65
|
+
'get', 'get-decoded-time', 'get-dispatch-macro-character', 'getf',
|
66
|
+
'gethash', 'get-internal-real-time', 'get-internal-run-time',
|
67
|
+
'get-macro-character', 'get-output-stream-string', 'get-properties',
|
68
|
+
'get-setf-expansion', 'get-universal-time', 'graphic-char-p',
|
69
|
+
'hash-table-count', 'hash-table-p', 'hash-table-rehash-size',
|
70
|
+
'hash-table-rehash-threshold', 'hash-table-size', 'hash-table-test',
|
71
|
+
'host-namestring', 'identity', 'imagpart', 'import',
|
72
|
+
'initialize-instance', 'input-stream-p', 'inspect',
|
73
|
+
'integer-decode-float', 'integer-length', 'integerp',
|
74
|
+
'interactive-stream-p', 'intern', 'intersection',
|
75
|
+
'invalid-method-error', 'invoke-debugger', 'invoke-restart',
|
76
|
+
'invoke-restart-interactively', 'isqrt', 'keywordp', 'last', 'lcm',
|
77
|
+
'ldb', 'ldb-test', 'ldiff', 'length', 'lisp-implementation-type',
|
78
|
+
'lisp-implementation-version', 'list', 'list*', 'list-all-packages',
|
79
|
+
'listen', 'list-length', 'listp', 'load',
|
80
|
+
'load-logical-pathname-translations', 'log', 'logand', 'logandc1',
|
81
|
+
'logandc2', 'logbitp', 'logcount', 'logeqv', 'logical-pathname',
|
82
|
+
'logical-pathname-translations', 'logior', 'lognand', 'lognor',
|
83
|
+
'lognot', 'logorc1', 'logorc2', 'logtest', 'logxor', 'long-site-name',
|
84
|
+
'lower-case-p', 'machine-instance', 'machine-type', 'machine-version',
|
85
|
+
'macroexpand', 'macroexpand-1', 'macro-function', 'make-array',
|
86
|
+
'make-broadcast-stream', 'make-concatenated-stream', 'make-condition',
|
87
|
+
'make-dispatch-macro-character', 'make-echo-stream', 'make-hash-table',
|
88
|
+
'make-instance', 'make-instances-obsolete', 'make-list',
|
89
|
+
'make-load-form', 'make-load-form-saving-slots', 'make-package',
|
90
|
+
'make-pathname', 'make-random-state', 'make-sequence', 'make-string',
|
91
|
+
'make-string-input-stream', 'make-string-output-stream', 'make-symbol',
|
92
|
+
'make-synonym-stream', 'make-two-way-stream', 'makunbound', 'map',
|
93
|
+
'mapc', 'mapcan', 'mapcar', 'mapcon', 'maphash', 'map-into', 'mapl',
|
94
|
+
'maplist', 'mask-field', 'max', 'member', 'member-if', 'member-if-not',
|
95
|
+
'merge', 'merge-pathnames', 'method-combination-error',
|
96
|
+
'method-qualifiers', 'min', 'minusp', 'mismatch', 'mod',
|
97
|
+
'muffle-warning', 'name-char', 'namestring', 'nbutlast', 'nconc',
|
98
|
+
'next-method-p', 'nintersection', 'ninth', 'no-applicable-method',
|
99
|
+
'no-next-method', 'not', 'notany', 'notevery', 'nreconc', 'nreverse',
|
100
|
+
'nset-difference', 'nset-exclusive-or', 'nstring-capitalize',
|
101
|
+
'nstring-downcase', 'nstring-upcase', 'nsublis', 'nsubst', 'nsubst-if',
|
102
|
+
'nsubst-if-not', 'nsubstitute', 'nsubstitute-if', 'nsubstitute-if-not',
|
103
|
+
'nth', 'nthcdr', 'null', 'numberp', 'numerator', 'nunion', 'oddp',
|
104
|
+
'open', 'open-stream-p', 'output-stream-p', 'package-error-package',
|
105
|
+
'package-name', 'package-nicknames', 'packagep',
|
106
|
+
'package-shadowing-symbols', 'package-used-by-list', 'package-use-list',
|
107
|
+
'pairlis', 'parse-integer', 'parse-namestring', 'pathname',
|
108
|
+
'pathname-device', 'pathname-directory', 'pathname-host',
|
109
|
+
'pathname-match-p', 'pathname-name', 'pathnamep', 'pathname-type',
|
110
|
+
'pathname-version', 'peek-char', 'phase', 'plusp', 'position',
|
111
|
+
'position-if', 'position-if-not', 'pprint', 'pprint-dispatch',
|
112
|
+
'pprint-fill', 'pprint-indent', 'pprint-linear', 'pprint-newline',
|
113
|
+
'pprint-tab', 'pprint-tabular', 'prin1', 'prin1-to-string', 'princ',
|
114
|
+
'princ-to-string', 'print', 'print-object', 'probe-file', 'proclaim',
|
115
|
+
'provide', 'random', 'random-state-p', 'rassoc', 'rassoc-if',
|
116
|
+
'rassoc-if-not', 'rational', 'rationalize', 'rationalp', 'read',
|
117
|
+
'read-byte', 'read-char', 'read-char-no-hang', 'read-delimited-list',
|
118
|
+
'read-from-string', 'read-line', 'read-preserving-whitespace',
|
119
|
+
'read-sequence', 'readtable-case', 'readtablep', 'realp', 'realpart',
|
120
|
+
'reduce', 'reinitialize-instance', 'rem', 'remhash', 'remove',
|
121
|
+
'remove-duplicates', 'remove-if', 'remove-if-not', 'remove-method',
|
122
|
+
'remprop', 'rename-file', 'rename-package', 'replace', 'require',
|
123
|
+
'rest', 'restart-name', 'revappend', 'reverse', 'room', 'round',
|
124
|
+
'row-major-aref', 'rplaca', 'rplacd', 'sbit', 'scale-float', 'schar',
|
125
|
+
'search', 'second', 'set', 'set-difference',
|
126
|
+
'set-dispatch-macro-character', 'set-exclusive-or',
|
127
|
+
'set-macro-character', 'set-pprint-dispatch', 'set-syntax-from-char',
|
128
|
+
'seventh', 'shadow', 'shadowing-import', 'shared-initialize',
|
129
|
+
'short-site-name', 'signal', 'signum', 'simple-bit-vector-p',
|
130
|
+
'simple-condition-format-arguments', 'simple-condition-format-control',
|
131
|
+
'simple-string-p', 'simple-vector-p', 'sin', 'sinh', 'sixth', 'sleep',
|
132
|
+
'slot-boundp', 'slot-exists-p', 'slot-makunbound', 'slot-missing',
|
133
|
+
'slot-unbound', 'slot-value', 'software-type', 'software-version',
|
134
|
+
'some', 'sort', 'special-operator-p', 'sqrt', 'stable-sort',
|
135
|
+
'standard-char-p', 'store-value', 'stream-element-type',
|
136
|
+
'stream-error-stream', 'stream-external-format', 'streamp', 'string',
|
137
|
+
'string<', 'string<=', 'string=', 'string>', 'string>=', 'string/=',
|
138
|
+
'string-capitalize', 'string-downcase', 'string-equal',
|
139
|
+
'string-greaterp', 'string-left-trim', 'string-lessp',
|
140
|
+
'string-not-equal', 'string-not-greaterp', 'string-not-lessp',
|
141
|
+
'stringp', 'string-right-trim', 'string-trim', 'string-upcase',
|
142
|
+
'sublis', 'subseq', 'subsetp', 'subst', 'subst-if', 'subst-if-not',
|
143
|
+
'substitute', 'substitute-if', 'substitute-if-not', 'subtypep','svref',
|
144
|
+
'sxhash', 'symbol-function', 'symbol-name', 'symbolp', 'symbol-package',
|
145
|
+
'symbol-plist', 'symbol-value', 'synonym-stream-symbol', 'syntax:',
|
146
|
+
'tailp', 'tan', 'tanh', 'tenth', 'terpri', 'third',
|
147
|
+
'translate-logical-pathname', 'translate-pathname', 'tree-equal',
|
148
|
+
'truename', 'truncate', 'two-way-stream-input-stream',
|
149
|
+
'two-way-stream-output-stream', 'type-error-datum',
|
150
|
+
'type-error-expected-type', 'type-of', 'typep', 'unbound-slot-instance',
|
151
|
+
'unexport', 'unintern', 'union', 'unread-char', 'unuse-package',
|
152
|
+
'update-instance-for-different-class',
|
153
|
+
'update-instance-for-redefined-class', 'upgraded-array-element-type',
|
154
|
+
'upgraded-complex-part-type', 'upper-case-p', 'use-package',
|
155
|
+
'user-homedir-pathname', 'use-value', 'values', 'values-list', 'vector',
|
156
|
+
'vectorp', 'vector-pop', 'vector-push', 'vector-push-extend', 'warn',
|
157
|
+
'wild-pathname-p', 'write', 'write-byte', 'write-char', 'write-line',
|
158
|
+
'write-sequence', 'write-string', 'write-to-string', 'yes-or-no-p',
|
159
|
+
'y-or-n-p', 'zerop',
|
160
|
+
]
|
161
|
+
|
162
|
+
SPECIAL_FORMS = [
|
163
|
+
'block', 'catch', 'declare', 'eval-when', 'flet', 'function', 'go', 'if',
|
164
|
+
'labels', 'lambda', 'let', 'let*', 'load-time-value', 'locally', 'macrolet',
|
165
|
+
'multiple-value-call', 'multiple-value-prog1', 'progn', 'progv', 'quote',
|
166
|
+
'return-from', 'setq', 'symbol-macrolet', 'tagbody', 'the', 'throw',
|
167
|
+
'unwind-protect',
|
168
|
+
]
|
169
|
+
|
170
|
+
MACROS = [
|
171
|
+
'and', 'assert', 'call-method', 'case', 'ccase', 'check-type', 'cond',
|
172
|
+
'ctypecase', 'decf', 'declaim', 'defclass', 'defconstant', 'defgeneric',
|
173
|
+
'define-compiler-macro', 'define-condition', 'define-method-combination',
|
174
|
+
'define-modify-macro', 'define-setf-expander', 'define-symbol-macro',
|
175
|
+
'defmacro', 'defmethod', 'defpackage', 'defparameter', 'defsetf',
|
176
|
+
'defstruct', 'deftype', 'defun', 'defvar', 'destructuring-bind', 'do',
|
177
|
+
'do*', 'do-all-symbols', 'do-external-symbols', 'dolist', 'do-symbols',
|
178
|
+
'dotimes', 'ecase', 'etypecase', 'formatter', 'handler-bind',
|
179
|
+
'handler-case', 'ignore-errors', 'incf', 'in-package', 'lambda', 'loop',
|
180
|
+
'loop-finish', 'make-method', 'multiple-value-bind', 'multiple-value-list',
|
181
|
+
'multiple-value-setq', 'nth-value', 'or', 'pop',
|
182
|
+
'pprint-exit-if-list-exhausted', 'pprint-logical-block', 'pprint-pop',
|
183
|
+
'print-unreadable-object', 'prog', 'prog*', 'prog1', 'prog2', 'psetf',
|
184
|
+
'psetq', 'push', 'pushnew', 'remf', 'restart-bind', 'restart-case',
|
185
|
+
'return', 'rotatef', 'setf', 'shiftf', 'step', 'time', 'trace', 'typecase',
|
186
|
+
'unless', 'untrace', 'when', 'with-accessors', 'with-compilation-unit',
|
187
|
+
'with-condition-restarts', 'with-hash-table-iterator',
|
188
|
+
'with-input-from-string', 'with-open-file', 'with-open-stream',
|
189
|
+
'with-output-to-string', 'with-package-iterator', 'with-simple-restart',
|
190
|
+
'with-slots', 'with-standard-io-syntax',
|
191
|
+
]
|
192
|
+
|
193
|
+
LAMBDA_LIST_KEYWORDS = [
|
194
|
+
'&allow-other-keys', '&aux', '&body', '&environment', '&key', '&optional',
|
195
|
+
'&rest', '&whole',
|
196
|
+
]
|
197
|
+
|
198
|
+
DECLARATIONS = [
|
199
|
+
'dynamic-extent', 'ignore', 'optimize', 'ftype', 'inline', 'special',
|
200
|
+
'ignorable', 'notinline', 'type',
|
201
|
+
]
|
202
|
+
|
203
|
+
BUILTIN_TYPES = [
|
204
|
+
'atom', 'boolean', 'base-char', 'base-string', 'bignum', 'bit',
|
205
|
+
'compiled-function', 'extended-char', 'fixnum', 'keyword', 'nil',
|
206
|
+
'signed-byte', 'short-float', 'single-float', 'double-float', 'long-float',
|
207
|
+
'simple-array', 'simple-base-string', 'simple-bit-vector', 'simple-string',
|
208
|
+
'simple-vector', 'standard-char', 'unsigned-byte',
|
209
|
+
|
210
|
+
# Condition Types
|
211
|
+
'arithmetic-error', 'cell-error', 'condition', 'control-error',
|
212
|
+
'division-by-zero', 'end-of-file', 'error', 'file-error',
|
213
|
+
'floating-point-inexact', 'floating-point-overflow',
|
214
|
+
'floating-point-underflow', 'floating-point-invalid-operation',
|
215
|
+
'parse-error', 'package-error', 'print-not-readable', 'program-error',
|
216
|
+
'reader-error', 'serious-condition', 'simple-condition', 'simple-error',
|
217
|
+
'simple-type-error', 'simple-warning', 'stream-error', 'storage-condition',
|
218
|
+
'style-warning', 'type-error', 'unbound-variable', 'unbound-slot',
|
219
|
+
'undefined-function', 'warning',
|
220
|
+
]
|
221
|
+
|
222
|
+
BUILTIN_CLASSES = [
|
223
|
+
'array', 'broadcast-stream', 'bit-vector', 'built-in-class', 'character',
|
224
|
+
'class', 'complex', 'concatenated-stream', 'cons', 'echo-stream',
|
225
|
+
'file-stream', 'float', 'function', 'generic-function', 'hash-table',
|
226
|
+
'integer', 'list', 'logical-pathname', 'method-combination', 'method',
|
227
|
+
'null', 'number', 'package', 'pathname', 'ratio', 'rational', 'readtable',
|
228
|
+
'real', 'random-state', 'restart', 'sequence', 'standard-class',
|
229
|
+
'standard-generic-function', 'standard-method', 'standard-object',
|
230
|
+
'string-stream', 'stream', 'string', 'structure-class', 'structure-object',
|
231
|
+
'symbol', 'synonym-stream', 't', 'two-way-stream', 'vector',
|
232
|
+
]
|
@@ -0,0 +1,256 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
"""
|
3
|
+
pygments.lexers._luabuiltins
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
5
|
+
|
6
|
+
This file contains the names and modules of lua functions
|
7
|
+
It is able to re-generate itself, but for adding new functions you
|
8
|
+
probably have to add some callbacks (see function module_callbacks).
|
9
|
+
|
10
|
+
Do not edit the MODULES dict by hand.
|
11
|
+
|
12
|
+
:copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS.
|
13
|
+
:license: BSD, see LICENSE for details.
|
14
|
+
"""
|
15
|
+
|
16
|
+
MODULES = {'basic': ['_G',
|
17
|
+
'_VERSION',
|
18
|
+
'assert',
|
19
|
+
'collectgarbage',
|
20
|
+
'dofile',
|
21
|
+
'error',
|
22
|
+
'getfenv',
|
23
|
+
'getmetatable',
|
24
|
+
'ipairs',
|
25
|
+
'load',
|
26
|
+
'loadfile',
|
27
|
+
'loadstring',
|
28
|
+
'next',
|
29
|
+
'pairs',
|
30
|
+
'pcall',
|
31
|
+
'print',
|
32
|
+
'rawequal',
|
33
|
+
'rawget',
|
34
|
+
'rawset',
|
35
|
+
'select',
|
36
|
+
'setfenv',
|
37
|
+
'setmetatable',
|
38
|
+
'tonumber',
|
39
|
+
'tostring',
|
40
|
+
'type',
|
41
|
+
'unpack',
|
42
|
+
'xpcall'],
|
43
|
+
'coroutine': ['coroutine.create',
|
44
|
+
'coroutine.resume',
|
45
|
+
'coroutine.running',
|
46
|
+
'coroutine.status',
|
47
|
+
'coroutine.wrap',
|
48
|
+
'coroutine.yield'],
|
49
|
+
'debug': ['debug.debug',
|
50
|
+
'debug.getfenv',
|
51
|
+
'debug.gethook',
|
52
|
+
'debug.getinfo',
|
53
|
+
'debug.getlocal',
|
54
|
+
'debug.getmetatable',
|
55
|
+
'debug.getregistry',
|
56
|
+
'debug.getupvalue',
|
57
|
+
'debug.setfenv',
|
58
|
+
'debug.sethook',
|
59
|
+
'debug.setlocal',
|
60
|
+
'debug.setmetatable',
|
61
|
+
'debug.setupvalue',
|
62
|
+
'debug.traceback'],
|
63
|
+
'io': ['file:close',
|
64
|
+
'file:flush',
|
65
|
+
'file:lines',
|
66
|
+
'file:read',
|
67
|
+
'file:seek',
|
68
|
+
'file:setvbuf',
|
69
|
+
'file:write',
|
70
|
+
'io.close',
|
71
|
+
'io.flush',
|
72
|
+
'io.input',
|
73
|
+
'io.lines',
|
74
|
+
'io.open',
|
75
|
+
'io.output',
|
76
|
+
'io.popen',
|
77
|
+
'io.read',
|
78
|
+
'io.tmpfile',
|
79
|
+
'io.type',
|
80
|
+
'io.write'],
|
81
|
+
'math': ['math.abs',
|
82
|
+
'math.acos',
|
83
|
+
'math.asin',
|
84
|
+
'math.atan2',
|
85
|
+
'math.atan',
|
86
|
+
'math.ceil',
|
87
|
+
'math.cosh',
|
88
|
+
'math.cos',
|
89
|
+
'math.deg',
|
90
|
+
'math.exp',
|
91
|
+
'math.floor',
|
92
|
+
'math.fmod',
|
93
|
+
'math.frexp',
|
94
|
+
'math.huge',
|
95
|
+
'math.ldexp',
|
96
|
+
'math.log10',
|
97
|
+
'math.log',
|
98
|
+
'math.max',
|
99
|
+
'math.min',
|
100
|
+
'math.modf',
|
101
|
+
'math.pi',
|
102
|
+
'math.pow',
|
103
|
+
'math.rad',
|
104
|
+
'math.random',
|
105
|
+
'math.randomseed',
|
106
|
+
'math.sinh',
|
107
|
+
'math.sin',
|
108
|
+
'math.sqrt',
|
109
|
+
'math.tanh',
|
110
|
+
'math.tan'],
|
111
|
+
'modules': ['module',
|
112
|
+
'require',
|
113
|
+
'package.cpath',
|
114
|
+
'package.loaded',
|
115
|
+
'package.loadlib',
|
116
|
+
'package.path',
|
117
|
+
'package.preload',
|
118
|
+
'package.seeall'],
|
119
|
+
'os': ['os.clock',
|
120
|
+
'os.date',
|
121
|
+
'os.difftime',
|
122
|
+
'os.execute',
|
123
|
+
'os.exit',
|
124
|
+
'os.getenv',
|
125
|
+
'os.remove',
|
126
|
+
'os.rename',
|
127
|
+
'os.setlocale',
|
128
|
+
'os.time',
|
129
|
+
'os.tmpname'],
|
130
|
+
'string': ['string.byte',
|
131
|
+
'string.char',
|
132
|
+
'string.dump',
|
133
|
+
'string.find',
|
134
|
+
'string.format',
|
135
|
+
'string.gmatch',
|
136
|
+
'string.gsub',
|
137
|
+
'string.len',
|
138
|
+
'string.lower',
|
139
|
+
'string.match',
|
140
|
+
'string.rep',
|
141
|
+
'string.reverse',
|
142
|
+
'string.sub',
|
143
|
+
'string.upper'],
|
144
|
+
'table': ['table.concat',
|
145
|
+
'table.insert',
|
146
|
+
'table.maxn',
|
147
|
+
'table.remove',
|
148
|
+
'table.sort']}
|
149
|
+
|
150
|
+
if __name__ == '__main__':
|
151
|
+
import re
|
152
|
+
import urllib
|
153
|
+
import pprint
|
154
|
+
|
155
|
+
# you can't generally find out what module a function belongs to if you
|
156
|
+
# have only its name. Because of this, here are some callback functions
|
157
|
+
# that recognize if a gioven function belongs to a specific module
|
158
|
+
def module_callbacks():
|
159
|
+
def is_in_coroutine_module(name):
|
160
|
+
return name.startswith('coroutine.')
|
161
|
+
|
162
|
+
def is_in_modules_module(name):
|
163
|
+
if name in ['require', 'module'] or name.startswith('package'):
|
164
|
+
return True
|
165
|
+
else:
|
166
|
+
return False
|
167
|
+
|
168
|
+
def is_in_string_module(name):
|
169
|
+
return name.startswith('string.')
|
170
|
+
|
171
|
+
def is_in_table_module(name):
|
172
|
+
return name.startswith('table.')
|
173
|
+
|
174
|
+
def is_in_math_module(name):
|
175
|
+
return name.startswith('math')
|
176
|
+
|
177
|
+
def is_in_io_module(name):
|
178
|
+
return name.startswith('io.') or name.startswith('file:')
|
179
|
+
|
180
|
+
def is_in_os_module(name):
|
181
|
+
return name.startswith('os.')
|
182
|
+
|
183
|
+
def is_in_debug_module(name):
|
184
|
+
return name.startswith('debug.')
|
185
|
+
|
186
|
+
return {'coroutine': is_in_coroutine_module,
|
187
|
+
'modules': is_in_modules_module,
|
188
|
+
'string': is_in_string_module,
|
189
|
+
'table': is_in_table_module,
|
190
|
+
'math': is_in_math_module,
|
191
|
+
'io': is_in_io_module,
|
192
|
+
'os': is_in_os_module,
|
193
|
+
'debug': is_in_debug_module}
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
def get_newest_version():
|
198
|
+
f = urllib.urlopen('http://www.lua.org/manual/')
|
199
|
+
r = re.compile(r'^<A HREF="(\d\.\d)/">Lua \1</A>')
|
200
|
+
for line in f:
|
201
|
+
m = r.match(line)
|
202
|
+
if m is not None:
|
203
|
+
return m.groups()[0]
|
204
|
+
|
205
|
+
def get_lua_functions(version):
|
206
|
+
f = urllib.urlopen('http://www.lua.org/manual/%s/' % version)
|
207
|
+
r = re.compile(r'^<A HREF="manual.html#pdf-(.+)">\1</A>')
|
208
|
+
functions = []
|
209
|
+
for line in f:
|
210
|
+
m = r.match(line)
|
211
|
+
if m is not None:
|
212
|
+
functions.append(m.groups()[0])
|
213
|
+
return functions
|
214
|
+
|
215
|
+
def get_function_module(name):
|
216
|
+
for mod, cb in module_callbacks().iteritems():
|
217
|
+
if cb(name):
|
218
|
+
return mod
|
219
|
+
if '.' in name:
|
220
|
+
return name.split('.')[0]
|
221
|
+
else:
|
222
|
+
return 'basic'
|
223
|
+
|
224
|
+
def regenerate(filename, modules):
|
225
|
+
f = open(filename)
|
226
|
+
try:
|
227
|
+
content = f.read()
|
228
|
+
finally:
|
229
|
+
f.close()
|
230
|
+
|
231
|
+
header = content[:content.find('MODULES = {')]
|
232
|
+
footer = content[content.find("if __name__ == '__main__':"):]
|
233
|
+
|
234
|
+
|
235
|
+
f = open(filename, 'w')
|
236
|
+
f.write(header)
|
237
|
+
f.write('MODULES = %s\n\n' % pprint.pformat(modules))
|
238
|
+
f.write(footer)
|
239
|
+
f.close()
|
240
|
+
|
241
|
+
def run():
|
242
|
+
version = get_newest_version()
|
243
|
+
print '> Downloading function index for Lua %s' % version
|
244
|
+
functions = get_lua_functions(version)
|
245
|
+
print '> %d functions found:' % len(functions)
|
246
|
+
|
247
|
+
modules = {}
|
248
|
+
for full_function_name in functions:
|
249
|
+
print '>> %s' % full_function_name
|
250
|
+
m = get_function_module(full_function_name)
|
251
|
+
modules.setdefault(m, []).append(full_function_name)
|
252
|
+
|
253
|
+
regenerate(__file__, modules)
|
254
|
+
|
255
|
+
|
256
|
+
run()
|