Mercurial > moin > 1.9
changeset 4377:00b1307bd9c2
Adding Pygments to MoinMoin/support
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/__init__.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +""" + Pygments + ~~~~~~~~ + + Pygments is a syntax highlighting package written in Python. + + It is a generic syntax highlighter for general use in all kinds of software + such as forum systems, wikis or other applications that need to prettify + source code. Highlights are: + + * a wide range of common languages and markup formats is supported + * special attention is paid to details, increasing quality by a fair amount + * support for new languages and formats are added easily + * a number of output formats, presently HTML, LaTeX, RTF, SVG and ANSI sequences + * it is usable as a command-line tool and as a library + * ... and it highlights even Brainfuck! + + The `Pygments tip`_ is installable with ``easy_install Pygments==dev``. + + .. _Pygments tip: http://dev.pocoo.org/hg/pygments-main/archive/tip.tar.gz#egg=Pygments-dev + + :copyright: 2006-2007 by Georg Brandl, Armin Ronacher and others. + :license: BSD, see LICENSE for more details. +""" + +__version__ = '0.11.1' +__author__ = 'Georg Brandl <g.brandl@gmx.net>' +__url__ = 'http://pygments.org/' +__license__ = 'BSD License' +__docformat__ = 'restructuredtext' + +__all__ = ['lex', 'format', 'highlight'] + + +import sys, os +from StringIO import StringIO +from cStringIO import StringIO as CStringIO + + +def lex(code, lexer): + """ + Lex ``code`` with ``lexer`` and return an iterable of tokens. + """ + try: + return lexer.get_tokens(code) + except TypeError, err: + if isinstance(err.args[0], str) and \ + 'unbound method get_tokens' in err.args[0]: + raise TypeError('lex() argument must be a lexer instance, ' + 'not a class') + raise + + +def format(tokens, formatter, outfile=None): + """ + Format a tokenlist ``tokens`` with the formatter ``formatter``. + + If ``outfile`` is given and a valid file object (an object + with a ``write`` method), the result will be written to it, otherwise + it is returned as a string. + """ + try: + if not outfile: + # if we want Unicode output, we have to use Python StringIO + realoutfile = formatter.encoding and CStringIO() or StringIO() + formatter.format(tokens, realoutfile) + return realoutfile.getvalue() + else: + formatter.format(tokens, outfile) + except TypeError, err: + if isinstance(err.args[0], str) and \ + 'unbound method format' in err.args[0]: + raise TypeError('format() argument must be a formatter instance, ' + 'not a class') + raise + + +def highlight(code, lexer, formatter, outfile=None): + """ + Lex ``code`` with ``lexer`` and format it with the formatter + ``formatter``. If ``filters`` are given they will be applied + on the token stream. + + If ``outfile`` is given and a valid file object (an object + with a ``write`` method), the result will be written to it, otherwise + it is returned as a string. + """ + return format(lex(code, lexer), formatter, outfile) + + +if __name__ == '__main__': + from pygments.cmdline import main + sys.exit(main(sys.argv))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/cmdline.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,404 @@ +# -*- coding: utf-8 -*- +""" + pygments.cmdline + ~~~~~~~~~~~~~~~~ + + Command line interface. + + :copyright: 2006-2008 by Georg Brandl. + :license: BSD, see LICENSE for more details. +""" +import sys +import getopt +from textwrap import dedent + +from pygments import __version__, __author__, highlight +from pygments.util import ClassNotFound, OptionError, docstring_headline +from pygments.lexers import get_all_lexers, get_lexer_by_name, get_lexer_for_filename, \ + find_lexer_class, guess_lexer, TextLexer +from pygments.formatters import get_all_formatters, get_formatter_by_name, \ + get_formatter_for_filename, find_formatter_class, \ + TerminalFormatter # pylint:disable-msg=E0611 +from pygments.filters import get_all_filters, find_filter_class +from pygments.styles import get_all_styles, get_style_by_name + + +USAGE = """\ +Usage: %s [-l <lexer> | -g] [-F <filter>[:<options>]] [-f <formatter>] + [-O <options>] [-P <option=value>] [-o <outfile>] [<infile>] + + %s -S <style> -f <formatter> [-a <arg>] [-O <options>] [-P <option=value>] + %s -L [<which> ...] + %s -H <type> <name> + %s -h | -V + +Highlight the input file and write the result to <outfile>. + +If no input file is given, use stdin, if -o is not given, use stdout. + +<lexer> is a lexer name (query all lexer names with -L). If -l is not +given, the lexer is guessed from the extension of the input file name +(this obviously doesn't work if the input is stdin). If -g is passed, +attempt to guess the lexer from the file contents, or pass through as +plain text if this fails (this can work for stdin). + +Likewise, <formatter> is a formatter name, and will be guessed from +the extension of the output file name. If no output file is given, +the terminal formatter will be used by default. + +With the -O option, you can give the lexer and formatter a comma- +separated list of options, e.g. ``-O bg=light,python=cool``. + +The -P option adds lexer and formatter options like the -O option, but +you can only give one option per -P. That way, the option value may +contain commas and equals signs, which it can't with -O, e.g. +``-P "heading=Pygments, the Python highlighter". + +With the -F option, you can add filters to the token stream, you can +give options in the same way as for -O after a colon (note: there must +not be spaces around the colon). + +The -O, -P and -F options can be given multiple times. + +With the -S option, print out style definitions for style <style> +for formatter <formatter>. The argument given by -a is formatter +dependent. + +The -L option lists lexers, formatters, styles or filters -- set +`which` to the thing you want to list (e.g. "styles"), or omit it to +list everything. + +The -H option prints detailed help for the object <name> of type <type>, +where <type> is one of "lexer", "formatter" or "filter". + +The -h option prints this help. +The -V option prints the package version. +""" + + +def _parse_options(o_strs): + opts = {} + if not o_strs: + return opts + for o_str in o_strs: + if not o_str: + continue + o_args = o_str.split(',') + for o_arg in o_args: + o_arg = o_arg.strip() + try: + o_key, o_val = o_arg.split('=') + o_key = o_key.strip() + o_val = o_val.strip() + except ValueError: + opts[o_arg] = True + else: + opts[o_key] = o_val + return opts + + +def _parse_filters(f_strs): + filters = [] + if not f_strs: + return filters + for f_str in f_strs: + if ':' in f_str: + fname, fopts = f_str.split(':', 1) + filters.append((fname, _parse_options([fopts]))) + else: + filters.append((f_str, {})) + return filters + + +def _print_help(what, name): + try: + if what == 'lexer': + cls = find_lexer_class(name) + print "Help on the %s lexer:" % cls.name + print dedent(cls.__doc__) + elif what == 'formatter': + cls = find_formatter_class(name) + print "Help on the %s formatter:" % cls.name + print dedent(cls.__doc__) + elif what == 'filter': + cls = find_filter_class(name) + print "Help on the %s filter:" % name + print dedent(cls.__doc__) + except AttributeError: + print >>sys.stderr, "%s not found!" % what + + +def _print_list(what): + if what == 'lexer': + print + print "Lexers:" + print "~~~~~~~" + + info = [] + for fullname, names, exts, _ in get_all_lexers(): + tup = (', '.join(names)+':', fullname, + exts and '(filenames ' + ', '.join(exts) + ')' or '') + info.append(tup) + info.sort() + for i in info: + print ('* %s\n %s %s') % i + + elif what == 'formatter': + print + print "Formatters:" + print "~~~~~~~~~~~" + + info = [] + for cls in get_all_formatters(): + doc = docstring_headline(cls) + tup = (', '.join(cls.aliases) + ':', doc, cls.filenames and + '(filenames ' + ', '.join(cls.filenames) + ')' or '') + info.append(tup) + info.sort() + for i in info: + print ('* %s\n %s %s') % i + + elif what == 'filter': + print + print "Filters:" + print "~~~~~~~~" + + for name in get_all_filters(): + cls = find_filter_class(name) + print "* " + name + ':' + print " %s" % docstring_headline(cls) + + elif what == 'style': + print + print "Styles:" + print "~~~~~~~" + + for name in get_all_styles(): + cls = get_style_by_name(name) + print "* " + name + ':' + print " %s" % docstring_headline(cls) + + +def main(args=sys.argv): + """ + Main command line entry point. + """ + # pylint: disable-msg=R0911,R0912,R0915 + + usage = USAGE % ((args[0],) * 5) + + try: + popts, args = getopt.getopt(args[1:], "l:f:F:o:O:P:LS:a:hVHg") + except getopt.GetoptError, err: + print >>sys.stderr, usage + return 2 + opts = {} + O_opts = [] + P_opts = [] + F_opts = [] + for opt, arg in popts: + if opt == '-O': + O_opts.append(arg) + elif opt == '-P': + P_opts.append(arg) + elif opt == '-F': + F_opts.append(arg) + opts[opt] = arg + + if not opts and not args: + print usage + return 0 + + if opts.pop('-h', None) is not None: + print usage + return 0 + + if opts.pop('-V', None) is not None: + print 'Pygments version %s, (c) 2006-2008 by %s.' % (__version__, __author__) + return 0 + + # handle ``pygmentize -L`` + L_opt = opts.pop('-L', None) + if L_opt is not None: + if opts: + print >>sys.stderr, usage + return 2 + + # print version + main(['', '-V']) + if not args: + args = ['lexer', 'formatter', 'filter', 'style'] + for arg in args: + _print_list(arg.rstrip('s')) + return 0 + + # handle ``pygmentize -H`` + H_opt = opts.pop('-H', None) + if H_opt is not None: + if opts or len(args) != 2: + print >>sys.stderr, usage + return 2 + + what, name = args + if what not in ('lexer', 'formatter', 'filter'): + print >>sys.stderr, usage + return 2 + + _print_help(what, name) + return 0 + + # parse -O options + parsed_opts = _parse_options(O_opts) + opts.pop('-O', None) + + # parse -P options + for p_opt in P_opts: + try: + name, value = p_opt.split('=', 1) + except ValueError: + parsed_opts[p_opt] = True + else: + parsed_opts[name] = value + opts.pop('-P', None) + + # handle ``pygmentize -S`` + S_opt = opts.pop('-S', None) + a_opt = opts.pop('-a', None) + if S_opt is not None: + f_opt = opts.pop('-f', None) + if not f_opt: + print >>sys.stderr, usage + return 2 + if opts or args: + print >>sys.stderr, usage + return 2 + + try: + parsed_opts['style'] = S_opt + fmter = get_formatter_by_name(f_opt, **parsed_opts) + except ClassNotFound, err: + print >>sys.stderr, err + return 1 + + arg = a_opt or '' + print fmter.get_style_defs(arg) + return 0 + + # if no -S is given, -a is not allowed + if a_opt is not None: + print >>sys.stderr, usage + return 2 + + # parse -F options + F_opts = _parse_filters(F_opts) + opts.pop('-F', None) + + # select formatter + outfn = opts.pop('-o', None) + fmter = opts.pop('-f', None) + if fmter: + try: + fmter = get_formatter_by_name(fmter, **parsed_opts) + except (OptionError, ClassNotFound), err: + print >>sys.stderr, 'Error:', err + return 1 + + if outfn: + if not fmter: + try: + fmter = get_formatter_for_filename(outfn, **parsed_opts) + except (OptionError, ClassNotFound), err: + print >>sys.stderr, 'Error:', err + return 1 + try: + outfile = file(outfn, 'wb') + except Exception, err: + print >>sys.stderr, 'Error: cannot open outfile:', err + return 1 + else: + if not fmter: + fmter = TerminalFormatter(**parsed_opts) + outfile = sys.stdout + + # select lexer + lexer = opts.pop('-l', None) + if lexer: + try: + lexer = get_lexer_by_name(lexer, **parsed_opts) + except (OptionError, ClassNotFound), err: + print >>sys.stderr, 'Error:', err + return 1 + + if args: + if len(args) > 1: + print >>sys.stderr, usage + return 2 + + infn = args[0] + try: + code = file(infn).read() + except Exception, err: + print >>sys.stderr, 'Error: cannot read infile:', err + return 1 + + if not lexer: + try: + lexer = get_lexer_for_filename(infn, **parsed_opts) + except ClassNotFound, err: + if '-g' in opts: + try: + lexer = guess_lexer(code) + except ClassNotFound: + lexer = TextLexer() + else: + print >>sys.stderr, 'Error:', err + return 1 + except OptionError, err: + print >>sys.stderr, 'Error:', err + return 1 + + else: + if '-g' in opts: + code = sys.stdin.read() + try: + lexer = guess_lexer(code) + except ClassNotFound: + lexer = TextLexer() + elif not lexer: + print >>sys.stderr, 'Error: no lexer name given and reading ' + \ + 'from stdin (try using -g or -l <lexer>)' + return 2 + else: + code = sys.stdin.read() + + # No encoding given? Use latin1 if output file given, + # stdin/stdout encoding otherwise. + # (This is a compromise, I'm not too happy with it...) + if 'encoding' not in parsed_opts and 'outencoding' not in parsed_opts: + if outfn: + # encoding pass-through + fmter.encoding = 'latin1' + else: + # use terminal encoding + lexer.encoding = getattr(sys.stdin, 'encoding', None) or 'ascii' + fmter.encoding = getattr(sys.stdout, 'encoding', None) or 'ascii' + + # ... and do it! + try: + # process filters + for fname, fopts in F_opts: + lexer.add_filter(fname, **fopts) + highlight(code, lexer, fmter, outfile) + except Exception, err: + import traceback + info = traceback.format_exception(*sys.exc_info()) + msg = info[-1].strip() + if len(info) >= 3: + # extract relevant file and position info + msg += '\n (f%s)' % info[-2].split('\n')[0].strip()[1:] + print >>sys.stderr + print >>sys.stderr, '*** Error while highlighting:' + print >>sys.stderr, msg + return 1 + + return 0
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/console.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +""" + pygments.console + ~~~~~~~~~~~~~~~~ + + Format colored console output. + + :copyright: 2006-2007 by Georg Brandl, Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" + +esc = "\x1b[" + +codes = {} +codes[""] = "" +codes["reset"] = esc + "39;49;00m" + +codes["bold"] = esc + "01m" +codes["faint"] = esc + "02m" +codes["standout"] = esc + "03m" +codes["underline"] = esc + "04m" +codes["blink"] = esc + "05m" +codes["overline"] = esc + "06m" + +dark_colors = ["black", "darkred", "darkgreen", "brown", "darkblue", + "purple", "teal", "lightgray"] +light_colors = ["darkgray", "red", "green", "yellow", "blue", + "fuchsia", "turquoise", "white"] + +x = 30 +for d, l in zip(dark_colors, light_colors): + codes[d] = esc + "%im" % x + codes[l] = esc + "%i;01m" % x + x += 1 + +del d, l, x + +codes["darkteal"] = codes["turquoise"] +codes["darkyellow"] = codes["brown"] +codes["fuscia"] = codes["fuchsia"] +codes["white"] = codes["bold"] + + +def reset_color(): + return codes["reset"] + + +def colorize(color_key, text): + return codes[color_key] + text + codes["reset"] + + +def ansiformat(attr, text): + """ + Format ``text`` with a color and/or some attributes:: + + color normal color + *color* bold color + _color_ underlined color + +color+ blinking color + """ + result = [] + if attr[:1] == attr[-1:] == '+': + result.append(codes['blink']) + attr = attr[1:-1] + if attr[:1] == attr[-1:] == '*': + result.append(codes['bold']) + attr = attr[1:-1] + if attr[:1] == attr[-1:] == '_': + result.append(codes['underline']) + attr = attr[1:-1] + result.append(codes[attr]) + result.append(text) + result.append(codes['reset']) + return ''.join(result)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/filter.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- +""" + pygments.filter + ~~~~~~~~~~~~~~~ + + Module that implements the default filter. + + :copyright: 2006-2007 by Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" + + +def apply_filters(stream, filters, lexer=None): + """ + Use this method to apply an iterable of filters to + a stream. If lexer is given it's forwarded to the + filter, otherwise the filter receives `None`. + """ + def _apply(filter_, stream): + for token in filter_.filter(lexer, stream): + yield token + for filter_ in filters: + stream = _apply(filter_, stream) + return stream + + +def simplefilter(f): + """ + Decorator that converts a function into a filter:: + + @simplefilter + def lowercase(lexer, stream, options): + for ttype, value in stream: + yield ttype, value.lower() + """ + return type(f.__name__, (FunctionFilter,), { + 'function': f, + '__module__': getattr(f, '__module__'), + '__doc__': f.__doc__ + }) + + +class Filter(object): + """ + Default filter. Subclass this class or use the `simplefilter` + decorator to create own filters. + """ + + def __init__(self, **options): + self.options = options + + def filter(self, lexer, stream): + raise NotImplementedError() + + +class FunctionFilter(Filter): + """ + Abstract class used by `simplefilter` to create simple + function filters on the fly. The `simplefilter` decorator + automatically creates subclasses of this class for + functions passed to it. + """ + function = None + + def __init__(self, **options): + if not hasattr(self, 'function'): + raise TypeError('%r used without bound function' % + self.__class__.__name__) + Filter.__init__(self, **options) + + def filter(self, lexer, stream): + # pylint: disable-msg=E1102 + for ttype, value in self.function(lexer, stream, self.options): + yield ttype, value
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/filters/__init__.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,292 @@ +# -*- coding: utf-8 -*- +""" + pygments.filters + ~~~~~~~~~~~~~~~~ + + Module containing filter lookup functions and default + filters. + + :copyright: 2006-2007 by Armin Ronacher, Georg Brandl. + :license: BSD, see LICENSE for more details. +""" +try: + set +except NameError: + from sets import Set as set + +import re +from pygments.token import String, Comment, Keyword, Name, Error, Whitespace, \ + string_to_tokentype +from pygments.filter import Filter +from pygments.util import get_list_opt, get_int_opt, get_bool_opt, get_choice_opt, \ + ClassNotFound, OptionError +from pygments.plugin import find_plugin_filters + + +def find_filter_class(filtername): + """ + Lookup a filter by name. Return None if not found. + """ + if filtername in FILTERS: + return FILTERS[filtername] + for name, cls in find_plugin_filters(): + if name == filtername: + return cls + return None + + +def get_filter_by_name(filtername, **options): + """ + Return an instantiated filter. Options are passed to the filter + initializer if wanted. Raise a ClassNotFound if not found. + """ + cls = find_filter_class(filtername) + if cls: + return cls(**options) + else: + raise ClassNotFound('filter %r not found' % filtername) + + +def get_all_filters(): + """ + Return a generator of all filter names. + """ + for name in FILTERS: + yield name + for name, _ in find_plugin_filters(): + yield name + + +def _replace_special(ttype, value, regex, specialttype, + replacefunc=lambda x: x): + last = 0 + for match in regex.finditer(value): + start, end = match.start(), match.end() + if start != last: + yield ttype, value[last:start] + yield specialttype, replacefunc(value[start:end]) + last = end + if last != len(value): + yield ttype, value[last:] + + +class CodeTagFilter(Filter): + """ + Highlight special code tags in comments and docstrings. + + Options accepted: + + `codetags` : list of strings + A list of strings that are flagged as code tags. The default is to + highlight ``XXX``, ``TODO``, ``BUG`` and ``NOTE``. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + tags = get_list_opt(options, 'codetags', + ['XXX', 'TODO', 'BUG', 'NOTE']) + self.tag_re = re.compile(r'(%s)' % '|'.join([ + re.escape(tag) for tag in tags if tag + ])) + + def filter(self, lexer, stream): + regex = self.tag_re + for ttype, value in stream: + if ttype in String.Doc or \ + ttype in Comment and \ + ttype not in Comment.Preproc: + for sttype, svalue in _replace_special(ttype, value, regex, + Comment.Special): + yield sttype, svalue + else: + yield ttype, value + + +class KeywordCaseFilter(Filter): + """ + Convert keywords to lowercase or uppercase or capitalize them, which + means first letter uppercase, rest lowercase. + + This can be useful e.g. if you highlight Pascal code and want to adapt the + code to your styleguide. + + Options accepted: + + `case` : string + The casing to convert keywords to. Must be one of ``'lower'``, + ``'upper'`` or ``'capitalize'``. The default is ``'lower'``. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + case = get_choice_opt(options, 'case', ['lower', 'upper', 'capitalize'], 'lower') + self.convert = getattr(unicode, case) + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype in Keyword: + yield ttype, self.convert(value) + else: + yield ttype, value + + +class NameHighlightFilter(Filter): + """ + Highlight a normal Name token with a different token type. + + Example:: + + filter = NameHighlightFilter( + names=['foo', 'bar', 'baz'], + tokentype=Name.Function, + ) + + This would highlight the names "foo", "bar" and "baz" + as functions. `Name.Function` is the default token type. + + Options accepted: + + `names` : list of strings + A list of names that should be given the different token type. + There is no default. + `tokentype` : TokenType or string + A token type or a string containing a token type name that is + used for highlighting the strings in `names`. The default is + `Name.Function`. + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + self.names = set(get_list_opt(options, 'names', [])) + tokentype = options.get('tokentype') + if tokentype: + self.tokentype = string_to_tokentype(tokentype) + else: + self.tokentype = Name.Function + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype is Name and value in self.names: + yield self.tokentype, value + else: + yield ttype, value + + +class ErrorToken(Exception): + pass + +class RaiseOnErrorTokenFilter(Filter): + """ + Raise an exception when the lexer generates an error token. + + Options accepted: + + `excclass` : Exception class + The exception class to raise. + The default is `pygments.filters.ErrorToken`. + + *New in Pygments 0.8.* + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + self.exception = options.get('excclass', ErrorToken) + try: + # issubclass() will raise TypeError if first argument is not a class + if not issubclass(self.exception, Exception): + raise TypeError + except TypeError: + raise OptionError('excclass option is not an exception class') + + def filter(self, lexer, stream): + for ttype, value in stream: + if ttype is Error: + raise self.exception(value) + yield ttype, value + + +class VisibleWhitespaceFilter(Filter): + """ + Convert tabs, newlines and/or spaces to visible characters. + + Options accepted: + + `spaces` : string or bool + If this is a one-character string, spaces will be replaces by this string. + If it is another true value, spaces will be replaced by ``·`` (unicode + MIDDLE DOT). If it is a false value, spaces will not be replaced. The + default is ``False``. + `tabs` : string or bool + The same as for `spaces`, but the default replacement character is ``»`` + (unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK). The default value + is ``False``. Note: this will not work if the `tabsize` option for the + lexer is nonzero, as tabs will already have been expanded then. + `tabsize` : int + If tabs are to be replaced by this filter (see the `tabs` option), this + is the total number of characters that a tab should be expanded to. + The default is ``8``. + `newlines` : string or bool + The same as for `spaces`, but the default replacement character is ``¶`` + (unicode PILCROW SIGN). The default value is ``False``. + `wstokentype` : bool + If true, give whitespace the special `Whitespace` token type. This allows + styling the visible whitespace differently (e.g. greyed out), but it can + disrupt background colors. The default is ``True``. + + *New in Pygments 0.8.* + """ + + def __init__(self, **options): + Filter.__init__(self, **options) + for name, default in {'spaces': u'·', 'tabs': u'»', 'newlines': u'¶'}.items(): + opt = options.get(name, False) + if isinstance(opt, basestring) and len(opt) == 1: + setattr(self, name, opt) + else: + setattr(self, name, (opt and default or '')) + tabsize = get_int_opt(options, 'tabsize', 8) + if self.tabs: + self.tabs += ' '*(tabsize-1) + if self.newlines: + self.newlines += '\n' + self.wstt = get_bool_opt(options, 'wstokentype', True) + + def filter(self, lexer, stream): + if self.wstt: + spaces = self.spaces or ' ' + tabs = self.tabs or '\t' + newlines = self.newlines or '\n' + regex = re.compile(r'\s') + def replacefunc(wschar): + if wschar == ' ': + return spaces + elif wschar == '\t': + return tabs + elif wschar == '\n': + return newlines + return wschar + + for ttype, value in stream: + for sttype, svalue in _replace_special(ttype, value, regex, + Whitespace, replacefunc): + yield sttype, svalue + else: + spaces, tabs, newlines = self.spaces, self.tabs, self.newlines + # simpler processing + for ttype, value in stream: + if spaces: + value = value.replace(' ', spaces) + if tabs: + value = value.replace('\t', tabs) + if newlines: + value = value.replace('\n', newlines) + yield ttype, value + + +FILTERS = { + 'codetagify': CodeTagFilter, + 'keywordcase': KeywordCaseFilter, + 'highlight': NameHighlightFilter, + 'raiseonerror': RaiseOnErrorTokenFilter, + 'whitespace': VisibleWhitespaceFilter, +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatter.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,87 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatter + ~~~~~~~~~~~~~~~~~~ + + Base formatter class. + + :copyright: 2006-2007 by Georg Brandl, Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" + +from pygments.util import get_bool_opt +from pygments.styles import get_style_by_name + +__all__ = ['Formatter'] + + +def _lookup_style(style): + if isinstance(style, basestring): + return get_style_by_name(style) + return style + + +class Formatter(object): + """ + Converts a token stream to text. + + Options accepted: + + ``style`` + The style to use, can be a string or a Style subclass + (default: "default"). Not used by e.g. the + TerminalFormatter. + ``full`` + Tells the formatter to output a "full" document, i.e. + a complete self-contained document. This doesn't have + any effect for some formatters (default: false). + ``title`` + If ``full`` is true, the title that should be used to + caption the document (default: ''). + ``encoding`` + If given, must be an encoding name. This will be used to + convert the Unicode token strings to byte strings in the + output. If it is "" or None, Unicode strings will be written + to the output file, which most file-like objects do not + support (default: None). + ``outencoding`` + Overrides ``encoding`` if given. + """ + + #: Name of the formatter + name = None + + #: Shortcuts for the formatter + aliases = [] + + #: fn match rules + filenames = [] + + #: If True, this formatter outputs Unicode strings when no encoding + #: option is given. + unicodeoutput = True + + def __init__(self, **options): + self.style = _lookup_style(options.get('style', 'default')) + self.full = get_bool_opt(options, 'full', False) + self.title = options.get('title', '') + self.encoding = options.get('encoding', None) or None + self.encoding = options.get('outencoding', None) or self.encoding + self.options = options + + def get_style_defs(self, arg=''): + """ + Return the style definitions for the current style as a string. + + ``arg`` is an additional argument whose meaning depends on the + formatter used. Note that ``arg`` can also be a list or tuple + for some formatters like the html formatter. + """ + return '' + + def format(self, tokensource, outfile): + """ + Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` + tuples and write it into ``outfile``. + """ + raise NotImplementedError()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/__init__.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,68 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters + ~~~~~~~~~~~~~~~~~~~ + + Pygments formatters. + + :copyright: 2006-2007 by Georg Brandl, Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" +import os.path +import fnmatch + +from pygments.formatters._mapping import FORMATTERS +from pygments.plugin import find_plugin_formatters +from pygments.util import docstring_headline, ClassNotFound + +ns = globals() +for fcls in FORMATTERS: + ns[fcls.__name__] = fcls +del fcls + +__all__ = ['get_formatter_by_name', 'get_formatter_for_filename', + 'get_all_formatters'] + [cls.__name__ for cls in FORMATTERS] + + +_formatter_alias_cache = {} +_formatter_filename_cache = [] + +def _init_formatter_cache(): + if _formatter_alias_cache: + return + for cls in get_all_formatters(): + for alias in cls.aliases: + _formatter_alias_cache[alias] = cls + for fn in cls.filenames: + _formatter_filename_cache.append((fn, cls)) + + +def find_formatter_class(name): + _init_formatter_cache() + cls = _formatter_alias_cache.get(name, None) + return cls + + +def get_formatter_by_name(name, **options): + _init_formatter_cache() + cls = _formatter_alias_cache.get(name, None) + if not cls: + raise ClassNotFound("No formatter found for name %r" % name) + return cls(**options) + + +def get_formatter_for_filename(fn, **options): + _init_formatter_cache() + fn = os.path.basename(fn) + for pattern, cls in _formatter_filename_cache: + if fnmatch.fnmatch(fn, pattern): + return cls(**options) + raise ClassNotFound("No formatter found for file name %r" % fn) + + +def get_all_formatters(): + """Return a generator for all formatters.""" + for formatter in FORMATTERS: + yield formatter + for _, formatter in find_plugin_formatters(): + yield formatter
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/_mapping.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters._mapping + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter mapping defintions. This file is generated by itself. Everytime + you change something on a builtin formatter defintion, run this script from + the formatters folder to update it. + + Do not alter the FORMATTERS dictionary by hand. + + :copyright: 2006-2007 by Armin Ronacher, Georg Brandl. + :license: BSD, see LICENSE for more details. +""" + +from pygments.util import docstring_headline + +# start +from pygments.formatters.bbcode import BBCodeFormatter +from pygments.formatters.html import HtmlFormatter +from pygments.formatters.img import ImageFormatter +from pygments.formatters.latex import LatexFormatter +from pygments.formatters.other import NullFormatter +from pygments.formatters.other import RawTokenFormatter +from pygments.formatters.rtf import RtfFormatter +from pygments.formatters.svg import SvgFormatter +from pygments.formatters.terminal import TerminalFormatter +from pygments.formatters.terminal256 import Terminal256Formatter + +FORMATTERS = { + BBCodeFormatter: ('BBCode', ('bbcode', 'bb'), (), 'Format tokens with BBcodes. These formatting codes are used by many bulletin boards, so you can highlight your sourcecode with pygments before posting it there.'), + HtmlFormatter: ('HTML', ('html',), ('*.html', '*.htm'), "Format tokens as HTML 4 ``<span>`` tags within a ``<pre>`` tag, wrapped in a ``<div>`` tag. The ``<div>``'s CSS class can be set by the `cssclass` option."), + ImageFormatter: ('img', ('img', 'IMG', 'png', 'jpg', 'gif', 'bmp'), ('*.png', '*.jpg', '*.gif', '*.bmp'), 'Create an image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'), + LatexFormatter: ('LaTeX', ('latex', 'tex'), ('*.tex',), 'Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.'), + NullFormatter: ('Text only', ('text', 'null'), ('*.txt',), 'Output the text unchanged without any formatting.'), + RawTokenFormatter: ('Raw tokens', ('raw', 'tokens'), ('*.raw',), 'Format tokens as a raw representation for storing token streams.'), + RtfFormatter: ('RTF', ('rtf',), ('*.rtf',), 'Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft\xc2\xae Word\xc2\xae documents.'), + SvgFormatter: ('SVG', ('svg',), ('*.svg',), 'Format tokens as an SVG graphics file. This formatter is still experimental. Each line of code is a ``<text>`` element with explicit ``x`` and ``y`` coordinates containing ``<tspan>`` elements with the individual token styles.'), + Terminal256Formatter: ('Terminal256', ('terminal256', 'console256', '256'), (), 'Format tokens with ANSI color sequences, for output in a 256-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'), + TerminalFormatter: ('Terminal', ('terminal', 'console'), (), 'Format tokens with ANSI color sequences, for output in a text console. Color sequences are terminated at newlines, so that paging the output works correctly.') +} + +if __name__ == '__main__': + import sys + import os + + # lookup formatters + found_formatters = [] + imports = [] + sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) + for filename in os.listdir('.'): + if filename.endswith('.py') and not filename.startswith('_'): + module_name = 'pygments.formatters.%s' % filename[:-3] + print module_name + module = __import__(module_name, None, None, ['']) + for formatter_name in module.__all__: + imports.append((module_name, formatter_name)) + formatter = getattr(module, formatter_name) + found_formatters.append( + '%s: %r' % (formatter_name, + (formatter.name, + tuple(formatter.aliases), + tuple(formatter.filenames), + docstring_headline(formatter)))) + # sort them, that should make the diff files for svn smaller + found_formatters.sort() + imports.sort() + + # extract useful sourcecode from this file + f = file(__file__) + try: + content = f.read() + finally: + f.close() + header = content[:content.find('# start')] + footer = content[content.find("if __name__ == '__main__':"):] + + # write new file + f = file(__file__, 'w') + f.write(header) + f.write('# start\n') + f.write('\n'.join(['from %s import %s' % imp for imp in imports])) + f.write('\n\n') + f.write('FORMATTERS = {\n %s\n}\n\n' % ',\n '.join(found_formatters)) + f.write(footer) + f.close()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/bbcode.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,112 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.bbcode + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + + BBcode formatter. + + :copyright: 2006-2007 by Lukas Meuser. + :license: BSD, see LICENSE for more details. +""" + + +from pygments.formatter import Formatter +from pygments.util import get_bool_opt + +__all__ = ['BBCodeFormatter'] + + +class BBCodeFormatter(Formatter): + """ + Format tokens with BBcodes. These formatting codes are used by many + bulletin boards, so you can highlight your sourcecode with pygments before + posting it there. + + This formatter has no support for background colors and borders, as there + are no common BBcode tags for that. + + Some board systems (e.g. phpBB) don't support colors in their [code] tag, + so you can't use the highlighting together with that tag. + Text in a [code] tag usually is shown with a monospace font (which this + formatter can do with the ``monofont`` option) and no spaces (which you + need for indentation) are removed. + + Additional options accepted: + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + + `codetag` + If set to true, put the output into ``[code]`` tags (default: + ``false``) + + `monofont` + If set to true, add a tag to show the code with a monospace font + (default: ``false``). + """ + name = 'BBCode' + aliases = ['bbcode', 'bb'] + filenames = [] + + def __init__(self, **options): + Formatter.__init__(self, **options) + self._code = get_bool_opt(options, 'codetag', False) + self._mono = get_bool_opt(options, 'monofont', False) + + self.styles = {} + self._make_styles() + + def _make_styles(self): + for ttype, ndef in self.style: + start = end = '' + if ndef['color']: + start += '[color=#%s]' % ndef['color'] + end = '[/color]' + end + if ndef['bold']: + start += '[b]' + end = '[/b]' + end + if ndef['italic']: + start += '[i]' + end = '[/i]' + end + if ndef['underline']: + start += '[u]' + end = '[/u]' + end + # there are no common BBcodes for background-color and border + + self.styles[ttype] = start, end + + def format(self, tokensource, outfile): + if self._code: + outfile.write('[code]') + if self._mono: + outfile.write('[font=monospace]') + + enc = self.encoding + lastval = '' + lasttype = None + + for ttype, value in tokensource: + if enc: + value = value.encode(enc) + while ttype not in self.styles: + ttype = ttype.parent + if ttype == lasttype: + lastval += value + else: + if lastval: + start, end = self.styles[lasttype] + outfile.write(''.join((start, lastval, end))) + lastval = value + lasttype = ttype + + if lastval: + start, end = self.styles[lasttype] + outfile.write(''.join((start, lastval, end))) + + if self._mono: + outfile.write('[/font]') + if self._code: + outfile.write('[/code]') + if self._code or self._mono: + outfile.write('\n')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/html.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,657 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.html + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for HTML output. + + :copyright: 2006-2008 by Georg Brandl, Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" +import sys, os +import StringIO + +try: + set +except NameError: + from sets import Set as set + +from pygments.formatter import Formatter +from pygments.token import Token, Text, STANDARD_TYPES +from pygments.util import get_bool_opt, get_int_opt, get_list_opt + + +__all__ = ['HtmlFormatter'] + + +def escape_html(text): + """Escape &, <, > as well as single and double quotes for HTML.""" + return text.replace('&', '&'). \ + replace('<', '<'). \ + replace('>', '>'). \ + replace('"', '"'). \ + replace("'", ''') + + +def get_random_id(): + """Return a random id for javascript fields.""" + from random import random + from time import time + try: + from hashlib import sha1 as sha + except ImportError: + import sha + sha = sha.new + return sha('%s|%s' % (random(), time())).hexdigest() + + +def _get_ttype_class(ttype): + fname = STANDARD_TYPES.get(ttype) + if fname: + return fname + aname = '' + while fname is None: + aname = '-' + ttype[-1] + aname + ttype = ttype.parent + fname = STANDARD_TYPES.get(ttype) + return fname + aname + + +CSSFILE_TEMPLATE = '''\ +td.linenos { background-color: #f0f0f0; padding-right: 10px; } +span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } +pre { line-height: 125%%; } +%(styledefs)s +''' + +DOC_HEADER = '''\ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> + +<html> +<head> + <title>%(title)s</title> + <meta http-equiv="content-type" content="text/html; charset=%(encoding)s"> + <style type="text/css"> +''' + CSSFILE_TEMPLATE + ''' + </style> +</head> +<body> +<h2>%(title)s</h2> + +''' + +DOC_HEADER_EXTERNALCSS = '''\ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" + "http://www.w3.org/TR/html4/strict.dtd"> + +<html> +<head> + <title>%(title)s</title> + <meta http-equiv="content-type" content="text/html; charset=%(encoding)s"> + <link rel="stylesheet" href="%(cssfile)s" type="text/css"> +</head> +<body> +<h2>%(title)s</h2> + +''' + +DOC_FOOTER = '''\ +</body> +</html> +''' + + +class HtmlFormatter(Formatter): + r""" + Format tokens as HTML 4 ``<span>`` tags within a ``<pre>`` tag, wrapped + in a ``<div>`` tag. The ``<div>``'s CSS class can be set by the `cssclass` + option. + + If the `linenos` option is set to ``"table"``, the ``<pre>`` is + additionally wrapped inside a ``<table>`` which has one row and two + cells: one containing the line numbers and one containing the code. + Example: + + .. sourcecode:: html + + <div class="highlight" > + <table><tr> + <td class="linenos" title="click to toggle" + onclick="with (this.firstChild.style) + { display = (display == '') ? 'none' : '' }"> + <pre>1 + 2</pre> + </td> + <td class="code"> + <pre><span class="Ke">def </span><span class="NaFu">foo</span>(bar): + <span class="Ke">pass</span> + </pre> + </td> + </tr></table></div> + + (whitespace added to improve clarity). + + Wrapping can be disabled using the `nowrap` option. + + A list of lines can be specified using the `hl_lines` option to make these + lines highlighted (as of Pygments 0.11). + + With the `full` option, a complete HTML 4 document is output, including + the style definitions inside a ``<style>`` tag, or in a separate file if + the `cssfile` option is given. + + The `get_style_defs(arg='')` method of a `HtmlFormatter` returns a string + containing CSS rules for the CSS classes used by the formatter. The + argument `arg` can be used to specify additional CSS selectors that + are prepended to the classes. A call `fmter.get_style_defs('td .code')` + would result in the following CSS classes: + + .. sourcecode:: css + + td .code .kw { font-weight: bold; color: #00FF00 } + td .code .cm { color: #999999 } + ... + + If you have Pygments 0.6 or higher, you can also pass a list or tuple to the + `get_style_defs()` method to request multiple prefixes for the tokens: + + .. sourcecode:: python + + formatter.get_style_defs(['div.syntax pre', 'pre.syntax']) + + The output would then look like this: + + .. sourcecode:: css + + div.syntax pre .kw, + pre.syntax .kw { font-weight: bold; color: #00FF00 } + div.syntax pre .cm, + pre.syntax .cm { color: #999999 } + ... + + Additional options accepted: + + `nowrap` + If set to ``True``, don't wrap the tokens at all, not even inside a ``<pre>`` + tag. This disables most other options (default: ``False``). + + `full` + Tells the formatter to output a "full" document, i.e. a complete + self-contained document (default: ``False``). + + `title` + If `full` is true, the title that should be used to caption the + document (default: ``''``). + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + + `noclasses` + If set to true, token ``<span>`` tags will not use CSS classes, but + inline styles. This is not recommended for larger pieces of code since + it increases output size by quite a bit (default: ``False``). + + `classprefix` + Since the token types use relatively short class names, they may clash + with some of your own class names. In this case you can use the + `classprefix` option to give a string to prepend to all Pygments-generated + CSS class names for token types. + Note that this option also affects the output of `get_style_defs()`. + + `cssclass` + CSS class for the wrapping ``<div>`` tag (default: ``'highlight'``). + If you set this option, the default selector for `get_style_defs()` + will be this class. + + *New in Pygments 0.9:* If you select the ``'table'`` line numbers, the + wrapping table will have a CSS class of this string plus ``'table'``, + the default is accordingly ``'highlighttable'``. + + `cssstyles` + Inline CSS styles for the wrapping ``<div>`` tag (default: ``''``). + + `prestyles` + Inline CSS styles for the ``<pre>`` tag (default: ``''``). *New in + Pygments 0.11.* + + `cssfile` + If the `full` option is true and this option is given, it must be the + name of an external file. If the filename does not include an absolute + path, the file's path will be assumed to be relative to the main output + file's path, if the latter can be found. The stylesheet is then written + to this file instead of the HTML file. *New in Pygments 0.6.* + + `linenos` + If set to ``'table'``, output line numbers as a table with two cells, + one containing the line numbers, the other the whole code. This is + copy-and-paste-friendly, but may cause alignment problems with some + browsers or fonts. If set to ``'inline'``, the line numbers will be + integrated in the ``<pre>`` tag that contains the code (that setting + is *new in Pygments 0.8*). + + For compatibility with Pygments 0.7 and earlier, every true value + except ``'inline'`` means the same as ``'table'`` (in particular, that + means also ``True``). + + The default value is ``False``, which means no line numbers at all. + + **Note:** with the default ("table") line number mechanism, the line + numbers and code can have different line heights in Internet Explorer + unless you give the enclosing ``<pre>`` tags an explicit ``line-height`` + CSS property (you get the default line spacing with ``line-height: + 125%``). + + `hl_lines` + Specify a list of lines to be highlighted. *New in Pygments 0.11.* + + `linenostart` + The line number for the first line (default: ``1``). + + `linenostep` + If set to a number n > 1, only every nth line number is printed. + + `linenospecial` + If set to a number n > 0, every nth line number is given the CSS + class ``"special"`` (default: ``0``). + + `nobackground` + If set to ``True``, the formatter won't output the background color + for the wrapping element (this automatically defaults to ``False`` + when there is no wrapping element [eg: no argument for the + `get_syntax_defs` method given]) (default: ``False``). *New in + Pygments 0.6.* + + `lineseparator` + This string is output between lines of code. It defaults to ``"\n"``, + which is enough to break a line inside ``<pre>`` tags, but you can + e.g. set it to ``"<br>"`` to get HTML line breaks. *New in Pygments + 0.7.* + + `lineanchors` + If set to a nonempty string, e.g. ``foo``, the formatter will wrap each + output line in an anchor tag with a ``name`` of ``foo-linenumber``. + This allows easy linking to certain lines. *New in Pygments 0.9.* + + + **Subclassing the HTML formatter** + + *New in Pygments 0.7.* + + The HTML formatter is now built in a way that allows easy subclassing, thus + customizing the output HTML code. The `format()` method calls + `self._format_lines()` which returns a generator that yields tuples of ``(1, + line)``, where the ``1`` indicates that the ``line`` is a line of the + formatted source code. + + If the `nowrap` option is set, the generator is the iterated over and the + resulting HTML is output. + + Otherwise, `format()` calls `self.wrap()`, which wraps the generator with + other generators. These may add some HTML code to the one generated by + `_format_lines()`, either by modifying the lines generated by the latter, + then yielding them again with ``(1, line)``, and/or by yielding other HTML + code before or after the lines, with ``(0, html)``. The distinction between + source lines and other code makes it possible to wrap the generator multiple + times. + + The default `wrap()` implementation adds a ``<div>`` and a ``<pre>`` tag. + + A custom `HtmlFormatter` subclass could look like this: + + .. sourcecode:: python + + class CodeHtmlFormatter(HtmlFormatter): + + def wrap(self, source, outfile): + return self._wrap_code(source) + + def _wrap_code(self, source): + yield 0, '<code>' + for i, t in source: + if i == 1: + # it's a line of formatted code + t += '<br>' + yield i, t + yield 0, '</code>' + + This results in wrapping the formatted lines with a ``<code>`` tag, where the + source lines are broken using ``<br>`` tags. + + After calling `wrap()`, the `format()` method also adds the "line numbers" + and/or "full document" wrappers if the respective options are set. Then, all + HTML yielded by the wrapped generator is output. + """ + + name = 'HTML' + aliases = ['html'] + filenames = ['*.html', '*.htm'] + + def __init__(self, **options): + Formatter.__init__(self, **options) + self.nowrap = get_bool_opt(options, 'nowrap', False) + self.noclasses = get_bool_opt(options, 'noclasses', False) + self.classprefix = options.get('classprefix', '') + self.cssclass = options.get('cssclass', 'highlight') + self.cssstyles = options.get('cssstyles', '') + self.prestyles = options.get('prestyles', '') + self.cssfile = options.get('cssfile', '') + linenos = options.get('linenos', False) + if linenos == 'inline': + self.linenos = 2 + elif linenos: + # compatibility with <= 0.7 + self.linenos = 1 + else: + self.linenos = 0 + self.linenostart = abs(get_int_opt(options, 'linenostart', 1)) + self.linenostep = abs(get_int_opt(options, 'linenostep', 1)) + self.linenospecial = abs(get_int_opt(options, 'linenospecial', 0)) + self.nobackground = get_bool_opt(options, 'nobackground', False) + self.lineseparator = options.get('lineseparator', '\n') + self.lineanchors = options.get('lineanchors', '') + self.hl_lines = set() + for lineno in get_list_opt(options, 'hl_lines', []): + try: + self.hl_lines.add(int(lineno)) + except ValueError: + pass + + self._class_cache = {} + self._create_stylesheet() + + def _get_css_class(self, ttype): + """Return the css class of this token type prefixed with + the classprefix option.""" + if ttype in self._class_cache: + return self._class_cache[ttype] + return self.classprefix + _get_ttype_class(ttype) + + def _create_stylesheet(self): + t2c = self.ttype2class = {Token: ''} + c2s = self.class2style = {} + cp = self.classprefix + for ttype, ndef in self.style: + name = cp + _get_ttype_class(ttype) + style = '' + if ndef['color']: + style += 'color: #%s; ' % ndef['color'] + if ndef['bold']: + style += 'font-weight: bold; ' + if ndef['italic']: + style += 'font-style: italic; ' + if ndef['underline']: + style += 'text-decoration: underline; ' + if ndef['bgcolor']: + style += 'background-color: #%s; ' % ndef['bgcolor'] + if ndef['border']: + style += 'border: 1px solid #%s; ' % ndef['border'] + if style: + t2c[ttype] = name + # save len(ttype) to enable ordering the styles by + # hierarchy (necessary for CSS cascading rules!) + c2s[name] = (style[:-2], ttype, len(ttype)) + + def get_style_defs(self, arg=None): + """ + Return CSS style definitions for the classes produced by the current + highlighting style. ``arg`` can be a string or list of selectors to + insert before the token type classes. + """ + if arg is None: + arg = ('cssclass' in self.options and '.'+self.cssclass or '') + if isinstance(arg, basestring): + args = [arg] + else: + args = list(arg) + + def prefix(cls): + if cls: + cls = '.' + cls + tmp = [] + for arg in args: + tmp.append((arg and arg + ' ' or '') + cls) + return ', '.join(tmp) + + styles = [(level, ttype, cls, style) + for cls, (style, ttype, level) in self.class2style.iteritems() + if cls and style] + styles.sort() + lines = ['%s { %s } /* %s */' % (prefix(cls), style, repr(ttype)[6:]) + for (level, ttype, cls, style) in styles] + if arg and not self.nobackground and \ + self.style.background_color is not None: + text_style = '' + if Text in self.ttype2class: + text_style = ' ' + self.class2style[self.ttype2class[Text]][0] + lines.insert(0, '%s { background: %s;%s }' % + (prefix(''), self.style.background_color, text_style)) + if self.style.highlight_color is not None: + lines.insert(0, '%s.hll { background-color: %s }' % + (prefix(''), self.style.highlight_color)) + return '\n'.join(lines) + + def _wrap_full(self, inner, outfile): + if self.cssfile: + if os.path.isabs(self.cssfile): + # it's an absolute filename + cssfilename = self.cssfile + else: + try: + filename = outfile.name + if not filename or filename[0] == '<': + # pseudo files, e.g. name == '<fdopen>' + raise AttributeError + cssfilename = os.path.join(os.path.dirname(filename), self.cssfile) + except AttributeError: + print >>sys.stderr, 'Note: Cannot determine output file name, ' \ + 'using current directory as base for the CSS file name' + cssfilename = self.cssfile + # write CSS file + try: + cf = open(cssfilename, "w") + cf.write(CSSFILE_TEMPLATE % + {'styledefs': self.get_style_defs('body')}) + cf.close() + except IOError, err: + err.strerror = 'Error writing CSS file: ' + err.strerror + raise + + yield 0, (DOC_HEADER_EXTERNALCSS % + dict(title = self.title, + cssfile = self.cssfile, + encoding = self.encoding)) + else: + yield 0, (DOC_HEADER % + dict(title = self.title, + styledefs = self.get_style_defs('body'), + encoding = self.encoding)) + + for t, line in inner: + yield t, line + yield 0, DOC_FOOTER + + def _wrap_tablelinenos(self, inner): + dummyoutfile = StringIO.StringIO() + lncount = 0 + for t, line in inner: + if t: + lncount += 1 + dummyoutfile.write(line) + + fl = self.linenostart + mw = len(str(lncount + fl - 1)) + sp = self.linenospecial + st = self.linenostep + if sp: + ls = '\n'.join([(i%st == 0 and + (i%sp == 0 and '<span class="special">%*d</span>' + or '%*d') % (mw, i) + or '') + for i in range(fl, fl + lncount)]) + else: + ls = '\n'.join([(i%st == 0 and ('%*d' % (mw, i)) or '') + for i in range(fl, fl + lncount)]) + + yield 0, ('<table class="%stable">' % self.cssclass + + '<tr><td class="linenos"><pre>' + + ls + '</pre></td><td class="code">') + yield 0, dummyoutfile.getvalue() + yield 0, '</td></tr></table>' + + def _wrap_inlinelinenos(self, inner): + # need a list of lines since we need the width of a single number :( + lines = list(inner) + sp = self.linenospecial + st = self.linenostep + num = self.linenostart + mw = len(str(len(lines) + num - 1)) + + if sp: + for t, line in lines: + yield 1, '<span class="lineno%s">%*s</span> ' % ( + num%sp == 0 and ' special' or '', mw, (num%st and ' ' or num)) + line + num += 1 + else: + for t, line in lines: + yield 1, '<span class="lineno">%*s</span> ' % ( + mw, (num%st and ' ' or num)) + line + num += 1 + + def _wrap_lineanchors(self, inner): + s = self.lineanchors + i = 0 + for t, line in inner: + if t: + i += 1 + yield 1, '<a name="%s-%d"></a>' % (s, i) + line + else: + yield 0, line + + def _wrap_div(self, inner): + yield 0, ('<div' + (self.cssclass and ' class="%s"' % self.cssclass) + + (self.cssstyles and ' style="%s"' % self.cssstyles) + '>') + for tup in inner: + yield tup + yield 0, '</div>\n' + + def _wrap_pre(self, inner): + yield 0, ('<pre' + + (self.prestyles and ' style="%s"' % self.prestyles) + '>') + for tup in inner: + yield tup + yield 0, '</pre>' + + def _format_lines(self, tokensource): + """ + Just format the tokens, without any wrapping tags. + Yield individual lines. + """ + nocls = self.noclasses + enc = self.encoding + lsep = self.lineseparator + # for <span style=""> lookup only + getcls = self.ttype2class.get + c2s = self.class2style + + lspan = '' + line = '' + for ttype, value in tokensource: + if nocls: + cclass = getcls(ttype) + while cclass is None: + ttype = ttype.parent + cclass = getcls(ttype) + cspan = cclass and '<span style="%s">' % c2s[cclass][0] or '' + else: + cls = self._get_css_class(ttype) + cspan = cls and '<span class="%s">' % cls or '' + + if enc: + value = value.encode(enc) + + parts = escape_html(value).split('\n') + + # for all but the last line + for part in parts[:-1]: + if line: + if lspan != cspan: + line += (lspan and '</span>') + cspan + part + \ + (cspan and '</span>') + lsep + else: # both are the same + line += part + (lspan and '</span>') + lsep + yield 1, line + line = '' + elif part: + yield 1, cspan + part + (cspan and '</span>') + lsep + else: + yield 1, lsep + # for the last line + if line and parts[-1]: + if lspan != cspan: + line += (lspan and '</span>') + cspan + parts[-1] + lspan = cspan + else: + line += parts[-1] + elif parts[-1]: + line = cspan + parts[-1] + lspan = cspan + # else we neither have to open a new span nor set lspan + + if line: + yield 1, line + (lspan and '</span>') + lsep + + def _highlight_lines(self, tokensource): + """ + Highlighted the lines specified in the `hl_lines` option by + post-processing the token stream coming from `_format_lines`. + """ + hls = self.hl_lines + + for i, (t, value) in enumerate(tokensource): + if t != 1: + yield t, value + if i + 1 in hls: # i + 1 because Python indexes start at 0 + yield 1, '<span class="hll">%s</span>' % value + else: + yield 1, value + + def wrap(self, source, outfile): + """ + Wrap the ``source``, which is a generator yielding + individual lines, in custom generators. See docstring + for `format`. Can be overridden. + """ + return self._wrap_div(self._wrap_pre(source)) + + def format(self, tokensource, outfile): + """ + The formatting process uses several nested generators; which of + them are used is determined by the user's options. + + Each generator should take at least one argument, ``inner``, + and wrap the pieces of text generated by this. + + Always yield 2-tuples: (code, text). If "code" is 1, the text + is part of the original tokensource being highlighted, if it's + 0, the text is some piece of wrapping. This makes it possible to + use several different wrappers that process the original source + linewise, e.g. line number generators. + """ + source = self._format_lines(tokensource) + if self.hl_lines: + source = self._highlight_lines(source) + if not self.nowrap: + if self.linenos == 2: + source = self._wrap_inlinelinenos(source) + if self.lineanchors: + source = self._wrap_lineanchors(source) + source = self.wrap(source, outfile) + if self.linenos == 1: + source = self._wrap_tablelinenos(source) + if self.full: + source = self._wrap_full(source, outfile) + + for t, piece in source: + outfile.write(piece)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/img.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,460 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.img + ~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for Pixmap output. + + :copyright: 2007 by Ali Afshar. + :license: BSD, see LICENSE for more details. +""" + +import sys +from commands import getstatusoutput + +from pygments.formatter import Formatter +from pygments.util import get_bool_opt, get_int_opt, get_choice_opt + +# Import this carefully +try: + import Image, ImageDraw, ImageFont + pil_available = True +except ImportError: + pil_available = False + +try: + import _winreg +except ImportError: + _winreg = None + +__all__ = ['ImageFormatter'] + + +# For some unknown reason every font calls it something different +STYLES = { + 'NORMAL': ['', 'Roman', 'Book', 'Normal', 'Regular', 'Medium'], + 'ITALIC': ['Oblique', 'Italic'], + 'BOLD': ['Bold'], + 'BOLDITALIC': ['Bold Oblique', 'Bold Italic'], +} + +# A sane default for modern systems +DEFAULT_FONT_NAME_NIX = 'Bitstream Vera Sans Mono' +DEFAULT_FONT_NAME_WIN = 'Courier New' + + +class PilNotAvailable(ImportError): + """When Python imaging library is not available""" + + +class FontNotFound(Exception): + """When there are no usable fonts specified""" + + +class FontManager(object): + """ + Manages a set of fonts: normal, italic, bold, etc... + """ + + def __init__(self, font_name, font_size=14): + self.font_name = font_name + self.font_size = font_size + self.fonts = {} + if sys.platform.startswith('win'): + if not font_name: + self.font_name = DEFAULT_FONT_NAME_WIN + self._create_win() + else: + if not font_name: + self.font_name = DEFAULT_FONT_NAME_NIX + self._create_nix() + + def _get_nix_font_path(self, name, style): + exit, out = getstatusoutput('fc-list "%s:style=%s" file' % + (name, style)) + if not exit: + lines = out.splitlines() + if lines: + path = lines[0].strip().strip(':') + return path + + def _create_nix(self): + for name in STYLES['NORMAL']: + path = self._get_nix_font_path(self.font_name, name) + if path is not None: + self.fonts['NORMAL'] = ImageFont.truetype(path, self.font_size) + break + else: + raise FontNotFound('No usable fonts named: "%s"' % + self.font_name) + for style in ('ITALIC', 'BOLD', 'BOLDITALIC'): + for stylename in STYLES[style]: + path = self._get_nix_font_path(self.font_name, stylename) + if path is not None: + self.fonts[style] = ImageFont.truetype(path, self.font_size) + break + else: + if style == 'BOLDITALIC': + self.fonts[style] = self.fonts['BOLD'] + else: + self.fonts[style] = self.fonts['NORMAL'] + + def _lookup_win(self, key, basename, styles, fail=False): + for suffix in ('', ' (TrueType)'): + for style in styles: + try: + valname = '%s%s%s' % (basename, style and ' '+style, suffix) + val, _ = _winreg.QueryValueEx(key, valname) + return val + except EnvironmentError: + continue + else: + if fail: + raise FontNotFound('Font %s (%s) not found in registry' % + (basename, styles[0])) + return None + + def _create_win(self): + try: + key = _winreg.OpenKey( + _winreg.HKEY_LOCAL_MACHINE, + r'Software\Microsoft\Windows NT\CurrentVersion\Fonts') + except EnvironmentError: + try: + key = _winreg.OpenKey( + _winreg.HKEY_LOCAL_MACHINE, + r'Software\Microsoft\Windows\CurrentVersion\Fonts') + except EnvironmentError: + raise FontNotFound('Can\'t open Windows font registry key') + try: + path = self._lookup_win(key, self.font_name, STYLES['NORMAL'], True) + self.fonts['NORMAL'] = ImageFont.truetype(path, self.font_size) + for style in ('ITALIC', 'BOLD', 'BOLDITALIC'): + path = self._lookup_win(key, self.font_name, STYLES[style]) + if path: + self.fonts[style] = ImageFont.truetype(path, self.font_size) + else: + if style == 'BOLDITALIC': + self.fonts[style] = self.fonts['BOLD'] + else: + self.fonts[style] = self.fonts['NORMAL'] + finally: + _winreg.CloseKey(key) + + def get_char_size(self): + """ + Get the character size. + """ + return self.fonts['NORMAL'].getsize('M') + + def get_font(self, bold, oblique): + """ + Get the font based on bold and italic flags. + """ + if bold and oblique: + return self.fonts['BOLDITALIC'] + elif bold: + return self.fonts['BOLD'] + elif oblique: + return self.fonts['ITALIC'] + else: + return self.fonts['NORMAL'] + + +class ImageFormatter(Formatter): + """ + Create an image from source code. This uses the Python Imaging Library to + generate a pixmap from the source code. + + *New in Pygments 0.10.* + + Additional options accepted: + + `image_format` + An image format to output to that is recognised by PIL, these include: + + * "PNG" (default) + * "JPEG" + * "BMP" + * "GIF" + + `line_pad` + The extra spacing (in pixels) between each line of text. + + Default: 2 + + `font_name` + The font name to be used as the base font from which others, such as + bold and italic fonts will be generated. This really should be a + monospace font to look sane. + + Default: "Bitstream Vera Sans Mono" + + `font_size` + The font size in points to be used. + + Default: 14 + + `image_pad` + The padding, in pixels to be used at each edge of the resulting image. + + Default: 10 + + `line_numbers` + Whether line numbers should be shown: True/False + + Default: True + + `line_number_step` + The step used when printing line numbers. + + Default: 1 + + `line_number_bg` + The background colour (in "#123456" format) of the line number bar, or + None to use the style background color. + + Default: "#eed" + + `line_number_fg` + The text color of the line numbers (in "#123456"-like format). + + Default: "#886" + + `line_number_chars` + The number of columns of line numbers allowable in the line number + margin. + + Default: 2 + + `line_number_bold` + Whether line numbers will be bold: True/False + + Default: False + + `line_number_italic` + Whether line numbers will be italicized: True/False + + Default: False + + `line_number_separator` + Whether a line will be drawn between the line number area and the + source code area: True/False + + Default: True + + `line_number_pad` + The horizontal padding (in pixels) between the line number margin, and + the source code area. + + Default: 6 + """ + + # Required by the pygments mapper + name = 'img' + aliases = ['img', 'IMG', 'png', 'jpg', 'gif', 'bmp'] + filenames = ['*.png', '*.jpg', '*.gif', '*.bmp'] + + unicodeoutput = False + + def __init__(self, **options): + """ + See the class docstring for explanation of options. + """ + if not pil_available: + raise PilNotAvailable( + 'Python Imaging Library is required for this formatter') + Formatter.__init__(self, **options) + # Read the style + self.styles = dict(self.style) + if self.style.background_color is None: + self.background_color = '#fff' + else: + self.background_color = self.style.background_color + # Image options + self.image_format = get_choice_opt(options, 'image_format', + ['PNG', 'JPEG', 'GIF', 'BMP'], 'PNG') + self.image_pad = get_int_opt(options, 'image_pad', 10) + self.line_pad = get_int_opt(options, 'line_pad', 2) + # The fonts + self.fonts = FontManager(options.get('font_name', '')) + self.fontw, self.fonth = self.fonts.get_char_size() + # Line number options + self.line_number_fg = options.get('line_number_fg', '#886') + self.line_number_bg = options.get('line_number_bg', '#eed') + self.line_number_chars = get_int_opt(options, + 'line_number_chars', 2) + self.line_number_bold = get_bool_opt(options, + 'line_number_bold', False) + self.line_number_italic = get_bool_opt(options, + 'line_number_italic', False) + self.line_number_pad = get_int_opt(options, 'line_number_pad', 6) + self.line_numbers = get_bool_opt(options, 'line_numbers', True) + self.line_number_separator = get_bool_opt(options, + 'line_number_separator', True) + self.line_number_step = get_int_opt(options, 'line_number_step', 1) + if self.line_numbers: + self.line_number_width = (self.fontw * self.line_number_chars + + self.line_number_pad * 2) + else: + self.line_number_width = 0 + self.drawables = [] + + def _get_line_height(self): + """ + Get the height of a line. + """ + return self.fonth + self.line_pad + + def _get_line_y(self, lineno): + """ + Get the Y coordinate of a line number. + """ + return lineno * self._get_line_height() + self.image_pad + + def _get_char_width(self): + """ + Get the width of a character. + """ + return self.fontw + + def _get_char_x(self, charno): + """ + Get the X coordinate of a character position. + """ + return charno * self.fontw + self.image_pad + self.line_number_width + + def _get_text_pos(self, charno, lineno): + """ + Get the actual position for a character and line position. + """ + return self._get_char_x(charno), self._get_line_y(lineno) + + def _get_linenumber_pos(self, lineno): + """ + Get the actual position for the start of a line number. + """ + return (self.image_pad, self._get_line_y(lineno)) + + def _get_text_color(self, style): + """ + Get the correct color for the token from the style. + """ + if style['color'] is not None: + fill = '#' + style['color'] + else: + fill = '#000' + return fill + + def _get_style_font(self, style): + """ + Get the correct font for the style. + """ + return self.fonts.get_font(style['bold'], style['italic']) + + def _get_image_size(self, maxcharno, maxlineno): + """ + Get the required image size. + """ + return (self._get_char_x(maxcharno) + self.image_pad, + self._get_line_y(maxlineno + 0) + self.image_pad) + + def _draw_linenumber(self, lineno): + """ + Remember a line number drawable to paint later. + """ + self._draw_text( + self._get_linenumber_pos(lineno), + str(lineno + 1).rjust(self.line_number_chars), + font=self.fonts.get_font(self.line_number_bold, + self.line_number_italic), + fill=self.line_number_fg, + ) + + def _draw_text(self, pos, text, font, **kw): + """ + Remember a single drawable tuple to paint later. + """ + self.drawables.append((pos, text, font, kw)) + + def _create_drawables(self, tokensource): + """ + Create drawables for the token content. + """ + lineno = charno = maxcharno = 0 + for ttype, value in tokensource: + while ttype not in self.styles: + ttype = ttype.parent + style = self.styles[ttype] + value = value.expandtabs(4) + lines = value.splitlines() + #print lines + for i, line in enumerate(lines): + if not line: + lineno += 1 + charno = 0 + else: + # add a line for each extra line in the value + if i: + lineno += 1 + charno = 0 + self._draw_text( + self._get_text_pos(charno, lineno), + line, + font = self._get_style_font(style), + fill = self._get_text_color(style) + ) + charno += len(value) + maxcharno = max(maxcharno, charno) + self.maxcharno = maxcharno + self.maxlineno = lineno + + def _draw_line_numbers(self): + """ + Create drawables for the line numbers. + """ + if not self.line_numbers: + return + for i in xrange(self.maxlineno): + if ((i + 1) % self.line_number_step) == 0: + self._draw_linenumber(i) + + def _paint_line_number_bg(self, im): + """ + Paint the line number background on the image. + """ + if not self.line_numbers: + return + if self.line_number_fg is None: + return + draw = ImageDraw.Draw(im) + recth = im.size[-1] + rectw = self.image_pad + self.line_number_width - self.line_number_pad + draw.rectangle([(0, 0), + (rectw, recth)], + fill=self.line_number_bg) + draw.line([(rectw, 0), (rectw, recth)], fill=self.line_number_fg) + del draw + + def format(self, tokensource, outfile): + """ + Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` + tuples and write it into ``outfile``. + + This implementation calculates where it should draw each token on the + pixmap, then calculates the required pixmap size and draws the items. + """ + self._create_drawables(tokensource) + self._draw_line_numbers() + im = Image.new( + 'RGB', + self._get_image_size(self.maxcharno, self.maxlineno), + self.background_color + ) + self._paint_line_number_bg(im) + draw = ImageDraw.Draw(im) + for pos, value, font, kw in self.drawables: + draw.text(pos, value, font=font, **kw) + im.save(outfile, self.image_format) + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/latex.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,248 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.latex + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for LaTeX fancyvrb output. + + :copyright: 2006-2007 by Georg Brandl. + :license: BSD, see LICENSE for more details. +""" +import StringIO + +from pygments.formatter import Formatter +from pygments.token import Token +from pygments.util import get_bool_opt, get_int_opt + + +__all__ = ['LatexFormatter'] + + +def escape_tex(text): + return text.replace('@', '\x00'). \ + replace('[', '\x01'). \ + replace(']', '\x02'). \ + replace('\x00', '@at[]').\ + replace('\x01', '@lb[]').\ + replace('\x02', '@rb[]') + + +DOC_TEMPLATE = r''' +\documentclass{%(docclass)s} +\usepackage{fancyvrb} +\usepackage{color} +\usepackage[%(encoding)s]{inputenc} +%(preamble)s + +%(styledefs)s + +\begin{document} + +\section*{%(title)s} + +%(code)s +\end{document} +''' + + +class LatexFormatter(Formatter): + r""" + Format tokens as LaTeX code. This needs the `fancyvrb` and `color` + standard packages. + + Without the `full` option, code is formatted as one ``Verbatim`` + environment, like this: + + .. sourcecode:: latex + + \begin{Verbatim}[commandchars=@\[\]] + @PYan[def ]@PYax[foo](bar): + @PYan[pass] + \end{Verbatim} + + The command sequences used here (``@PYan`` etc.) are generated from the given + `style` and can be retrieved using the `get_style_defs` method. + + With the `full` option, a complete LaTeX document is output, including + the command definitions in the preamble. + + The `get_style_defs()` method of a `LatexFormatter` returns a string + containing ``\newcommand`` commands defining the commands used inside the + ``Verbatim`` environments. + + Additional options accepted: + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + + `full` + Tells the formatter to output a "full" document, i.e. a complete + self-contained document (default: ``False``). + + `title` + If `full` is true, the title that should be used to caption the + document (default: ``''``). + + `docclass` + If the `full` option is enabled, this is the document class to use + (default: ``'article'``). + + `preamble` + If the `full` option is enabled, this can be further preamble commands, + e.g. ``\usepackage`` (default: ``''``). + + `linenos` + If set to ``True``, output line numbers (default: ``False``). + + `linenostart` + The line number for the first line (default: ``1``). + + `linenostep` + If set to a number n > 1, only every nth line number is printed. + + `verboptions` + Additional options given to the Verbatim environment (see the *fancyvrb* + docs for possible values) (default: ``''``). + + `commandprefix` + The LaTeX commands used to produce colored output are constructed + using this prefix and some letters (default: ``'PY'``). + *New in Pygments 0.7.* + + *New in Pygments 0.10:* the default is now ``'PY'`` instead of ``'C'``. + """ + name = 'LaTeX' + aliases = ['latex', 'tex'] + filenames = ['*.tex'] + + def __init__(self, **options): + Formatter.__init__(self, **options) + self.docclass = options.get('docclass', 'article') + self.preamble = options.get('preamble', '') + self.linenos = get_bool_opt(options, 'linenos', False) + self.linenostart = abs(get_int_opt(options, 'linenostart', 1)) + self.linenostep = abs(get_int_opt(options, 'linenostep', 1)) + self.verboptions = options.get('verboptions', '') + self.nobackground = get_bool_opt(options, 'nobackground', False) + self.commandprefix = options.get('commandprefix', 'PY') + + self._create_stylecmds() + + + def _create_stylecmds(self): + t2c = self.ttype2cmd = {Token: ''} + c2d = self.cmd2def = {} + cp = self.commandprefix + + letters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' + first = iter(letters) + second = iter(letters) + firstl = first.next() + + def rgbcolor(col): + if col: + return ','.join(['%.2f' %(int(col[i] + col[i + 1], 16) / 255.0) + for i in (0, 2, 4)]) + else: + return '1,1,1' + + for ttype, ndef in self.style: + cmndef = '#1' + if ndef['bold']: + cmndef = r'\textbf{' + cmndef + '}' + if ndef['italic']: + cmndef = r'\textit{' + cmndef + '}' + if ndef['underline']: + cmndef = r'\underline{' + cmndef + '}' + if ndef['roman']: + cmndef = r'\textrm{' + cmndef + '}' + if ndef['sans']: + cmndef = r'\textsf{' + cmndef + '}' + if ndef['mono']: + cmndef = r'\texttt{' + cmndef + '}' + if ndef['color']: + cmndef = r'\textcolor[rgb]{%s}{%s}' % ( + rgbcolor(ndef['color']), + cmndef + ) + if ndef['border']: + cmndef = r'\fcolorbox[rgb]{%s}{%s}{%s}' % ( + rgbcolor(ndef['border']), + rgbcolor(ndef['bgcolor']), + cmndef + ) + elif ndef['bgcolor']: + cmndef = r'\colorbox[rgb]{%s}{%s}' % ( + rgbcolor(ndef['bgcolor']), + cmndef + ) + if cmndef == '#1': + continue + try: + alias = cp + firstl + second.next() + except StopIteration: + firstl = first.next() + second = iter(letters) + alias = cp + firstl + second.next() + t2c[ttype] = alias + c2d[alias] = cmndef + + def get_style_defs(self, arg=''): + """ + Return the \\newcommand sequences needed to define the commands + used to format text in the verbatim environment. ``arg`` is ignored. + """ + nc = '\\newcommand' + return '%s\\at{@}\n%s\\lb{[}\n%s\\rb{]}\n' % (nc, nc, nc) + \ + '\n'.join(['\\newcommand\\%s[1]{%s}' % (alias, cmndef) + for alias, cmndef in self.cmd2def.iteritems() + if cmndef != '#1']) + + def format(self, tokensource, outfile): + # TODO: add support for background colors + enc = self.encoding + + if self.full: + realoutfile = outfile + outfile = StringIO.StringIO() + + outfile.write(r'\begin{Verbatim}[commandchars=@\[\]') + if self.linenos: + start, step = self.linenostart, self.linenostep + outfile.write(',numbers=left' + + (start and ',firstnumber=%d' % start or '') + + (step and ',stepnumber=%d' % step or '')) + if self.verboptions: + outfile.write(',' + self.verboptions) + outfile.write(']\n') + + for ttype, value in tokensource: + if enc: + value = value.encode(enc) + value = escape_tex(value) + cmd = self.ttype2cmd.get(ttype) + while cmd is None: + ttype = ttype.parent + cmd = self.ttype2cmd.get(ttype) + if cmd: + spl = value.split('\n') + for line in spl[:-1]: + if line: + outfile.write("@%s[%s]" % (cmd, line)) + outfile.write('\n') + if spl[-1]: + outfile.write("@%s[%s]" % (cmd, spl[-1])) + else: + outfile.write(value) + + outfile.write('\\end{Verbatim}\n') + + if self.full: + realoutfile.write(DOC_TEMPLATE % + dict(docclass = self.docclass, + preamble = self.preamble, + title = self.title, + encoding = self.encoding or 'latin1', + styledefs = self.get_style_defs(), + code = outfile.getvalue()))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/other.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.other + ~~~~~~~~~~~~~~~~~~~~~~~~~ + + Other formatters: NullFormatter, RawTokenFormatter. + + :copyright: 2006-2007 by Georg Brandl, Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" + +from pygments.formatter import Formatter +from pygments.util import get_choice_opt +from pygments.token import Token +from pygments.console import colorize + +__all__ = ['NullFormatter', 'RawTokenFormatter'] + + +class NullFormatter(Formatter): + """ + Output the text unchanged without any formatting. + """ + name = 'Text only' + aliases = ['text', 'null'] + filenames = ['*.txt'] + + def format(self, tokensource, outfile): + enc = self.encoding + for ttype, value in tokensource: + if enc: + outfile.write(value.encode(enc)) + else: + outfile.write(value) + + +class RawTokenFormatter(Formatter): + r""" + Format tokens as a raw representation for storing token streams. + + The format is ``tokentype<TAB>repr(tokenstring)\n``. The output can later + be converted to a token stream with the `RawTokenLexer`, described in the + `lexer list <lexers.txt>`_. + + Only one option is accepted: + + `compress` + If set to ``'gz'`` or ``'bz2'``, compress the output with the given + compression algorithm after encoding (default: ``''``). + `error_color` + If set to a color name, highlight error tokens using that color. If + set but with no value, defaults to ``'red'``. + *New in Pygments 0.11.* + + """ + name = 'Raw tokens' + aliases = ['raw', 'tokens'] + filenames = ['*.raw'] + + unicodeoutput = False + + def __init__(self, **options): + Formatter.__init__(self, **options) + self.compress = get_choice_opt(options, 'compress', + ['', 'none', 'gz', 'bz2'], '') + self.error_color = options.get('error_color', None) + if self.error_color is True: + self.error_color = 'red' + if self.error_color is not None: + try: + colorize(self.error_color, '') + except KeyError: + raise ValueError("Invalid color %r specified" % + self.error_color) + + def format(self, tokensource, outfile): + if self.compress == 'gz': + import gzip + outfile = gzip.GzipFile('', 'wb', 9, outfile) + write = outfile.write + flush = outfile.flush + elif self.compress == 'bz2': + import bz2 + compressor = bz2.BZ2Compressor(9) + def write(text): + outfile.write(compressor.compress(text)) + def flush(): + outfile.write(compressor.flush()) + outfile.flush() + else: + write = outfile.write + flush = outfile.flush + + lasttype = None + lastval = u'' + if self.error_color: + for ttype, value in tokensource: + line = "%s\t%r\n" % (ttype, value) + if ttype is Token.Error: + write(colorize(self.error_color, line)) + else: + write(line) + else: + for ttype, value in tokensource: + write("%s\t%r\n" % (ttype, value)) + flush()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/rtf.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.rtf + ~~~~~~~~~~~~~~~~~~~~~~~ + + A formatter that generates RTF files. + + :copyright: 2006-2007 by Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" + +from pygments.formatter import Formatter + + +__all__ = ['RtfFormatter'] + + +class RtfFormatter(Formatter): + """ + Format tokens as RTF markup. This formatter automatically outputs full RTF + documents with color information and other useful stuff. Perfect for Copy and + Paste into Microsoft® Word® documents. + + *New in Pygments 0.6.* + + Additional options accepted: + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + + `fontface` + The used font famliy, for example ``Bitstream Vera Sans``. Defaults to + some generic font which is supposed to have fixed width. + """ + name = 'RTF' + aliases = ['rtf'] + filenames = ['*.rtf'] + + unicodeoutput = False + + def __init__(self, **options): + """ + Additional options accepted: + + ``fontface`` + Name of the font used. Could for example be ``'Courier New'`` + to further specify the default which is ``'\fmodern'``. The RTF + specification claims that ``\fmodern`` are "Fixed-pitch serif + and sans serif fonts". Hope every RTF implementation thinks + the same about modern... + """ + Formatter.__init__(self, **options) + self.fontface = options.get('fontface') or '' + if self.encoding in ('utf-8', 'utf-16', 'utf-32'): + self.encoding = None + + def _escape(self, text): + return text.replace('\\', '\\\\') \ + .replace('{', '\\{') \ + .replace('}', '\\}') + + def _escape_text(self, text): + # empty strings, should give a small performance improvment + if not text: + return '' + + # escape text + text = self._escape(text) + encoding = self.encoding or 'iso-8859-15' + + buf = [] + for c in text: + if ord(c) > 128: + ansic = c.encode(encoding, 'ignore') or '?' + if ord(ansic) > 128: + ansic = '\\\'%x' % ord(ansic) + buf.append(r'\ud{\u%d%s}' % (ord(c), ansic)) + else: + buf.append(str(c)) + + return ''.join(buf).replace('\n', '\\par\n') + + def format(self, tokensource, outfile): + # rtf 1.8 header + outfile.write(r'{\rtf1\ansi\deff0' + r'{\fonttbl{\f0\fmodern\fprq1\fcharset0%s;}}' + r'{\colortbl;' % (self.fontface and + ' ' + self._escape(self.fontface) or + '')) + + # convert colors and save them in a mapping to access them later. + color_mapping = {} + offset = 1 + for _, style in self.style: + for color in style['color'], style['bgcolor'], style['border']: + if color and color not in color_mapping: + color_mapping[color] = offset + outfile.write(r'\red%d\green%d\blue%d;' % ( + int(color[0:2], 16), + int(color[2:4], 16), + int(color[4:6], 16) + )) + offset += 1 + outfile.write(r'}\f0') + + # highlight stream + for ttype, value in tokensource: + while not self.style.styles_token(ttype) and ttype.parent: + ttype = ttype.parent + style = self.style.style_for_token(ttype) + buf = [] + if style['bgcolor']: + buf.append(r'\cb%d' % color_mapping[style['bgcolor']]) + if style['color']: + buf.append(r'\cf%d' % color_mapping[style['color']]) + if style['bold']: + buf.append(r'\b') + if style['italic']: + buf.append(r'\i') + if style['underline']: + buf.append(r'\ul') + if style['border']: + buf.append(r'\chbrdr\chcfpat%d' % + color_mapping[style['border']]) + start = ''.join(buf) + if start: + outfile.write('{%s ' % start) + outfile.write(self._escape_text(value)) + if start: + outfile.write('}') + + outfile.write('}')
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/svg.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.svg + ~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for SVG output. + + :copyright: 2007 by Matthew Harrison, Georg Brandl. + :license: BSD, see LICENSE for more details. +""" +import StringIO + +from pygments.formatter import Formatter +from pygments.util import get_bool_opt, get_int_opt + +__all__ = ['SvgFormatter'] + + +def escape_html(text): + """Escape &, <, > as well as single and double quotes for HTML.""" + return text.replace('&', '&'). \ + replace('<', '<'). \ + replace('>', '>'). \ + replace('"', '"'). \ + replace("'", ''') + + +class2style = {} + +class SvgFormatter(Formatter): + """ + Format tokens as an SVG graphics file. This formatter is still experimental. + Each line of code is a ``<text>`` element with explicit ``x`` and ``y`` + coordinates containing ``<tspan>`` elements with the individual token styles. + + By default, this formatter outputs a full SVG document including doctype + declaration and the ``<svg>`` root element. + + *New in Pygments 0.9.* + + Additional options accepted: + + `nowrap` + Don't wrap the SVG ``<text>`` elements in ``<svg><g>`` elements and + don't add a XML declaration and a doctype. If true, the `fontfamily` + and `fontsize` options are ignored. Defaults to ``False``. + + `fontfamily` + The value to give the wrapping ``<g>`` element's ``font-family`` + attribute, defaults to ``"monospace"``. + + `fontsize` + The value to give the wrapping ``<g>`` element's ``font-size`` + attribute, defaults to ``"14px"``. + + `xoffset` + Starting offset in X direction, defaults to ``0``. + + `yoffset` + Starting offset in Y direction, defaults to the font size if it is given + in pixels, or ``20`` else. (This is necessary since text coordinates + refer to the text baseline, not the top edge.) + + `ystep` + Offset to add to the Y coordinate for each subsequent line. This should + roughly be the text size plus 5. It defaults to that value if the text + size is given in pixels, or ``25`` else. + + `spacehack` + Convert spaces in the source to ``&160;``, which are non-breaking + spaces. SVG provides the ``xml:space`` attribute to control how + whitespace inside tags is handled, in theory, the ``preserve`` value + could be used to keep all whitespace as-is. However, many current SVG + viewers don't obey that rule, so this option is provided as a workaround + and defaults to ``True``. + """ + name = 'SVG' + aliases = ['svg'] + filenames = ['*.svg'] + + def __init__(self, **options): + # XXX outencoding + Formatter.__init__(self, **options) + self.nowrap = get_bool_opt(options, 'nowrap', False) + self.fontfamily = options.get('fontfamily', 'monospace') + self.fontsize = options.get('fontsize', '14px') + self.xoffset = get_int_opt(options, 'xoffset', 0) + fs = self.fontsize.strip() + if fs.endswith('px'): fs = fs[:-2].strip() + try: + int_fs = int(fs) + except: + int_fs = 20 + self.yoffset = get_int_opt(options, 'yoffset', int_fs) + self.ystep = get_int_opt(options, 'ystep', int_fs + 5) + self.spacehack = get_bool_opt(options, 'spacehack', True) + self._stylecache = {} + + def format(self, tokensource, outfile): + """ + Format ``tokensource``, an iterable of ``(tokentype, tokenstring)`` + tuples and write it into ``outfile``. + + For our implementation we put all lines in their own 'line group'. + """ + x = self.xoffset + y = self.yoffset + enc = self.encoding + if not self.nowrap: + if enc: + outfile.write('<?xml version="1.0" encoding="%s"?>\n' % self.encoding) + else: + outfile.write('<?xml version="1.0"?>\n') + outfile.write('<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" ' + '"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/' + 'svg10.dtd">\n') + outfile.write('<svg xmlns="http://www.w3.org/2000/svg">\n') + outfile.write('<g font-family="%s" font-size="%s">\n' % (self.fontfamily, + self.fontsize)) + outfile.write('<text x="%s" y="%s" xml:space="preserve">' % (x, y)) + for ttype, value in tokensource: + if enc: + value = value.encode(enc) + style = self._get_style(ttype) + tspan = style and '<tspan' + style + '>' or '' + tspanend = tspan and '</tspan>' or '' + value = escape_html(value) + if self.spacehack: + value = value.expandtabs().replace(' ', ' ') + parts = value.split('\n') + for part in parts[:-1]: + outfile.write(tspan + part + tspanend) + y += self.ystep + outfile.write('</text>\n<text x="%s" y="%s" ' + 'xml:space="preserve">' % (x, y)) + outfile.write(tspan + parts[-1] + tspanend) + outfile.write('</text>') + + if not self.nowrap: + outfile.write('</g></svg>\n') + + def _get_style(self, tokentype): + if tokentype in self._stylecache: + return self._stylecache[tokentype] + otokentype = tokentype + while not self.style.styles_token(tokentype): + tokentype = tokentype.parent + value = self.style.style_for_token(tokentype) + result = '' + if value['color']: + result = ' fill="#' + value['color'] + '"' + if value['bold']: + result += ' font-weight="bold"' + if value['italic']: + result += ' font-style="italic"' + self._stylecache[otokentype] = result + return result
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/terminal.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.terminal + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for terminal output with ANSI sequences. + + :copyright: 2006-2007 by Georg Brandl. + :license: BSD, see LICENSE for more details. +""" + +from pygments.formatter import Formatter +from pygments.token import Keyword, Name, Comment, String, Error, \ + Number, Operator, Generic, Token, Whitespace +from pygments.console import ansiformat +from pygments.util import get_choice_opt + + +__all__ = ['TerminalFormatter'] + + +#: Map token types to a tuple of color values for light and dark +#: backgrounds. +TERMINAL_COLORS = { + Token: ('', ''), + + Whitespace: ('lightgray', 'darkgray'), + Comment: ('lightgray', 'darkgray'), + Comment.Preproc: ('teal', 'turquoise'), + Keyword: ('darkblue', 'blue'), + Keyword.Type: ('teal', 'turquoise'), + Operator.Word: ('purple', 'fuchsia'), + Name.Builtin: ('teal', 'turquoise'), + Name.Function: ('darkgreen', 'green'), + Name.Namespace: ('_teal_', '_turquoise_'), + Name.Class: ('_darkgreen_', '_green_'), + Name.Exception: ('teal', 'turquoise'), + Name.Decorator: ('darkgray', 'lightgray'), + Name.Variable: ('darkred', 'red'), + Name.Constant: ('darkred', 'red'), + Name.Attribute: ('teal', 'turquoise'), + Name.Tag: ('blue', 'blue'), + String: ('brown', 'brown'), + Number: ('darkblue', 'blue'), + + Generic.Deleted: ('red', 'red'), + Generic.Inserted: ('darkgreen', 'green'), + Generic.Heading: ('**', '**'), + Generic.Subheading: ('*purple*', '*fuchsia*'), + Generic.Error: ('red', 'red'), + + Error: ('_red_', '_red_'), +} + + +class TerminalFormatter(Formatter): + r""" + Format tokens with ANSI color sequences, for output in a text console. + Color sequences are terminated at newlines, so that paging the output + works correctly. + + The `get_style_defs()` method doesn't do anything special since there is + no support for common styles. + + Options accepted: + + `bg` + Set to ``"light"`` or ``"dark"`` depending on the terminal's background + (default: ``"light"``). + + `colorscheme` + A dictionary mapping token types to (lightbg, darkbg) color names or + ``None`` (default: ``None`` = use builtin colorscheme). + """ + name = 'Terminal' + aliases = ['terminal', 'console'] + filenames = [] + + def __init__(self, **options): + Formatter.__init__(self, **options) + self.darkbg = get_choice_opt(options, 'bg', ['light', 'dark'], 'light') == 'dark' + self.colorscheme = options.get('colorscheme', None) or TERMINAL_COLORS + + def format(self, tokensource, outfile): + enc = self.encoding + # hack: if the output is a terminal and has an encoding set, + # use that to avoid unicode encode problems + if not enc and hasattr(outfile, "encoding") and \ + hasattr(outfile, "isatty") and outfile.isatty(): + enc = outfile.encoding + for ttype, value in tokensource: + if enc: + value = value.encode(enc) + color = self.colorscheme.get(ttype) + while color is None: + ttype = ttype[:-1] + color = self.colorscheme.get(ttype) + if color: + color = color[self.darkbg] + spl = value.split('\n') + for line in spl[:-1]: + if line: + outfile.write(ansiformat(color, line)) + outfile.write('\n') + if spl[-1]: + outfile.write(ansiformat(color, spl[-1])) + else: + outfile.write(value)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/formatters/terminal256.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,221 @@ +# -*- coding: utf-8 -*- +""" + pygments.formatters.terminal256 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + Formatter for 256-color terminal output with ANSI sequences. + + RGB-to-XTERM color conversion routines adapted from xterm256-conv + tool (http://frexx.de/xterm-256-notes/data/xterm256-conv2.tar.bz2) + by Wolfgang Frisch. + + Formatter version 1. + + :copyright: 2007 by Artem Egorkine. + :license: BSD, see LICENSE for more details. +""" + +# TODO: +# - Options to map style's bold/underline/italic/border attributes +# to some ANSI attrbutes (something like 'italic=underline') +# - An option to output "style RGB to xterm RGB/index" conversion table +# - An option to indicate that we are running in "reverse background" +# xterm. This means that default colors are white-on-black, not +# black-on-while, so colors like "white background" need to be converted +# to "white background, black foreground", etc... + +from pygments.formatter import Formatter + + +__all__ = ['Terminal256Formatter'] + + +class EscapeSequence: + def __init__(self, fg=None, bg=None, bold=False, underline=False): + self.fg = fg + self.bg = bg + self.bold = bold + self.underline = underline + + def escape(self, attrs): + if len(attrs): + return "\x1b[" + ";".join(attrs) + "m" + return "" + + def color_string(self): + attrs = [] + if self.fg is not None: + attrs.extend(("38", "5", "%i" % self.fg)) + if self.bg is not None: + attrs.extend(("48", "5", "%i" % self.bg)) + if self.bold: + attrs.append("01") + if self.underline: + attrs.append("04") + return self.escape(attrs) + + def reset_string(self): + attrs = [] + if self.fg is not None: + attrs.append("39") + if self.bg is not None: + attrs.append("49") + if self.bold or self.underline: + attrs.append("00") + return self.escape(attrs) + +class Terminal256Formatter(Formatter): + r""" + Format tokens with ANSI color sequences, for output in a 256-color + terminal or console. Like in `TerminalFormatter` color sequences + are terminated at newlines, so that paging the output works correctly. + + The formatter takes colors from a style defined by the `style` option + and converts them to nearest ANSI 256-color escape sequences. Bold and + underline attributes from the style are preserved (and displayed). + + *New in Pygments 0.9.* + + Options accepted: + + `style` + The style to use, can be a string or a Style subclass (default: + ``'default'``). + """ + name = 'Terminal256' + aliases = ['terminal256', 'console256', '256'] + filenames = [] + + def __init__(self, **options): + Formatter.__init__(self, **options) + + self.xterm_colors = [] + self.best_match = {} + self.style_string = {} + + self.usebold = 'nobold' not in options + self.useunderline = 'nounderline' not in options + + self._build_color_table() # build an RGB-to-256 color conversion table + self._setup_styles() # convert selected style's colors to term. colors + + def _build_color_table(self): + # colors 0..15: 16 basic colors + + self.xterm_colors.append((0x00, 0x00, 0x00)) # 0 + self.xterm_colors.append((0xcd, 0x00, 0x00)) # 1 + self.xterm_colors.append((0x00, 0xcd, 0x00)) # 2 + self.xterm_colors.append((0xcd, 0xcd, 0x00)) # 3 + self.xterm_colors.append((0x00, 0x00, 0xee)) # 4 + self.xterm_colors.append((0xcd, 0x00, 0xcd)) # 5 + self.xterm_colors.append((0x00, 0xcd, 0xcd)) # 6 + self.xterm_colors.append((0xe5, 0xe5, 0xe5)) # 7 + self.xterm_colors.append((0x7f, 0x7f, 0x7f)) # 8 + self.xterm_colors.append((0xff, 0x00, 0x00)) # 9 + self.xterm_colors.append((0x00, 0xff, 0x00)) # 10 + self.xterm_colors.append((0xff, 0xff, 0x00)) # 11 + self.xterm_colors.append((0x5c, 0x5c, 0xff)) # 12 + self.xterm_colors.append((0xff, 0x00, 0xff)) # 13 + self.xterm_colors.append((0x00, 0xff, 0xff)) # 14 + self.xterm_colors.append((0xff, 0xff, 0xff)) # 15 + + # colors 16..232: the 6x6x6 color cube + + valuerange = (0x00, 0x5f, 0x87, 0xaf, 0xd7, 0xff) + + for i in range(217): + r = valuerange[(i / 36) % 6] + g = valuerange[(i / 6) % 6] + b = valuerange[i % 6] + self.xterm_colors.append((r, g, b)) + + # colors 233..253: grayscale + + for i in range(1, 22): + v = 8 + i * 10 + self.xterm_colors.append((v, v, v)) + + def _closest_color(self, r, g, b): + distance = 257*257*3 # "infinity" (>distance from #000000 to #ffffff) + match = 0 + + for i in range(0, 254): + values = self.xterm_colors[i] + + rd = r - values[0] + gd = g - values[1] + bd = b - values[2] + d = rd*rd + gd*gd + bd*bd + + if d < distance: + match = i + distance = d + return match + + def _color_index(self, color): + index = self.best_match.get(color, None) + if index is None: + try: + rgb = int(str(color), 16) + except ValueError: + rgb = 0 + + r = (rgb >> 16) & 0xff + g = (rgb >> 8) & 0xff + b = rgb & 0xff + index = self._closest_color(r, g, b) + self.best_match[color] = index + return index + + def _setup_styles(self): + for ttype, ndef in self.style: + escape = EscapeSequence() + if ndef['color']: + escape.fg = self._color_index(ndef['color']) + if ndef['bgcolor']: + escape.bg = self._color_index(ndef['bgcolor']) + if self.usebold and ndef['bold']: + escape.bold = True + if self.useunderline and ndef['underline']: + escape.underline = True + self.style_string[str(ttype)] = (escape.color_string(), + escape.reset_string()) + + def format(self, tokensource, outfile): + enc = self.encoding + # hack: if the output is a terminal and has an encoding set, + # use that to avoid unicode encode problems + if not enc and hasattr(outfile, "encoding") and \ + hasattr(outfile, "isatty") and outfile.isatty(): + enc = outfile.encoding + + for ttype, value in tokensource: + if enc: + value = value.encode(enc) + + not_found = True + while ttype and not_found: + try: + #outfile.write( "<" + str(ttype) + ">" ) + on, off = self.style_string[str(ttype)] + + # Like TerminalFormatter, add "reset colors" escape sequence + # on newline. + spl = value.split('\n') + for line in spl[:-1]: + if line: + outfile.write(on + line + off) + outfile.write('\n') + if spl[-1]: + outfile.write(on + spl[-1] + off) + + not_found = False + #outfile.write( '#' + str(ttype) + '#' ) + + except KeyError: + #ottype = ttype + ttype = ttype[:-1] + #outfile.write( '!' + str(ottype) + '->' + str(ttype) + '!' ) + + if not_found: + outfile.write(value)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/lexer.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,655 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexer + ~~~~~~~~~~~~~~ + + Base lexer classes. + + :copyright: 2006-2007 by Georg Brandl. + :license: BSD, see LICENSE for more details. +""" +import re + +try: + set +except NameError: + from sets import Set as set + +from pygments.filter import apply_filters, Filter +from pygments.filters import get_filter_by_name +from pygments.token import Error, Text, Other, _TokenType +from pygments.util import get_bool_opt, get_int_opt, get_list_opt, \ + make_analysator + + +__all__ = ['Lexer', 'RegexLexer', 'ExtendedRegexLexer', 'DelegatingLexer', + 'LexerContext', 'include', 'flags', 'bygroups', 'using', 'this'] + + +_default_analyse = staticmethod(lambda x: 0.0) + + +class LexerMeta(type): + """ + This metaclass automagically converts ``analyse_text`` methods into + static methods which always return float values. + """ + + def __new__(cls, name, bases, d): + if 'analyse_text' in d: + d['analyse_text'] = make_analysator(d['analyse_text']) + return type.__new__(cls, name, bases, d) + + +class Lexer(object): + """ + Lexer for a specific language. + + Basic options recognized: + ``stripnl`` + Strip leading and trailing newlines from the input (default: True). + ``stripall`` + Strip all leading and trailing whitespace from the input + (default: False). + ``tabsize`` + If given and greater than 0, expand tabs in the input (default: 0). + ``encoding`` + If given, must be an encoding name. This encoding will be used to + convert the input string to Unicode, if it is not already a Unicode + string (default: ``'latin1'``). + Can also be ``'guess'`` to use a simple UTF-8 / Latin1 detection, or + ``'chardet'`` to use the chardet library, if it is installed. + """ + + #: Name of the lexer + name = None + + #: Shortcuts for the lexer + aliases = [] + + #: fn match rules + filenames = [] + + #: fn alias filenames + alias_filenames = [] + + #: mime types + mimetypes = [] + + __metaclass__ = LexerMeta + + def __init__(self, **options): + self.options = options + self.stripnl = get_bool_opt(options, 'stripnl', True) + self.stripall = get_bool_opt(options, 'stripall', False) + self.tabsize = get_int_opt(options, 'tabsize', 0) + self.encoding = options.get('encoding', 'latin1') + # self.encoding = options.get('inencoding', None) or self.encoding + self.filters = [] + for filter_ in get_list_opt(options, 'filters', ()): + self.add_filter(filter_) + + def __repr__(self): + if self.options: + return '<pygments.lexers.%s with %r>' % (self.__class__.__name__, + self.options) + else: + return '<pygments.lexers.%s>' % self.__class__.__name__ + + def add_filter(self, filter_, **options): + """ + Add a new stream filter to this lexer. + """ + if not isinstance(filter_, Filter): + filter_ = get_filter_by_name(filter_, **options) + self.filters.append(filter_) + + def analyse_text(text): + """ + Has to return a float between ``0`` and ``1`` that indicates + if a lexer wants to highlight this text. Used by ``guess_lexer``. + If this method returns ``0`` it won't highlight it in any case, if + it returns ``1`` highlighting with this lexer is guaranteed. + + The `LexerMeta` metaclass automatically wraps this function so + that it works like a static method (no ``self`` or ``cls`` + parameter) and the return value is automatically converted to + `float`. If the return value is an object that is boolean `False` + it's the same as if the return values was ``0.0``. + """ + + def get_tokens(self, text, unfiltered=False): + """ + Return an iterable of (tokentype, value) pairs generated from + `text`. If `unfiltered` is set to `True`, the filtering mechanism + is bypassed even if filters are defined. + + Also preprocess the text, i.e. expand tabs and strip it if + wanted and applies registered filters. + """ + if isinstance(text, unicode): + text = u'\n'.join(text.splitlines()) + else: + text = '\n'.join(text.splitlines()) + if self.encoding == 'guess': + try: + text = text.decode('utf-8') + if text.startswith(u'\ufeff'): + text = text[len(u'\ufeff'):] + except UnicodeDecodeError: + text = text.decode('latin1') + elif self.encoding == 'chardet': + try: + import chardet + except ImportError: + raise ImportError('To enable chardet encoding guessing, ' + 'please install the chardet library ' + 'from http://chardet.feedparser.org/') + enc = chardet.detect(text) + text = text.decode(enc['encoding']) + else: + text = text.decode(self.encoding) + if self.stripall: + text = text.strip() + elif self.stripnl: + text = text.strip('\n') + if self.tabsize > 0: + text = text.expandtabs(self.tabsize) + if not text.endswith('\n'): + text += '\n' + + def streamer(): + for i, t, v in self.get_tokens_unprocessed(text): + yield t, v + stream = streamer() + if not unfiltered: + stream = apply_filters(stream, self.filters, self) + return stream + + def get_tokens_unprocessed(self, text): + """ + Return an iterable of (tokentype, value) pairs. + In subclasses, implement this method as a generator to + maximize effectiveness. + """ + raise NotImplementedError + + +class DelegatingLexer(Lexer): + """ + This lexer takes two lexer as arguments. A root lexer and + a language lexer. First everything is scanned using the language + lexer, afterwards all ``Other`` tokens are lexed using the root + lexer. + + The lexers from the ``template`` lexer package use this base lexer. + """ + + def __init__(self, _root_lexer, _language_lexer, _needle=Other, **options): + self.root_lexer = _root_lexer(**options) + self.language_lexer = _language_lexer(**options) + self.needle = _needle + Lexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + buffered = '' + insertions = [] + lng_buffer = [] + for i, t, v in self.language_lexer.get_tokens_unprocessed(text): + if t is self.needle: + if lng_buffer: + insertions.append((len(buffered), lng_buffer)) + lng_buffer = [] + buffered += v + else: + lng_buffer.append((i, t, v)) + if lng_buffer: + insertions.append((len(buffered), lng_buffer)) + return do_insertions(insertions, + self.root_lexer.get_tokens_unprocessed(buffered)) + + +#------------------------------------------------------------------------------- +# RegexLexer and ExtendedRegexLexer +# + + +class include(str): + """ + Indicates that a state should include rules from another state. + """ + pass + + +class combined(tuple): + """ + Indicates a state combined from multiple states. + """ + + def __new__(cls, *args): + return tuple.__new__(cls, args) + + def __init__(self, *args): + # tuple.__init__ doesn't do anything + pass + + +class _PseudoMatch(object): + """ + A pseudo match object constructed from a string. + """ + + def __init__(self, start, text): + self._text = text + self._start = start + + def start(self, arg=None): + return self._start + + def end(self, arg=None): + return self._start + len(self._text) + + def group(self, arg=None): + if arg: + raise IndexError('No such group') + return self._text + + def groups(self): + return (self._text,) + + def groupdict(self): + return {} + + +def bygroups(*args): + """ + Callback that yields multiple actions for each group in the match. + """ + def callback(lexer, match, ctx=None): + for i, action in enumerate(args): + if action is None: + continue + elif type(action) is _TokenType: + data = match.group(i + 1) + if data: + yield match.start(i + 1), action, data + else: + if ctx: + ctx.pos = match.start(i + 1) + for item in action(lexer, _PseudoMatch(match.start(i + 1), + match.group(i + 1)), ctx): + if item: + yield item + if ctx: + ctx.pos = match.end() + return callback + + +class _This(object): + """ + Special singleton used for indicating the caller class. + Used by ``using``. + """ +this = _This() + + +def using(_other, **kwargs): + """ + Callback that processes the match with a different lexer. + + The keyword arguments are forwarded to the lexer, except `state` which + is handled separately. + + `state` specifies the state that the new lexer will start in, and can + be an enumerable such as ('root', 'inline', 'string') or a simple + string which is assumed to be on top of the root state. + + Note: For that to work, `_other` must not be an `ExtendedRegexLexer`. + """ + gt_kwargs = {} + if 'state' in kwargs: + s = kwargs.pop('state') + if isinstance(s, (list, tuple)): + gt_kwargs['stack'] = s + else: + gt_kwargs['stack'] = ('root', s) + + if _other is this: + def callback(lexer, match, ctx=None): + # if keyword arguments are given the callback + # function has to create a new lexer instance + if kwargs: + # XXX: cache that somehow + kwargs.update(lexer.options) + lx = lexer.__class__(**kwargs) + else: + lx = lexer + s = match.start() + for i, t, v in lx.get_tokens_unprocessed(match.group(), **gt_kwargs): + yield i + s, t, v + if ctx: + ctx.pos = match.end() + else: + def callback(lexer, match, ctx=None): + # XXX: cache that somehow + kwargs.update(lexer.options) + lx = _other(**kwargs) + + s = match.start() + for i, t, v in lx.get_tokens_unprocessed(match.group(), **gt_kwargs): + yield i + s, t, v + if ctx: + ctx.pos = match.end() + return callback + + +class RegexLexerMeta(LexerMeta): + """ + Metaclass for RegexLexer, creates the self._tokens attribute from + self.tokens on the first instantiation. + """ + + def _process_state(cls, unprocessed, processed, state): + assert type(state) is str, "wrong state name %r" % state + assert state[0] != '#', "invalid state name %r" % state + if state in processed: + return processed[state] + tokens = processed[state] = [] + rflags = cls.flags + for tdef in unprocessed[state]: + if isinstance(tdef, include): + # it's a state reference + assert tdef != state, "circular state reference %r" % state + tokens.extend(cls._process_state(unprocessed, processed, str(tdef))) + continue + + assert type(tdef) is tuple, "wrong rule def %r" % tdef + + try: + rex = re.compile(tdef[0], rflags).match + except Exception, err: + raise ValueError("uncompilable regex %r in state %r of %r: %s" % + (tdef[0], state, cls, err)) + + assert type(tdef[1]) is _TokenType or callable(tdef[1]), \ + 'token type must be simple type or callable, not %r' % (tdef[1],) + + if len(tdef) == 2: + new_state = None + else: + tdef2 = tdef[2] + if isinstance(tdef2, str): + # an existing state + if tdef2 == '#pop': + new_state = -1 + elif tdef2 in unprocessed: + new_state = (tdef2,) + elif tdef2 == '#push': + new_state = tdef2 + elif tdef2[:5] == '#pop:': + new_state = -int(tdef2[5:]) + else: + assert False, 'unknown new state %r' % tdef2 + elif isinstance(tdef2, combined): + # combine a new state from existing ones + new_state = '_tmp_%d' % cls._tmpname + cls._tmpname += 1 + itokens = [] + for istate in tdef2: + assert istate != state, 'circular state ref %r' % istate + itokens.extend(cls._process_state(unprocessed, + processed, istate)) + processed[new_state] = itokens + new_state = (new_state,) + elif isinstance(tdef2, tuple): + # push more than one state + for state in tdef2: + assert (state in unprocessed or + state in ('#pop', '#push')), \ + 'unknown new state ' + state + new_state = tdef2 + else: + assert False, 'unknown new state def %r' % tdef2 + tokens.append((rex, tdef[1], new_state)) + return tokens + + def process_tokendef(cls, name, tokendefs=None): + processed = cls._all_tokens[name] = {} + tokendefs = tokendefs or cls.tokens[name] + for state in tokendefs.keys(): + cls._process_state(tokendefs, processed, state) + return processed + + def __call__(cls, *args, **kwds): + if not hasattr(cls, '_tokens'): + cls._all_tokens = {} + cls._tmpname = 0 + if hasattr(cls, 'token_variants') and cls.token_variants: + # don't process yet + pass + else: + cls._tokens = cls.process_tokendef('', cls.tokens) + + return type.__call__(cls, *args, **kwds) + + +class RegexLexer(Lexer): + """ + Base for simple stateful regular expression-based lexers. + Simplifies the lexing process so that you need only + provide a list of states and regular expressions. + """ + __metaclass__ = RegexLexerMeta + + #: Flags for compiling the regular expressions. + #: Defaults to MULTILINE. + flags = re.MULTILINE + + #: Dict of ``{'state': [(regex, tokentype, new_state), ...], ...}`` + #: + #: The initial state is 'root'. + #: ``new_state`` can be omitted to signify no state transition. + #: If it is a string, the state is pushed on the stack and changed. + #: If it is a tuple of strings, all states are pushed on the stack and + #: the current state will be the topmost. + #: It can also be ``combined('state1', 'state2', ...)`` + #: to signify a new, anonymous state combined from the rules of two + #: or more existing ones. + #: Furthermore, it can be '#pop' to signify going back one step in + #: the state stack, or '#push' to push the current state on the stack + #: again. + #: + #: The tuple can also be replaced with ``include('state')``, in which + #: case the rules from the state named by the string are included in the + #: current one. + tokens = {} + + def get_tokens_unprocessed(self, text, stack=('root',)): + """ + Split ``text`` into (tokentype, text) pairs. + + ``stack`` is the inital stack (default: ``['root']``) + """ + pos = 0 + tokendefs = self._tokens + statestack = list(stack) + statetokens = tokendefs[statestack[-1]] + while 1: + for rexmatch, action, new_state in statetokens: + m = rexmatch(text, pos) + if m: + # print rex.pattern + if type(action) is _TokenType: + yield pos, action, m.group() + else: + for item in action(self, m): + yield item + pos = m.end() + if new_state is not None: + # state transition + if isinstance(new_state, tuple): + for state in new_state: + if state == '#pop': + statestack.pop() + elif state == '#push': + statestack.append(statestack[-1]) + else: + statestack.append(state) + elif isinstance(new_state, int): + # pop + del statestack[new_state:] + elif new_state == '#push': + statestack.append(statestack[-1]) + else: + assert False, "wrong state def: %r" % new_state + statetokens = tokendefs[statestack[-1]] + break + else: + try: + if text[pos] == '\n': + # at EOL, reset state to "root" + pos += 1 + statestack = ['root'] + statetokens = tokendefs['root'] + yield pos, Text, u'\n' + continue + yield pos, Error, text[pos] + pos += 1 + except IndexError: + break + + +class LexerContext(object): + """ + A helper object that holds lexer position data. + """ + + def __init__(self, text, pos, stack=None, end=None): + self.text = text + self.pos = pos + self.end = end or len(text) # end=0 not supported ;-) + self.stack = stack or ['root'] + + def __repr__(self): + return 'LexerContext(%r, %r, %r)' % ( + self.text, self.pos, self.stack) + + +class ExtendedRegexLexer(RegexLexer): + """ + A RegexLexer that uses a context object to store its state. + """ + + def get_tokens_unprocessed(self, text=None, context=None): + """ + Split ``text`` into (tokentype, text) pairs. + If ``context`` is given, use this lexer context instead. + """ + tokendefs = self._tokens + if not context: + ctx = LexerContext(text, 0) + statetokens = tokendefs['root'] + else: + ctx = context + statetokens = tokendefs[ctx.stack[-1]] + text = ctx.text + while 1: + for rexmatch, action, new_state in statetokens: + m = rexmatch(text, ctx.pos, ctx.end) + if m: + if type(action) is _TokenType: + yield ctx.pos, action, m.group() + ctx.pos = m.end() + else: + for item in action(self, m, ctx): + yield item + if not new_state: + # altered the state stack? + statetokens = tokendefs[ctx.stack[-1]] + # CAUTION: callback must set ctx.pos! + if new_state is not None: + # state transition + if isinstance(new_state, tuple): + ctx.stack.extend(new_state) + elif isinstance(new_state, int): + # pop + del ctx.stack[new_state:] + elif new_state == '#push': + ctx.stack.append(ctx.stack[-1]) + else: + assert False, "wrong state def: %r" % new_state + statetokens = tokendefs[ctx.stack[-1]] + break + else: + try: + if ctx.pos >= ctx.end: + break + if text[ctx.pos] == '\n': + # at EOL, reset state to "root" + ctx.pos += 1 + ctx.stack = ['root'] + statetokens = tokendefs['root'] + yield ctx.pos, Text, u'\n' + continue + yield ctx.pos, Error, text[ctx.pos] + ctx.pos += 1 + except IndexError: + break + + +def do_insertions(insertions, tokens): + """ + Helper for lexers which must combine the results of several + sublexers. + + ``insertions`` is a list of ``(index, itokens)`` pairs. + Each ``itokens`` iterable should be inserted at position + ``index`` into the token stream given by the ``tokens`` + argument. + + The result is a combined token stream. + + TODO: clean up the code here. + """ + insertions = iter(insertions) + try: + index, itokens = insertions.next() + except StopIteration: + # no insertions + for item in tokens: + yield item + return + + realpos = None + insleft = True + + # iterate over the token stream where we want to insert + # the tokens from the insertion list. + for i, t, v in tokens: + # first iteration. store the postition of first item + if realpos is None: + realpos = i + oldi = 0 + while insleft and i + len(v) >= index: + tmpval = v[oldi:index - i] + yield realpos, t, tmpval + realpos += len(tmpval) + for it_index, it_token, it_value in itokens: + yield realpos, it_token, it_value + realpos += len(it_value) + oldi = index - i + try: + index, itokens = insertions.next() + except StopIteration: + insleft = False + break # not strictly necessary + yield realpos, t, v[oldi:] + realpos += len(v) - oldi + + # leftover tokens + if insleft: + # no normal tokens, set realpos to zero + realpos = realpos or 0 + for p, t, v in itokens: + yield realpos, t, v + realpos += len(v)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/lexers/__init__.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,208 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers + ~~~~~~~~~~~~~~~ + + Pygments lexers. + + :copyright: 2006-2007 by Georg Brandl. + :license: BSD, see LICENSE for more details. +""" +import fnmatch +import types +from os.path import basename + +try: + set +except NameError: + from sets import Set as set + +from pygments.lexers._mapping import LEXERS +from pygments.plugin import find_plugin_lexers +from pygments.util import ClassNotFound + + +__all__ = ['get_lexer_by_name', 'get_lexer_for_filename', 'find_lexer_class', + 'guess_lexer'] + LEXERS.keys() + +_lexer_cache = {} + + +def _load_lexers(module_name): + """ + Load a lexer (and all others in the module too). + """ + mod = __import__(module_name, None, None, ['__all__']) + for lexer_name in mod.__all__: + cls = getattr(mod, lexer_name) + _lexer_cache[cls.name] = cls + + +def get_all_lexers(): + """ + Return a generator of tuples in the form ``(name, aliases, + filenames, mimetypes)`` of all know lexers. + """ + for item in LEXERS.itervalues(): + yield item[1:] + for lexer in find_plugin_lexers(): + yield lexer.name, lexer.aliases, lexer.filenames, lexer.mimetypes + + +def find_lexer_class(name): + """ + Lookup a lexer class by name. Return None if not found. + """ + if name in _lexer_cache: + return _lexer_cache[name] + # lookup builtin lexers + for module_name, lname, aliases, _, _ in LEXERS.itervalues(): + if name == lname: + _load_lexers(module_name) + return _lexer_cache[name] + # continue with lexers from setuptools entrypoints + for cls in find_plugin_lexers(): + if cls.name == name: + return cls + + +def get_lexer_by_name(_alias, **options): + """ + Get a lexer by an alias. + """ + # lookup builtin lexers + for module_name, name, aliases, _, _ in LEXERS.itervalues(): + if _alias in aliases: + if name not in _lexer_cache: + _load_lexers(module_name) + return _lexer_cache[name](**options) + # continue with lexers from setuptools entrypoints + for cls in find_plugin_lexers(): + if _alias in cls.aliases: + return cls(**options) + raise ClassNotFound('no lexer for alias %r found' % _alias) + + +def get_lexer_for_filename(_fn, **options): + """ + Get a lexer for a filename. + """ + fn = basename(_fn) + for modname, name, _, filenames, _ in LEXERS.itervalues(): + for filename in filenames: + if fnmatch.fnmatch(fn, filename): + if name not in _lexer_cache: + _load_lexers(modname) + return _lexer_cache[name](**options) + for cls in find_plugin_lexers(): + for filename in cls.filenames: + if fnmatch.fnmatch(fn, filename): + return cls(**options) + raise ClassNotFound('no lexer for filename %r found' % _fn) + + +def get_lexer_for_mimetype(_mime, **options): + """ + Get a lexer for a mimetype. + """ + for modname, name, _, _, mimetypes in LEXERS.itervalues(): + if _mime in mimetypes: + if name not in _lexer_cache: + _load_lexers(modname) + return _lexer_cache[name](**options) + for cls in find_plugin_lexers(): + if _mime in cls.mimetypes: + return cls(**options) + raise ClassNotFound('no lexer for mimetype %r found' % _mime) + + +def _iter_lexerclasses(): + """ + Return an iterator over all lexer classes. + """ + for module_name, name, _, _, _ in LEXERS.itervalues(): + if name not in _lexer_cache: + _load_lexers(module_name) + yield _lexer_cache[name] + for lexer in find_plugin_lexers(): + yield lexer + + +def guess_lexer_for_filename(_fn, _text, **options): + """ + Lookup all lexers that handle those filenames primary (``filenames``) + or secondary (``alias_filenames``). Then run a text analysis for those + lexers and choose the best result. + + usage:: + + >>> from pygments.lexers import guess_lexer_for_filename + >>> guess_lexer_for_filename('hello.html', '<%= @foo %>') + <pygments.lexers.templates.RhtmlLexer object at 0xb7d2f32c> + >>> guess_lexer_for_filename('hello.html', '<h1>{{ title|e }}</h1>') + <pygments.lexers.templates.HtmlDjangoLexer object at 0xb7d2f2ac> + >>> guess_lexer_for_filename('style.css', 'a { color: <?= $link ?> }') + <pygments.lexers.templates.CssPhpLexer object at 0xb7ba518c> + """ + fn = basename(_fn) + primary = None + matching_lexers = set() + for lexer in _iter_lexerclasses(): + for filename in lexer.filenames: + if fnmatch.fnmatch(fn, filename): + matching_lexers.add(lexer) + primary = lexer + for filename in lexer.alias_filenames: + if fnmatch.fnmatch(fn, filename): + matching_lexers.add(lexer) + if not matching_lexers: + raise ClassNotFound('no lexer for filename %r found' % fn) + if len(matching_lexers) == 1: + return matching_lexers.pop()(**options) + result = [] + for lexer in matching_lexers: + rv = lexer.analyse_text(_text) + if rv == 1.0: + return lexer(**options) + result.append((rv, lexer)) + result.sort() + if not result[-1][0] and primary is not None: + return primary(**options) + return result[-1][1](**options) + + +def guess_lexer(_text, **options): + """ + Guess a lexer by strong distinctions in the text (eg, shebang). + """ + best_lexer = [0.0, None] + for lexer in _iter_lexerclasses(): + rv = lexer.analyse_text(_text) + if rv == 1.0: + return lexer(**options) + if rv > best_lexer[0]: + best_lexer[:] = (rv, lexer) + if not best_lexer[0] or best_lexer[1] is None: + raise ClassNotFound('no lexer matching the text found') + return best_lexer[1](**options) + + +class _automodule(types.ModuleType): + """Automatically import lexers.""" + + def __getattr__(self, name): + info = LEXERS.get(name) + if info: + _load_lexers(info[0]) + cls = _lexer_cache[info[1]] + setattr(self, name, cls) + return cls + raise AttributeError(name) + + +import sys +oldmod = sys.modules['pygments.lexers'] +newmod = _automodule('pygments.lexers') +newmod.__dict__.update(oldmod.__dict__) +sys.modules['pygments.lexers'] = newmod +del newmod.newmod, newmod.oldmod, newmod.sys, newmod.types
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/lexers/_clbuiltins.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,232 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers._clbuiltins + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + ANSI Common Lisp builtins. + + :copyright: 2006-2007 by Matteo Sasso. + :license: BSD, see LICENSE for more details. +""" + +BUILTIN_FUNCTIONS = [ # 638 functions + '<', '<=', '=', '>', '>=', '-', '/', '/=', '*', '+', '1-', '1+', + 'abort', 'abs', 'acons', 'acos', 'acosh', 'add-method', 'adjoin', + 'adjustable-array-p', 'adjust-array', 'allocate-instance', + 'alpha-char-p', 'alphanumericp', 'append', 'apply', 'apropos', + 'apropos-list', 'aref', 'arithmetic-error-operands', + 'arithmetic-error-operation', 'array-dimension', 'array-dimensions', + 'array-displacement', 'array-element-type', 'array-has-fill-pointer-p', + 'array-in-bounds-p', 'arrayp', 'array-rank', 'array-row-major-index', + 'array-total-size', 'ash', 'asin', 'asinh', 'assoc', 'assoc-if', + 'assoc-if-not', 'atan', 'atanh', 'atom', 'bit', 'bit-and', 'bit-andc1', + 'bit-andc2', 'bit-eqv', 'bit-ior', 'bit-nand', 'bit-nor', 'bit-not', + 'bit-orc1', 'bit-orc2', 'bit-vector-p', 'bit-xor', 'boole', + 'both-case-p', 'boundp', 'break', 'broadcast-stream-streams', + 'butlast', 'byte', 'byte-position', 'byte-size', 'caaaar', 'caaadr', + 'caaar', 'caadar', 'caaddr', 'caadr', 'caar', 'cadaar', 'cadadr', + 'cadar', 'caddar', 'cadddr', 'caddr', 'cadr', 'call-next-method', 'car', + 'cdaaar', 'cdaadr', 'cdaar', 'cdadar', 'cdaddr', 'cdadr', 'cdar', + 'cddaar', 'cddadr', 'cddar', 'cdddar', 'cddddr', 'cdddr', 'cddr', 'cdr', + 'ceiling', 'cell-error-name', 'cerror', 'change-class', 'char', 'char<', + 'char<=', 'char=', 'char>', 'char>=', 'char/=', 'character', + 'characterp', 'char-code', 'char-downcase', 'char-equal', + 'char-greaterp', 'char-int', 'char-lessp', 'char-name', + 'char-not-equal', 'char-not-greaterp', 'char-not-lessp', 'char-upcase', + 'cis', 'class-name', 'class-of', 'clear-input', 'clear-output', + 'close', 'clrhash', 'code-char', 'coerce', 'compile', + 'compiled-function-p', 'compile-file', 'compile-file-pathname', + 'compiler-macro-function', 'complement', 'complex', 'complexp', + 'compute-applicable-methods', 'compute-restarts', 'concatenate', + 'concatenated-stream-streams', 'conjugate', 'cons', 'consp', + 'constantly', 'constantp', 'continue', 'copy-alist', 'copy-list', + 'copy-pprint-dispatch', 'copy-readtable', 'copy-seq', 'copy-structure', + 'copy-symbol', 'copy-tree', 'cos', 'cosh', 'count', 'count-if', + 'count-if-not', 'decode-float', 'decode-universal-time', 'delete', + 'delete-duplicates', 'delete-file', 'delete-if', 'delete-if-not', + 'delete-package', 'denominator', 'deposit-field', 'describe', + 'describe-object', 'digit-char', 'digit-char-p', 'directory', + 'directory-namestring', 'disassemble', 'documentation', 'dpb', + 'dribble', 'echo-stream-input-stream', 'echo-stream-output-stream', + 'ed', 'eighth', 'elt', 'encode-universal-time', 'endp', + 'enough-namestring', 'ensure-directories-exist', + 'ensure-generic-function', 'eq', 'eql', 'equal', 'equalp', 'error', + 'eval', 'evenp', 'every', 'exp', 'export', 'expt', 'fboundp', + 'fceiling', 'fdefinition', 'ffloor', 'fifth', 'file-author', + 'file-error-pathname', 'file-length', 'file-namestring', + 'file-position', 'file-string-length', 'file-write-date', + 'fill', 'fill-pointer', 'find', 'find-all-symbols', 'find-class', + 'find-if', 'find-if-not', 'find-method', 'find-package', 'find-restart', + 'find-symbol', 'finish-output', 'first', 'float', 'float-digits', + 'floatp', 'float-precision', 'float-radix', 'float-sign', 'floor', + 'fmakunbound', 'force-output', 'format', 'fourth', 'fresh-line', + 'fround', 'ftruncate', 'funcall', 'function-keywords', + 'function-lambda-expression', 'functionp', 'gcd', 'gensym', 'gentemp', + 'get', 'get-decoded-time', 'get-dispatch-macro-character', 'getf', + 'gethash', 'get-internal-real-time', 'get-internal-run-time', + 'get-macro-character', 'get-output-stream-string', 'get-properties', + 'get-setf-expansion', 'get-universal-time', 'graphic-char-p', + 'hash-table-count', 'hash-table-p', 'hash-table-rehash-size', + 'hash-table-rehash-threshold', 'hash-table-size', 'hash-table-test', + 'host-namestring', 'identity', 'imagpart', 'import', + 'initialize-instance', 'input-stream-p', 'inspect', + 'integer-decode-float', 'integer-length', 'integerp', + 'interactive-stream-p', 'intern', 'intersection', + 'invalid-method-error', 'invoke-debugger', 'invoke-restart', + 'invoke-restart-interactively', 'isqrt', 'keywordp', 'last', 'lcm', + 'ldb', 'ldb-test', 'ldiff', 'length', 'lisp-implementation-type', + 'lisp-implementation-version', 'list', 'list*', 'list-all-packages', + 'listen', 'list-length', 'listp', 'load', + 'load-logical-pathname-translations', 'log', 'logand', 'logandc1', + 'logandc2', 'logbitp', 'logcount', 'logeqv', 'logical-pathname', + 'logical-pathname-translations', 'logior', 'lognand', 'lognor', + 'lognot', 'logorc1', 'logorc2', 'logtest', 'logxor', 'long-site-name', + 'lower-case-p', 'machine-instance', 'machine-type', 'machine-version', + 'macroexpand', 'macroexpand-1', 'macro-function', 'make-array', + 'make-broadcast-stream', 'make-concatenated-stream', 'make-condition', + 'make-dispatch-macro-character', 'make-echo-stream', 'make-hash-table', + 'make-instance', 'make-instances-obsolete', 'make-list', + 'make-load-form', 'make-load-form-saving-slots', 'make-package', + 'make-pathname', 'make-random-state', 'make-sequence', 'make-string', + 'make-string-input-stream', 'make-string-output-stream', 'make-symbol', + 'make-synonym-stream', 'make-two-way-stream', 'makunbound', 'map', + 'mapc', 'mapcan', 'mapcar', 'mapcon', 'maphash', 'map-into', 'mapl', + 'maplist', 'mask-field', 'max', 'member', 'member-if', 'member-if-not', + 'merge', 'merge-pathnames', 'method-combination-error', + 'method-qualifiers', 'min', 'minusp', 'mismatch', 'mod', + 'muffle-warning', 'name-char', 'namestring', 'nbutlast', 'nconc', + 'next-method-p', 'nintersection', 'ninth', 'no-applicable-method', + 'no-next-method', 'not', 'notany', 'notevery', 'nreconc', 'nreverse', + 'nset-difference', 'nset-exclusive-or', 'nstring-capitalize', + 'nstring-downcase', 'nstring-upcase', 'nsublis', 'nsubst', 'nsubst-if', + 'nsubst-if-not', 'nsubstitute', 'nsubstitute-if', 'nsubstitute-if-not', + 'nth', 'nthcdr', 'null', 'numberp', 'numerator', 'nunion', 'oddp', + 'open', 'open-stream-p', 'output-stream-p', 'package-error-package', + 'package-name', 'package-nicknames', 'packagep', + 'package-shadowing-symbols', 'package-used-by-list', 'package-use-list', + 'pairlis', 'parse-integer', 'parse-namestring', 'pathname', + 'pathname-device', 'pathname-directory', 'pathname-host', + 'pathname-match-p', 'pathname-name', 'pathnamep', 'pathname-type', + 'pathname-version', 'peek-char', 'phase', 'plusp', 'position', + 'position-if', 'position-if-not', 'pprint', 'pprint-dispatch', + 'pprint-fill', 'pprint-indent', 'pprint-linear', 'pprint-newline', + 'pprint-tab', 'pprint-tabular', 'prin1', 'prin1-to-string', 'princ', + 'princ-to-string', 'print', 'print-object', 'probe-file', 'proclaim', + 'provide', 'random', 'random-state-p', 'rassoc', 'rassoc-if', + 'rassoc-if-not', 'rational', 'rationalize', 'rationalp', 'read', + 'read-byte', 'read-char', 'read-char-no-hang', 'read-delimited-list', + 'read-from-string', 'read-line', 'read-preserving-whitespace', + 'read-sequence', 'readtable-case', 'readtablep', 'realp', 'realpart', + 'reduce', 'reinitialize-instance', 'rem', 'remhash', 'remove', + 'remove-duplicates', 'remove-if', 'remove-if-not', 'remove-method', + 'remprop', 'rename-file', 'rename-package', 'replace', 'require', + 'rest', 'restart-name', 'revappend', 'reverse', 'room', 'round', + 'row-major-aref', 'rplaca', 'rplacd', 'sbit', 'scale-float', 'schar', + 'search', 'second', 'set', 'set-difference', + 'set-dispatch-macro-character', 'set-exclusive-or', + 'set-macro-character', 'set-pprint-dispatch', 'set-syntax-from-char', + 'seventh', 'shadow', 'shadowing-import', 'shared-initialize', + 'short-site-name', 'signal', 'signum', 'simple-bit-vector-p', + 'simple-condition-format-arguments', 'simple-condition-format-control', + 'simple-string-p', 'simple-vector-p', 'sin', 'sinh', 'sixth', 'sleep', + 'slot-boundp', 'slot-exists-p', 'slot-makunbound', 'slot-missing', + 'slot-unbound', 'slot-value', 'software-type', 'software-version', + 'some', 'sort', 'special-operator-p', 'sqrt', 'stable-sort', + 'standard-char-p', 'store-value', 'stream-element-type', + 'stream-error-stream', 'stream-external-format', 'streamp', 'string', + 'string<', 'string<=', 'string=', 'string>', 'string>=', 'string/=', + 'string-capitalize', 'string-downcase', 'string-equal', + 'string-greaterp', 'string-left-trim', 'string-lessp', + 'string-not-equal', 'string-not-greaterp', 'string-not-lessp', + 'stringp', 'string-right-trim', 'string-trim', 'string-upcase', + 'sublis', 'subseq', 'subsetp', 'subst', 'subst-if', 'subst-if-not', + 'substitute', 'substitute-if', 'substitute-if-not', 'subtypep','svref', + 'sxhash', 'symbol-function', 'symbol-name', 'symbolp', 'symbol-package', + 'symbol-plist', 'symbol-value', 'synonym-stream-symbol', 'syntax:', + 'tailp', 'tan', 'tanh', 'tenth', 'terpri', 'third', + 'translate-logical-pathname', 'translate-pathname', 'tree-equal', + 'truename', 'truncate', 'two-way-stream-input-stream', + 'two-way-stream-output-stream', 'type-error-datum', + 'type-error-expected-type', 'type-of', 'typep', 'unbound-slot-instance', + 'unexport', 'unintern', 'union', 'unread-char', 'unuse-package', + 'update-instance-for-different-class', + 'update-instance-for-redefined-class', 'upgraded-array-element-type', + 'upgraded-complex-part-type', 'upper-case-p', 'use-package', + 'user-homedir-pathname', 'use-value', 'values', 'values-list', 'vector', + 'vectorp', 'vector-pop', 'vector-push', 'vector-push-extend', 'warn', + 'wild-pathname-p', 'write', 'write-byte', 'write-char', 'write-line', + 'write-sequence', 'write-string', 'write-to-string', 'yes-or-no-p', + 'y-or-n-p', 'zerop', +] + +SPECIAL_FORMS = [ + 'block', 'catch', 'declare', 'eval-when', 'flet', 'function', 'go', 'if', + 'labels', 'lambda', 'let', 'let*', 'load-time-value', 'locally', 'macrolet', + 'multiple-value-call', 'multiple-value-prog1', 'progn', 'progv', 'quote', + 'return-from', 'setq', 'symbol-macrolet', 'tagbody', 'the', 'throw', + 'unwind-protect', +] + +MACROS = [ + 'and', 'assert', 'call-method', 'case', 'ccase', 'check-type', 'cond', + 'ctypecase', 'decf', 'declaim', 'defclass', 'defconstant', 'defgeneric', + 'define-compiler-macro', 'define-condition', 'define-method-combination', + 'define-modify-macro', 'define-setf-expander', 'define-symbol-macro', + 'defmacro', 'defmethod', 'defpackage', 'defparameter', 'defsetf', + 'defstruct', 'deftype', 'defun', 'defvar', 'destructuring-bind', 'do', + 'do*', 'do-all-symbols', 'do-external-symbols', 'dolist', 'do-symbols', + 'dotimes', 'ecase', 'etypecase', 'formatter', 'handler-bind', + 'handler-case', 'ignore-errors', 'incf', 'in-package', 'lambda', 'loop', + 'loop-finish', 'make-method', 'multiple-value-bind', 'multiple-value-list', + 'multiple-value-setq', 'nth-value', 'or', 'pop', + 'pprint-exit-if-list-exhausted', 'pprint-logical-block', 'pprint-pop', + 'print-unreadable-object', 'prog', 'prog*', 'prog1', 'prog2', 'psetf', + 'psetq', 'push', 'pushnew', 'remf', 'restart-bind', 'restart-case', + 'return', 'rotatef', 'setf', 'shiftf', 'step', 'time', 'trace', 'typecase', + 'unless', 'untrace', 'when', 'with-accessors', 'with-compilation-unit', + 'with-condition-restarts', 'with-hash-table-iterator', + 'with-input-from-string', 'with-open-file', 'with-open-stream', + 'with-output-to-string', 'with-package-iterator', 'with-simple-restart', + 'with-slots', 'with-standard-io-syntax', +] + +LAMBDA_LIST_KEYWORDS = [ + '&allow-other-keys', '&aux', '&body', '&environment', '&key', '&optional', + '&rest', '&whole', +] + +DECLARATIONS = [ + 'dynamic-extent', 'ignore', 'optimize', 'ftype', 'inline', 'special', + 'ignorable', 'notinline', 'type', +] + +BUILTIN_TYPES = [ + 'atom', 'boolean', 'base-char', 'base-string', 'bignum', 'bit', + 'compiled-function', 'extended-char', 'fixnum', 'keyword', 'nil', + 'signed-byte', 'short-float', 'single-float', 'double-float', 'long-float', + 'simple-array', 'simple-base-string', 'simple-bit-vector', 'simple-string', + 'simple-vector', 'standard-char', 'unsigned-byte', + + # Condition Types + 'arithmetic-error', 'cell-error', 'condition', 'control-error', + 'division-by-zero', 'end-of-file', 'error', 'file-error', + 'floating-point-inexact', 'floating-point-overflow', + 'floating-point-underflow', 'floating-point-invalid-operation', + 'parse-error', 'package-error', 'print-not-readable', 'program-error', + 'reader-error', 'serious-condition', 'simple-condition', 'simple-error', + 'simple-type-error', 'simple-warning', 'stream-error', 'storage-condition', + 'style-warning', 'type-error', 'unbound-variable', 'unbound-slot', + 'undefined-function', 'warning', +] + +BUILTIN_CLASSES = [ + 'array', 'broadcast-stream', 'bit-vector', 'built-in-class', 'character', + 'class', 'complex', 'concatenated-stream', 'cons', 'echo-stream', + 'file-stream', 'float', 'function', 'generic-function', 'hash-table', + 'integer', 'list', 'logical-pathname', 'method-combination', 'method', + 'null', 'number', 'package', 'pathname', 'ratio', 'rational', 'readtable', + 'real', 'random-state', 'restart', 'sequence', 'standard-class', + 'standard-generic-function', 'standard-method', 'standard-object', + 'string-stream', 'stream', 'string', 'structure-class', 'structure-object', + 'symbol', 'synonym-stream', 't', 'two-way-stream', 'vector', +]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/lexers/_luabuiltins.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,256 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers._luabuiltins + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + This file contains the names and modules of lua functions + It is able to re-generate itself, but for adding new functions you + probably have to add some callbacks (see function module_callbacks). + + Do not edit the MODULES dict by hand. + + :copyright: 2006-2007 by Lukas Meuser. + :license: BSD, see LICENSE for more details. +""" + +MODULES = {'basic': ['_G', + '_VERSION', + 'assert', + 'collectgarbage', + 'dofile', + 'error', + 'getfenv', + 'getmetatable', + 'ipairs', + 'load', + 'loadfile', + 'loadstring', + 'next', + 'pairs', + 'pcall', + 'print', + 'rawequal', + 'rawget', + 'rawset', + 'select', + 'setfenv', + 'setmetatable', + 'tonumber', + 'tostring', + 'type', + 'unpack', + 'xpcall'], + 'coroutine': ['coroutine.create', + 'coroutine.resume', + 'coroutine.running', + 'coroutine.status', + 'coroutine.wrap', + 'coroutine.yield'], + 'debug': ['debug.debug', + 'debug.getfenv', + 'debug.gethook', + 'debug.getinfo', + 'debug.getlocal', + 'debug.getmetatable', + 'debug.getregistry', + 'debug.getupvalue', + 'debug.setfenv', + 'debug.sethook', + 'debug.setlocal', + 'debug.setmetatable', + 'debug.setupvalue', + 'debug.traceback'], + 'io': ['file:close', + 'file:flush', + 'file:lines', + 'file:read', + 'file:seek', + 'file:setvbuf', + 'file:write', + 'io.close', + 'io.flush', + 'io.input', + 'io.lines', + 'io.open', + 'io.output', + 'io.popen', + 'io.read', + 'io.tmpfile', + 'io.type', + 'io.write'], + 'math': ['math.abs', + 'math.acos', + 'math.asin', + 'math.atan2', + 'math.atan', + 'math.ceil', + 'math.cosh', + 'math.cos', + 'math.deg', + 'math.exp', + 'math.floor', + 'math.fmod', + 'math.frexp', + 'math.huge', + 'math.ldexp', + 'math.log10', + 'math.log', + 'math.max', + 'math.min', + 'math.modf', + 'math.pi', + 'math.pow', + 'math.rad', + 'math.random', + 'math.randomseed', + 'math.sinh', + 'math.sin', + 'math.sqrt', + 'math.tanh', + 'math.tan'], + 'modules': ['module', + 'require', + 'package.cpath', + 'package.loaded', + 'package.loadlib', + 'package.path', + 'package.preload', + 'package.seeall'], + 'os': ['os.clock', + 'os.date', + 'os.difftime', + 'os.execute', + 'os.exit', + 'os.getenv', + 'os.remove', + 'os.rename', + 'os.setlocale', + 'os.time', + 'os.tmpname'], + 'string': ['string.byte', + 'string.char', + 'string.dump', + 'string.find', + 'string.format', + 'string.gmatch', + 'string.gsub', + 'string.len', + 'string.lower', + 'string.match', + 'string.rep', + 'string.reverse', + 'string.sub', + 'string.upper'], + 'table': ['table.concat', + 'table.insert', + 'table.maxn', + 'table.remove', + 'table.sort']} + +if __name__ == '__main__': + import re + import urllib + import pprint + + # you can't generally find out what module a function belongs to if you + # have only its name. Because of this, here are some callback functions + # that recognize if a gioven function belongs to a specific module + def module_callbacks(): + def is_in_coroutine_module(name): + return name.startswith('coroutine.') + + def is_in_modules_module(name): + if name in ['require', 'module'] or name.startswith('package'): + return True + else: + return False + + def is_in_string_module(name): + return name.startswith('string.') + + def is_in_table_module(name): + return name.startswith('table.') + + def is_in_math_module(name): + return name.startswith('math') + + def is_in_io_module(name): + return name.startswith('io.') or name.startswith('file:') + + def is_in_os_module(name): + return name.startswith('os.') + + def is_in_debug_module(name): + return name.startswith('debug.') + + return {'coroutine': is_in_coroutine_module, + 'modules': is_in_modules_module, + 'string': is_in_string_module, + 'table': is_in_table_module, + 'math': is_in_math_module, + 'io': is_in_io_module, + 'os': is_in_os_module, + 'debug': is_in_debug_module} + + + + def get_newest_version(): + f = urllib.urlopen('http://www.lua.org/manual/') + r = re.compile(r'^<A HREF="(\d\.\d)/">Lua \1</A>') + for line in f: + m = r.match(line) + if m is not None: + return m.groups()[0] + + def get_lua_functions(version): + f = urllib.urlopen('http://www.lua.org/manual/%s/' % version) + r = re.compile(r'^<A HREF="manual.html#pdf-(.+)">\1</A>') + functions = [] + for line in f: + m = r.match(line) + if m is not None: + functions.append(m.groups()[0]) + return functions + + def get_function_module(name): + for mod, cb in module_callbacks().iteritems(): + if cb(name): + return mod + if '.' in name: + return name.split('.')[0] + else: + return 'basic' + + def regenerate(filename, modules): + f = file(filename) + try: + content = f.read() + finally: + f.close() + + header = content[:content.find('MODULES = {')] + footer = content[content.find("if __name__ == '__main__':"):] + + + f = file(filename, 'w') + f.write(header) + f.write('MODULES = %s\n\n' % pprint.pformat(modules)) + f.write(footer) + f.close() + + def run(): + version = get_newest_version() + print '> Downloading function index for Lua %s' % version + functions = get_lua_functions(version) + print '> %d functions found:' % len(functions) + + modules = {} + for full_function_name in functions: + print '>> %s' % full_function_name + m = get_function_module(full_function_name) + modules.setdefault(m, []).append(full_function_name) + + regenerate(__file__, modules) + + + run()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/lexers/_mapping.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers._mapping + ~~~~~~~~~~~~~~~~~~~~~~~~ + + Lexer mapping defintions. This file is generated by itself. Everytime + you change something on a builtin lexer defintion, run this script from + the lexers folder to update it. + + Do not alter the LEXERS dictionary by hand. + + :copyright: 2006-2007 by Armin Ronacher, Georg Brandl. + :license: BSD, see LICENSE for more details. +""" + +LEXERS = { + 'ActionScript3Lexer': ('pygments.lexers.web', 'ActionScript 3', ('as3', 'actionscript3'), ('*.as',), ('application/x-actionscript', 'text/x-actionscript', 'text/actionscript')), + 'ActionScriptLexer': ('pygments.lexers.web', 'ActionScript', ('as', 'actionscript'), ('*.as',), ('application/x-actionscript', 'text/x-actionscript', 'text/actionscript')), + 'ApacheConfLexer': ('pygments.lexers.text', 'ApacheConf', ('apacheconf', 'aconf', 'apache'), ('.htaccess', 'apache.conf', 'apache2.conf'), ('text/x-apacheconf',)), + 'BBCodeLexer': ('pygments.lexers.text', 'BBCode', ('bbcode',), (), ('text/x-bbcode',)), + 'BaseMakefileLexer': ('pygments.lexers.text', 'Makefile', ('basemake',), (), ()), + 'BashLexer': ('pygments.lexers.other', 'Bash', ('bash', 'sh'), ('*.sh',), ('application/x-sh', 'application/x-shellscript')), + 'BatchLexer': ('pygments.lexers.other', 'Batchfile', ('bat',), ('*.bat', '*.cmd'), ('application/x-dos-batch',)), + 'BefungeLexer': ('pygments.lexers.other', 'Befunge', ('befunge',), ('*.befunge',), ('application/x-befunge',)), + 'BooLexer': ('pygments.lexers.dotnet', 'Boo', ('boo',), ('*.boo',), ('text/x-boo',)), + 'BrainfuckLexer': ('pygments.lexers.other', 'Brainfuck', ('brainfuck', 'bf'), ('*.bf', '*.b'), ('application/x-brainfuck',)), + 'CLexer': ('pygments.lexers.compiled', 'C', ('c',), ('*.c', '*.h'), ('text/x-chdr', 'text/x-csrc')), + 'CObjdumpLexer': ('pygments.lexers.asm', 'c-objdump', ('c-objdump',), ('*.c-objdump',), ('text/x-c-objdump',)), + 'CSharpLexer': ('pygments.lexers.dotnet', 'C#', ('csharp', 'c#'), ('*.cs',), ('text/x-csharp',)), + 'CheetahHtmlLexer': ('pygments.lexers.templates', 'HTML+Cheetah', ('html+cheetah', 'html+spitfire'), (), ('text/html+cheetah', 'text/html+spitfire')), + 'CheetahJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Cheetah', ('js+cheetah', 'javascript+cheetah', 'js+spitfire', 'javascript+spitfire'), (), ('application/x-javascript+cheetah', 'text/x-javascript+cheetah', 'text/javascript+cheetah', 'application/x-javascript+spitfire', 'text/x-javascript+spitfire', 'text/javascript+spitfire')), + 'CheetahLexer': ('pygments.lexers.templates', 'Cheetah', ('cheetah', 'spitfire'), ('*.tmpl', '*.spt'), ('application/x-cheetah', 'application/x-spitfire')), + 'CheetahXmlLexer': ('pygments.lexers.templates', 'XML+Cheetah', ('xml+cheetah', 'xml+spitfire'), (), ('application/xml+cheetah', 'application/xml+spitfire')), + 'ClojureLexer': ('pygments.lexers.agile', 'Clojure', ('clojure', 'clj'), ('*.clj',), ('text/x-clojure', 'application/x-clojure')), + 'CommonLispLexer': ('pygments.lexers.functional', 'Common Lisp', ('common-lisp', 'cl'), ('*.cl', '*.lisp', '*.el'), ('text/x-common-lisp',)), + 'CppLexer': ('pygments.lexers.compiled', 'C++', ('cpp', 'c++'), ('*.cpp', '*.hpp', '*.c++', '*.h++', '*.cc', '*.hh', '*.cxx', '*.hxx'), ('text/x-c++hdr', 'text/x-c++src')), + 'CppObjdumpLexer': ('pygments.lexers.asm', 'cpp-objdump', ('cpp-objdump', 'c++-objdumb', 'cxx-objdump'), ('*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump'), ('text/x-cpp-objdump',)), + 'CssDjangoLexer': ('pygments.lexers.templates', 'CSS+Django/Jinja', ('css+django', 'css+jinja'), (), ('text/css+django', 'text/css+jinja')), + 'CssErbLexer': ('pygments.lexers.templates', 'CSS+Ruby', ('css+erb', 'css+ruby'), (), ('text/css+ruby',)), + 'CssGenshiLexer': ('pygments.lexers.templates', 'CSS+Genshi Text', ('css+genshitext', 'css+genshi'), (), ('text/css+genshi',)), + 'CssLexer': ('pygments.lexers.web', 'CSS', ('css',), ('*.css',), ('text/css',)), + 'CssPhpLexer': ('pygments.lexers.templates', 'CSS+PHP', ('css+php',), (), ('text/css+php',)), + 'CssSmartyLexer': ('pygments.lexers.templates', 'CSS+Smarty', ('css+smarty',), (), ('text/css+smarty',)), + 'DLexer': ('pygments.lexers.compiled', 'D', ('d',), ('*.d', '*.di'), ('text/x-dsrc',)), + 'DObjdumpLexer': ('pygments.lexers.asm', 'd-objdump', ('d-objdump',), ('*.d-objdump',), ('text/x-d-objdump',)), + 'DarcsPatchLexer': ('pygments.lexers.text', 'Darcs Patch', ('dpatch',), ('*.dpatch', '*.darcspatch'), ()), + 'DebianControlLexer': ('pygments.lexers.text', 'Debian Control file', ('control',), ('control',), ()), + 'DelphiLexer': ('pygments.lexers.compiled', 'Delphi', ('delphi', 'pas', 'pascal', 'objectpascal'), ('*.pas',), ('text/x-pascal',)), + 'DiffLexer': ('pygments.lexers.text', 'Diff', ('diff',), ('*.diff', '*.patch'), ('text/x-diff', 'text/x-patch')), + 'DjangoLexer': ('pygments.lexers.templates', 'Django/Jinja', ('django', 'jinja'), (), ('application/x-django-templating', 'application/x-jinja')), + 'DylanLexer': ('pygments.lexers.compiled', 'Dylan', ('dylan',), ('*.dylan',), ('text/x-dylan',)), + 'ErbLexer': ('pygments.lexers.templates', 'ERB', ('erb',), (), ('application/x-ruby-templating',)), + 'ErlangLexer': ('pygments.lexers.functional', 'Erlang', ('erlang',), ('*.erl', '*.hrl'), ('text/x-erlang',)), + 'FortranLexer': ('pygments.lexers.compiled', 'Fortran', ('fortran',), ('*.f', '*.f90'), ('text/x-fortran',)), + 'GasLexer': ('pygments.lexers.asm', 'GAS', ('gas',), ('*.s', '*.S'), ('text/x-gas',)), + 'GenshiLexer': ('pygments.lexers.templates', 'Genshi', ('genshi', 'kid', 'xml+genshi', 'xml+kid'), ('*.kid',), ('application/x-genshi', 'application/x-kid')), + 'GenshiTextLexer': ('pygments.lexers.templates', 'Genshi Text', ('genshitext',), (), ('application/x-genshi-text', 'text/x-genshi')), + 'GettextLexer': ('pygments.lexers.text', 'Gettext Catalog', ('pot', 'po'), ('*.pot', '*.po'), ('application/x-gettext', 'text/x-gettext', 'text/gettext')), + 'GnuplotLexer': ('pygments.lexers.other', 'Gnuplot', ('gnuplot',), ('*.plot', '*.plt'), ('text/x-gnuplot',)), + 'GroffLexer': ('pygments.lexers.text', 'Groff', ('groff', 'nroff', 'man'), ('*.[1234567]', '*.man'), ('application/x-troff', 'text/troff')), + 'HaskellLexer': ('pygments.lexers.functional', 'Haskell', ('haskell', 'hs'), ('*.hs',), ('text/x-haskell',)), + 'HtmlDjangoLexer': ('pygments.lexers.templates', 'HTML+Django/Jinja', ('html+django', 'html+jinja'), (), ('text/html+django', 'text/html+jinja')), + 'HtmlGenshiLexer': ('pygments.lexers.templates', 'HTML+Genshi', ('html+genshi', 'html+kid'), (), ('text/html+genshi',)), + 'HtmlLexer': ('pygments.lexers.web', 'HTML', ('html',), ('*.html', '*.htm', '*.xhtml', '*.xslt'), ('text/html', 'application/xhtml+xml')), + 'HtmlPhpLexer': ('pygments.lexers.templates', 'HTML+PHP', ('html+php',), ('*.phtml',), ('application/x-php', 'application/x-httpd-php', 'application/x-httpd-php3', 'application/x-httpd-php4', 'application/x-httpd-php5')), + 'HtmlSmartyLexer': ('pygments.lexers.templates', 'HTML+Smarty', ('html+smarty',), (), ('text/html+smarty',)), + 'IniLexer': ('pygments.lexers.text', 'INI', ('ini', 'cfg'), ('*.ini', '*.cfg', '*.properties'), ('text/x-ini',)), + 'IoLexer': ('pygments.lexers.agile', 'Io', ('io',), ('*.io',), ('text/x-iosrc',)), + 'IrcLogsLexer': ('pygments.lexers.text', 'IRC logs', ('irc',), ('*.weechatlog',), ('text/x-irclog',)), + 'JavaLexer': ('pygments.lexers.compiled', 'Java', ('java',), ('*.java',), ('text/x-java',)), + 'JavascriptDjangoLexer': ('pygments.lexers.templates', 'JavaScript+Django/Jinja', ('js+django', 'javascript+django', 'js+jinja', 'javascript+jinja'), (), ('application/x-javascript+django', 'application/x-javascript+jinja', 'text/x-javascript+django', 'text/x-javascript+jinja', 'text/javascript+django', 'text/javascript+jinja')), + 'JavascriptErbLexer': ('pygments.lexers.templates', 'JavaScript+Ruby', ('js+erb', 'javascript+erb', 'js+ruby', 'javascript+ruby'), (), ('application/x-javascript+ruby', 'text/x-javascript+ruby', 'text/javascript+ruby')), + 'JavascriptGenshiLexer': ('pygments.lexers.templates', 'JavaScript+Genshi Text', ('js+genshitext', 'js+genshi', 'javascript+genshitext', 'javascript+genshi'), (), ('application/x-javascript+genshi', 'text/x-javascript+genshi', 'text/javascript+genshi')), + 'JavascriptLexer': ('pygments.lexers.web', 'JavaScript', ('js', 'javascript'), ('*.js',), ('application/x-javascript', 'text/x-javascript', 'text/javascript')), + 'JavascriptPhpLexer': ('pygments.lexers.templates', 'JavaScript+PHP', ('js+php', 'javascript+php'), (), ('application/x-javascript+php', 'text/x-javascript+php', 'text/javascript+php')), + 'JavascriptSmartyLexer': ('pygments.lexers.templates', 'JavaScript+Smarty', ('js+smarty', 'javascript+smarty'), (), ('application/x-javascript+smarty', 'text/x-javascript+smarty', 'text/javascript+smarty')), + 'JspLexer': ('pygments.lexers.templates', 'Java Server Page', ('jsp',), ('*.jsp',), ('application/x-jsp',)), + 'LighttpdConfLexer': ('pygments.lexers.text', 'Lighttpd configuration file', ('lighty', 'lighttpd'), (), ('text/x-lighttpd-conf',)), + 'LiterateHaskellLexer': ('pygments.lexers.functional', 'Literate Haskell', ('lhs', 'literate-haskell'), ('*.lhs',), ('text/x-literate-haskell',)), + 'LlvmLexer': ('pygments.lexers.asm', 'LLVM', ('llvm',), ('*.ll',), ('text/x-llvm',)), + 'LogtalkLexer': ('pygments.lexers.other', 'Logtalk', ('logtalk',), ('*.lgt',), ('text/x-logtalk',)), + 'LuaLexer': ('pygments.lexers.agile', 'Lua', ('lua',), ('*.lua',), ('text/x-lua', 'application/x-lua')), + 'MOOCodeLexer': ('pygments.lexers.other', 'MOOCode', ('moocode',), ('*.moo',), ('text/x-moocode',)), + 'MakefileLexer': ('pygments.lexers.text', 'Makefile', ('make', 'makefile', 'mf', 'bsdmake'), ('*.mak', 'Makefile', 'makefile', 'Makefile.*'), ('text/x-makefile',)), + 'MakoCssLexer': ('pygments.lexers.templates', 'CSS+Mako', ('css+mako',), (), ('text/css+mako',)), + 'MakoHtmlLexer': ('pygments.lexers.templates', 'HTML+Mako', ('html+mako',), (), ('text/html+mako',)), + 'MakoJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Mako', ('js+mako', 'javascript+mako'), (), ('application/x-javascript+mako', 'text/x-javascript+mako', 'text/javascript+mako')), + 'MakoLexer': ('pygments.lexers.templates', 'Mako', ('mako',), ('*.mao',), ('application/x-mako',)), + 'MakoXmlLexer': ('pygments.lexers.templates', 'XML+Mako', ('xml+mako',), (), ('application/xml+mako',)), + 'MatlabLexer': ('pygments.lexers.math', 'Matlab', ('matlab', 'octave'), ('*.m',), ('text/matlab',)), + 'MatlabSessionLexer': ('pygments.lexers.math', 'Matlab session', ('matlabsession',), (), ()), + 'MiniDLexer': ('pygments.lexers.agile', 'MiniD', ('minid',), ('*.md',), ('text/x-minidsrc',)), + 'MoinWikiLexer': ('pygments.lexers.text', 'MoinMoin/Trac Wiki markup', ('trac-wiki', 'moin'), (), ('text/x-trac-wiki',)), + 'MuPADLexer': ('pygments.lexers.math', 'MuPAD', ('mupad',), ('*.mu',), ()), + 'MySqlLexer': ('pygments.lexers.other', 'MySQL', ('mysql',), (), ('text/x-mysql',)), + 'MyghtyCssLexer': ('pygments.lexers.templates', 'CSS+Myghty', ('css+myghty',), (), ('text/css+myghty',)), + 'MyghtyHtmlLexer': ('pygments.lexers.templates', 'HTML+Myghty', ('html+myghty',), (), ('text/html+myghty',)), + 'MyghtyJavascriptLexer': ('pygments.lexers.templates', 'JavaScript+Myghty', ('js+myghty', 'javascript+myghty'), (), ('application/x-javascript+myghty', 'text/x-javascript+myghty', 'text/javascript+mygthy')), + 'MyghtyLexer': ('pygments.lexers.templates', 'Myghty', ('myghty',), ('*.myt', 'autodelegate'), ('application/x-myghty',)), + 'MyghtyXmlLexer': ('pygments.lexers.templates', 'XML+Myghty', ('xml+myghty',), (), ('application/xml+myghty',)), + 'NasmLexer': ('pygments.lexers.asm', 'NASM', ('nasm',), ('*.asm', '*.ASM'), ('text/x-nasm',)), + 'NginxConfLexer': ('pygments.lexers.text', 'Nginx configuration file', ('nginx',), (), ('text/x-nginx-conf',)), + 'NumPyLexer': ('pygments.lexers.math', 'NumPy', ('numpy',), ('*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript'), ()), + 'ObjdumpLexer': ('pygments.lexers.asm', 'objdump', ('objdump',), ('*.objdump',), ('text/x-objdump',)), + 'ObjectiveCLexer': ('pygments.lexers.compiled', 'Objective-C', ('objective-c', 'objectivec', 'obj-c', 'objc'), ('*.m',), ('text/x-objective-c',)), + 'OcamlLexer': ('pygments.lexers.compiled', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)), + 'OcamlLexer': ('pygments.lexers.functional', 'OCaml', ('ocaml',), ('*.ml', '*.mli', '*.mll', '*.mly'), ('text/x-ocaml',)), + 'PerlLexer': ('pygments.lexers.agile', 'Perl', ('perl', 'pl'), ('*.pl', '*.pm'), ('text/x-perl', 'application/x-perl')), + 'PhpLexer': ('pygments.lexers.web', 'PHP', ('php', 'php3', 'php4', 'php5'), ('*.php', '*.php[345]'), ('text/x-php',)), + 'PovrayLexer': ('pygments.lexers.other', 'POVRay', ('pov',), ('*.pov', '*.inc'), ('text/x-povray',)), + 'Python3Lexer': ('pygments.lexers.agile', 'Python 3', ('python3', 'py3'), (), ('text/x-python3', 'application/x-python3')), + 'PythonConsoleLexer': ('pygments.lexers.agile', 'Python console session', ('pycon',), (), ('text/x-python-doctest',)), + 'PythonLexer': ('pygments.lexers.agile', 'Python', ('python', 'py'), ('*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript'), ('text/x-python', 'application/x-python')), + 'PythonTracebackLexer': ('pygments.lexers.agile', 'Python Traceback', ('pytb',), ('*.pytb',), ('text/x-python-traceback',)), + 'RawTokenLexer': ('pygments.lexers.special', 'Raw token data', ('raw',), (), ('application/x-pygments-tokens',)), + 'RedcodeLexer': ('pygments.lexers.other', 'Redcode', ('redcode',), ('*.cw',), ()), + 'RhtmlLexer': ('pygments.lexers.templates', 'RHTML', ('rhtml', 'html+erb', 'html+ruby'), ('*.rhtml',), ('text/html+ruby',)), + 'RstLexer': ('pygments.lexers.text', 'reStructuredText', ('rst', 'rest', 'restructuredtext'), ('*.rst', '*.rest'), ('text/x-rst',)), + 'RubyConsoleLexer': ('pygments.lexers.agile', 'Ruby irb session', ('rbcon', 'irb'), (), ('text/x-ruby-shellsession',)), + 'RubyLexer': ('pygments.lexers.agile', 'Ruby', ('rb', 'ruby'), ('*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx'), ('text/x-ruby', 'application/x-ruby')), + 'SLexer': ('pygments.lexers.math', 'S', ('splus', 's', 'r'), ('*.S', '*.R'), ('text/S-plus', 'text/S', 'text/R')), + 'ScalaLexer': ('pygments.lexers.compiled', 'Scala', ('scala',), ('*.scala',), ('text/x-scala',)), + 'SchemeLexer': ('pygments.lexers.functional', 'Scheme', ('scheme', 'scm'), ('*.scm',), ('text/x-scheme', 'application/x-scheme')), + 'SmalltalkLexer': ('pygments.lexers.other', 'Smalltalk', ('smalltalk', 'squeak'), ('*.st',), ('text/x-smalltalk',)), + 'SmartyLexer': ('pygments.lexers.templates', 'Smarty', ('smarty',), ('*.tpl',), ('application/x-smarty',)), + 'SourcesListLexer': ('pygments.lexers.text', 'Debian Sourcelist', ('sourceslist', 'sources.list'), ('sources.list',), ()), + 'SqlLexer': ('pygments.lexers.other', 'SQL', ('sql',), ('*.sql',), ('text/x-sql',)), + 'SqliteConsoleLexer': ('pygments.lexers.other', 'sqlite3con', ('sqlite3',), ('*.sqlite3-console',), ('text/x-sqlite3-console',)), + 'SquidConfLexer': ('pygments.lexers.text', 'SquidConf', ('squidconf', 'squid.conf', 'squid'), ('squid.conf',), ('text/x-squidconf',)), + 'TclLexer': ('pygments.lexers.agile', 'Tcl', ('tcl',), ('*.tcl',), ('text/x-tcl', 'text/x-script.tcl', 'application/x-tcl')), + 'TcshLexer': ('pygments.lexers.other', 'Tcsh', ('tcsh', 'csh'), ('*.tcsh', '*.csh'), ('application/x-csh',)), + 'TexLexer': ('pygments.lexers.text', 'TeX', ('tex', 'latex'), ('*.tex', '*.aux', '*.toc'), ('text/x-tex', 'text/x-latex')), + 'TextLexer': ('pygments.lexers.special', 'Text only', ('text',), ('*.txt',), ('text/plain',)), + 'VbNetLexer': ('pygments.lexers.dotnet', 'VB.net', ('vb.net', 'vbnet'), ('*.vb', '*.bas'), ('text/x-vbnet', 'text/x-vba')), + 'VimLexer': ('pygments.lexers.text', 'VimL', ('vim',), ('*.vim', '.vimrc'), ('text/x-vim',)), + 'XmlDjangoLexer': ('pygments.lexers.templates', 'XML+Django/Jinja', ('xml+django', 'xml+jinja'), (), ('application/xml+django', 'application/xml+jinja')), + 'XmlErbLexer': ('pygments.lexers.templates', 'XML+Ruby', ('xml+erb', 'xml+ruby'), (), ('application/xml+ruby',)), + 'XmlLexer': ('pygments.lexers.web', 'XML', ('xml',), ('*.xml', '*.xsl', '*.rss', '*.xslt', '*.xsd', '*.wsdl'), ('text/xml', 'application/xml', 'image/svg+xml', 'application/rss+xml', 'application/atom+xml', 'application/xsl+xml', 'application/xslt+xml')), + 'XmlPhpLexer': ('pygments.lexers.templates', 'XML+PHP', ('xml+php',), (), ('application/xml+php',)), + 'XmlSmartyLexer': ('pygments.lexers.templates', 'XML+Smarty', ('xml+smarty',), (), ('application/xml+smarty',)), + 'XsltLexer': ('pygments.lexers.web', 'XSLT', ('xslt',), ('*.xsl', '*.xslt'), ('text/xml', 'application/xml', 'image/svg+xml', 'application/rss+xml', 'application/atom+xml', 'application/xsl+xml', 'application/xslt+xml')), + 'YamlLexer': ('pygments.lexers.text', 'YAML', ('yaml',), ('*.yaml', '*.yml'), ('text/x-yaml',)) +} + +if __name__ == '__main__': + import sys + import os + + # lookup lexers + found_lexers = [] + sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..')) + for filename in os.listdir('.'): + if filename.endswith('.py') and not filename.startswith('_'): + module_name = 'pygments.lexers.%s' % filename[:-3] + print module_name + module = __import__(module_name, None, None, ['']) + for lexer_name in module.__all__: + lexer = getattr(module, lexer_name) + found_lexers.append( + '%r: %r' % (lexer_name, + (module_name, + lexer.name, + tuple(lexer.aliases), + tuple(lexer.filenames), + tuple(lexer.mimetypes)))) + # sort them, that should make the diff files for svn smaller + found_lexers.sort() + + # extract useful sourcecode from this file + f = file(__file__) + try: + content = f.read() + finally: + f.close() + header = content[:content.find('LEXERS = {')] + footer = content[content.find("if __name__ == '__main__':"):] + + # write new file + f = file(__file__, 'w') + f.write(header) + f.write('LEXERS = {\n %s\n}\n\n' % ',\n '.join(found_lexers)) + f.write(footer) + f.close()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/lexers/_phpbuiltins.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,3389 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers._phpbuiltins + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + This file loads the function names and their modules from the + php webpage and generates itself. + + Do not alter the MODULES dict by hand! + + WARNING: the generation transfers quite much data over your + internet connection. don't run that at home, use + a server ;-) + + :copyright: 2006-2007 by Armin Ronacher. + :license: BSD, see LICENSE for more details. +""" + + +MODULES = {'.NET': ['dotnet_load'], + 'APD': ['apd_breakpoint', + 'apd_callstack', + 'apd_clunk', + 'apd_continue', + 'apd_croak', + 'apd_dump_function_table', + 'apd_dump_persistent_resources', + 'apd_dump_regular_resources', + 'apd_echo', + 'apd_get_active_symbols', + 'apd_set_pprof_trace', + 'apd_set_session', + 'apd_set_session_trace', + 'apd_set_socket_session_trace', + 'override_function', + 'rename_function'], + 'Apache': ['apache_child_terminate', + 'apache_get_modules', + 'apache_get_version', + 'apache_getenv', + 'apache_lookup_uri', + 'apache_note', + 'apache_request_headers', + 'apache_reset_timeout', + 'apache_response_headers', + 'apache_setenv', + 'ascii2ebcdic', + 'ebcdic2ascii', + 'getallheaders', + 'virtual'], + 'Arrays': ['array', + 'array_change_key_case', + 'array_chunk', + 'array_combine', + 'array_count_values', + 'array_diff', + 'array_diff_assoc', + 'array_diff_key', + 'array_diff_uassoc', + 'array_diff_ukey', + 'array_fill', + 'array_filter', + 'array_flip', + 'array_intersect', + 'array_intersect_assoc', + 'array_intersect_key', + 'array_intersect_uassoc', + 'array_intersect_ukey', + 'array_key_exists', + 'array_keys', + 'array_map', + 'array_merge', + 'array_merge_recursive', + 'array_multisort', + 'array_pad', + 'array_pop', + 'array_push', + 'array_rand', + 'array_reduce', + 'array_reverse', + 'array_search', + 'array_shift', + 'array_slice', + 'array_splice', + 'array_sum', + 'array_udiff', + 'array_udiff_assoc', + 'array_udiff_uassoc', + 'array_uintersect', + 'array_uintersect_assoc', + 'array_uintersect_uassoc', + 'array_unique', + 'array_unshift', + 'array_values', + 'array_walk', + 'array_walk_recursive', + 'arsort', + 'asort', + 'compact', + 'count', + 'current', + 'each', + 'end', + 'extract', + 'in_array', + 'key', + 'krsort', + 'ksort', + 'list', + 'natcasesort', + 'natsort', + 'next', + 'pos', + 'prev', + 'range', + 'reset', + 'rsort', + 'shuffle', + 'sizeof', + 'sort', + 'uasort', + 'uksort', + 'usort'], + 'Aspell': ['aspell_check', + 'aspell_check_raw', + 'aspell_new', + 'aspell_suggest'], + 'BC math': ['bcadd', + 'bccomp', + 'bcdiv', + 'bcmod', + 'bcmul', + 'bcpow', + 'bcpowmod', + 'bcscale', + 'bcsqrt', + 'bcsub'], + 'Bzip2': ['bzclose', + 'bzcompress', + 'bzdecompress', + 'bzerrno', + 'bzerror', + 'bzerrstr', + 'bzflush', + 'bzopen', + 'bzread', + 'bzwrite'], + 'CCVS': ['ccvs_add', + 'ccvs_auth', + 'ccvs_command', + 'ccvs_count', + 'ccvs_delete', + 'ccvs_done', + 'ccvs_init', + 'ccvs_lookup', + 'ccvs_new', + 'ccvs_report', + 'ccvs_return', + 'ccvs_reverse', + 'ccvs_sale', + 'ccvs_status', + 'ccvs_textvalue', + 'ccvs_void'], + 'COM': ['com_addref', + 'com_create_guid', + 'com_event_sink', + 'com_get', + 'com_get_active_object', + 'com_invoke', + 'com_isenum', + 'com_load', + 'com_load_typelib', + 'com_message_pump', + 'com_print_typeinfo', + 'com_propget', + 'com_propput', + 'com_propset', + 'com_release', + 'com_set', + 'variant_abs', + 'variant_add', + 'variant_and', + 'variant_cast', + 'variant_cat', + 'variant_cmp', + 'variant_date_from_timestamp', + 'variant_date_to_timestamp', + 'variant_div', + 'variant_eqv', + 'variant_fix', + 'variant_get_type', + 'variant_idiv', + 'variant_imp', + 'variant_int', + 'variant_mod', + 'variant_mul', + 'variant_neg', + 'variant_not', + 'variant_or', + 'variant_pow', + 'variant_round', + 'variant_set', + 'variant_set_type', + 'variant_sub', + 'variant_xor'], + 'CURL': ['curl_close', + 'curl_copy_handle', + 'curl_errno', + 'curl_error', + 'curl_exec', + 'curl_getinfo', + 'curl_init', + 'curl_multi_add_handle', + 'curl_multi_close', + 'curl_multi_exec', + 'curl_multi_getcontent', + 'curl_multi_info_read', + 'curl_multi_init', + 'curl_multi_remove_handle', + 'curl_multi_select', + 'curl_setopt', + 'curl_version'], + 'Calendar': ['cal_days_in_month', + 'cal_from_jd', + 'cal_info', + 'cal_to_jd', + 'easter_date', + 'easter_days', + 'frenchtojd', + 'gregoriantojd', + 'jddayofweek', + 'jdmonthname', + 'jdtofrench', + 'jdtogregorian', + 'jdtojewish', + 'jdtojulian', + 'jdtounix', + 'jewishtojd', + 'juliantojd', + 'unixtojd'], + 'Classes/Objects': ['call_user_method', + 'call_user_method_array', + 'class_exists', + 'get_class', + 'get_class_methods', + 'get_class_vars', + 'get_declared_classes', + 'get_declared_interfaces', + 'get_object_vars', + 'get_parent_class', + 'interface_exists', + 'is_a', + 'is_subclass_of', + 'method_exists'], + 'Classkit': ['classkit_import', + 'classkit_method_add', + 'classkit_method_copy', + 'classkit_method_redefine', + 'classkit_method_remove', + 'classkit_method_rename'], + 'ClibPDF': ['cpdf_add_annotation', + 'cpdf_add_outline', + 'cpdf_arc', + 'cpdf_begin_text', + 'cpdf_circle', + 'cpdf_clip', + 'cpdf_close', + 'cpdf_closepath', + 'cpdf_closepath_fill_stroke', + 'cpdf_closepath_stroke', + 'cpdf_continue_text', + 'cpdf_curveto', + 'cpdf_end_text', + 'cpdf_fill', + 'cpdf_fill_stroke', + 'cpdf_finalize', + 'cpdf_finalize_page', + 'cpdf_global_set_document_limits', + 'cpdf_import_jpeg', + 'cpdf_lineto', + 'cpdf_moveto', + 'cpdf_newpath', + 'cpdf_open', + 'cpdf_output_buffer', + 'cpdf_page_init', + 'cpdf_place_inline_image', + 'cpdf_rect', + 'cpdf_restore', + 'cpdf_rlineto', + 'cpdf_rmoveto', + 'cpdf_rotate', + 'cpdf_rotate_text', + 'cpdf_save', + 'cpdf_save_to_file', + 'cpdf_scale', + 'cpdf_set_action_url', + 'cpdf_set_char_spacing', + 'cpdf_set_creator', + 'cpdf_set_current_page', + 'cpdf_set_font', + 'cpdf_set_font_directories', + 'cpdf_set_font_map_file', + 'cpdf_set_horiz_scaling', + 'cpdf_set_keywords', + 'cpdf_set_leading', + 'cpdf_set_page_animation', + 'cpdf_set_subject', + 'cpdf_set_text_matrix', + 'cpdf_set_text_pos', + 'cpdf_set_text_rendering', + 'cpdf_set_text_rise', + 'cpdf_set_title', + 'cpdf_set_viewer_preferences', + 'cpdf_set_word_spacing', + 'cpdf_setdash', + 'cpdf_setflat', + 'cpdf_setgray', + 'cpdf_setgray_fill', + 'cpdf_setgray_stroke', + 'cpdf_setlinecap', + 'cpdf_setlinejoin', + 'cpdf_setlinewidth', + 'cpdf_setmiterlimit', + 'cpdf_setrgbcolor', + 'cpdf_setrgbcolor_fill', + 'cpdf_setrgbcolor_stroke', + 'cpdf_show', + 'cpdf_show_xy', + 'cpdf_stringwidth', + 'cpdf_stroke', + 'cpdf_text', + 'cpdf_translate'], + 'Crack': ['crack_check', + 'crack_closedict', + 'crack_getlastmessage', + 'crack_opendict'], + 'Cybercash': ['cybercash_base64_decode', + 'cybercash_base64_encode', + 'cybercash_decr', + 'cybercash_encr'], + 'Cyrus IMAP': ['cyrus_authenticate', + 'cyrus_bind', + 'cyrus_close', + 'cyrus_connect', + 'cyrus_query', + 'cyrus_unbind'], + 'DB++': ['dbplus_add', + 'dbplus_aql', + 'dbplus_chdir', + 'dbplus_close', + 'dbplus_curr', + 'dbplus_errcode', + 'dbplus_errno', + 'dbplus_find', + 'dbplus_first', + 'dbplus_flush', + 'dbplus_freealllocks', + 'dbplus_freelock', + 'dbplus_freerlocks', + 'dbplus_getlock', + 'dbplus_getunique', + 'dbplus_info', + 'dbplus_last', + 'dbplus_lockrel', + 'dbplus_next', + 'dbplus_open', + 'dbplus_prev', + 'dbplus_rchperm', + 'dbplus_rcreate', + 'dbplus_rcrtexact', + 'dbplus_rcrtlike', + 'dbplus_resolve', + 'dbplus_restorepos', + 'dbplus_rkeys', + 'dbplus_ropen', + 'dbplus_rquery', + 'dbplus_rrename', + 'dbplus_rsecindex', + 'dbplus_runlink', + 'dbplus_rzap', + 'dbplus_savepos', + 'dbplus_setindex', + 'dbplus_setindexbynumber', + 'dbplus_sql', + 'dbplus_tcl', + 'dbplus_tremove', + 'dbplus_undo', + 'dbplus_undoprepare', + 'dbplus_unlockrel', + 'dbplus_unselect', + 'dbplus_update', + 'dbplus_xlockrel', + 'dbplus_xunlockrel'], + 'DBM': ['dblist', + 'dbmclose', + 'dbmdelete', + 'dbmexists', + 'dbmfetch', + 'dbmfirstkey', + 'dbminsert', + 'dbmnextkey', + 'dbmopen', + 'dbmreplace'], + 'DOM': ['dom_import_simplexml'], + 'DOM XML': ['domxml_new_doc', + 'domxml_open_file', + 'domxml_open_mem', + 'domxml_version', + 'domxml_xmltree', + 'domxml_xslt_stylesheet', + 'domxml_xslt_stylesheet_doc', + 'domxml_xslt_stylesheet_file', + 'xpath_eval', + 'xpath_eval_expression', + 'xpath_new_context', + 'xptr_eval', + 'xptr_new_context'], + 'Date/Time': ['checkdate', + 'date', + 'date_sunrise', + 'date_sunset', + 'getdate', + 'gettimeofday', + 'gmdate', + 'gmmktime', + 'gmstrftime', + 'idate', + 'localtime', + 'microtime', + 'mktime', + 'strftime', + 'strptime', + 'strtotime', + 'time'], + 'Direct IO': ['dio_close', + 'dio_fcntl', + 'dio_open', + 'dio_read', + 'dio_seek', + 'dio_stat', + 'dio_tcsetattr', + 'dio_truncate', + 'dio_write'], + 'Directories': ['chdir', + 'chroot', + 'closedir', + 'getcwd', + 'opendir', + 'readdir', + 'rewinddir', + 'scandir'], + 'Errors and Logging': ['debug_backtrace', + 'debug_print_backtrace', + 'error_log', + 'error_reporting', + 'restore_error_handler', + 'restore_exception_handler', + 'set_error_handler', + 'set_exception_handler', + 'trigger_error', + 'user_error'], + 'Exif': ['exif_imagetype', + 'exif_read_data', + 'exif_tagname', + 'exif_thumbnail', + 'read_exif_data'], + 'FDF': ['fdf_add_doc_javascript', + 'fdf_add_template', + 'fdf_close', + 'fdf_create', + 'fdf_enum_values', + 'fdf_errno', + 'fdf_error', + 'fdf_get_ap', + 'fdf_get_attachment', + 'fdf_get_encoding', + 'fdf_get_file', + 'fdf_get_flags', + 'fdf_get_opt', + 'fdf_get_status', + 'fdf_get_value', + 'fdf_get_version', + 'fdf_header', + 'fdf_next_field_name', + 'fdf_open', + 'fdf_open_string', + 'fdf_remove_item', + 'fdf_save', + 'fdf_save_string', + 'fdf_set_ap', + 'fdf_set_encoding', + 'fdf_set_file', + 'fdf_set_flags', + 'fdf_set_javascript_action', + 'fdf_set_on_import_javascript', + 'fdf_set_opt', + 'fdf_set_status', + 'fdf_set_submit_form_action', + 'fdf_set_target_frame', + 'fdf_set_value', + 'fdf_set_version'], + 'FTP': ['ftp_alloc', + 'ftp_cdup', + 'ftp_chdir', + 'ftp_chmod', + 'ftp_close', + 'ftp_connect', + 'ftp_delete', + 'ftp_exec', + 'ftp_fget', + 'ftp_fput', + 'ftp_get', + 'ftp_get_option', + 'ftp_login', + 'ftp_mdtm', + 'ftp_mkdir', + 'ftp_nb_continue', + 'ftp_nb_fget', + 'ftp_nb_fput', + 'ftp_nb_get', + 'ftp_nb_put', + 'ftp_nlist', + 'ftp_pasv', + 'ftp_put', + 'ftp_pwd', + 'ftp_quit', + 'ftp_raw', + 'ftp_rawlist', + 'ftp_rename', + 'ftp_rmdir', + 'ftp_set_option', + 'ftp_site', + 'ftp_size', + 'ftp_ssl_connect', + 'ftp_systype'], + 'Filesystem': ['basename', + 'chgrp', + 'chmod', + 'chown', + 'clearstatcache', + 'copy', + 'delete', + 'dirname', + 'disk_free_space', + 'disk_total_space', + 'diskfreespace', + 'fclose', + 'feof', + 'fflush', + 'fgetc', + 'fgetcsv', + 'fgets', + 'fgetss', + 'file', + 'file_exists', + 'file_get_contents', + 'file_put_contents', + 'fileatime', + 'filectime', + 'filegroup', + 'fileinode', + 'filemtime', + 'fileowner', + 'fileperms', + 'filesize', + 'filetype', + 'flock', + 'fnmatch', + 'fopen', + 'fpassthru', + 'fputcsv', + 'fputs', + 'fread', + 'fscanf', + 'fseek', + 'fstat', + 'ftell', + 'ftruncate', + 'fwrite', + 'glob', + 'is_dir', + 'is_executable', + 'is_file', + 'is_link', + 'is_readable', + 'is_uploaded_file', + 'is_writable', + 'is_writeable', + 'link', + 'linkinfo', + 'lstat', + 'mkdir', + 'move_uploaded_file', + 'parse_ini_file', + 'pathinfo', + 'pclose', + 'popen', + 'readfile', + 'readlink', + 'realpath', + 'rename', + 'rewind', + 'rmdir', + 'set_file_buffer', + 'stat', + 'symlink', + 'tempnam', + 'tmpfile', + 'touch', + 'umask', + 'unlink'], + 'Firebird/InterBase': ['ibase_add_user', + 'ibase_affected_rows', + 'ibase_backup', + 'ibase_blob_add', + 'ibase_blob_cancel', + 'ibase_blob_close', + 'ibase_blob_create', + 'ibase_blob_echo', + 'ibase_blob_get', + 'ibase_blob_import', + 'ibase_blob_info', + 'ibase_blob_open', + 'ibase_close', + 'ibase_commit', + 'ibase_commit_ret', + 'ibase_connect', + 'ibase_db_info', + 'ibase_delete_user', + 'ibase_drop_db', + 'ibase_errcode', + 'ibase_errmsg', + 'ibase_execute', + 'ibase_fetch_assoc', + 'ibase_fetch_object', + 'ibase_fetch_row', + 'ibase_field_info', + 'ibase_free_event_handler', + 'ibase_free_query', + 'ibase_free_result', + 'ibase_gen_id', + 'ibase_maintain_db', + 'ibase_modify_user', + 'ibase_name_result', + 'ibase_num_fields', + 'ibase_num_params', + 'ibase_param_info', + 'ibase_pconnect', + 'ibase_prepare', + 'ibase_query', + 'ibase_restore', + 'ibase_rollback', + 'ibase_rollback_ret', + 'ibase_server_info', + 'ibase_service_attach', + 'ibase_service_detach', + 'ibase_set_event_handler', + 'ibase_timefmt', + 'ibase_trans', + 'ibase_wait_event'], + 'FriBiDi': ['fribidi_log2vis'], + 'FrontBase': ['fbsql_affected_rows', + 'fbsql_autocommit', + 'fbsql_blob_size', + 'fbsql_change_user', + 'fbsql_clob_size', + 'fbsql_close', + 'fbsql_commit', + 'fbsql_connect', + 'fbsql_create_blob', + 'fbsql_create_clob', + 'fbsql_create_db', + 'fbsql_data_seek', + 'fbsql_database', + 'fbsql_database_password', + 'fbsql_db_query', + 'fbsql_db_status', + 'fbsql_drop_db', + 'fbsql_errno', + 'fbsql_error', + 'fbsql_fetch_array', + 'fbsql_fetch_assoc', + 'fbsql_fetch_field', + 'fbsql_fetch_lengths', + 'fbsql_fetch_object', + 'fbsql_fetch_row', + 'fbsql_field_flags', + 'fbsql_field_len', + 'fbsql_field_name', + 'fbsql_field_seek', + 'fbsql_field_table', + 'fbsql_field_type', + 'fbsql_free_result', + 'fbsql_get_autostart_info', + 'fbsql_hostname', + 'fbsql_insert_id', + 'fbsql_list_dbs', + 'fbsql_list_fields', + 'fbsql_list_tables', + 'fbsql_next_result', + 'fbsql_num_fields', + 'fbsql_num_rows', + 'fbsql_password', + 'fbsql_pconnect', + 'fbsql_query', + 'fbsql_read_blob', + 'fbsql_read_clob', + 'fbsql_result', + 'fbsql_rollback', + 'fbsql_select_db', + 'fbsql_set_lob_mode', + 'fbsql_set_password', + 'fbsql_set_transaction', + 'fbsql_start_db', + 'fbsql_stop_db', + 'fbsql_tablename', + 'fbsql_username', + 'fbsql_warnings'], + 'Function handling': ['call_user_func', + 'call_user_func_array', + 'create_function', + 'func_get_arg', + 'func_get_args', + 'func_num_args', + 'function_exists', + 'get_defined_functions', + 'register_shutdown_function', + 'register_tick_function', + 'unregister_tick_function'], + 'GMP': ['gmp_abs', + 'gmp_add', + 'gmp_and', + 'gmp_clrbit', + 'gmp_cmp', + 'gmp_com', + 'gmp_div', + 'gmp_div_q', + 'gmp_div_qr', + 'gmp_div_r', + 'gmp_divexact', + 'gmp_fact', + 'gmp_gcd', + 'gmp_gcdext', + 'gmp_hamdist', + 'gmp_init', + 'gmp_intval', + 'gmp_invert', + 'gmp_jacobi', + 'gmp_legendre', + 'gmp_mod', + 'gmp_mul', + 'gmp_neg', + 'gmp_or', + 'gmp_perfect_square', + 'gmp_popcount', + 'gmp_pow', + 'gmp_powm', + 'gmp_prob_prime', + 'gmp_random', + 'gmp_scan0', + 'gmp_scan1', + 'gmp_setbit', + 'gmp_sign', + 'gmp_sqrt', + 'gmp_sqrtrem', + 'gmp_strval', + 'gmp_sub', + 'gmp_xor'], + 'Hyperwave': ['hw_array2objrec', + 'hw_changeobject', + 'hw_children', + 'hw_childrenobj', + 'hw_close', + 'hw_connect', + 'hw_connection_info', + 'hw_cp', + 'hw_deleteobject', + 'hw_docbyanchor', + 'hw_docbyanchorobj', + 'hw_document_attributes', + 'hw_document_bodytag', + 'hw_document_content', + 'hw_document_setcontent', + 'hw_document_size', + 'hw_dummy', + 'hw_edittext', + 'hw_error', + 'hw_errormsg', + 'hw_free_document', + 'hw_getanchors', + 'hw_getanchorsobj', + 'hw_getandlock', + 'hw_getchildcoll', + 'hw_getchildcollobj', + 'hw_getchilddoccoll', + 'hw_getchilddoccollobj', + 'hw_getobject', + 'hw_getobjectbyquery', + 'hw_getobjectbyquerycoll', + 'hw_getobjectbyquerycollobj', + 'hw_getobjectbyqueryobj', + 'hw_getparents', + 'hw_getparentsobj', + 'hw_getrellink', + 'hw_getremote', + 'hw_getremotechildren', + 'hw_getsrcbydestobj', + 'hw_gettext', + 'hw_getusername', + 'hw_identify', + 'hw_incollections', + 'hw_info', + 'hw_inscoll', + 'hw_insdoc', + 'hw_insertanchors', + 'hw_insertdocument', + 'hw_insertobject', + 'hw_mapid', + 'hw_modifyobject', + 'hw_mv', + 'hw_new_document', + 'hw_objrec2array', + 'hw_output_document', + 'hw_pconnect', + 'hw_pipedocument', + 'hw_root', + 'hw_setlinkroot', + 'hw_stat', + 'hw_unlock', + 'hw_who'], + 'Hyperwave API': ['hwapi_hgcsp'], + 'IMAP': ['imap_8bit', + 'imap_alerts', + 'imap_append', + 'imap_base64', + 'imap_binary', + 'imap_body', + 'imap_bodystruct', + 'imap_check', + 'imap_clearflag_full', + 'imap_close', + 'imap_createmailbox', + 'imap_delete', + 'imap_deletemailbox', + 'imap_errors', + 'imap_expunge', + 'imap_fetch_overview', + 'imap_fetchbody', + 'imap_fetchheader', + 'imap_fetchstructure', + 'imap_get_quota', + 'imap_get_quotaroot', + 'imap_getacl', + 'imap_getmailboxes', + 'imap_getsubscribed', + 'imap_header', + 'imap_headerinfo', + 'imap_headers', + 'imap_last_error', + 'imap_list', + 'imap_listmailbox', + 'imap_listscan', + 'imap_listsubscribed', + 'imap_lsub', + 'imap_mail', + 'imap_mail_compose', + 'imap_mail_copy', + 'imap_mail_move', + 'imap_mailboxmsginfo', + 'imap_mime_header_decode', + 'imap_msgno', + 'imap_num_msg', + 'imap_num_recent', + 'imap_open', + 'imap_ping', + 'imap_qprint', + 'imap_renamemailbox', + 'imap_reopen', + 'imap_rfc822_parse_adrlist', + 'imap_rfc822_parse_headers', + 'imap_rfc822_write_address', + 'imap_scanmailbox', + 'imap_search', + 'imap_set_quota', + 'imap_setacl', + 'imap_setflag_full', + 'imap_sort', + 'imap_status', + 'imap_subscribe', + 'imap_thread', + 'imap_timeout', + 'imap_uid', + 'imap_undelete', + 'imap_unsubscribe', + 'imap_utf7_decode', + 'imap_utf7_encode', + 'imap_utf8'], + 'IRC Gateway': ['ircg_channel_mode', + 'ircg_disconnect', + 'ircg_eval_ecmascript_params', + 'ircg_fetch_error_msg', + 'ircg_get_username', + 'ircg_html_encode', + 'ircg_ignore_add', + 'ircg_ignore_del', + 'ircg_invite', + 'ircg_is_conn_alive', + 'ircg_join', + 'ircg_kick', + 'ircg_list', + 'ircg_lookup_format_messages', + 'ircg_lusers', + 'ircg_msg', + 'ircg_names', + 'ircg_nick', + 'ircg_nickname_escape', + 'ircg_nickname_unescape', + 'ircg_notice', + 'ircg_oper', + 'ircg_part', + 'ircg_pconnect', + 'ircg_register_format_messages', + 'ircg_set_current', + 'ircg_set_file', + 'ircg_set_on_die', + 'ircg_topic', + 'ircg_who', + 'ircg_whois'], + 'Image': ['gd_info', + 'getimagesize', + 'image2wbmp', + 'image_type_to_extension', + 'image_type_to_mime_type', + 'imagealphablending', + 'imageantialias', + 'imagearc', + 'imagechar', + 'imagecharup', + 'imagecolorallocate', + 'imagecolorallocatealpha', + 'imagecolorat', + 'imagecolorclosest', + 'imagecolorclosestalpha', + 'imagecolorclosesthwb', + 'imagecolordeallocate', + 'imagecolorexact', + 'imagecolorexactalpha', + 'imagecolormatch', + 'imagecolorresolve', + 'imagecolorresolvealpha', + 'imagecolorset', + 'imagecolorsforindex', + 'imagecolorstotal', + 'imagecolortransparent', + 'imagecopy', + 'imagecopymerge', + 'imagecopymergegray', + 'imagecopyresampled', + 'imagecopyresized', + 'imagecreate', + 'imagecreatefromgd', + 'imagecreatefromgd2', + 'imagecreatefromgd2part', + 'imagecreatefromgif', + 'imagecreatefromjpeg', + 'imagecreatefrompng', + 'imagecreatefromstring', + 'imagecreatefromwbmp', + 'imagecreatefromxbm', + 'imagecreatefromxpm', + 'imagecreatetruecolor', + 'imagedashedline', + 'imagedestroy', + 'imageellipse', + 'imagefill', + 'imagefilledarc', + 'imagefilledellipse', + 'imagefilledpolygon', + 'imagefilledrectangle', + 'imagefilltoborder', + 'imagefilter', + 'imagefontheight', + 'imagefontwidth', + 'imageftbbox', + 'imagefttext', + 'imagegammacorrect', + 'imagegd', + 'imagegd2', + 'imagegif', + 'imageinterlace', + 'imageistruecolor', + 'imagejpeg', + 'imagelayereffect', + 'imageline', + 'imageloadfont', + 'imagepalettecopy', + 'imagepng', + 'imagepolygon', + 'imagepsbbox', + 'imagepsencodefont', + 'imagepsextendfont', + 'imagepsfreefont', + 'imagepsloadfont', + 'imagepsslantfont', + 'imagepstext', + 'imagerectangle', + 'imagerotate', + 'imagesavealpha', + 'imagesetbrush', + 'imagesetpixel', + 'imagesetstyle', + 'imagesetthickness', + 'imagesettile', + 'imagestring', + 'imagestringup', + 'imagesx', + 'imagesy', + 'imagetruecolortopalette', + 'imagettfbbox', + 'imagettftext', + 'imagetypes', + 'imagewbmp', + 'imagexbm', + 'iptcembed', + 'iptcparse', + 'jpeg2wbmp', + 'png2wbmp'], + 'Informix': ['ifx_affected_rows', + 'ifx_blobinfile_mode', + 'ifx_byteasvarchar', + 'ifx_close', + 'ifx_connect', + 'ifx_copy_blob', + 'ifx_create_blob', + 'ifx_create_char', + 'ifx_do', + 'ifx_error', + 'ifx_errormsg', + 'ifx_fetch_row', + 'ifx_fieldproperties', + 'ifx_fieldtypes', + 'ifx_free_blob', + 'ifx_free_char', + 'ifx_free_result', + 'ifx_get_blob', + 'ifx_get_char', + 'ifx_getsqlca', + 'ifx_htmltbl_result', + 'ifx_nullformat', + 'ifx_num_fields', + 'ifx_num_rows', + 'ifx_pconnect', + 'ifx_prepare', + 'ifx_query', + 'ifx_textasvarchar', + 'ifx_update_blob', + 'ifx_update_char', + 'ifxus_close_slob', + 'ifxus_create_slob', + 'ifxus_free_slob', + 'ifxus_open_slob', + 'ifxus_read_slob', + 'ifxus_seek_slob', + 'ifxus_tell_slob', + 'ifxus_write_slob'], + 'Ingres II': ['ingres_autocommit', + 'ingres_close', + 'ingres_commit', + 'ingres_connect', + 'ingres_fetch_array', + 'ingres_fetch_object', + 'ingres_fetch_row', + 'ingres_field_length', + 'ingres_field_name', + 'ingres_field_nullable', + 'ingres_field_precision', + 'ingres_field_scale', + 'ingres_field_type', + 'ingres_num_fields', + 'ingres_num_rows', + 'ingres_pconnect', + 'ingres_query', + 'ingres_rollback'], + 'Java': ['java_last_exception_clear', 'java_last_exception_get'], + 'LDAP': ['ldap_8859_to_t61', + 'ldap_add', + 'ldap_bind', + 'ldap_close', + 'ldap_compare', + 'ldap_connect', + 'ldap_count_entries', + 'ldap_delete', + 'ldap_dn2ufn', + 'ldap_err2str', + 'ldap_errno', + 'ldap_error', + 'ldap_explode_dn', + 'ldap_first_attribute', + 'ldap_first_entry', + 'ldap_first_reference', + 'ldap_free_result', + 'ldap_get_attributes', + 'ldap_get_dn', + 'ldap_get_entries', + 'ldap_get_option', + 'ldap_get_values', + 'ldap_get_values_len', + 'ldap_list', + 'ldap_mod_add', + 'ldap_mod_del', + 'ldap_mod_replace', + 'ldap_modify', + 'ldap_next_attribute', + 'ldap_next_entry', + 'ldap_next_reference', + 'ldap_parse_reference', + 'ldap_parse_result', + 'ldap_read', + 'ldap_rename', + 'ldap_sasl_bind', + 'ldap_search', + 'ldap_set_option', + 'ldap_set_rebind_proc', + 'ldap_sort', + 'ldap_start_tls', + 'ldap_t61_to_8859', + 'ldap_unbind'], + 'LZF': ['lzf_compress', 'lzf_decompress', 'lzf_optimized_for'], + 'Lotus Notes': ['notes_body', + 'notes_copy_db', + 'notes_create_db', + 'notes_create_note', + 'notes_drop_db', + 'notes_find_note', + 'notes_header_info', + 'notes_list_msgs', + 'notes_mark_read', + 'notes_mark_unread', + 'notes_nav_create', + 'notes_search', + 'notes_unread', + 'notes_version'], + 'MCAL': ['mcal_append_event', + 'mcal_close', + 'mcal_create_calendar', + 'mcal_date_compare', + 'mcal_date_valid', + 'mcal_day_of_week', + 'mcal_day_of_year', + 'mcal_days_in_month', + 'mcal_delete_calendar', + 'mcal_delete_event', + 'mcal_event_add_attribute', + 'mcal_event_init', + 'mcal_event_set_alarm', + 'mcal_event_set_category', + 'mcal_event_set_class', + 'mcal_event_set_description', + 'mcal_event_set_end', + 'mcal_event_set_recur_daily', + 'mcal_event_set_recur_monthly_mday', + 'mcal_event_set_recur_monthly_wday', + 'mcal_event_set_recur_none', + 'mcal_event_set_recur_weekly', + 'mcal_event_set_recur_yearly', + 'mcal_event_set_start', + 'mcal_event_set_title', + 'mcal_expunge', + 'mcal_fetch_current_stream_event', + 'mcal_fetch_event', + 'mcal_is_leap_year', + 'mcal_list_alarms', + 'mcal_list_events', + 'mcal_next_recurrence', + 'mcal_open', + 'mcal_popen', + 'mcal_rename_calendar', + 'mcal_reopen', + 'mcal_snooze', + 'mcal_store_event', + 'mcal_time_valid', + 'mcal_week_of_year'], + 'MS SQL Server': ['mssql_bind', + 'mssql_close', + 'mssql_connect', + 'mssql_data_seek', + 'mssql_execute', + 'mssql_fetch_array', + 'mssql_fetch_assoc', + 'mssql_fetch_batch', + 'mssql_fetch_field', + 'mssql_fetch_object', + 'mssql_fetch_row', + 'mssql_field_length', + 'mssql_field_name', + 'mssql_field_seek', + 'mssql_field_type', + 'mssql_free_result', + 'mssql_free_statement', + 'mssql_get_last_message', + 'mssql_guid_string', + 'mssql_init', + 'mssql_min_error_severity', + 'mssql_min_message_severity', + 'mssql_next_result', + 'mssql_num_fields', + 'mssql_num_rows', + 'mssql_pconnect', + 'mssql_query', + 'mssql_result', + 'mssql_rows_affected', + 'mssql_select_db'], + 'Mail': ['ezmlm_hash', 'mail'], + 'Math': ['abs', + 'acos', + 'acosh', + 'asin', + 'asinh', + 'atan', + 'atan2', + 'atanh', + 'base_convert', + 'bindec', + 'ceil', + 'cos', + 'cosh', + 'decbin', + 'dechex', + 'decoct', + 'deg2rad', + 'exp', + 'expm1', + 'floor', + 'fmod', + 'getrandmax', + 'hexdec', + 'hypot', + 'is_finite', + 'is_infinite', + 'is_nan', + 'lcg_value', + 'log', + 'log10', + 'log1p', + 'max', + 'min', + 'mt_getrandmax', + 'mt_rand', + 'mt_srand', + 'octdec', + 'pi', + 'pow', + 'rad2deg', + 'rand', + 'round', + 'sin', + 'sinh', + 'sqrt', + 'srand', + 'tan', + 'tanh'], + 'Memcache': ['memcache_debug'], + 'Mimetype': ['mime_content_type'], + 'Ming (flash)': ['ming_setcubicthreshold', + 'ming_setscale', + 'ming_useswfversion', + 'swfaction', + 'swfbitmap', + 'swfbutton', + 'swffill', + 'swffont', + 'swfgradient', + 'swfmorph', + 'swfmovie', + 'swfshape', + 'swfsprite', + 'swftext', + 'swftextfield'], + 'Misc.': ['connection_aborted', + 'connection_status', + 'connection_timeout', + 'constant', + 'define', + 'defined', + 'die', + 'eval', + 'exit', + 'get_browser', + 'highlight_file', + 'highlight_string', + 'ignore_user_abort', + 'pack', + 'php_check_syntax', + 'php_strip_whitespace', + 'show_source', + 'sleep', + 'time_nanosleep', + 'uniqid', + 'unpack', + 'usleep'], + 'Msession': ['msession_connect', + 'msession_count', + 'msession_create', + 'msession_destroy', + 'msession_disconnect', + 'msession_find', + 'msession_get', + 'msession_get_array', + 'msession_get_data', + 'msession_inc', + 'msession_list', + 'msession_listvar', + 'msession_lock', + 'msession_plugin', + 'msession_randstr', + 'msession_set', + 'msession_set_array', + 'msession_set_data', + 'msession_timeout', + 'msession_uniq', + 'msession_unlock'], + 'Multibyte String': ['mb_convert_case', + 'mb_convert_encoding', + 'mb_convert_kana', + 'mb_convert_variables', + 'mb_decode_mimeheader', + 'mb_decode_numericentity', + 'mb_detect_encoding', + 'mb_detect_order', + 'mb_encode_mimeheader', + 'mb_encode_numericentity', + 'mb_ereg', + 'mb_ereg_match', + 'mb_ereg_replace', + 'mb_ereg_search', + 'mb_ereg_search_getpos', + 'mb_ereg_search_getregs', + 'mb_ereg_search_init', + 'mb_ereg_search_pos', + 'mb_ereg_search_regs', + 'mb_ereg_search_setpos', + 'mb_eregi', + 'mb_eregi_replace', + 'mb_get_info', + 'mb_http_input', + 'mb_http_output', + 'mb_internal_encoding', + 'mb_language', + 'mb_list_encodings', + 'mb_output_handler', + 'mb_parse_str', + 'mb_preferred_mime_name', + 'mb_regex_encoding', + 'mb_regex_set_options', + 'mb_send_mail', + 'mb_split', + 'mb_strcut', + 'mb_strimwidth', + 'mb_strlen', + 'mb_strpos', + 'mb_strrpos', + 'mb_strtolower', + 'mb_strtoupper', + 'mb_strwidth', + 'mb_substitute_character', + 'mb_substr', + 'mb_substr_count'], + 'MySQL': ['mysql_affected_rows', + 'mysql_change_user', + 'mysql_client_encoding', + 'mysql_close', + 'mysql_connect', + 'mysql_create_db', + 'mysql_data_seek', + 'mysql_db_name', + 'mysql_db_query', + 'mysql_drop_db', + 'mysql_errno', + 'mysql_error', + 'mysql_escape_string', + 'mysql_fetch_array', + 'mysql_fetch_assoc', + 'mysql_fetch_field', + 'mysql_fetch_lengths', + 'mysql_fetch_object', + 'mysql_fetch_row', + 'mysql_field_flags', + 'mysql_field_len', + 'mysql_field_name', + 'mysql_field_seek', + 'mysql_field_table', + 'mysql_field_type', + 'mysql_free_result', + 'mysql_get_client_info', + 'mysql_get_host_info', + 'mysql_get_proto_info', + 'mysql_get_server_info', + 'mysql_info', + 'mysql_insert_id', + 'mysql_list_dbs', + 'mysql_list_fields', + 'mysql_list_processes', + 'mysql_list_tables', + 'mysql_num_fields', + 'mysql_num_rows', + 'mysql_pconnect', + 'mysql_ping', + 'mysql_query', + 'mysql_real_escape_string', + 'mysql_result', + 'mysql_select_db', + 'mysql_stat', + 'mysql_tablename', + 'mysql_thread_id', + 'mysql_unbuffered_query'], + 'NSAPI': ['nsapi_request_headers', 'nsapi_response_headers', 'nsapi_virtual'], + 'Ncurses': ['ncurses_addch', + 'ncurses_addchnstr', + 'ncurses_addchstr', + 'ncurses_addnstr', + 'ncurses_addstr', + 'ncurses_assume_default_colors', + 'ncurses_attroff', + 'ncurses_attron', + 'ncurses_attrset', + 'ncurses_baudrate', + 'ncurses_beep', + 'ncurses_bkgd', + 'ncurses_bkgdset', + 'ncurses_border', + 'ncurses_bottom_panel', + 'ncurses_can_change_color', + 'ncurses_cbreak', + 'ncurses_clear', + 'ncurses_clrtobot', + 'ncurses_clrtoeol', + 'ncurses_color_content', + 'ncurses_color_set', + 'ncurses_curs_set', + 'ncurses_def_prog_mode', + 'ncurses_def_shell_mode', + 'ncurses_define_key', + 'ncurses_del_panel', + 'ncurses_delay_output', + 'ncurses_delch', + 'ncurses_deleteln', + 'ncurses_delwin', + 'ncurses_doupdate', + 'ncurses_echo', + 'ncurses_echochar', + 'ncurses_end', + 'ncurses_erase', + 'ncurses_erasechar', + 'ncurses_filter', + 'ncurses_flash', + 'ncurses_flushinp', + 'ncurses_getch', + 'ncurses_getmaxyx', + 'ncurses_getmouse', + 'ncurses_getyx', + 'ncurses_halfdelay', + 'ncurses_has_colors', + 'ncurses_has_ic', + 'ncurses_has_il', + 'ncurses_has_key', + 'ncurses_hide_panel', + 'ncurses_hline', + 'ncurses_inch', + 'ncurses_init', + 'ncurses_init_color', + 'ncurses_init_pair', + 'ncurses_insch', + 'ncurses_insdelln', + 'ncurses_insertln', + 'ncurses_insstr', + 'ncurses_instr', + 'ncurses_isendwin', + 'ncurses_keyok', + 'ncurses_keypad', + 'ncurses_killchar', + 'ncurses_longname', + 'ncurses_meta', + 'ncurses_mouse_trafo', + 'ncurses_mouseinterval', + 'ncurses_mousemask', + 'ncurses_move', + 'ncurses_move_panel', + 'ncurses_mvaddch', + 'ncurses_mvaddchnstr', + 'ncurses_mvaddchstr', + 'ncurses_mvaddnstr', + 'ncurses_mvaddstr', + 'ncurses_mvcur', + 'ncurses_mvdelch', + 'ncurses_mvgetch', + 'ncurses_mvhline', + 'ncurses_mvinch', + 'ncurses_mvvline', + 'ncurses_mvwaddstr', + 'ncurses_napms', + 'ncurses_new_panel', + 'ncurses_newpad', + 'ncurses_newwin', + 'ncurses_nl', + 'ncurses_nocbreak', + 'ncurses_noecho', + 'ncurses_nonl', + 'ncurses_noqiflush', + 'ncurses_noraw', + 'ncurses_pair_content', + 'ncurses_panel_above', + 'ncurses_panel_below', + 'ncurses_panel_window', + 'ncurses_pnoutrefresh', + 'ncurses_prefresh', + 'ncurses_putp', + 'ncurses_qiflush', + 'ncurses_raw', + 'ncurses_refresh', + 'ncurses_replace_panel', + 'ncurses_reset_prog_mode', + 'ncurses_reset_shell_mode', + 'ncurses_resetty', + 'ncurses_savetty', + 'ncurses_scr_dump', + 'ncurses_scr_init', + 'ncurses_scr_restore', + 'ncurses_scr_set', + 'ncurses_scrl', + 'ncurses_show_panel', + 'ncurses_slk_attr', + 'ncurses_slk_attroff', + 'ncurses_slk_attron', + 'ncurses_slk_attrset', + 'ncurses_slk_clear', + 'ncurses_slk_color', + 'ncurses_slk_init', + 'ncurses_slk_noutrefresh', + 'ncurses_slk_refresh', + 'ncurses_slk_restore', + 'ncurses_slk_set', + 'ncurses_slk_touch', + 'ncurses_standend', + 'ncurses_standout', + 'ncurses_start_color', + 'ncurses_termattrs', + 'ncurses_termname', + 'ncurses_timeout', + 'ncurses_top_panel', + 'ncurses_typeahead', + 'ncurses_ungetch', + 'ncurses_ungetmouse', + 'ncurses_update_panels', + 'ncurses_use_default_colors', + 'ncurses_use_env', + 'ncurses_use_extended_names', + 'ncurses_vidattr', + 'ncurses_vline', + 'ncurses_waddch', + 'ncurses_waddstr', + 'ncurses_wattroff', + 'ncurses_wattron', + 'ncurses_wattrset', + 'ncurses_wborder', + 'ncurses_wclear', + 'ncurses_wcolor_set', + 'ncurses_werase', + 'ncurses_wgetch', + 'ncurses_whline', + 'ncurses_wmouse_trafo', + 'ncurses_wmove', + 'ncurses_wnoutrefresh', + 'ncurses_wrefresh', + 'ncurses_wstandend', + 'ncurses_wstandout', + 'ncurses_wvline'], + 'Network': ['checkdnsrr', + 'closelog', + 'debugger_off', + 'debugger_on', + 'define_syslog_variables', + 'dns_check_record', + 'dns_get_mx', + 'dns_get_record', + 'fsockopen', + 'gethostbyaddr', + 'gethostbyname', + 'gethostbynamel', + 'getmxrr', + 'getprotobyname', + 'getprotobynumber', + 'getservbyname', + 'getservbyport', + 'header', + 'headers_list', + 'headers_sent', + 'inet_ntop', + 'inet_pton', + 'ip2long', + 'long2ip', + 'openlog', + 'pfsockopen', + 'setcookie', + 'setrawcookie', + 'socket_get_status', + 'socket_set_blocking', + 'socket_set_timeout', + 'syslog'], + 'OCI8': ['oci_bind_by_name', + 'oci_cancel', + 'oci_close', + 'oci_commit', + 'oci_connect', + 'oci_define_by_name', + 'oci_error', + 'oci_execute', + 'oci_fetch', + 'oci_fetch_all', + 'oci_fetch_array', + 'oci_fetch_assoc', + 'oci_fetch_object', + 'oci_fetch_row', + 'oci_field_is_null', + 'oci_field_name', + 'oci_field_precision', + 'oci_field_scale', + 'oci_field_size', + 'oci_field_type', + 'oci_field_type_raw', + 'oci_free_statement', + 'oci_internal_debug', + 'oci_lob_copy', + 'oci_lob_is_equal', + 'oci_new_collection', + 'oci_new_connect', + 'oci_new_cursor', + 'oci_new_descriptor', + 'oci_num_fields', + 'oci_num_rows', + 'oci_parse', + 'oci_password_change', + 'oci_pconnect', + 'oci_result', + 'oci_rollback', + 'oci_server_version', + 'oci_set_prefetch', + 'oci_statement_type', + 'ocibindbyname', + 'ocicancel', + 'ocicloselob', + 'ocicollappend', + 'ocicollassign', + 'ocicollassignelem', + 'ocicollgetelem', + 'ocicollmax', + 'ocicollsize', + 'ocicolltrim', + 'ocicolumnisnull', + 'ocicolumnname', + 'ocicolumnprecision', + 'ocicolumnscale', + 'ocicolumnsize', + 'ocicolumntype', + 'ocicolumntyperaw', + 'ocicommit', + 'ocidefinebyname', + 'ocierror', + 'ociexecute', + 'ocifetch', + 'ocifetchinto', + 'ocifetchstatement', + 'ocifreecollection', + 'ocifreecursor', + 'ocifreedesc', + 'ocifreestatement', + 'ociinternaldebug', + 'ociloadlob', + 'ocilogoff', + 'ocilogon', + 'ocinewcollection', + 'ocinewcursor', + 'ocinewdescriptor', + 'ocinlogon', + 'ocinumcols', + 'ociparse', + 'ociplogon', + 'ociresult', + 'ocirollback', + 'ocirowcount', + 'ocisavelob', + 'ocisavelobfile', + 'ociserverversion', + 'ocisetprefetch', + 'ocistatementtype', + 'ociwritelobtofile', + 'ociwritetemporarylob'], + 'ODBC': ['odbc_autocommit', + 'odbc_binmode', + 'odbc_close', + 'odbc_close_all', + 'odbc_columnprivileges', + 'odbc_columns', + 'odbc_commit', + 'odbc_connect', + 'odbc_cursor', + 'odbc_data_source', + 'odbc_do', + 'odbc_error', + 'odbc_errormsg', + 'odbc_exec', + 'odbc_execute', + 'odbc_fetch_array', + 'odbc_fetch_into', + 'odbc_fetch_object', + 'odbc_fetch_row', + 'odbc_field_len', + 'odbc_field_name', + 'odbc_field_num', + 'odbc_field_precision', + 'odbc_field_scale', + 'odbc_field_type', + 'odbc_foreignkeys', + 'odbc_free_result', + 'odbc_gettypeinfo', + 'odbc_longreadlen', + 'odbc_next_result', + 'odbc_num_fields', + 'odbc_num_rows', + 'odbc_pconnect', + 'odbc_prepare', + 'odbc_primarykeys', + 'odbc_procedurecolumns', + 'odbc_procedures', + 'odbc_result', + 'odbc_result_all', + 'odbc_rollback', + 'odbc_setoption', + 'odbc_specialcolumns', + 'odbc_statistics', + 'odbc_tableprivileges', + 'odbc_tables'], + 'Object Aggregation': ['aggregate', + 'aggregate_info', + 'aggregate_methods', + 'aggregate_methods_by_list', + 'aggregate_methods_by_regexp', + 'aggregate_properties', + 'aggregate_properties_by_list', + 'aggregate_properties_by_regexp', + 'aggregation_info', + 'deaggregate'], + 'Object overloading': ['overload'], + 'OpenSSL': ['openssl_csr_export', + 'openssl_csr_export_to_file', + 'openssl_csr_new', + 'openssl_csr_sign', + 'openssl_error_string', + 'openssl_free_key', + 'openssl_get_privatekey', + 'openssl_get_publickey', + 'openssl_open', + 'openssl_pkcs7_decrypt', + 'openssl_pkcs7_encrypt', + 'openssl_pkcs7_sign', + 'openssl_pkcs7_verify', + 'openssl_pkey_export', + 'openssl_pkey_export_to_file', + 'openssl_pkey_get_private', + 'openssl_pkey_get_public', + 'openssl_pkey_new', + 'openssl_private_decrypt', + 'openssl_private_encrypt', + 'openssl_public_decrypt', + 'openssl_public_encrypt', + 'openssl_seal', + 'openssl_sign', + 'openssl_verify', + 'openssl_x509_check_private_key', + 'openssl_x509_checkpurpose', + 'openssl_x509_export', + 'openssl_x509_export_to_file', + 'openssl_x509_free', + 'openssl_x509_parse', + 'openssl_x509_read'], + 'Oracle': ['ora_bind', + 'ora_close', + 'ora_columnname', + 'ora_columnsize', + 'ora_columntype', + 'ora_commit', + 'ora_commitoff', + 'ora_commiton', + 'ora_do', + 'ora_error', + 'ora_errorcode', + 'ora_exec', + 'ora_fetch', + 'ora_fetch_into', + 'ora_getcolumn', + 'ora_logoff', + 'ora_logon', + 'ora_numcols', + 'ora_numrows', + 'ora_open', + 'ora_parse', + 'ora_plogon', + 'ora_rollback'], + 'Output Control': ['flush', + 'ob_clean', + 'ob_end_clean', + 'ob_end_flush', + 'ob_flush', + 'ob_get_clean', + 'ob_get_contents', + 'ob_get_flush', + 'ob_get_length', + 'ob_get_level', + 'ob_get_status', + 'ob_gzhandler', + 'ob_implicit_flush', + 'ob_list_handlers', + 'ob_start', + 'output_add_rewrite_var', + 'output_reset_rewrite_vars'], + 'OvrimosSQL': ['ovrimos_close', + 'ovrimos_commit', + 'ovrimos_connect', + 'ovrimos_cursor', + 'ovrimos_exec', + 'ovrimos_execute', + 'ovrimos_fetch_into', + 'ovrimos_fetch_row', + 'ovrimos_field_len', + 'ovrimos_field_name', + 'ovrimos_field_num', + 'ovrimos_field_type', + 'ovrimos_free_result', + 'ovrimos_longreadlen', + 'ovrimos_num_fields', + 'ovrimos_num_rows', + 'ovrimos_prepare', + 'ovrimos_result', + 'ovrimos_result_all', + 'ovrimos_rollback'], + 'PCNTL': ['pcntl_alarm', + 'pcntl_exec', + 'pcntl_fork', + 'pcntl_getpriority', + 'pcntl_setpriority', + 'pcntl_signal', + 'pcntl_wait', + 'pcntl_waitpid', + 'pcntl_wexitstatus', + 'pcntl_wifexited', + 'pcntl_wifsignaled', + 'pcntl_wifstopped', + 'pcntl_wstopsig', + 'pcntl_wtermsig'], + 'PCRE': ['preg_grep', + 'preg_match', + 'preg_match_all', + 'preg_quote', + 'preg_replace', + 'preg_replace_callback', + 'preg_split'], + 'PDF': ['pdf_add_annotation', + 'pdf_add_bookmark', + 'pdf_add_launchlink', + 'pdf_add_locallink', + 'pdf_add_note', + 'pdf_add_outline', + 'pdf_add_pdflink', + 'pdf_add_thumbnail', + 'pdf_add_weblink', + 'pdf_arc', + 'pdf_arcn', + 'pdf_attach_file', + 'pdf_begin_page', + 'pdf_begin_pattern', + 'pdf_begin_template', + 'pdf_circle', + 'pdf_clip', + 'pdf_close', + 'pdf_close_image', + 'pdf_close_pdi', + 'pdf_close_pdi_page', + 'pdf_closepath', + 'pdf_closepath_fill_stroke', + 'pdf_closepath_stroke', + 'pdf_concat', + 'pdf_continue_text', + 'pdf_curveto', + 'pdf_delete', + 'pdf_end_page', + 'pdf_end_pattern', + 'pdf_end_template', + 'pdf_endpath', + 'pdf_fill', + 'pdf_fill_stroke', + 'pdf_findfont', + 'pdf_get_buffer', + 'pdf_get_font', + 'pdf_get_fontname', + 'pdf_get_fontsize', + 'pdf_get_image_height', + 'pdf_get_image_width', + 'pdf_get_majorversion', + 'pdf_get_minorversion', + 'pdf_get_parameter', + 'pdf_get_pdi_parameter', + 'pdf_get_pdi_value', + 'pdf_get_value', + 'pdf_initgraphics', + 'pdf_lineto', + 'pdf_makespotcolor', + 'pdf_moveto', + 'pdf_new', + 'pdf_open_ccitt', + 'pdf_open_file', + 'pdf_open_gif', + 'pdf_open_image', + 'pdf_open_image_file', + 'pdf_open_jpeg', + 'pdf_open_memory_image', + 'pdf_open_pdi', + 'pdf_open_pdi_page', + 'pdf_open_tiff', + 'pdf_place_image', + 'pdf_place_pdi_page', + 'pdf_rect', + 'pdf_restore', + 'pdf_rotate', + 'pdf_save', + 'pdf_scale', + 'pdf_set_border_color', + 'pdf_set_border_dash', + 'pdf_set_border_style', + 'pdf_set_char_spacing', + 'pdf_set_duration', + 'pdf_set_horiz_scaling', + 'pdf_set_info', + 'pdf_set_info_author', + 'pdf_set_info_creator', + 'pdf_set_info_keywords', + 'pdf_set_info_subject', + 'pdf_set_info_title', + 'pdf_set_leading', + 'pdf_set_parameter', + 'pdf_set_text_matrix', + 'pdf_set_text_pos', + 'pdf_set_text_rendering', + 'pdf_set_text_rise', + 'pdf_set_value', + 'pdf_set_word_spacing', + 'pdf_setcolor', + 'pdf_setdash', + 'pdf_setflat', + 'pdf_setfont', + 'pdf_setgray', + 'pdf_setgray_fill', + 'pdf_setgray_stroke', + 'pdf_setlinecap', + 'pdf_setlinejoin', + 'pdf_setlinewidth', + 'pdf_setmatrix', + 'pdf_setmiterlimit', + 'pdf_setpolydash', + 'pdf_setrgbcolor', + 'pdf_setrgbcolor_fill', + 'pdf_setrgbcolor_stroke', + 'pdf_show', + 'pdf_show_boxed', + 'pdf_show_xy', + 'pdf_skew', + 'pdf_stringwidth', + 'pdf_stroke', + 'pdf_translate'], + 'PHP Options/Info': ['assert', + 'assert_options', + 'dl', + 'extension_loaded', + 'get_cfg_var', + 'get_current_user', + 'get_defined_constants', + 'get_extension_funcs', + 'get_include_path', + 'get_included_files', + 'get_loaded_extensions', + 'get_magic_quotes_gpc', + 'get_magic_quotes_runtime', + 'get_required_files', + 'getenv', + 'getlastmod', + 'getmygid', + 'getmyinode', + 'getmypid', + 'getmyuid', + 'getopt', + 'getrusage', + 'ini_alter', + 'ini_get', + 'ini_get_all', + 'ini_restore', + 'ini_set', + 'main', + 'memory_get_usage', + 'php_ini_scanned_files', + 'php_logo_guid', + 'php_sapi_name', + 'php_uname', + 'phpcredits', + 'phpinfo', + 'phpversion', + 'putenv', + 'restore_include_path', + 'set_include_path', + 'set_magic_quotes_runtime', + 'set_time_limit', + 'version_compare', + 'zend_logo_guid', + 'zend_version'], + 'POSIX': ['posix_ctermid', + 'posix_get_last_error', + 'posix_getcwd', + 'posix_getegid', + 'posix_geteuid', + 'posix_getgid', + 'posix_getgrgid', + 'posix_getgrnam', + 'posix_getgroups', + 'posix_getlogin', + 'posix_getpgid', + 'posix_getpgrp', + 'posix_getpid', + 'posix_getppid', + 'posix_getpwnam', + 'posix_getpwuid', + 'posix_getrlimit', + 'posix_getsid', + 'posix_getuid', + 'posix_isatty', + 'posix_kill', + 'posix_mkfifo', + 'posix_setegid', + 'posix_seteuid', + 'posix_setgid', + 'posix_setpgid', + 'posix_setsid', + 'posix_setuid', + 'posix_strerror', + 'posix_times', + 'posix_ttyname', + 'posix_uname'], + 'POSIX Regex': ['ereg', + 'ereg_replace', + 'eregi', + 'eregi_replace', + 'split', + 'spliti', + 'sql_regcase'], + 'Parsekit': ['parsekit_compile_file', + 'parsekit_compile_string', + 'parsekit_func_arginfo'], + 'PostgreSQL': ['pg_affected_rows', + 'pg_cancel_query', + 'pg_client_encoding', + 'pg_close', + 'pg_connect', + 'pg_connection_busy', + 'pg_connection_reset', + 'pg_connection_status', + 'pg_convert', + 'pg_copy_from', + 'pg_copy_to', + 'pg_dbname', + 'pg_delete', + 'pg_end_copy', + 'pg_escape_bytea', + 'pg_escape_string', + 'pg_fetch_all', + 'pg_fetch_array', + 'pg_fetch_assoc', + 'pg_fetch_object', + 'pg_fetch_result', + 'pg_fetch_row', + 'pg_field_is_null', + 'pg_field_name', + 'pg_field_num', + 'pg_field_prtlen', + 'pg_field_size', + 'pg_field_type', + 'pg_free_result', + 'pg_get_notify', + 'pg_get_pid', + 'pg_get_result', + 'pg_host', + 'pg_insert', + 'pg_last_error', + 'pg_last_notice', + 'pg_last_oid', + 'pg_lo_close', + 'pg_lo_create', + 'pg_lo_export', + 'pg_lo_import', + 'pg_lo_open', + 'pg_lo_read', + 'pg_lo_read_all', + 'pg_lo_seek', + 'pg_lo_tell', + 'pg_lo_unlink', + 'pg_lo_write', + 'pg_meta_data', + 'pg_num_fields', + 'pg_num_rows', + 'pg_options', + 'pg_parameter_status', + 'pg_pconnect', + 'pg_ping', + 'pg_port', + 'pg_put_line', + 'pg_query', + 'pg_result_error', + 'pg_result_seek', + 'pg_result_status', + 'pg_select', + 'pg_send_query', + 'pg_set_client_encoding', + 'pg_trace', + 'pg_tty', + 'pg_unescape_bytea', + 'pg_untrace', + 'pg_update', + 'pg_version'], + 'Printer': ['printer_abort', + 'printer_close', + 'printer_create_brush', + 'printer_create_dc', + 'printer_create_font', + 'printer_create_pen', + 'printer_delete_brush', + 'printer_delete_dc', + 'printer_delete_font', + 'printer_delete_pen', + 'printer_draw_bmp', + 'printer_draw_chord', + 'printer_draw_elipse', + 'printer_draw_line', + 'printer_draw_pie', + 'printer_draw_rectangle', + 'printer_draw_roundrect', + 'printer_draw_text', + 'printer_end_doc', + 'printer_end_page', + 'printer_get_option', + 'printer_list', + 'printer_logical_fontheight', + 'printer_open', + 'printer_select_brush', + 'printer_select_font', + 'printer_select_pen', + 'printer_set_option', + 'printer_start_doc', + 'printer_start_page', + 'printer_write'], + 'Program Execution': ['escapeshellarg', + 'escapeshellcmd', + 'exec', + 'passthru', + 'proc_close', + 'proc_get_status', + 'proc_nice', + 'proc_open', + 'proc_terminate', + 'shell_exec', + 'system'], + 'Pspell': ['pspell_add_to_personal', + 'pspell_add_to_session', + 'pspell_check', + 'pspell_clear_session', + 'pspell_config_create', + 'pspell_config_data_dir', + 'pspell_config_dict_dir', + 'pspell_config_ignore', + 'pspell_config_mode', + 'pspell_config_personal', + 'pspell_config_repl', + 'pspell_config_runtogether', + 'pspell_config_save_repl', + 'pspell_new', + 'pspell_new_config', + 'pspell_new_personal', + 'pspell_save_wordlist', + 'pspell_store_replacement', + 'pspell_suggest'], + 'Rar': ['rar_close', 'rar_entry_get', 'rar_list', 'rar_open'], + 'Readline': ['readline', + 'readline_add_history', + 'readline_callback_handler_install', + 'readline_callback_handler_remove', + 'readline_callback_read_char', + 'readline_clear_history', + 'readline_completion_function', + 'readline_info', + 'readline_list_history', + 'readline_on_new_line', + 'readline_read_history', + 'readline_redisplay', + 'readline_write_history'], + 'Recode': ['recode', 'recode_file', 'recode_string'], + 'SESAM': ['sesam_affected_rows', + 'sesam_commit', + 'sesam_connect', + 'sesam_diagnostic', + 'sesam_disconnect', + 'sesam_errormsg', + 'sesam_execimm', + 'sesam_fetch_array', + 'sesam_fetch_result', + 'sesam_fetch_row', + 'sesam_field_array', + 'sesam_field_name', + 'sesam_free_result', + 'sesam_num_fields', + 'sesam_query', + 'sesam_rollback', + 'sesam_seek_row', + 'sesam_settransaction'], + 'SNMP': ['snmp_get_quick_print', + 'snmp_get_valueretrieval', + 'snmp_read_mib', + 'snmp_set_enum_print', + 'snmp_set_oid_numeric_print', + 'snmp_set_quick_print', + 'snmp_set_valueretrieval', + 'snmpget', + 'snmpgetnext', + 'snmprealwalk', + 'snmpset', + 'snmpwalk', + 'snmpwalkoid'], + 'SOAP': ['is_soap_fault'], + 'SQLite': ['sqlite_array_query', + 'sqlite_busy_timeout', + 'sqlite_changes', + 'sqlite_close', + 'sqlite_column', + 'sqlite_create_aggregate', + 'sqlite_create_function', + 'sqlite_current', + 'sqlite_error_string', + 'sqlite_escape_string', + 'sqlite_exec', + 'sqlite_factory', + 'sqlite_fetch_all', + 'sqlite_fetch_array', + 'sqlite_fetch_column_types', + 'sqlite_fetch_object', + 'sqlite_fetch_single', + 'sqlite_fetch_string', + 'sqlite_field_name', + 'sqlite_has_more', + 'sqlite_has_prev', + 'sqlite_last_error', + 'sqlite_last_insert_rowid', + 'sqlite_libencoding', + 'sqlite_libversion', + 'sqlite_next', + 'sqlite_num_fields', + 'sqlite_num_rows', + 'sqlite_open', + 'sqlite_popen', + 'sqlite_prev', + 'sqlite_query', + 'sqlite_rewind', + 'sqlite_seek', + 'sqlite_single_query', + 'sqlite_udf_decode_binary', + 'sqlite_udf_encode_binary', + 'sqlite_unbuffered_query'], + 'SWF': ['swf_actiongeturl', + 'swf_actiongotoframe', + 'swf_actiongotolabel', + 'swf_actionnextframe', + 'swf_actionplay', + 'swf_actionprevframe', + 'swf_actionsettarget', + 'swf_actionstop', + 'swf_actiontogglequality', + 'swf_actionwaitforframe', + 'swf_addbuttonrecord', + 'swf_addcolor', + 'swf_closefile', + 'swf_definebitmap', + 'swf_definefont', + 'swf_defineline', + 'swf_definepoly', + 'swf_definerect', + 'swf_definetext', + 'swf_endbutton', + 'swf_enddoaction', + 'swf_endshape', + 'swf_endsymbol', + 'swf_fontsize', + 'swf_fontslant', + 'swf_fonttracking', + 'swf_getbitmapinfo', + 'swf_getfontinfo', + 'swf_getframe', + 'swf_labelframe', + 'swf_lookat', + 'swf_modifyobject', + 'swf_mulcolor', + 'swf_nextid', + 'swf_oncondition', + 'swf_openfile', + 'swf_ortho', + 'swf_ortho2', + 'swf_perspective', + 'swf_placeobject', + 'swf_polarview', + 'swf_popmatrix', + 'swf_posround', + 'swf_pushmatrix', + 'swf_removeobject', + 'swf_rotate', + 'swf_scale', + 'swf_setfont', + 'swf_setframe', + 'swf_shapearc', + 'swf_shapecurveto', + 'swf_shapecurveto3', + 'swf_shapefillbitmapclip', + 'swf_shapefillbitmaptile', + 'swf_shapefilloff', + 'swf_shapefillsolid', + 'swf_shapelinesolid', + 'swf_shapelineto', + 'swf_shapemoveto', + 'swf_showframe', + 'swf_startbutton', + 'swf_startdoaction', + 'swf_startshape', + 'swf_startsymbol', + 'swf_textwidth', + 'swf_translate', + 'swf_viewport'], + 'Semaphore': ['ftok', + 'msg_get_queue', + 'msg_receive', + 'msg_remove_queue', + 'msg_send', + 'msg_set_queue', + 'msg_stat_queue', + 'sem_acquire', + 'sem_get', + 'sem_release', + 'sem_remove', + 'shm_attach', + 'shm_detach', + 'shm_get_var', + 'shm_put_var', + 'shm_remove', + 'shm_remove_var'], + 'Sessions': ['session_cache_expire', + 'session_cache_limiter', + 'session_commit', + 'session_decode', + 'session_destroy', + 'session_encode', + 'session_get_cookie_params', + 'session_id', + 'session_is_registered', + 'session_module_name', + 'session_name', + 'session_regenerate_id', + 'session_register', + 'session_save_path', + 'session_set_cookie_params', + 'session_set_save_handler', + 'session_start', + 'session_unregister', + 'session_unset', + 'session_write_close'], + 'SimpleXML': ['simplexml_import_dom', + 'simplexml_load_file', + 'simplexml_load_string'], + 'Sockets': ['socket_accept', + 'socket_bind', + 'socket_clear_error', + 'socket_close', + 'socket_connect', + 'socket_create', + 'socket_create_listen', + 'socket_create_pair', + 'socket_get_option', + 'socket_getpeername', + 'socket_getsockname', + 'socket_last_error', + 'socket_listen', + 'socket_read', + 'socket_recv', + 'socket_recvfrom', + 'socket_select', + 'socket_send', + 'socket_sendto', + 'socket_set_block', + 'socket_set_nonblock', + 'socket_set_option', + 'socket_shutdown', + 'socket_strerror', + 'socket_write'], + 'Streams': ['stream_context_create', + 'stream_context_get_default', + 'stream_context_get_options', + 'stream_context_set_option', + 'stream_context_set_params', + 'stream_copy_to_stream', + 'stream_filter_append', + 'stream_filter_prepend', + 'stream_filter_register', + 'stream_filter_remove', + 'stream_get_contents', + 'stream_get_filters', + 'stream_get_line', + 'stream_get_meta_data', + 'stream_get_transports', + 'stream_get_wrappers', + 'stream_register_wrapper', + 'stream_select', + 'stream_set_blocking', + 'stream_set_timeout', + 'stream_set_write_buffer', + 'stream_socket_accept', + 'stream_socket_client', + 'stream_socket_enable_crypto', + 'stream_socket_get_name', + 'stream_socket_pair', + 'stream_socket_recvfrom', + 'stream_socket_sendto', + 'stream_socket_server', + 'stream_wrapper_register', + 'stream_wrapper_restore', + 'stream_wrapper_unregister'], + 'Strings': ['addcslashes', + 'addslashes', + 'bin2hex', + 'chop', + 'chr', + 'chunk_split', + 'convert_cyr_string', + 'convert_uudecode', + 'convert_uuencode', + 'count_chars', + 'crc32', + 'crypt', + 'echo', + 'explode', + 'fprintf', + 'get_html_translation_table', + 'hebrev', + 'hebrevc', + 'html_entity_decode', + 'htmlentities', + 'htmlspecialchars', + 'implode', + 'join', + 'levenshtein', + 'localeconv', + 'ltrim', + 'md5', + 'md5_file', + 'metaphone', + 'money_format', + 'nl2br', + 'nl_langinfo', + 'number_format', + 'ord', + 'parse_str', + 'print', + 'printf', + 'quoted_printable_decode', + 'quotemeta', + 'rtrim', + 'setlocale', + 'sha1', + 'sha1_file', + 'similar_text', + 'soundex', + 'sprintf', + 'sscanf', + 'str_ireplace', + 'str_pad', + 'str_repeat', + 'str_replace', + 'str_rot13', + 'str_shuffle', + 'str_split', + 'str_word_count', + 'strcasecmp', + 'strchr', + 'strcmp', + 'strcoll', + 'strcspn', + 'strip_tags', + 'stripcslashes', + 'stripos', + 'stripslashes', + 'stristr', + 'strlen', + 'strnatcasecmp', + 'strnatcmp', + 'strncasecmp', + 'strncmp', + 'strpbrk', + 'strpos', + 'strrchr', + 'strrev', + 'strripos', + 'strrpos', + 'strspn', + 'strstr', + 'strtok', + 'strtolower', + 'strtoupper', + 'strtr', + 'substr', + 'substr_compare', + 'substr_count', + 'substr_replace', + 'trim', + 'ucfirst', + 'ucwords', + 'vfprintf', + 'vprintf', + 'vsprintf', + 'wordwrap'], + 'Sybase': ['sybase_affected_rows', + 'sybase_close', + 'sybase_connect', + 'sybase_data_seek', + 'sybase_deadlock_retry_count', + 'sybase_fetch_array', + 'sybase_fetch_assoc', + 'sybase_fetch_field', + 'sybase_fetch_object', + 'sybase_fetch_row', + 'sybase_field_seek', + 'sybase_free_result', + 'sybase_get_last_message', + 'sybase_min_client_severity', + 'sybase_min_error_severity', + 'sybase_min_message_severity', + 'sybase_min_server_severity', + 'sybase_num_fields', + 'sybase_num_rows', + 'sybase_pconnect', + 'sybase_query', + 'sybase_result', + 'sybase_select_db', + 'sybase_set_message_handler', + 'sybase_unbuffered_query'], + 'TCP Wrappers': ['tcpwrap_check'], + 'Tokenizer': ['token_get_all', 'token_name'], + 'URLs': ['base64_decode', + 'base64_encode', + 'get_headers', + 'get_meta_tags', + 'http_build_query', + 'parse_url', + 'rawurldecode', + 'rawurlencode', + 'urldecode', + 'urlencode'], + 'Variables handling': ['debug_zval_dump', + 'doubleval', + 'empty', + 'floatval', + 'get_defined_vars', + 'get_resource_type', + 'gettype', + 'import_request_variables', + 'intval', + 'is_array', + 'is_bool', + 'is_callable', + 'is_double', + 'is_float', + 'is_int', + 'is_integer', + 'is_long', + 'is_null', + 'is_numeric', + 'is_object', + 'is_real', + 'is_resource', + 'is_scalar', + 'is_string', + 'isset', + 'print_r', + 'serialize', + 'settype', + 'strval', + 'unserialize', + 'unset', + 'var_dump', + 'var_export'], + 'Verisign Payflow Pro': ['pfpro_cleanup', + 'pfpro_init', + 'pfpro_process', + 'pfpro_process_raw', + 'pfpro_version'], + 'W32api': ['w32api_deftype', + 'w32api_init_dtype', + 'w32api_invoke_function', + 'w32api_register_function', + 'w32api_set_call_method'], + 'WDDX': ['wddx_add_vars', + 'wddx_deserialize', + 'wddx_packet_end', + 'wddx_packet_start', + 'wddx_serialize_value', + 'wddx_serialize_vars'], + 'XML': ['utf8_decode', + 'utf8_encode', + 'xml_error_string', + 'xml_get_current_byte_index', + 'xml_get_current_column_number', + 'xml_get_current_line_number', + 'xml_get_error_code', + 'xml_parse', + 'xml_parse_into_struct', + 'xml_parser_create', + 'xml_parser_create_ns', + 'xml_parser_free', + 'xml_parser_get_option', + 'xml_parser_set_option', + 'xml_set_character_data_handler', + 'xml_set_default_handler', + 'xml_set_element_handler', + 'xml_set_end_namespace_decl_handler', + 'xml_set_external_entity_ref_handler', + 'xml_set_notation_decl_handler', + 'xml_set_object', + 'xml_set_processing_instruction_handler', + 'xml_set_start_namespace_decl_handler', + 'xml_set_unparsed_entity_decl_handler'], + 'XML-RPC': ['xmlrpc_decode', + 'xmlrpc_decode_request', + 'xmlrpc_encode', + 'xmlrpc_encode_request', + 'xmlrpc_get_type', + 'xmlrpc_is_fault', + 'xmlrpc_parse_method_descriptions', + 'xmlrpc_server_add_introspection_data', + 'xmlrpc_server_call_method', + 'xmlrpc_server_create', + 'xmlrpc_server_destroy', + 'xmlrpc_server_register_introspection_callback', + 'xmlrpc_server_register_method', + 'xmlrpc_set_type'], + 'XSL': ['xsl_xsltprocessor_get_parameter', + 'xsl_xsltprocessor_has_exslt_support', + 'xsl_xsltprocessor_import_stylesheet', + 'xsl_xsltprocessor_register_php_functions', + 'xsl_xsltprocessor_remove_parameter', + 'xsl_xsltprocessor_set_parameter', + 'xsl_xsltprocessor_transform_to_doc', + 'xsl_xsltprocessor_transform_to_uri', + 'xsl_xsltprocessor_transform_to_xml'], + 'XSLT': ['xslt_backend_info', + 'xslt_backend_name', + 'xslt_backend_version', + 'xslt_create', + 'xslt_errno', + 'xslt_error', + 'xslt_free', + 'xslt_getopt', + 'xslt_process', + 'xslt_set_base', + 'xslt_set_encoding', + 'xslt_set_error_handler', + 'xslt_set_log', + 'xslt_set_object', + 'xslt_set_sax_handler', + 'xslt_set_sax_handlers', + 'xslt_set_scheme_handler', + 'xslt_set_scheme_handlers', + 'xslt_setopt'], + 'YAZ': ['yaz_addinfo', + 'yaz_ccl_conf', + 'yaz_ccl_parse', + 'yaz_close', + 'yaz_connect', + 'yaz_database', + 'yaz_element', + 'yaz_errno', + 'yaz_error', + 'yaz_es_result', + 'yaz_get_option', + 'yaz_hits', + 'yaz_itemorder', + 'yaz_present', + 'yaz_range', + 'yaz_record', + 'yaz_scan', + 'yaz_scan_result', + 'yaz_schema', + 'yaz_search', + 'yaz_set_option', + 'yaz_sort', + 'yaz_syntax', + 'yaz_wait'], + 'YP/NIS': ['yp_all', + 'yp_cat', + 'yp_err_string', + 'yp_errno', + 'yp_first', + 'yp_get_default_domain', + 'yp_master', + 'yp_match', + 'yp_next', + 'yp_order'], + 'Zip': ['zip_close', + 'zip_entry_close', + 'zip_entry_compressedsize', + 'zip_entry_compressionmethod', + 'zip_entry_filesize', + 'zip_entry_name', + 'zip_entry_open', + 'zip_entry_read', + 'zip_open', + 'zip_read'], + 'Zlib': ['gzclose', + 'gzcompress', + 'gzdeflate', + 'gzencode', + 'gzeof', + 'gzfile', + 'gzgetc', + 'gzgets', + 'gzgetss', + 'gzinflate', + 'gzopen', + 'gzpassthru', + 'gzputs', + 'gzread', + 'gzrewind', + 'gzseek', + 'gztell', + 'gzuncompress', + 'gzwrite', + 'readgzfile', + 'zlib_get_coding_type'], + 'bcompiler': ['bcompiler_load', + 'bcompiler_load_exe', + 'bcompiler_parse_class', + 'bcompiler_read', + 'bcompiler_write_class', + 'bcompiler_write_constant', + 'bcompiler_write_exe_footer', + 'bcompiler_write_footer', + 'bcompiler_write_function', + 'bcompiler_write_functions_from_file', + 'bcompiler_write_header'], + 'ctype': ['ctype_alnum', + 'ctype_alpha', + 'ctype_cntrl', + 'ctype_digit', + 'ctype_graph', + 'ctype_lower', + 'ctype_print', + 'ctype_punct', + 'ctype_space', + 'ctype_upper', + 'ctype_xdigit'], + 'dBase': ['dbase_add_record', + 'dbase_close', + 'dbase_create', + 'dbase_delete_record', + 'dbase_get_header_info', + 'dbase_get_record', + 'dbase_get_record_with_names', + 'dbase_numfields', + 'dbase_numrecords', + 'dbase_open', + 'dbase_pack', + 'dbase_replace_record'], + 'dba': ['dba_close', + 'dba_delete', + 'dba_exists', + 'dba_fetch', + 'dba_firstkey', + 'dba_handlers', + 'dba_insert', + 'dba_key_split', + 'dba_list', + 'dba_nextkey', + 'dba_open', + 'dba_optimize', + 'dba_popen', + 'dba_replace', + 'dba_sync'], + 'dbx': ['dbx_close', + 'dbx_compare', + 'dbx_connect', + 'dbx_error', + 'dbx_escape_string', + 'dbx_fetch_row', + 'dbx_query', + 'dbx_sort'], + 'fam': ['fam_cancel_monitor', + 'fam_close', + 'fam_monitor_collection', + 'fam_monitor_directory', + 'fam_monitor_file', + 'fam_next_event', + 'fam_open', + 'fam_pending', + 'fam_resume_monitor', + 'fam_suspend_monitor'], + 'filePro': ['filepro', + 'filepro_fieldcount', + 'filepro_fieldname', + 'filepro_fieldtype', + 'filepro_fieldwidth', + 'filepro_retrieve', + 'filepro_rowcount'], + 'gettext': ['bind_textdomain_codeset', + 'bindtextdomain', + 'dcgettext', + 'dcngettext', + 'dgettext', + 'dngettext', + 'gettext', + 'ngettext', + 'textdomain'], + 'iconv': ['iconv', + 'iconv_get_encoding', + 'iconv_mime_decode', + 'iconv_mime_decode_headers', + 'iconv_mime_encode', + 'iconv_set_encoding', + 'iconv_strlen', + 'iconv_strpos', + 'iconv_strrpos', + 'iconv_substr', + 'ob_iconv_handler'], + 'id3': ['id3_get_frame_long_name', + 'id3_get_frame_short_name', + 'id3_get_genre_id', + 'id3_get_genre_list', + 'id3_get_genre_name', + 'id3_get_tag', + 'id3_get_version', + 'id3_remove_tag', + 'id3_set_tag'], + 'mSQL': ['msql', + 'msql_affected_rows', + 'msql_close', + 'msql_connect', + 'msql_create_db', + 'msql_createdb', + 'msql_data_seek', + 'msql_db_query', + 'msql_dbname', + 'msql_drop_db', + 'msql_error', + 'msql_fetch_array', + 'msql_fetch_field', + 'msql_fetch_object', + 'msql_fetch_row', + 'msql_field_flags', + 'msql_field_len', + 'msql_field_name', + 'msql_field_seek', + 'msql_field_table', + 'msql_field_type', + 'msql_fieldflags', + 'msql_fieldlen', + 'msql_fieldname', + 'msql_fieldtable', + 'msql_fieldtype', + 'msql_free_result', + 'msql_list_dbs', + 'msql_list_fields', + 'msql_list_tables', + 'msql_num_fields', + 'msql_num_rows', + 'msql_numfields', + 'msql_numrows', + 'msql_pconnect', + 'msql_query', + 'msql_regcase', + 'msql_result', + 'msql_select_db', + 'msql_tablename'], + 'mailparse': ['mailparse_determine_best_xfer_encoding', + 'mailparse_msg_create', + 'mailparse_msg_extract_part', + 'mailparse_msg_extract_part_file', + 'mailparse_msg_free', + 'mailparse_msg_get_part', + 'mailparse_msg_get_part_data', + 'mailparse_msg_get_structure', + 'mailparse_msg_parse', + 'mailparse_msg_parse_file', + 'mailparse_rfc822_parse_addresses', + 'mailparse_stream_encode', + 'mailparse_uudecode_all'], + 'mcrypt': ['mcrypt_cbc', + 'mcrypt_cfb', + 'mcrypt_create_iv', + 'mcrypt_decrypt', + 'mcrypt_ecb', + 'mcrypt_enc_get_algorithms_name', + 'mcrypt_enc_get_block_size', + 'mcrypt_enc_get_iv_size', + 'mcrypt_enc_get_key_size', + 'mcrypt_enc_get_modes_name', + 'mcrypt_enc_get_supported_key_sizes', + 'mcrypt_enc_is_block_algorithm', + 'mcrypt_enc_is_block_algorithm_mode', + 'mcrypt_enc_is_block_mode', + 'mcrypt_enc_self_test', + 'mcrypt_encrypt', + 'mcrypt_generic', + 'mcrypt_generic_deinit', + 'mcrypt_generic_end', + 'mcrypt_generic_init', + 'mcrypt_get_block_size', + 'mcrypt_get_cipher_name', + 'mcrypt_get_iv_size', + 'mcrypt_get_key_size', + 'mcrypt_list_algorithms', + 'mcrypt_list_modes', + 'mcrypt_module_close', + 'mcrypt_module_get_algo_block_size', + 'mcrypt_module_get_algo_key_size', + 'mcrypt_module_get_supported_key_sizes', + 'mcrypt_module_is_block_algorithm', + 'mcrypt_module_is_block_algorithm_mode', + 'mcrypt_module_is_block_mode', + 'mcrypt_module_open', + 'mcrypt_module_self_test', + 'mcrypt_ofb', + 'mdecrypt_generic'], + 'mhash': ['mhash', + 'mhash_count', + 'mhash_get_block_size', + 'mhash_get_hash_name', + 'mhash_keygen_s2k'], + 'mnoGoSearch': ['udm_add_search_limit', + 'udm_alloc_agent', + 'udm_alloc_agent_array', + 'udm_api_version', + 'udm_cat_list', + 'udm_cat_path', + 'udm_check_charset', + 'udm_check_stored', + 'udm_clear_search_limits', + 'udm_close_stored', + 'udm_crc32', + 'udm_errno', + 'udm_error', + 'udm_find', + 'udm_free_agent', + 'udm_free_ispell_data', + 'udm_free_res', + 'udm_get_doc_count', + 'udm_get_res_field', + 'udm_get_res_param', + 'udm_hash32', + 'udm_load_ispell_data', + 'udm_open_stored', + 'udm_set_agent_param'], + 'muscat': ['muscat_close', + 'muscat_get', + 'muscat_give', + 'muscat_setup', + 'muscat_setup_net'], + 'mysqli': ['mysqli_affected_rows', + 'mysqli_autocommit', + 'mysqli_bind_param', + 'mysqli_bind_result', + 'mysqli_change_user', + 'mysqli_character_set_name', + 'mysqli_client_encoding', + 'mysqli_close', + 'mysqli_commit', + 'mysqli_connect', + 'mysqli_connect_errno', + 'mysqli_connect_error', + 'mysqli_data_seek', + 'mysqli_debug', + 'mysqli_disable_reads_from_master', + 'mysqli_disable_rpl_parse', + 'mysqli_dump_debug_info', + 'mysqli_embedded_connect', + 'mysqli_enable_reads_from_master', + 'mysqli_enable_rpl_parse', + 'mysqli_errno', + 'mysqli_error', + 'mysqli_escape_string', + 'mysqli_execute', + 'mysqli_fetch', + 'mysqli_fetch_array', + 'mysqli_fetch_assoc', + 'mysqli_fetch_field', + 'mysqli_fetch_field_direct', + 'mysqli_fetch_fields', + 'mysqli_fetch_lengths', + 'mysqli_fetch_object', + 'mysqli_fetch_row', + 'mysqli_field_count', + 'mysqli_field_seek', + 'mysqli_field_tell', + 'mysqli_free_result', + 'mysqli_get_client_info', + 'mysqli_get_client_version', + 'mysqli_get_host_info', + 'mysqli_get_metadata', + 'mysqli_get_proto_info', + 'mysqli_get_server_info', + 'mysqli_get_server_version', + 'mysqli_info', + 'mysqli_init', + 'mysqli_insert_id', + 'mysqli_kill', + 'mysqli_master_query', + 'mysqli_more_results', + 'mysqli_multi_query', + 'mysqli_next_result', + 'mysqli_num_fields', + 'mysqli_num_rows', + 'mysqli_options', + 'mysqli_param_count', + 'mysqli_ping', + 'mysqli_prepare', + 'mysqli_query', + 'mysqli_real_connect', + 'mysqli_real_escape_string', + 'mysqli_real_query', + 'mysqli_report', + 'mysqli_rollback', + 'mysqli_rpl_parse_enabled', + 'mysqli_rpl_probe', + 'mysqli_rpl_query_type', + 'mysqli_select_db', + 'mysqli_send_long_data', + 'mysqli_send_query', + 'mysqli_server_end', + 'mysqli_server_init', + 'mysqli_set_opt', + 'mysqli_sqlstate', + 'mysqli_ssl_set', + 'mysqli_stat', + 'mysqli_stmt_affected_rows', + 'mysqli_stmt_bind_param', + 'mysqli_stmt_bind_result', + 'mysqli_stmt_close', + 'mysqli_stmt_data_seek', + 'mysqli_stmt_errno', + 'mysqli_stmt_error', + 'mysqli_stmt_execute', + 'mysqli_stmt_fetch', + 'mysqli_stmt_free_result', + 'mysqli_stmt_init', + 'mysqli_stmt_num_rows', + 'mysqli_stmt_param_count', + 'mysqli_stmt_prepare', + 'mysqli_stmt_reset', + 'mysqli_stmt_result_metadata', + 'mysqli_stmt_send_long_data', + 'mysqli_stmt_sqlstate', + 'mysqli_stmt_store_result', + 'mysqli_store_result', + 'mysqli_thread_id', + 'mysqli_thread_safe', + 'mysqli_use_result', + 'mysqli_warning_count'], + 'openal': ['openal_buffer_create', + 'openal_buffer_data', + 'openal_buffer_destroy', + 'openal_buffer_get', + 'openal_buffer_loadwav', + 'openal_context_create', + 'openal_context_current', + 'openal_context_destroy', + 'openal_context_process', + 'openal_context_suspend', + 'openal_device_close', + 'openal_device_open', + 'openal_listener_get', + 'openal_listener_set', + 'openal_source_create', + 'openal_source_destroy', + 'openal_source_get', + 'openal_source_pause', + 'openal_source_play', + 'openal_source_rewind', + 'openal_source_set', + 'openal_source_stop', + 'openal_stream'], + 'qtdom': ['qdom_error', 'qdom_tree'], + 'shmop': ['shmop_close', + 'shmop_delete', + 'shmop_open', + 'shmop_read', + 'shmop_size', + 'shmop_write'], + 'spl': ['class_implements', + 'class_parents', + 'iterator-to-array', + 'iterator_count', + 'spl_classes'], + 'ssh2': ['ssh2_auth_none', + 'ssh2_auth_password', + 'ssh2_auth_pubkey_file', + 'ssh2_connect', + 'ssh2_exec', + 'ssh2_fetch_stream', + 'ssh2_fingerprint', + 'ssh2_methods_negotiated', + 'ssh2_scp_recv', + 'ssh2_scp_send', + 'ssh2_sftp', + 'ssh2_sftp_lstat', + 'ssh2_sftp_mkdir', + 'ssh2_sftp_readlink', + 'ssh2_sftp_realpath', + 'ssh2_sftp_rename', + 'ssh2_sftp_rmdir', + 'ssh2_sftp_stat', + 'ssh2_sftp_symlink', + 'ssh2_sftp_unlink', + 'ssh2_shell', + 'ssh2_tunnel'], + 'tidy': ['ob_tidyhandler', + 'tidy_access_count', + 'tidy_clean_repair', + 'tidy_config_count', + 'tidy_diagnose', + 'tidy_error_count', + 'tidy_get_body', + 'tidy_get_config', + 'tidy_get_error_buffer', + 'tidy_get_head', + 'tidy_get_html', + 'tidy_get_html_ver', + 'tidy_get_output', + 'tidy_get_release', + 'tidy_get_root', + 'tidy_get_status', + 'tidy_getopt', + 'tidy_is_xhtml', + 'tidy_is_xml', + 'tidy_load_config', + 'tidy_parse_file', + 'tidy_parse_string', + 'tidy_repair_file', + 'tidy_repair_string', + 'tidy_reset_config', + 'tidy_save_config', + 'tidy_set_encoding', + 'tidy_setopt', + 'tidy_warning_count'], + 'unknown': ['bcompile_write_file', + 'com', + 'dir', + 'dotnet', + 'hw_api_attribute', + 'hw_api_content', + 'hw_api_object', + 'imagepscopyfont', + 'mcve_adduser', + 'mcve_adduserarg', + 'mcve_bt', + 'mcve_checkstatus', + 'mcve_chkpwd', + 'mcve_chngpwd', + 'mcve_completeauthorizations', + 'mcve_connect', + 'mcve_connectionerror', + 'mcve_deleteresponse', + 'mcve_deletetrans', + 'mcve_deleteusersetup', + 'mcve_deluser', + 'mcve_destroyconn', + 'mcve_destroyengine', + 'mcve_disableuser', + 'mcve_edituser', + 'mcve_enableuser', + 'mcve_force', + 'mcve_getcell', + 'mcve_getcellbynum', + 'mcve_getcommadelimited', + 'mcve_getheader', + 'mcve_getuserarg', + 'mcve_getuserparam', + 'mcve_gft', + 'mcve_gl', + 'mcve_gut', + 'mcve_initconn', + 'mcve_initengine', + 'mcve_initusersetup', + 'mcve_iscommadelimited', + 'mcve_liststats', + 'mcve_listusers', + 'mcve_maxconntimeout', + 'mcve_monitor', + 'mcve_numcolumns', + 'mcve_numrows', + 'mcve_override', + 'mcve_parsecommadelimited', + 'mcve_ping', + 'mcve_preauth', + 'mcve_preauthcompletion', + 'mcve_qc', + 'mcve_responseparam', + 'mcve_return', + 'mcve_returncode', + 'mcve_returnstatus', + 'mcve_sale', + 'mcve_setblocking', + 'mcve_setdropfile', + 'mcve_setip', + 'mcve_setssl', + 'mcve_setssl_files', + 'mcve_settimeout', + 'mcve_settle', + 'mcve_text_avs', + 'mcve_text_code', + 'mcve_text_cv', + 'mcve_transactionauth', + 'mcve_transactionavs', + 'mcve_transactionbatch', + 'mcve_transactioncv', + 'mcve_transactionid', + 'mcve_transactionitem', + 'mcve_transactionssent', + 'mcve_transactiontext', + 'mcve_transinqueue', + 'mcve_transnew', + 'mcve_transparam', + 'mcve_transsend', + 'mcve_ub', + 'mcve_uwait', + 'mcve_verifyconnection', + 'mcve_verifysslcert', + 'mcve_void', + 'mysqli()', + 'pdf_open', + 'pdf_open_png', + 'pdf_set_font', + 'php_register_url_stream_wrapper', + 'php_stream_can_cast', + 'php_stream_cast', + 'php_stream_close', + 'php_stream_closedir', + 'php_stream_copy_to_mem', + 'php_stream_copy_to_stream', + 'php_stream_eof', + 'php_stream_filter_register_factory', + 'php_stream_filter_unregister_factory', + 'php_stream_flush', + 'php_stream_fopen_from_file', + 'php_stream_fopen_temporary_file', + 'php_stream_fopen_tmpfile', + 'php_stream_getc', + 'php_stream_gets', + 'php_stream_is', + 'php_stream_is_persistent', + 'php_stream_make_seekable', + 'php_stream_open_wrapper', + 'php_stream_open_wrapper_as_file', + 'php_stream_open_wrapper_ex', + 'php_stream_opendir', + 'php_stream_passthru', + 'php_stream_read', + 'php_stream_readdir', + 'php_stream_rewinddir', + 'php_stream_seek', + 'php_stream_sock_open_from_socket', + 'php_stream_sock_open_host', + 'php_stream_sock_open_unix', + 'php_stream_stat', + 'php_stream_stat_path', + 'php_stream_tell', + 'php_stream_write', + 'php_unregister_url_stream_wrapper', + 'swfbutton_keypress', + 'swfdisplayitem', + 'variant'], + 'vpopmail': ['vpopmail_add_alias_domain', + 'vpopmail_add_alias_domain_ex', + 'vpopmail_add_domain', + 'vpopmail_add_domain_ex', + 'vpopmail_add_user', + 'vpopmail_alias_add', + 'vpopmail_alias_del', + 'vpopmail_alias_del_domain', + 'vpopmail_alias_get', + 'vpopmail_alias_get_all', + 'vpopmail_auth_user', + 'vpopmail_del_domain', + 'vpopmail_del_domain_ex', + 'vpopmail_del_user', + 'vpopmail_error', + 'vpopmail_passwd', + 'vpopmail_set_user_quota'], + 'xattr': ['xattr_get', + 'xattr_list', + 'xattr_remove', + 'xattr_set', + 'xattr_supported'], + 'xdiff': ['xdiff_file_diff', + 'xdiff_file_diff_binary', + 'xdiff_file_merge3', + 'xdiff_file_patch', + 'xdiff_file_patch_binary', + 'xdiff_string_diff', + 'xdiff_string_diff_binary', + 'xdiff_string_merge3', + 'xdiff_string_patch', + 'xdiff_string_patch_binary']} + + +if __name__ == '__main__': + import pprint + import re + import urllib + _function_re = re.compile('<B\s+CLASS="function"\s*>(.*?)\(\)</B\s*>(?uism)') + + def get_php_functions(): + uf = urllib.urlopen('http://de.php.net/manual/en/index.functions.php') + data = uf.read() + uf.close() + results = set() + for match in _function_re.finditer(data): + fn = match.group(1) + if '->' not in fn and '::' not in fn: + results.add(fn) + # PY24: use sorted() + results = list(results) + results.sort() + return results + + def get_function_module(func_name): + fn = func_name.replace('_', '-') + uf = urllib.urlopen('http://de.php.net/manual/en/function.%s.php' % fn) + regex = re.compile('<li class="header up">' + '<a href="ref\..*?\.php">([a-zA-Z0-9\s]+)</a></li>') + for line in uf: + match = regex.search(line) + if match: + return match.group(1) + + print '>> Downloading Function Index' + functions = get_php_functions() + total = len(functions) + print '%d functions found' % total + modules = {} + idx = 1 + for function_name in get_php_functions(): + print '>> %r (%d/%d)' % (function_name, idx, total) + m = get_function_module(function_name) + if m is None: + print 'NOT_FOUND' + m = 'unknown' + else: + print repr(m) + modules.setdefault(m, []).append(function_name) + idx += 1 + + # extract useful sourcecode from this file + f = file(__file__) + try: + content = f.read() + finally: + f.close() + header = content[:content.find('MODULES = {')] + footer = content[content.find("if __name__ == '__main__':"):] + + # write new file + f = file(__file__, 'w') + f.write(header) + f.write('MODULES = %s\n\n' % pprint.pformat(modules)) + f.write(footer) + f.close()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/lexers/_vimbuiltins.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,3 @@ +auto=[('BufAdd', 'BufAdd'), ('BufCreate', 'BufCreate'), ('BufDelete', 'BufDelete'), ('BufEnter', 'BufEnter'), ('BufFilePost', 'BufFilePost'), ('BufFilePre', 'BufFilePre'), ('BufHidden', 'BufHidden'), ('BufLeave', 'BufLeave'), ('BufNew', 'BufNew'), ('BufNewFile', 'BufNewFile'), ('BufRead', 'BufRead'), ('BufReadCmd', 'BufReadCmd'), ('BufReadPost', 'BufReadPost'), ('BufReadPre', 'BufReadPre'), ('BufUnload', 'BufUnload'), ('BufWinEnter', 'BufWinEnter'), ('BufWinLeave', 'BufWinLeave'), ('BufWipeout', 'BufWipeout'), ('BufWrite', 'BufWrite'), ('BufWriteCmd', 'BufWriteCmd'), ('BufWritePost', 'BufWritePost'), ('BufWritePre', 'BufWritePre'), ('Cmd', 'Cmd'), ('CmdwinEnter', 'CmdwinEnter'), ('CmdwinLeave', 'CmdwinLeave'), ('ColorScheme', 'ColorScheme'), ('CursorHold', 'CursorHold'), ('CursorHoldI', 'CursorHoldI'), ('CursorMoved', 'CursorMoved'), ('CursorMovedI', 'CursorMovedI'), ('EncodingChanged', 'EncodingChanged'), ('FileAppendCmd', 'FileAppendCmd'), ('FileAppendPost', 'FileAppendPost'), ('FileAppendPre', 'FileAppendPre'), ('FileChangedRO', 'FileChangedRO'), ('FileChangedShell', 'FileChangedShell'), ('FileChangedShellPost', 'FileChangedShellPost'), ('FileEncoding', 'FileEncoding'), ('FileReadCmd', 'FileReadCmd'), ('FileReadPost', 'FileReadPost'), ('FileReadPre', 'FileReadPre'), ('FileType', 'FileType'), ('FileWriteCmd', 'FileWriteCmd'), ('FileWritePost', 'FileWritePost'), ('FileWritePre', 'FileWritePre'), ('FilterReadPost', 'FilterReadPost'), ('FilterReadPre', 'FilterReadPre'), ('FilterWritePost', 'FilterWritePost'), ('FilterWritePre', 'FilterWritePre'), ('FocusGained', 'FocusGained'), ('FocusLost', 'FocusLost'), ('FuncUndefined', 'FuncUndefined'), ('GUIEnter', 'GUIEnter'), ('InsertChange', 'InsertChange'), ('InsertEnter', 'InsertEnter'), ('InsertLeave', 'InsertLeave'), ('MenuPopup', 'MenuPopup'), ('QuickFixCmdPost', 'QuickFixCmdPost'), ('QuickFixCmdPre', 'QuickFixCmdPre'), ('RemoteReply', 'RemoteReply'), ('SessionLoadPost', 'SessionLoadPost'), ('ShellCmdPost', 'ShellCmdPost'), ('ShellFilterPost', 'ShellFilterPost'), ('SourcePre', 'SourcePre'), ('SpellFileMissing', 'SpellFileMissing'), ('StdinReadPost', 'StdinReadPost'), ('StdinReadPre', 'StdinReadPre'), ('SwapExists', 'SwapExists'), ('Syntax', 'Syntax'), ('TabEnter', 'TabEnter'), ('TabLeave', 'TabLeave'), ('TermChanged', 'TermChanged'), ('TermResponse', 'TermResponse'), ('User', 'User'), ('UserGettingBored', 'UserGettingBored'), ('VimEnter', 'VimEnter'), ('VimLeave', 'VimLeave'), ('VimLeavePre', 'VimLeavePre'), ('VimResized', 'VimResized'), ('WinEnter', 'WinEnter'), ('WinLeave', 'WinLeave'), ('event', 'event')] +command=[('DeleteFirst', 'DeleteFirst'), ('Explore', 'Explore'), ('Hexplore', 'Hexplore'), ('I', 'I'), ('N', 'Next'), ('NetrwSettings', 'NetrwSettings'), ('Nread', 'Nread'), ('Nw', 'Nw'), ('P', 'Print'), ('Sexplore', 'Sexplore'), ('Vexplore', 'Vexplore'), ('X', 'X'), ('XMLent', 'XMLent'), ('XMLns', 'XMLns'), ('ab', 'abbreviate'), ('abc', 'abclear'), ('abo', 'aboveleft'), ('al', 'all'), ('ar', 'args'), ('arga', 'argadd'), ('argd', 'argdelete'), ('argdo', 'argdo'), ('arge', 'argedit'), ('argg', 'argglobal'), ('argl', 'arglocal'), ('argu', 'argument'), ('as', 'ascii'), ('b', 'buffer'), ('bN', 'bNext'), ('ba', 'ball'), ('bad', 'badd'), ('bd', 'bdelete'), ('be', 'be'), ('bel', 'belowright'), ('bf', 'bfirst'), ('bl', 'blast'), ('bm', 'bmodified'), ('bn', 'bnext'), ('bo', 'botright'), ('bp', 'bprevious'), ('br', 'brewind'), ('brea', 'break'), ('breaka', 'breakadd'), ('breakd', 'breakdel'), ('breakl', 'breaklist'), ('bro', 'browse'), ('bufdo', 'bufdo'), ('buffers', 'buffers'), ('bun', 'bunload'), ('bw', 'bwipeout'), ('c', 'change'), ('cN', 'cNext'), ('cNf', 'cNfile'), ('ca', 'cabbrev'), ('cabc', 'cabclear'), ('cad', 'caddexpr'), ('caddb', 'caddbuffer'), ('caddf', 'caddfile'), ('cal', 'call'), ('cat', 'catch'), ('cb', 'cbuffer'), ('cc', 'cc'), ('ccl', 'cclose'), ('cd', 'cd'), ('ce', 'center'), ('cex', 'cexpr'), ('cf', 'cfile'), ('cfir', 'cfirst'), ('cg', 'cgetfile'), ('cgetb', 'cgetbuffer'), ('cgete', 'cgetexpr'), ('changes', 'changes'), ('chd', 'chdir'), ('che', 'checkpath'), ('checkt', 'checktime'), ('cl', 'clist'), ('cla', 'clast'), ('clo', 'close'), ('cmapc', 'cmapclear'), ('cn', 'cnext'), ('cnew', 'cnewer'), ('cnf', 'cnfile'), ('cnorea', 'cnoreabbrev'), ('co', 'copy'), ('col', 'colder'), ('colo', 'colorscheme'), ('comc', 'comclear'), ('comp', 'compiler'), ('con', 'continue'), ('conf', 'confirm'), ('cope', 'copen'), ('cp', 'cprevious'), ('cpf', 'cpfile'), ('cq', 'cquit'), ('cr', 'crewind'), ('cu', 'cunmap'), ('cuna', 'cunabbrev'), ('cw', 'cwindow'), ('d', 'delete'), ('debugg', 'debuggreedy'), ('delc', 'delcommand'), ('delf', 'delfunction'), ('delm', 'delmarks'), ('di', 'display'), ('diffg', 'diffget'), ('diffoff', 'diffoff'), ('diffpatch', 'diffpatch'), ('diffpu', 'diffput'), ('diffsplit', 'diffsplit'), ('diffthis', 'diffthis'), ('diffu', 'diffupdate'), ('dig', 'digraphs'), ('dj', 'djump'), ('dl', 'dlist'), ('dr', 'drop'), ('ds', 'dsearch'), ('dsp', 'dsplit'), ('e', 'edit'), ('earlier', 'earlier'), ('echoe', 'echoerr'), ('echom', 'echomsg'), ('echon', 'echon'), ('el', 'else'), ('elsei', 'elseif'), ('em', 'emenu'), ('emenu', 'emenu'), ('en', 'endif'), ('endf', 'endfunction'), ('endfo', 'endfor'), ('endt', 'endtry'), ('endw', 'endwhile'), ('ene', 'enew'), ('ex', 'ex'), ('exi', 'exit'), ('exu', 'exusage'), ('f', 'file'), ('files', 'files'), ('filetype', 'filetype'), ('fin', 'find'), ('fina', 'finally'), ('fini', 'finish'), ('fir', 'first'), ('fix', 'fixdel'), ('fo', 'fold'), ('foldc', 'foldclose'), ('foldd', 'folddoopen'), ('folddoc', 'folddoclosed'), ('foldo', 'foldopen'), ('for', 'for'), ('fu', 'function'), ('go', 'goto'), ('gr', 'grep'), ('grepa', 'grepadd'), ('h', 'help'), ('ha', 'hardcopy'), ('helpf', 'helpfind'), ('helpg', 'helpgrep'), ('helpt', 'helptags'), ('hid', 'hide'), ('his', 'history'), ('ia', 'iabbrev'), ('iabc', 'iabclear'), ('if', 'if'), ('ij', 'ijump'), ('il', 'ilist'), ('imapc', 'imapclear'), ('in', 'in'), ('inorea', 'inoreabbrev'), ('is', 'isearch'), ('isp', 'isplit'), ('iu', 'iunmap'), ('iuna', 'iunabbrev'), ('j', 'join'), ('ju', 'jumps'), ('k', 'k'), ('kee', 'keepmarks'), ('keepalt', 'keepalt'), ('keepj', 'keepjumps'), ('l', 'list'), ('lN', 'lNext'), ('lNf', 'lNfile'), ('la', 'last'), ('lad', 'laddexpr'), ('laddb', 'laddbuffer'), ('laddf', 'laddfile'), ('lan', 'language'), ('later', 'later'), ('lb', 'lbuffer'), ('lc', 'lcd'), ('lch', 'lchdir'), ('lcl', 'lclose'), ('le', 'left'), ('lefta', 'leftabove'), ('lex', 'lexpr'), ('lf', 'lfile'), ('lfir', 'lfirst'), ('lg', 'lgetfile'), ('lgetb', 'lgetbuffer'), ('lgete', 'lgetexpr'), ('lgr', 'lgrep'), ('lgrepa', 'lgrepadd'), ('lh', 'lhelpgrep'), ('ll', 'll'), ('lla', 'llast'), ('lli', 'llist'), ('lm', 'lmap'), ('lmak', 'lmake'), ('lmapc', 'lmapclear'), ('ln', 'lnoremap'), ('lne', 'lnext'), ('lnew', 'lnewer'), ('lnf', 'lnfile'), ('lo', 'loadview'), ('loc', 'lockmarks'), ('lockv', 'lockvar'), ('lol', 'lolder'), ('lop', 'lopen'), ('lp', 'lprevious'), ('lpf', 'lpfile'), ('lr', 'lrewind'), ('ls', 'ls'), ('lt', 'ltag'), ('lu', 'lunmap'), ('lv', 'lvimgrep'), ('lvimgrepa', 'lvimgrepadd'), ('lw', 'lwindow'), ('m', 'move'), ('ma', 'mark'), ('mak', 'make'), ('marks', 'marks'), ('mat', 'match'), ('menut', 'menutranslate'), ('mk', 'mkexrc'), ('mks', 'mksession'), ('mksp', 'mkspell'), ('mkv', 'mkvimrc'), ('mkvie', 'mkview'), ('mod', 'mode'), ('mz', 'mzscheme'), ('mzf', 'mzfile'), ('n', 'next'), ('nbkey', 'nbkey'), ('new', 'new'), ('nmapc', 'nmapclear'), ('noh', 'nohlsearch'), ('norea', 'noreabbrev'), ('nu', 'number'), ('nun', 'nunmap'), ('o', 'open'), ('omapc', 'omapclear'), ('on', 'only'), ('opt', 'options'), ('ou', 'ounmap'), ('p', 'print'), ('pc', 'pclose'), ('pe', 'perl'), ('ped', 'pedit'), ('perld', 'perldo'), ('po', 'pop'), ('popu', 'popu'), ('popu', 'popup'), ('pp', 'ppop'), ('pre', 'preserve'), ('prev', 'previous'), ('prof', 'profile'), ('profd', 'profdel'), ('prompt', 'prompt'), ('promptf', 'promptfind'), ('promptr', 'promptrepl'), ('ps', 'psearch'), ('ptN', 'ptNext'), ('pta', 'ptag'), ('ptf', 'ptfirst'), ('ptj', 'ptjump'), ('ptl', 'ptlast'), ('ptn', 'ptnext'), ('ptp', 'ptprevious'), ('ptr', 'ptrewind'), ('pts', 'ptselect'), ('pu', 'put'), ('pw', 'pwd'), ('py', 'python'), ('pyf', 'pyfile'), ('q', 'quit'), ('qa', 'qall'), ('quita', 'quitall'), ('r', 'read'), ('rec', 'recover'), ('red', 'redo'), ('redi', 'redir'), ('redr', 'redraw'), ('redraws', 'redrawstatus'), ('reg', 'registers'), ('res', 'resize'), ('ret', 'retab'), ('retu', 'return'), ('rew', 'rewind'), ('ri', 'right'), ('rightb', 'rightbelow'), ('ru', 'runtime'), ('rub', 'ruby'), ('rubyd', 'rubydo'), ('rubyf', 'rubyfile'), ('rv', 'rviminfo'), ('sN', 'sNext'), ('sa', 'sargument'), ('sal', 'sall'), ('san', 'sandbox'), ('sav', 'saveas'), ('sb', 'sbuffer'), ('sbN', 'sbNext'), ('sba', 'sball'), ('sbf', 'sbfirst'), ('sbl', 'sblast'), ('sbm', 'sbmodified'), ('sbn', 'sbnext'), ('sbp', 'sbprevious'), ('sbr', 'sbrewind'), ('scrip', 'scriptnames'), ('scripte', 'scriptencoding'), ('se', 'set'), ('setf', 'setfiletype'), ('setg', 'setglobal'), ('setl', 'setlocal'), ('sf', 'sfind'), ('sfir', 'sfirst'), ('sh', 'shell'), ('sign', 'sign'), ('sil', 'silent'), ('sim', 'simalt'), ('sl', 'sleep'), ('sla', 'slast'), ('sm', 'smagic'), ('sm', 'smap'), ('smapc', 'smapclear'), ('sme', 'sme'), ('smenu', 'smenu'), ('sn', 'snext'), ('sni', 'sniff'), ('sno', 'snomagic'), ('snor', 'snoremap'), ('snoreme', 'snoreme'), ('snoremenu', 'snoremenu'), ('so', 'source'), ('sor', 'sort'), ('sp', 'split'), ('spe', 'spellgood'), ('spelld', 'spelldump'), ('spelli', 'spellinfo'), ('spellr', 'spellrepall'), ('spellu', 'spellundo'), ('spellw', 'spellwrong'), ('spr', 'sprevious'), ('sre', 'srewind'), ('st', 'stop'), ('sta', 'stag'), ('star', 'startinsert'), ('startg', 'startgreplace'), ('startr', 'startreplace'), ('stj', 'stjump'), ('stopi', 'stopinsert'), ('sts', 'stselect'), ('sun', 'sunhide'), ('sunm', 'sunmap'), ('sus', 'suspend'), ('sv', 'sview'), ('syncbind', 'syncbind'), ('t', 't'), ('tN', 'tNext'), ('ta', 'tag'), ('tab', 'tab'), ('tabN', 'tabNext'), ('tabc', 'tabclose'), ('tabd', 'tabdo'), ('tabe', 'tabedit'), ('tabf', 'tabfind'), ('tabfir', 'tabfirst'), ('tabl', 'tablast'), ('tabmove', 'tabmove'), ('tabn', 'tabnext'), ('tabnew', 'tabnew'), ('tabo', 'tabonly'), ('tabp', 'tabprevious'), ('tabr', 'tabrewind'), ('tabs', 'tabs'), ('tags', 'tags'), ('tc', 'tcl'), ('tcld', 'tcldo'), ('tclf', 'tclfile'), ('te', 'tearoff'), ('tf', 'tfirst'), ('th', 'throw'), ('the', 'the'), ('tj', 'tjump'), ('tl', 'tlast'), ('tm', 'tm'), ('tm', 'tmenu'), ('tn', 'tnext'), ('to', 'topleft'), ('tp', 'tprevious'), ('tr', 'trewind'), ('try', 'try'), ('ts', 'tselect'), ('tu', 'tu'), ('tu', 'tunmenu'), ('u', 'undo'), ('una', 'unabbreviate'), ('undoj', 'undojoin'), ('undol', 'undolist'), ('unh', 'unhide'), ('unlo', 'unlockvar'), ('unm', 'unmap'), ('up', 'update'), ('ve', 'version'), ('verb', 'verbose'), ('vert', 'vertical'), ('vi', 'visual'), ('vie', 'view'), ('vim', 'vimgrep'), ('vimgrepa', 'vimgrepadd'), ('viu', 'viusage'), ('vmapc', 'vmapclear'), ('vne', 'vnew'), ('vs', 'vsplit'), ('vu', 'vunmap'), ('w', 'write'), ('wN', 'wNext'), ('wa', 'wall'), ('wh', 'while'), ('win', 'winsize'), ('winc', 'wincmd'), ('windo', 'windo'), ('winp', 'winpos'), ('wn', 'wnext'), ('wp', 'wprevious'), ('wq', 'wq'), ('wqa', 'wqall'), ('ws', 'wsverb'), ('wv', 'wviminfo'), ('x', 'xit'), ('xa', 'xall'), ('xm', 'xmap'), ('xmapc', 'xmapclear'), ('xme', 'xme'), ('xmenu', 'xmenu'), ('xn', 'xnoremap'), ('xnoreme', 'xnoreme'), ('xnoremenu', 'xnoremenu'), ('xu', 'xunmap'), ('y', 'yank')] +option=[('acd', 'acd'), ('ai', 'ai'), ('akm', 'akm'), ('al', 'al'), ('aleph', 'aleph'), ('allowrevins', 'allowrevins'), ('altkeymap', 'altkeymap'), ('ambiwidth', 'ambiwidth'), ('ambw', 'ambw'), ('anti', 'anti'), ('antialias', 'antialias'), ('ar', 'ar'), ('arab', 'arab'), ('arabic', 'arabic'), ('arabicshape', 'arabicshape'), ('ari', 'ari'), ('arshape', 'arshape'), ('autochdir', 'autochdir'), ('autoindent', 'autoindent'), ('autoread', 'autoread'), ('autowrite', 'autowrite'), ('autowriteall', 'autowriteall'), ('aw', 'aw'), ('awa', 'awa'), ('background', 'background'), ('backspace', 'backspace'), ('backup', 'backup'), ('backupcopy', 'backupcopy'), ('backupdir', 'backupdir'), ('backupext', 'backupext'), ('backupskip', 'backupskip'), ('balloondelay', 'balloondelay'), ('ballooneval', 'ballooneval'), ('balloonexpr', 'balloonexpr'), ('bar', 'bar'), ('bdir', 'bdir'), ('bdlay', 'bdlay'), ('beval', 'beval'), ('bex', 'bex'), ('bexpr', 'bexpr'), ('bg', 'bg'), ('bh', 'bh'), ('bin', 'bin'), ('binary', 'binary'), ('biosk', 'biosk'), ('bioskey', 'bioskey'), ('bk', 'bk'), ('bkc', 'bkc'), ('bl', 'bl'), ('block', 'block'), ('bomb', 'bomb'), ('breakat', 'breakat'), ('brk', 'brk'), ('browsedir', 'browsedir'), ('bs', 'bs'), ('bsdir', 'bsdir'), ('bsk', 'bsk'), ('bt', 'bt'), ('bufhidden', 'bufhidden'), ('buflisted', 'buflisted'), ('buftype', 'buftype'), ('casemap', 'casemap'), ('cb', 'cb'), ('ccv', 'ccv'), ('cd', 'cd'), ('cdpath', 'cdpath'), ('cedit', 'cedit'), ('cf', 'cf'), ('cfu', 'cfu'), ('ch', 'ch'), ('charconvert', 'charconvert'), ('ci', 'ci'), ('cin', 'cin'), ('cindent', 'cindent'), ('cink', 'cink'), ('cinkeys', 'cinkeys'), ('cino', 'cino'), ('cinoptions', 'cinoptions'), ('cinw', 'cinw'), ('cinwords', 'cinwords'), ('clipboard', 'clipboard'), ('cmdheight', 'cmdheight'), ('cmdwinheight', 'cmdwinheight'), ('cmp', 'cmp'), ('cms', 'cms'), ('co', 'co'), ('columns', 'columns'), ('com', 'com'), ('comments', 'comments'), ('commentstring', 'commentstring'), ('compatible', 'compatible'), ('complete', 'complete'), ('completefunc', 'completefunc'), ('completeopt', 'completeopt'), ('confirm', 'confirm'), ('consk', 'consk'), ('conskey', 'conskey'), ('copyindent', 'copyindent'), ('cot', 'cot'), ('cp', 'cp'), ('cpo', 'cpo'), ('cpoptions', 'cpoptions'), ('cpt', 'cpt'), ('cscopepathcomp', 'cscopepathcomp'), ('cscopeprg', 'cscopeprg'), ('cscopequickfix', 'cscopequickfix'), ('cscopetag', 'cscopetag'), ('cscopetagorder', 'cscopetagorder'), ('cscopeverbose', 'cscopeverbose'), ('cspc', 'cspc'), ('csprg', 'csprg'), ('csqf', 'csqf'), ('cst', 'cst'), ('csto', 'csto'), ('csverb', 'csverb'), ('cuc', 'cuc'), ('cul', 'cul'), ('cursor', 'cursor'), ('cursor', 'cursor'), ('cursorcolumn', 'cursorcolumn'), ('cursorline', 'cursorline'), ('cwh', 'cwh'), ('debug', 'debug'), ('deco', 'deco'), ('def', 'def'), ('define', 'define'), ('delcombine', 'delcombine'), ('dex', 'dex'), ('dg', 'dg'), ('dict', 'dict'), ('dictionary', 'dictionary'), ('diff', 'diff'), ('diffexpr', 'diffexpr'), ('diffopt', 'diffopt'), ('digraph', 'digraph'), ('dip', 'dip'), ('dir', 'dir'), ('directory', 'directory'), ('display', 'display'), ('dy', 'dy'), ('ea', 'ea'), ('ead', 'ead'), ('eadirection', 'eadirection'), ('eb', 'eb'), ('ed', 'ed'), ('edcompatible', 'edcompatible'), ('ef', 'ef'), ('efm', 'efm'), ('ei', 'ei'), ('ek', 'ek'), ('enc', 'enc'), ('encoding', 'encoding'), ('end', 'end'), ('endofline', 'endofline'), ('eol', 'eol'), ('ep', 'ep'), ('equalalways', 'equalalways'), ('equalprg', 'equalprg'), ('errorbells', 'errorbells'), ('errorfile', 'errorfile'), ('errorformat', 'errorformat'), ('esckeys', 'esckeys'), ('et', 'et'), ('eventignore', 'eventignore'), ('ex', 'ex'), ('expandtab', 'expandtab'), ('exrc', 'exrc'), ('fcl', 'fcl'), ('fcs', 'fcs'), ('fdc', 'fdc'), ('fde', 'fde'), ('fdi', 'fdi'), ('fdl', 'fdl'), ('fdls', 'fdls'), ('fdm', 'fdm'), ('fdn', 'fdn'), ('fdo', 'fdo'), ('fdt', 'fdt'), ('fen', 'fen'), ('fenc', 'fenc'), ('fencs', 'fencs'), ('fex', 'fex'), ('ff', 'ff'), ('ffs', 'ffs'), ('fileencoding', 'fileencoding'), ('fileencodings', 'fileencodings'), ('fileformat', 'fileformat'), ('fileformats', 'fileformats'), ('filetype', 'filetype'), ('fillchars', 'fillchars'), ('fk', 'fk'), ('fkmap', 'fkmap'), ('flp', 'flp'), ('fml', 'fml'), ('fmr', 'fmr'), ('fo', 'fo'), ('foldclose', 'foldclose'), ('foldcolumn', 'foldcolumn'), ('foldenable', 'foldenable'), ('foldexpr', 'foldexpr'), ('foldignore', 'foldignore'), ('foldlevel', 'foldlevel'), ('foldlevelstart', 'foldlevelstart'), ('foldmarker', 'foldmarker'), ('foldmethod', 'foldmethod'), ('foldminlines', 'foldminlines'), ('foldnestmax', 'foldnestmax'), ('foldopen', 'foldopen'), ('foldtext', 'foldtext'), ('formatexpr', 'formatexpr'), ('formatlistpat', 'formatlistpat'), ('formatoptions', 'formatoptions'), ('formatprg', 'formatprg'), ('fp', 'fp'), ('fs', 'fs'), ('fsync', 'fsync'), ('ft', 'ft'), ('gcr', 'gcr'), ('gd', 'gd'), ('gdefault', 'gdefault'), ('gfm', 'gfm'), ('gfn', 'gfn'), ('gfs', 'gfs'), ('gfw', 'gfw'), ('ghr', 'ghr'), ('go', 'go'), ('gp', 'gp'), ('grepformat', 'grepformat'), ('grepprg', 'grepprg'), ('gtl', 'gtl'), ('gtt', 'gtt'), ('guicursor', 'guicursor'), ('guifont', 'guifont'), ('guifontset', 'guifontset'), ('guifontwide', 'guifontwide'), ('guiheadroom', 'guiheadroom'), ('guioptions', 'guioptions'), ('guipty', 'guipty'), ('guitablabel', 'guitablabel'), ('guitabtooltip', 'guitabtooltip'), ('helpfile', 'helpfile'), ('helpheight', 'helpheight'), ('helplang', 'helplang'), ('hf', 'hf'), ('hh', 'hh'), ('hi', 'hi'), ('hid', 'hid'), ('hidden', 'hidden'), ('highlight', 'highlight'), ('history', 'history'), ('hk', 'hk'), ('hkmap', 'hkmap'), ('hkmapp', 'hkmapp'), ('hkp', 'hkp'), ('hl', 'hl'), ('hlg', 'hlg'), ('hls', 'hls'), ('hlsearch', 'hlsearch'), ('ic', 'ic'), ('icon', 'icon'), ('iconstring', 'iconstring'), ('ignorecase', 'ignorecase'), ('im', 'im'), ('imactivatekey', 'imactivatekey'), ('imak', 'imak'), ('imc', 'imc'), ('imcmdline', 'imcmdline'), ('imd', 'imd'), ('imdisable', 'imdisable'), ('imi', 'imi'), ('iminsert', 'iminsert'), ('ims', 'ims'), ('imsearch', 'imsearch'), ('inc', 'inc'), ('include', 'include'), ('includeexpr', 'includeexpr'), ('incsearch', 'incsearch'), ('inde', 'inde'), ('indentexpr', 'indentexpr'), ('indentkeys', 'indentkeys'), ('indk', 'indk'), ('inex', 'inex'), ('inf', 'inf'), ('infercase', 'infercase'), ('insert', 'insert'), ('insert', 'insert'), ('insertmode', 'insertmode'), ('invacd', 'invacd'), ('invai', 'invai'), ('invakm', 'invakm'), ('invallowrevins', 'invallowrevins'), ('invaltkeymap', 'invaltkeymap'), ('invanti', 'invanti'), ('invantialias', 'invantialias'), ('invar', 'invar'), ('invarab', 'invarab'), ('invarabic', 'invarabic'), ('invarabicshape', 'invarabicshape'), ('invari', 'invari'), ('invarshape', 'invarshape'), ('invautochdir', 'invautochdir'), ('invautoindent', 'invautoindent'), ('invautoread', 'invautoread'), ('invautowrite', 'invautowrite'), ('invautowriteall', 'invautowriteall'), ('invaw', 'invaw'), ('invawa', 'invawa'), ('invbackup', 'invbackup'), ('invballooneval', 'invballooneval'), ('invbeval', 'invbeval'), ('invbin', 'invbin'), ('invbinary', 'invbinary'), ('invbiosk', 'invbiosk'), ('invbioskey', 'invbioskey'), ('invbk', 'invbk'), ('invbl', 'invbl'), ('invbomb', 'invbomb'), ('invbuflisted', 'invbuflisted'), ('invcf', 'invcf'), ('invci', 'invci'), ('invcin', 'invcin'), ('invcindent', 'invcindent'), ('invcompatible', 'invcompatible'), ('invconfirm', 'invconfirm'), ('invconsk', 'invconsk'), ('invconskey', 'invconskey'), ('invcopyindent', 'invcopyindent'), ('invcp', 'invcp'), ('invcscopetag', 'invcscopetag'), ('invcscopeverbose', 'invcscopeverbose'), ('invcst', 'invcst'), ('invcsverb', 'invcsverb'), ('invcuc', 'invcuc'), ('invcul', 'invcul'), ('invcursorcolumn', 'invcursorcolumn'), ('invcursorline', 'invcursorline'), ('invdeco', 'invdeco'), ('invdelcombine', 'invdelcombine'), ('invdg', 'invdg'), ('invdiff', 'invdiff'), ('invdigraph', 'invdigraph'), ('invdisable', 'invdisable'), ('invea', 'invea'), ('inveb', 'inveb'), ('inved', 'inved'), ('invedcompatible', 'invedcompatible'), ('invek', 'invek'), ('invendofline', 'invendofline'), ('inveol', 'inveol'), ('invequalalways', 'invequalalways'), ('inverrorbells', 'inverrorbells'), ('invesckeys', 'invesckeys'), ('invet', 'invet'), ('invex', 'invex'), ('invexpandtab', 'invexpandtab'), ('invexrc', 'invexrc'), ('invfen', 'invfen'), ('invfk', 'invfk'), ('invfkmap', 'invfkmap'), ('invfoldenable', 'invfoldenable'), ('invgd', 'invgd'), ('invgdefault', 'invgdefault'), ('invguipty', 'invguipty'), ('invhid', 'invhid'), ('invhidden', 'invhidden'), ('invhk', 'invhk'), ('invhkmap', 'invhkmap'), ('invhkmapp', 'invhkmapp'), ('invhkp', 'invhkp'), ('invhls', 'invhls'), ('invhlsearch', 'invhlsearch'), ('invic', 'invic'), ('invicon', 'invicon'), ('invignorecase', 'invignorecase'), ('invim', 'invim'), ('invimc', 'invimc'), ('invimcmdline', 'invimcmdline'), ('invimd', 'invimd'), ('invincsearch', 'invincsearch'), ('invinf', 'invinf'), ('invinfercase', 'invinfercase'), ('invinsertmode', 'invinsertmode'), ('invis', 'invis'), ('invjoinspaces', 'invjoinspaces'), ('invjs', 'invjs'), ('invlazyredraw', 'invlazyredraw'), ('invlbr', 'invlbr'), ('invlinebreak', 'invlinebreak'), ('invlisp', 'invlisp'), ('invlist', 'invlist'), ('invloadplugins', 'invloadplugins'), ('invlpl', 'invlpl'), ('invlz', 'invlz'), ('invma', 'invma'), ('invmacatsui', 'invmacatsui'), ('invmagic', 'invmagic'), ('invmh', 'invmh'), ('invml', 'invml'), ('invmod', 'invmod'), ('invmodeline', 'invmodeline'), ('invmodifiable', 'invmodifiable'), ('invmodified', 'invmodified'), ('invmore', 'invmore'), ('invmousef', 'invmousef'), ('invmousefocus', 'invmousefocus'), ('invmousehide', 'invmousehide'), ('invnu', 'invnu'), ('invnumber', 'invnumber'), ('invpaste', 'invpaste'), ('invpi', 'invpi'), ('invpreserveindent', 'invpreserveindent'), ('invpreviewwindow', 'invpreviewwindow'), ('invprompt', 'invprompt'), ('invpvw', 'invpvw'), ('invreadonly', 'invreadonly'), ('invremap', 'invremap'), ('invrestorescreen', 'invrestorescreen'), ('invrevins', 'invrevins'), ('invri', 'invri'), ('invrightleft', 'invrightleft'), ('invrightleftcmd', 'invrightleftcmd'), ('invrl', 'invrl'), ('invrlc', 'invrlc'), ('invro', 'invro'), ('invrs', 'invrs'), ('invru', 'invru'), ('invruler', 'invruler'), ('invsb', 'invsb'), ('invsc', 'invsc'), ('invscb', 'invscb'), ('invscrollbind', 'invscrollbind'), ('invscs', 'invscs'), ('invsecure', 'invsecure'), ('invsft', 'invsft'), ('invshellslash', 'invshellslash'), ('invshelltemp', 'invshelltemp'), ('invshiftround', 'invshiftround'), ('invshortname', 'invshortname'), ('invshowcmd', 'invshowcmd'), ('invshowfulltag', 'invshowfulltag'), ('invshowmatch', 'invshowmatch'), ('invshowmode', 'invshowmode'), ('invsi', 'invsi'), ('invsm', 'invsm'), ('invsmartcase', 'invsmartcase'), ('invsmartindent', 'invsmartindent'), ('invsmarttab', 'invsmarttab'), ('invsmd', 'invsmd'), ('invsn', 'invsn'), ('invsol', 'invsol'), ('invspell', 'invspell'), ('invsplitbelow', 'invsplitbelow'), ('invsplitright', 'invsplitright'), ('invspr', 'invspr'), ('invsr', 'invsr'), ('invssl', 'invssl'), ('invsta', 'invsta'), ('invstartofline', 'invstartofline'), ('invstmp', 'invstmp'), ('invswapfile', 'invswapfile'), ('invswf', 'invswf'), ('invta', 'invta'), ('invtagbsearch', 'invtagbsearch'), ('invtagrelative', 'invtagrelative'), ('invtagstack', 'invtagstack'), ('invtbi', 'invtbi'), ('invtbidi', 'invtbidi'), ('invtbs', 'invtbs'), ('invtermbidi', 'invtermbidi'), ('invterse', 'invterse'), ('invtextauto', 'invtextauto'), ('invtextmode', 'invtextmode'), ('invtf', 'invtf'), ('invtgst', 'invtgst'), ('invtildeop', 'invtildeop'), ('invtimeout', 'invtimeout'), ('invtitle', 'invtitle'), ('invto', 'invto'), ('invtop', 'invtop'), ('invtr', 'invtr'), ('invttimeout', 'invttimeout'), ('invttybuiltin', 'invttybuiltin'), ('invttyfast', 'invttyfast'), ('invtx', 'invtx'), ('invvb', 'invvb'), ('invvisualbell', 'invvisualbell'), ('invwa', 'invwa'), ('invwarn', 'invwarn'), ('invwb', 'invwb'), ('invweirdinvert', 'invweirdinvert'), ('invwfh', 'invwfh'), ('invwfw', 'invwfw'), ('invwildmenu', 'invwildmenu'), ('invwinfixheight', 'invwinfixheight'), ('invwinfixwidth', 'invwinfixwidth'), ('invwiv', 'invwiv'), ('invwmnu', 'invwmnu'), ('invwrap', 'invwrap'), ('invwrapscan', 'invwrapscan'), ('invwrite', 'invwrite'), ('invwriteany', 'invwriteany'), ('invwritebackup', 'invwritebackup'), ('invws', 'invws'), ('is', 'is'), ('isf', 'isf'), ('isfname', 'isfname'), ('isi', 'isi'), ('isident', 'isident'), ('isk', 'isk'), ('iskeyword', 'iskeyword'), ('isp', 'isp'), ('isprint', 'isprint'), ('joinspaces', 'joinspaces'), ('js', 'js'), ('key', 'key'), ('keymap', 'keymap'), ('keymodel', 'keymodel'), ('keywordprg', 'keywordprg'), ('km', 'km'), ('kmp', 'kmp'), ('kp', 'kp'), ('langmap', 'langmap'), ('langmenu', 'langmenu'), ('laststatus', 'laststatus'), ('lazyredraw', 'lazyredraw'), ('lbr', 'lbr'), ('lcs', 'lcs'), ('linebreak', 'linebreak'), ('lines', 'lines'), ('linespace', 'linespace'), ('lisp', 'lisp'), ('lispwords', 'lispwords'), ('list', 'list'), ('listchars', 'listchars'), ('lm', 'lm'), ('lmap', 'lmap'), ('loadplugins', 'loadplugins'), ('lpl', 'lpl'), ('ls', 'ls'), ('lsp', 'lsp'), ('lw', 'lw'), ('lz', 'lz'), ('ma', 'ma'), ('macatsui', 'macatsui'), ('magic', 'magic'), ('makeef', 'makeef'), ('makeprg', 'makeprg'), ('mat', 'mat'), ('matchpairs', 'matchpairs'), ('matchtime', 'matchtime'), ('maxcombine', 'maxcombine'), ('maxfuncdepth', 'maxfuncdepth'), ('maxmapdepth', 'maxmapdepth'), ('maxmem', 'maxmem'), ('maxmempattern', 'maxmempattern'), ('maxmemtot', 'maxmemtot'), ('mco', 'mco'), ('mef', 'mef'), ('menuitems', 'menuitems'), ('mfd', 'mfd'), ('mh', 'mh'), ('mis', 'mis'), ('mkspellmem', 'mkspellmem'), ('ml', 'ml'), ('mls', 'mls'), ('mm', 'mm'), ('mmd', 'mmd'), ('mmp', 'mmp'), ('mmt', 'mmt'), ('mod', 'mod'), ('mode', 'mode'), ('mode', 'mode'), ('modeline', 'modeline'), ('modelines', 'modelines'), ('modifiable', 'modifiable'), ('modified', 'modified'), ('more', 'more'), ('mouse', 'mouse'), ('mousef', 'mousef'), ('mousefocus', 'mousefocus'), ('mousehide', 'mousehide'), ('mousem', 'mousem'), ('mousemodel', 'mousemodel'), ('mouses', 'mouses'), ('mouseshape', 'mouseshape'), ('mouset', 'mouset'), ('mousetime', 'mousetime'), ('mp', 'mp'), ('mps', 'mps'), ('msm', 'msm'), ('mzq', 'mzq'), ('mzquantum', 'mzquantum'), ('nf', 'nf'), ('noacd', 'noacd'), ('noai', 'noai'), ('noakm', 'noakm'), ('noallowrevins', 'noallowrevins'), ('noaltkeymap', 'noaltkeymap'), ('noanti', 'noanti'), ('noantialias', 'noantialias'), ('noar', 'noar'), ('noarab', 'noarab'), ('noarabic', 'noarabic'), ('noarabicshape', 'noarabicshape'), ('noari', 'noari'), ('noarshape', 'noarshape'), ('noautochdir', 'noautochdir'), ('noautoindent', 'noautoindent'), ('noautoread', 'noautoread'), ('noautowrite', 'noautowrite'), ('noautowriteall', 'noautowriteall'), ('noaw', 'noaw'), ('noawa', 'noawa'), ('nobackup', 'nobackup'), ('noballooneval', 'noballooneval'), ('nobeval', 'nobeval'), ('nobin', 'nobin'), ('nobinary', 'nobinary'), ('nobiosk', 'nobiosk'), ('nobioskey', 'nobioskey'), ('nobk', 'nobk'), ('nobl', 'nobl'), ('nobomb', 'nobomb'), ('nobuflisted', 'nobuflisted'), ('nocf', 'nocf'), ('noci', 'noci'), ('nocin', 'nocin'), ('nocindent', 'nocindent'), ('nocompatible', 'nocompatible'), ('noconfirm', 'noconfirm'), ('noconsk', 'noconsk'), ('noconskey', 'noconskey'), ('nocopyindent', 'nocopyindent'), ('nocp', 'nocp'), ('nocscopetag', 'nocscopetag'), ('nocscopeverbose', 'nocscopeverbose'), ('nocst', 'nocst'), ('nocsverb', 'nocsverb'), ('nocuc', 'nocuc'), ('nocul', 'nocul'), ('nocursorcolumn', 'nocursorcolumn'), ('nocursorline', 'nocursorline'), ('nodeco', 'nodeco'), ('nodelcombine', 'nodelcombine'), ('nodg', 'nodg'), ('nodiff', 'nodiff'), ('nodigraph', 'nodigraph'), ('nodisable', 'nodisable'), ('noea', 'noea'), ('noeb', 'noeb'), ('noed', 'noed'), ('noedcompatible', 'noedcompatible'), ('noek', 'noek'), ('noendofline', 'noendofline'), ('noeol', 'noeol'), ('noequalalways', 'noequalalways'), ('noerrorbells', 'noerrorbells'), ('noesckeys', 'noesckeys'), ('noet', 'noet'), ('noex', 'noex'), ('noexpandtab', 'noexpandtab'), ('noexrc', 'noexrc'), ('nofen', 'nofen'), ('nofk', 'nofk'), ('nofkmap', 'nofkmap'), ('nofoldenable', 'nofoldenable'), ('nogd', 'nogd'), ('nogdefault', 'nogdefault'), ('noguipty', 'noguipty'), ('nohid', 'nohid'), ('nohidden', 'nohidden'), ('nohk', 'nohk'), ('nohkmap', 'nohkmap'), ('nohkmapp', 'nohkmapp'), ('nohkp', 'nohkp'), ('nohls', 'nohls'), ('nohlsearch', 'nohlsearch'), ('noic', 'noic'), ('noicon', 'noicon'), ('noignorecase', 'noignorecase'), ('noim', 'noim'), ('noimc', 'noimc'), ('noimcmdline', 'noimcmdline'), ('noimd', 'noimd'), ('noincsearch', 'noincsearch'), ('noinf', 'noinf'), ('noinfercase', 'noinfercase'), ('noinsertmode', 'noinsertmode'), ('nois', 'nois'), ('nojoinspaces', 'nojoinspaces'), ('nojs', 'nojs'), ('nolazyredraw', 'nolazyredraw'), ('nolbr', 'nolbr'), ('nolinebreak', 'nolinebreak'), ('nolisp', 'nolisp'), ('nolist', 'nolist'), ('noloadplugins', 'noloadplugins'), ('nolpl', 'nolpl'), ('nolz', 'nolz'), ('noma', 'noma'), ('nomacatsui', 'nomacatsui'), ('nomagic', 'nomagic'), ('nomh', 'nomh'), ('noml', 'noml'), ('nomod', 'nomod'), ('nomodeline', 'nomodeline'), ('nomodifiable', 'nomodifiable'), ('nomodified', 'nomodified'), ('nomore', 'nomore'), ('nomousef', 'nomousef'), ('nomousefocus', 'nomousefocus'), ('nomousehide', 'nomousehide'), ('nonu', 'nonu'), ('nonumber', 'nonumber'), ('nopaste', 'nopaste'), ('nopi', 'nopi'), ('nopreserveindent', 'nopreserveindent'), ('nopreviewwindow', 'nopreviewwindow'), ('noprompt', 'noprompt'), ('nopvw', 'nopvw'), ('noreadonly', 'noreadonly'), ('noremap', 'noremap'), ('norestorescreen', 'norestorescreen'), ('norevins', 'norevins'), ('nori', 'nori'), ('norightleft', 'norightleft'), ('norightleftcmd', 'norightleftcmd'), ('norl', 'norl'), ('norlc', 'norlc'), ('noro', 'noro'), ('nors', 'nors'), ('noru', 'noru'), ('noruler', 'noruler'), ('nosb', 'nosb'), ('nosc', 'nosc'), ('noscb', 'noscb'), ('noscrollbind', 'noscrollbind'), ('noscs', 'noscs'), ('nosecure', 'nosecure'), ('nosft', 'nosft'), ('noshellslash', 'noshellslash'), ('noshelltemp', 'noshelltemp'), ('noshiftround', 'noshiftround'), ('noshortname', 'noshortname'), ('noshowcmd', 'noshowcmd'), ('noshowfulltag', 'noshowfulltag'), ('noshowmatch', 'noshowmatch'), ('noshowmode', 'noshowmode'), ('nosi', 'nosi'), ('nosm', 'nosm'), ('nosmartcase', 'nosmartcase'), ('nosmartindent', 'nosmartindent'), ('nosmarttab', 'nosmarttab'), ('nosmd', 'nosmd'), ('nosn', 'nosn'), ('nosol', 'nosol'), ('nospell', 'nospell'), ('nosplitbelow', 'nosplitbelow'), ('nosplitright', 'nosplitright'), ('nospr', 'nospr'), ('nosr', 'nosr'), ('nossl', 'nossl'), ('nosta', 'nosta'), ('nostartofline', 'nostartofline'), ('nostmp', 'nostmp'), ('noswapfile', 'noswapfile'), ('noswf', 'noswf'), ('nota', 'nota'), ('notagbsearch', 'notagbsearch'), ('notagrelative', 'notagrelative'), ('notagstack', 'notagstack'), ('notbi', 'notbi'), ('notbidi', 'notbidi'), ('notbs', 'notbs'), ('notermbidi', 'notermbidi'), ('noterse', 'noterse'), ('notextauto', 'notextauto'), ('notextmode', 'notextmode'), ('notf', 'notf'), ('notgst', 'notgst'), ('notildeop', 'notildeop'), ('notimeout', 'notimeout'), ('notitle', 'notitle'), ('noto', 'noto'), ('notop', 'notop'), ('notr', 'notr'), ('nottimeout', 'nottimeout'), ('nottybuiltin', 'nottybuiltin'), ('nottyfast', 'nottyfast'), ('notx', 'notx'), ('novb', 'novb'), ('novisualbell', 'novisualbell'), ('nowa', 'nowa'), ('nowarn', 'nowarn'), ('nowb', 'nowb'), ('noweirdinvert', 'noweirdinvert'), ('nowfh', 'nowfh'), ('nowfw', 'nowfw'), ('nowildmenu', 'nowildmenu'), ('nowinfixheight', 'nowinfixheight'), ('nowinfixwidth', 'nowinfixwidth'), ('nowiv', 'nowiv'), ('nowmnu', 'nowmnu'), ('nowrap', 'nowrap'), ('nowrapscan', 'nowrapscan'), ('nowrite', 'nowrite'), ('nowriteany', 'nowriteany'), ('nowritebackup', 'nowritebackup'), ('nows', 'nows'), ('nrformats', 'nrformats'), ('nu', 'nu'), ('number', 'number'), ('numberwidth', 'numberwidth'), ('nuw', 'nuw'), ('oft', 'oft'), ('ofu', 'ofu'), ('omnifunc', 'omnifunc'), ('operatorfunc', 'operatorfunc'), ('opfunc', 'opfunc'), ('osfiletype', 'osfiletype'), ('pa', 'pa'), ('para', 'para'), ('paragraphs', 'paragraphs'), ('paste', 'paste'), ('pastetoggle', 'pastetoggle'), ('patchexpr', 'patchexpr'), ('patchmode', 'patchmode'), ('path', 'path'), ('pdev', 'pdev'), ('penc', 'penc'), ('pex', 'pex'), ('pexpr', 'pexpr'), ('pfn', 'pfn'), ('ph', 'ph'), ('pheader', 'pheader'), ('pi', 'pi'), ('pm', 'pm'), ('pmbcs', 'pmbcs'), ('pmbfn', 'pmbfn'), ('popt', 'popt'), ('preserveindent', 'preserveindent'), ('previewheight', 'previewheight'), ('previewwindow', 'previewwindow'), ('printdevice', 'printdevice'), ('printencoding', 'printencoding'), ('printexpr', 'printexpr'), ('printfont', 'printfont'), ('printheader', 'printheader'), ('printmbcharset', 'printmbcharset'), ('printmbfont', 'printmbfont'), ('printoptions', 'printoptions'), ('prompt', 'prompt'), ('pt', 'pt'), ('pumheight', 'pumheight'), ('pvh', 'pvh'), ('pvw', 'pvw'), ('qe', 'qe'), ('quoteescape', 'quoteescape'), ('readonly', 'readonly'), ('remap', 'remap'), ('report', 'report'), ('restorescreen', 'restorescreen'), ('revins', 'revins'), ('ri', 'ri'), ('rightleft', 'rightleft'), ('rightleftcmd', 'rightleftcmd'), ('rl', 'rl'), ('rlc', 'rlc'), ('ro', 'ro'), ('rs', 'rs'), ('rtp', 'rtp'), ('ru', 'ru'), ('ruf', 'ruf'), ('ruler', 'ruler'), ('rulerformat', 'rulerformat'), ('runtimepath', 'runtimepath'), ('sb', 'sb'), ('sbo', 'sbo'), ('sbr', 'sbr'), ('sc', 'sc'), ('scb', 'scb'), ('scr', 'scr'), ('scroll', 'scroll'), ('scrollbind', 'scrollbind'), ('scrolljump', 'scrolljump'), ('scrolloff', 'scrolloff'), ('scrollopt', 'scrollopt'), ('scs', 'scs'), ('sect', 'sect'), ('sections', 'sections'), ('secure', 'secure'), ('sel', 'sel'), ('selection', 'selection'), ('selectmode', 'selectmode'), ('sessionoptions', 'sessionoptions'), ('sft', 'sft'), ('sh', 'sh'), ('shape', 'shape'), ('shape', 'shape'), ('shcf', 'shcf'), ('shell', 'shell'), ('shellcmdflag', 'shellcmdflag'), ('shellpipe', 'shellpipe'), ('shellquote', 'shellquote'), ('shellredir', 'shellredir'), ('shellslash', 'shellslash'), ('shelltemp', 'shelltemp'), ('shelltype', 'shelltype'), ('shellxquote', 'shellxquote'), ('shiftround', 'shiftround'), ('shiftwidth', 'shiftwidth'), ('shm', 'shm'), ('shortmess', 'shortmess'), ('shortname', 'shortname'), ('showbreak', 'showbreak'), ('showcmd', 'showcmd'), ('showfulltag', 'showfulltag'), ('showmatch', 'showmatch'), ('showmode', 'showmode'), ('showtabline', 'showtabline'), ('shq', 'shq'), ('si', 'si'), ('sidescroll', 'sidescroll'), ('sidescrolloff', 'sidescrolloff'), ('siso', 'siso'), ('sj', 'sj'), ('slm', 'slm'), ('sm', 'sm'), ('smartcase', 'smartcase'), ('smartindent', 'smartindent'), ('smarttab', 'smarttab'), ('smc', 'smc'), ('smd', 'smd'), ('sn', 'sn'), ('so', 'so'), ('softtabstop', 'softtabstop'), ('sol', 'sol'), ('sp', 'sp'), ('spc', 'spc'), ('spell', 'spell'), ('spellcapcheck', 'spellcapcheck'), ('spellfile', 'spellfile'), ('spelllang', 'spelllang'), ('spellsuggest', 'spellsuggest'), ('spf', 'spf'), ('spl', 'spl'), ('splitbelow', 'splitbelow'), ('splitright', 'splitright'), ('spr', 'spr'), ('sps', 'sps'), ('sr', 'sr'), ('srr', 'srr'), ('ss', 'ss'), ('ssl', 'ssl'), ('ssop', 'ssop'), ('st', 'st'), ('sta', 'sta'), ('stal', 'stal'), ('start', 'start'), ('startofline', 'startofline'), ('statusline', 'statusline'), ('stl', 'stl'), ('stmp', 'stmp'), ('sts', 'sts'), ('su', 'su'), ('sua', 'sua'), ('suffixes', 'suffixes'), ('suffixesadd', 'suffixesadd'), ('sw', 'sw'), ('swapfile', 'swapfile'), ('swapsync', 'swapsync'), ('swb', 'swb'), ('swf', 'swf'), ('switchbuf', 'switchbuf'), ('sws', 'sws'), ('sxq', 'sxq'), ('syn', 'syn'), ('synmaxcol', 'synmaxcol'), ('syntax', 'syntax'), ('t_AB', 't_AB'), ('t_AF', 't_AF'), ('t_AL', 't_AL'), ('t_CS', 't_CS'), ('t_CV', 't_CV'), ('t_Ce', 't_Ce'), ('t_Co', 't_Co'), ('t_Cs', 't_Cs'), ('t_DL', 't_DL'), ('t_EI', 't_EI'), ('t_EI', 't_EI'), ('t_EI', 't_EI'), ('t_F1', 't_F1'), ('t_F2', 't_F2'), ('t_F3', 't_F3'), ('t_F4', 't_F4'), ('t_F5', 't_F5'), ('t_F6', 't_F6'), ('t_F7', 't_F7'), ('t_F8', 't_F8'), ('t_F9', 't_F9'), ('t_IE', 't_IE'), ('t_IS', 't_IS'), ('t_K1', 't_K1'), ('t_K3', 't_K3'), ('t_K4', 't_K4'), ('t_K5', 't_K5'), ('t_K6', 't_K6'), ('t_K7', 't_K7'), ('t_K8', 't_K8'), ('t_K9', 't_K9'), ('t_KA', 't_KA'), ('t_KB', 't_KB'), ('t_KC', 't_KC'), ('t_KD', 't_KD'), ('t_KE', 't_KE'), ('t_KF', 't_KF'), ('t_KG', 't_KG'), ('t_KH', 't_KH'), ('t_KI', 't_KI'), ('t_KJ', 't_KJ'), ('t_KK', 't_KK'), ('t_KL', 't_KL'), ('t_RI', 't_RI'), ('t_RV', 't_RV'), ('t_SI', 't_SI'), ('t_SI', 't_SI'), ('t_SI', 't_SI'), ('t_Sb', 't_Sb'), ('t_Sf', 't_Sf'), ('t_WP', 't_WP'), ('t_WS', 't_WS'), ('t_ZH', 't_ZH'), ('t_ZR', 't_ZR'), ('t_al', 't_al'), ('t_bc', 't_bc'), ('t_cd', 't_cd'), ('t_ce', 't_ce'), ('t_cl', 't_cl'), ('t_cm', 't_cm'), ('t_cs', 't_cs'), ('t_da', 't_da'), ('t_db', 't_db'), ('t_dl', 't_dl'), ('t_fs', 't_fs'), ('t_k1', 't_k1'), ('t_k2', 't_k2'), ('t_k3', 't_k3'), ('t_k4', 't_k4'), ('t_k5', 't_k5'), ('t_k6', 't_k6'), ('t_k7', 't_k7'), ('t_k8', 't_k8'), ('t_k9', 't_k9'), ('t_kB', 't_kB'), ('t_kD', 't_kD'), ('t_kI', 't_kI'), ('t_kN', 't_kN'), ('t_kP', 't_kP'), ('t_kb', 't_kb'), ('t_kd', 't_kd'), ('t_ke', 't_ke'), ('t_kh', 't_kh'), ('t_kl', 't_kl'), ('t_kr', 't_kr'), ('t_ks', 't_ks'), ('t_ku', 't_ku'), ('t_le', 't_le'), ('t_mb', 't_mb'), ('t_md', 't_md'), ('t_me', 't_me'), ('t_mr', 't_mr'), ('t_ms', 't_ms'), ('t_nd', 't_nd'), ('t_op', 't_op'), ('t_se', 't_se'), ('t_so', 't_so'), ('t_sr', 't_sr'), ('t_te', 't_te'), ('t_ti', 't_ti'), ('t_ts', 't_ts'), ('t_ue', 't_ue'), ('t_us', 't_us'), ('t_ut', 't_ut'), ('t_vb', 't_vb'), ('t_ve', 't_ve'), ('t_vi', 't_vi'), ('t_vs', 't_vs'), ('t_xs', 't_xs'), ('ta', 'ta'), ('tabline', 'tabline'), ('tabpagemax', 'tabpagemax'), ('tabstop', 'tabstop'), ('tag', 'tag'), ('tagbsearch', 'tagbsearch'), ('taglength', 'taglength'), ('tagrelative', 'tagrelative'), ('tags', 'tags'), ('tagstack', 'tagstack'), ('tal', 'tal'), ('tb', 'tb'), ('tbi', 'tbi'), ('tbidi', 'tbidi'), ('tbis', 'tbis'), ('tbs', 'tbs'), ('tenc', 'tenc'), ('term', 'term'), ('termbidi', 'termbidi'), ('termencoding', 'termencoding'), ('terse', 'terse'), ('textauto', 'textauto'), ('textmode', 'textmode'), ('textwidth', 'textwidth'), ('tf', 'tf'), ('tgst', 'tgst'), ('thesaurus', 'thesaurus'), ('tildeop', 'tildeop'), ('timeout', 'timeout'), ('timeoutlen', 'timeoutlen'), ('title', 'title'), ('titlelen', 'titlelen'), ('titleold', 'titleold'), ('titlestring', 'titlestring'), ('tl', 'tl'), ('tm', 'tm'), ('to', 'to'), ('toolbar', 'toolbar'), ('toolbariconsize', 'toolbariconsize'), ('top', 'top'), ('tpm', 'tpm'), ('tr', 'tr'), ('ts', 'ts'), ('tsl', 'tsl'), ('tsr', 'tsr'), ('ttimeout', 'ttimeout'), ('ttimeoutlen', 'ttimeoutlen'), ('ttm', 'ttm'), ('tty', 'tty'), ('ttybuiltin', 'ttybuiltin'), ('ttyfast', 'ttyfast'), ('ttym', 'ttym'), ('ttymouse', 'ttymouse'), ('ttyscroll', 'ttyscroll'), ('ttytype', 'ttytype'), ('tw', 'tw'), ('tx', 'tx'), ('uc', 'uc'), ('ul', 'ul'), ('undolevels', 'undolevels'), ('updatecount', 'updatecount'), ('updatetime', 'updatetime'), ('ut', 'ut'), ('vb', 'vb'), ('vbs', 'vbs'), ('vdir', 'vdir'), ('ve', 've'), ('verbose', 'verbose'), ('verbosefile', 'verbosefile'), ('vfile', 'vfile'), ('vi', 'vi'), ('viewdir', 'viewdir'), ('viewoptions', 'viewoptions'), ('viminfo', 'viminfo'), ('virtualedit', 'virtualedit'), ('visualbell', 'visualbell'), ('vop', 'vop'), ('wa', 'wa'), ('wak', 'wak'), ('warn', 'warn'), ('wb', 'wb'), ('wc', 'wc'), ('wcm', 'wcm'), ('wd', 'wd'), ('weirdinvert', 'weirdinvert'), ('wfh', 'wfh'), ('wfw', 'wfw'), ('wh', 'wh'), ('whichwrap', 'whichwrap'), ('wi', 'wi'), ('wig', 'wig'), ('wildchar', 'wildchar'), ('wildcharm', 'wildcharm'), ('wildignore', 'wildignore'), ('wildmenu', 'wildmenu'), ('wildmode', 'wildmode'), ('wildoptions', 'wildoptions'), ('wim', 'wim'), ('winaltkeys', 'winaltkeys'), ('window', 'window'), ('winfixheight', 'winfixheight'), ('winfixwidth', 'winfixwidth'), ('winheight', 'winheight'), ('winminheight', 'winminheight'), ('winminwidth', 'winminwidth'), ('winwidth', 'winwidth'), ('wiv', 'wiv'), ('wiw', 'wiw'), ('wm', 'wm'), ('wmh', 'wmh'), ('wmnu', 'wmnu'), ('wmw', 'wmw'), ('wop', 'wop'), ('wrap', 'wrap'), ('wrapmargin', 'wrapmargin'), ('wrapscan', 'wrapscan'), ('write', 'write'), ('writeany', 'writeany'), ('writebackup', 'writebackup'), ('writedelay', 'writedelay'), ('ws', 'ws'), ('ww', 'ww')]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MoinMoin/support/pygments/lexers/agile.py Sat Oct 11 21:27:32 2008 +0200 @@ -0,0 +1,1413 @@ +# -*- coding: utf-8 -*- +""" + pygments.lexers.agile + ~~~~~~~~~~~~~~~~~~~~~ + + Lexers for agile languages. + + :copyright: 2006-2008 by Georg Brandl, Armin Ronacher, + Lukas Meuser, Tim Hatch, Jarrett Billingsley, + Tassilo Schweyer, Steven Hazel, Nick Efford, + Davy Wybiral. + :license: BSD, see LICENSE for more details. +""" + +import re +try: + set +except NameError: + from sets import Set as set + +from pygments.lexer import Lexer, RegexLexer, ExtendedRegexLexer, \ + LexerContext, include, combined, do_insertions, bygroups, using +from pygments.token import Error, Text, \ + Comment, Operator, Keyword, Name, String, Number, Generic, Punctuation +from pygments.util import get_bool_opt, get_list_opt, shebang_matches +from pygments import unistring as uni + + +__all__ = ['PythonLexer', 'PythonConsoleLexer', 'PythonTracebackLexer', + 'RubyLexer', 'RubyConsoleLexer', 'PerlLexer', 'LuaLexer', + 'MiniDLexer', 'IoLexer', 'TclLexer', 'Python3Lexer', 'ClojureLexer'] + +# b/w compatibility +from pygments.lexers.functional import SchemeLexer + +line_re = re.compile('.*?\n') + + +class PythonLexer(RegexLexer): + """ + For `Python <http://www.python.org>`_ source code. + """ + + name = 'Python' + aliases = ['python', 'py'] + filenames = ['*.py', '*.pyw', '*.sc', 'SConstruct', 'SConscript'] + mimetypes = ['text/x-python', 'application/x-python'] + + tokens = { + 'root': [ + (r'\n', Text), + (r'^(\s*)("""(?:.|\n)*?""")', bygroups(Text, String.Doc)), + (r"^(\s*)('''(?:.|\n)*?''')", bygroups(Text, String.Doc)), + (r'[^\S\n]+', Text), + (r'#.*$', Comment), + (r'[]{}:(),;[]', Punctuation), + (r'\\\n', Text), + (r'\\', Text), + (r'(in|is|and|or|not)\b', Operator.Word), + (r'!=|==|<<|>>|[-~+/*%=<>&^|.]', Operator), + include('keywords'), + (r'(def)(\s+)', bygroups(Keyword, Text), 'funcname'), + (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), + (r'(from)(\s+)', bygroups(Keyword.Namespace, Text), 'fromimport'), + (r'(import)(\s+)', bygroups(Keyword.Namespace, Text), 'import'), + include('builtins'), + include('backtick'), + ('(?:[rR]|[uU][rR]|[rR][uU])"""', String, 'tdqs'), + ("(?:[rR]|[uU][rR]|[rR][uU])'''", String, 'tsqs'), + ('(?:[rR]|[uU][rR]|[rR][uU])"', String, 'dqs'), + ("(?:[rR]|[uU][rR]|[rR][uU])'", String, 'sqs'), + ('[uU]?"""', String, combined('stringescape', 'tdqs')), + ("[uU]?'''", String, combined('stringescape', 'tsqs')), + ('[uU]?"', String, combined('stringescape', 'dqs')), + ("[uU]?'", String, combined('stringescape', 'sqs')), + include('name'), + include('numbers'), + ], + 'keywords': [ + (r'(assert|break|continue|del|elif|else|except|exec|' + r'finally|for|global|if|lambda|pass|print|raise|' + r'return|try|while|yield|as|with)\b', Keyword), + ], + 'builtins': [ + (r'(?<!\.)(__import__|abs|apply|basestring|bool|buffer|callable|' + r'chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|' + r'divmod|enumerate|eval|execfile|exit|file|filter|float|getattr|' + r'globals|hasattr|hash|hex|id|input|int|intern|isinstance|' + r'issubclass|iter|len|list|locals|long|map|max|min|object|oct|' + r'open|ord|pow|property|range|raw_input|reduce|reload|repr|' + r'round|setattr|slice|staticmethod|str|sum|super|tuple|type|' + r'unichr|unicode|vars|xrange|zip)\b', Name.Builtin), + (r'(?<!\.)(self|None|Ellipsis|NotImplemented|False|True' + r')\b', Name.Builtin.Pseudo), + (r'(?<!\.)(ArithmeticError|AssertionError|AttributeError|' + r'BaseException|DeprecationWarning|EOFError|EnvironmentError|' + r'Exception|FloatingPointError|FutureWarning|GeneratorExit|IOError|' + r'ImportError|ImportWarning|IndentationError|IndexError|KeyError|' + r'KeyboardInterrupt|LookupError|MemoryError|NameError|' + r'NotImplemented|NotImplementedError|OSError|OverflowError|' + r'OverflowWarning|PendingDeprecationWarning|ReferenceError|' + r'RuntimeError|RuntimeWarning|StandardError|StopIteration|' + r'SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|' + r'TypeError|UnboundLocalError|UnicodeDecodeError|' + r'UnicodeEncodeError|UnicodeError|UnicodeTranslateError|' + r'UnicodeWarning|UserWarning|ValueError|Warning|ZeroDivisionError' + r')\b', Name.Exception), + ], + 'numbers': [ + (r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float), + (r'0\d+', Number.Oct), + (r'0[xX][a-fA-F0-9]+', Number.Hex), + (r'\d+L', Number.Integer.Long), + (r'\d+', Number.Integer) + ], + 'backtick': [ + ('`.*?`', String.Backtick), + ], + 'name': [ + (r'@[a-zA-Z0-9_]+', Name.Decorator), + ('[a-zA-Z_][a-zA-Z0-9_]*', Name), + ], + 'funcname': [ + ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Function, '#pop') + ], + 'classname': [ + ('[a-zA-Z_][a-zA-Z0-9_]*', Name.Class, '#pop') + ], + 'import': [ + (r'(\s+)(as)(\s+)', bygroups(Text, Keyword.Namespace, Text)), + (r'[a-zA-Z_][a-zA-Z0-9_.]*', Name.Namespace), + (r'(\s*)(,)(\s*)', bygroups(Text, Operator, Text)), + (r'', Text, '#pop') # all else: go back + ], + 'fromimport': [ + (r'(\s+)(import)\b', bygroups(Text, Keyword.Namespace), '#pop'), + (r'[a-zA-Z_.][a-zA-Z0-9_.]*', Name.Namespace), + ], + 'stringescape': [ + (r'\\([\\abfnrtv"\']|\n|N{.*?}|u[a-fA-F0-9]{4}|' + r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape) + ], + 'strings': [ + (r'%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?' + '[hlL]?[diouxXeEfFgGcrs%]', String.Interpol), + (r'[^\\\'"%\n]+', String), + # quotes, percents and backslashes must be parsed one at a time + (r'[\'"\\]', String), + # unhandled string formatting sign + (r'%', String) + # newlines are an error (use "nl" state) + ], + 'nl': [ + (r'\n', String) + ], + 'dqs': [ + (r'"', String, '#pop'), + (r'\\\\|\\"|\\\n', String.Escape), # included here again for raw strings + include('strings') + ], + 'sqs': [ + (r"'", String, '#pop'), + (r"\\\\|\\'|\\\n", String.Escape), # included here again for raw strings + include('strings') + ], + 'tdqs': [ + (r'"""', String, '#pop'), + include('strings'), + include('nl') + ], + 'tsqs': [ + (r"'''", String, '#pop'), + include('strings'), + include('nl') + ], + } + + def analyse_text(text): + return shebang_matches(text, r'pythonw?(2\.\d)?') + + +class Python3Lexer(RegexLexer): + """ + For `Python <http://www.python.org>`_ source code (version 3.0). + + *New in Pygments 0.10.* + """ + + name = 'Python 3' + aliases = ['python3', 'py3'] + filenames = [] # Nothing until Python 3 gets widespread + mimetypes = ['text/x-python3', 'application/x-python3'] + + flags = re.MULTILINE | re.UNICODE + + uni_name = "[%s][%s]*" % (uni.xid_start, uni.xid_continue) + + tokens = PythonLexer.tokens.copy() + tokens['keywords'] = [ + (r'(assert|break|continue|del|elif|else|except|' + r'finally|for|global|if|lambda|pass|raise|' + r'return|try|while|yield|as|with|True|False|None)\b', Keyword), + ] + tokens['builtins'] = [ + (r'(?<!\.)(__import__|abs|all|any|bin|bool|bytearray|bytes|' + r'chr|classmethod|cmp|compile|complex|delattr|dict|dir|' + r'divmod|enumerate|eval|filter|float|format|frozenset|getattr|' + r'globals|hasattr|hash|hex|id|input|int|isinstance|issubclass|' + r'iter|len|list|locals|map|max|memoryview|min|next|object|oct|' + r'open|ord|pow|print|property|range|repr|reversed|round|' + r'set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|' + r'vars|zip)\b', Name.Builtin), + (r'(?<!\.)(self|Ellipsis|NotImplemented)\b', Name.Builtin.Pseudo), + (r'(?<!\.)(ArithmeticError|AssertionError|AttributeError|' + r'BaseException|BufferError|BytesWarning|DeprecationWarning|' + r'EOFError|EnvironmentError|Exception|FloatingPointError|' + r'FutureWarning|GeneratorExit|IOError|ImportError|' + r'ImportWarning|IndentationError|IndexError|KeyError|' + r'KeyboardInterrupt|LookupError|MemoryError|NameError|' + r'NotImplementedError|OSError|OverflowError|' + r'PendingDeprecationWarning|ReferenceError|' + r'RuntimeError|RuntimeWarning|StopIteration|' + r'SyntaxError|SyntaxWarning|SystemError|SystemExit|TabError|' + r'TypeError|UnboundLocalError|UnicodeDecodeError|' + r'UnicodeEncodeError|UnicodeError|UnicodeTranslateError|' + r'UnicodeWarning|UserWarning|ValueError|Warning|ZeroDivisionError' + r')\b', Name.Exception), + ] + tokens['numbers'] = [ + (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float), + (r'0[oO][0-7]+', Number.Oct), + (r'0[bB][01]+', Number.Bin), + (r'0[xX][a-fA-F0-9]+', Number.Hex), + (r'\d+', Number.Integer) + ] + tokens['backtick'] = [] + tokens['name'] = [ + (r'@[a-zA-Z0-9_]+', Name.Decorator), + (uni_name, Name), + ] + tokens['funcname'] = [ + (uni_name, Name.Function, '#pop') + ] + tokens['classname'] = [ + (uni_name, Name.Class, '#pop') + ] + tokens['import'] = [ + (r'(\s+)(as)(\s+)', bygroups(Text, Keyword, Text)), + (r'\.', Name.Namespace), + (uni_name, Name.Namespace), + (r'(\s*)(,)(\s*)', bygroups(Text, Operator, Text)), + (r'', Text, '#pop') # all else: go back + ] + tokens['fromimport'] = [ + (r'(\s+)(import)\b', bygroups(Text, Keyword), '#pop'), + (r'\.', Name.Namespace), + (uni_name, Name.Namespace), + ] + # don't highlight "%s" substitutions + tokens['strings'] = [ + (r'[^\\\'"%\n]+', String), + # quotes, percents and backslashes must be parsed one at a time + (r'[\'"\\]', String), + # unhandled string formatting sign + (r'%', String) + # newlines are an error (use "nl" state) + ] + + def analyse_text(text): + return shebang_matches(text, r'pythonw?(3\.\d)?') + + +class PythonConsoleLexer(Lexer): + """ + For Python console output or doctests, such as: + + .. sourcecode:: pycon + + >>> a = 'foo' + >>> print a + foo + >>> 1 / 0 + Traceback (most recent call last): + File "<stdin>", line 1, in <module> + ZeroDivisionError: integer division or modulo by zero + """ + name = 'Python console session' + aliases = ['pycon'] + mimetypes = ['text/x-python-doctest'] + + def get_tokens_unprocessed(self, text): + pylexer = PythonLexer(**self.options) + tblexer = PythonTracebackLexer(**self.options) + + curcode = '' + insertions = [] + curtb = '' + tbindex = 0 + tb = 0 + for match in line_re.finditer(text): + line = match.group() + if line.startswith('>>> ') or line.startswith('... '): + tb = 0 + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:4])])) + curcode += line[4:] + elif line.rstrip() == '...': + tb = 0 + insertions.append((len(curcode), + [(0, Generic.Prompt, '...')])) + curcode += line[3:] + else: + if curcode: + for item in do_insertions(insertions, + pylexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + if line.startswith('Traceback (most recent call last):'): + tb = 1 + curtb = line + tbindex = match.start() + elif tb: + curtb += line + if not (line.startswith(' ') or line.strip() == '...'): + tb = 0 + for i, t, v in tblexer.get_tokens_unprocessed(curtb): + yield tbindex+i, t, v + else: + yield match.start(), Generic.Output, line + if curcode: + for item in do_insertions(insertions, + pylexer.get_tokens_unprocessed(curcode)): + yield item + + +class PythonTracebackLexer(RegexLexer): + """ + For Python tracebacks. + + *New in Pygments 0.7.* + """ + + name = 'Python Traceback' + aliases = ['pytb'] + filenames = ['*.pytb'] + mimetypes = ['text/x-python-traceback'] + + tokens = { + 'root': [ + (r'^Traceback \(most recent call last\):\n', Generic.Traceback, 'intb'), + ], + 'intb': [ + (r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)', + bygroups(Text, Name.Builtin, Text, Number, Text, Name.Identifier, Text)), + (r'^( )(.+)(\n)', + bygroups(Text, using(PythonLexer), Text)), + (r'^([ \t]*)(...)(\n)', + bygroups(Text, Comment, Text)), # for doctests... + (r'^(.+)(: )(.+)(\n)', + bygroups(Name.Class, Text, Name.Identifier, Text), '#pop'), + (r'^([a-zA-Z_][a-zA-Z0-9_]*)(:?\n)', + bygroups(Name.Class, Text), '#pop') + ], + } + + +class RubyLexer(ExtendedRegexLexer): + """ + For `Ruby <http://www.ruby-lang.org>`_ source code. + """ + + name = 'Ruby' + aliases = ['rb', 'ruby'] + filenames = ['*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec', '*.rbx'] + mimetypes = ['text/x-ruby', 'application/x-ruby'] + + flags = re.DOTALL | re.MULTILINE + + def heredoc_callback(self, match, ctx): + # okay, this is the hardest part of parsing Ruby... + # match: 1 = <<-?, 2 = quote? 3 = name 4 = quote? 5 = rest of line + + start = match.start(1) + yield start, Operator, match.group(1) # <<-? + yield match.start(2), String.Heredoc, match.group(2) # quote ", ', ` + yield match.start(3), Name.Constant, match.group(3) # heredoc name + yield match.start(4), String.Heredoc, match.group(4) # quote again + + heredocstack = ctx.__dict__.setdefault('heredocstack', []) + outermost = not bool(heredocstack) + heredocstack.append((match.group(1) == '<<-', match.group(3))) + + ctx.pos = match.start(5) + ctx.end = match.end(5) + # this may find other heredocs + for i, t, v in self.get_tokens_unprocessed(context=ctx): + yield i+start, t, v + ctx.pos = match.end() + + if outermost: + # this is the outer heredoc again, now we can process them all + for tolerant, hdname in heredocstack: + lines = [] + for match in line_re.finditer(ctx.text, ctx.pos): + if tolerant: + check = match.group().strip() + else: + check = match.group().rstrip() + if check == hdname: + for amatch in lines: + yield amatch.start(), String.Heredoc, amatch.group() + yield match.start(), Name.Constant, match.group() + ctx.pos = match.end() + break + else: + lines.append(match) + else: + # end of heredoc not found -- error! + for amatch in lines: + yield amatch.start(), Error, amatch.group() + ctx.end = len(ctx.text) + del heredocstack[:] + + + def gen_rubystrings_rules(): + def intp_regex_callback(self, match, ctx): + yield match.start(1), String.Regex, match.group(1) # begin + nctx = LexerContext(match.group(3), 0, ['interpolated-regex']) + for i, t, v in self.get_tokens_unprocessed(context=nctx): + yield match.start(3)+i, t, v + yield match.start(4), String.Regex, match.group(4) # end[mixounse]* + ctx.pos = match.end() + + def intp_string_callback(self, match, ctx): + yield match.start(1), String.Other, match.group(1) + nctx = LexerContext(match.group(3), 0, ['interpolated-string']) + for i, t, v in self.get_tokens_unprocessed(context=nctx): + yield match.start(3)+i, t, v + yield match.start(4), String.Other, match.group(4) # end + ctx.pos = match.end() + + states = {} + states['strings'] = [ + # easy ones + (r'\:([a-zA-Z_][\w_]*[\!\?]?|\*\*?|[-+]@?|' + r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)', String.Symbol), + (r":'(\\\\|\\'|[^'])*'", String.Symbol), + (r"'(\\\\|\\'|[^'])*'", String.Single), + (r':"', String.Symbol, 'simple-sym'), + (r'"', String.Double, 'simple-string'), + (r'(?<!\.)`', String.Backtick, 'simple-backtick'), + ] + # double-quoted string and symbol + + for name, ttype, end in ('string', String.Double, '"'), \ + ('sym', String.Symbol, '"'), \ + ('backtick', String.Backtick, '`'): + states['simple-'+name] = [ + include('string-intp-escaped'), + (r'[^\\%s#]+' % end, ttype), + (r'[\\#]', ttype), + (end, ttype, '#pop'), + ] + + # braced quoted strings + + for lbrace, rbrace, name in ('\\{', '\\}', 'cb'), \ + ('\\[', '\\]', 'sb'), \ + ('\\(', '\\)', 'pa'), \ + ('<', '>', 'ab'): + states[name+'-intp-string'] = [ + (r'\\[\\' + lbrace + rbrace + ']', String.Other), + (r'(?<!\\)' + lbrace, String.Other, '#push'), + (r'(?<!\\)' + rbrace, String.Other, '#pop'), + include('string-intp-escaped'), + (r'[\\#' + lbrace + rbrace + ']', String.Other), + (r'[^\\#' + lbrace + rbrace + ']+', String.Other), + ] + states['strings'].append((r'%[QWx]?' + lbrace, String.Other, + name+'-intp-string')) + states[name+'-string'] = [ + (r'\\[\\' + lbrace + rbrace + ']', String.Other), + (r'(?<!\\)' + lbrace, String.Other, '#push'), + (r'(?<!\\)' + rbrace, String.Other, '#pop'), + (r'[\\#' + lbrace + rbrace + ']', String.Other), + (r'[^\\#' + lbrace + rbrace + ']+', String.Other), + ] + states['strings'].append((r'%[qsw]' + lbrace, String.Other, + name+'-string')) + states[name+'-regex'] = [ + (r'\\[\\' + lbrace + rbrace + ']', String.Regex), + (r'(?<!\\)' + lbrace, String.Regex, '#push'), + (r'(?<!\\)' + rbrace + '[mixounse]*', String.Regex, '#pop'), + include('string-intp'), + (r'[\\#' + lbrace + rbrace + ']', String.Regex), + (r'[^\\#' + lbrace + rbrace + ']+', String.Regex), + ] + states['strings'].append((r'%r' + lbrace, String.Regex, + name+'-regex')) + + # these must come after %<brace>! + states['strings'] += [ + # %r regex + (r'(%r(.))(.*?)(\2[mixounse]*)', intp_regex_callback), + # regular fancy strings + (r'%[qsw](.).*?\1', String.Other), + (r'(%[QWx](.))(.*?)(\2)', intp_string_callback), + # special forms of fancy strings after operators or + # in method calls with braces + (r'(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ]).*?\3)', + bygroups(Text, String.Other, None)), + # and because of fixed with lookbehinds the whole thing a + # second time for line startings... + (r'^(\s*)(%([\t ]).*?\3)', + bygroups(Text, String.Other, None)), + # all regular fancy strings + (r'(%([^a-zA-Z0-9\s]))(.*?)(\2)', intp_string_callback), + ] + + return states + + tokens = { + 'root': [ + (r'#.*?$', Comment.Single), + (r'=begin\s.*?\n=end', Comment.Multiline), + # keywords + (r'(BEGIN|END|alias|begin|break|case|defined\?|' + r'do|else|elsif|end|ensure|for|if|in|next|redo|' + r'rescue|raise|retry|return|super|then|undef|unless|until|when|' + r'while|yield)\b', Keyword), + # start of function, class and module names + (r'(module)(\s+)([a-zA-Z_][a-zA-Z0-9_]*(::[a-zA-Z_][a-zA-Z0-9_]*)*)', + bygroups(Keyword, Text, Name.Namespace)), + (r'(def)(\s+)', bygroups(Keyword, Text), 'funcname'), + (r'def(?=[*%&^`~+-/\[<>=])', Keyword, 'funcname'), + (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), + # special methods + (r'(initialize|new|loop|include|extend|raise|attr_reader|' + r'attr_writer|attr_accessor|attr|catch|throw|private|' + r'module_function|public|protected|true|false|nil)\b', Keyword.Pseudo), + (r'(not|and|or)\b', Operator.Word), + (r'(autoload|block_given|const_defined|eql|equal|frozen|include|' + r'instance_of|is_a|iterator|kind_of|method_defined|nil|' + r'private_method_defined|protected_method_defined|' + r'public_method_defined|respond_to|tainted)\?', Name.Builtin), + (r'(chomp|chop|exit|gsub|sub)!', Name.Builtin), + (r'(?<!\.)(Array|Float|Integer|String|__id__|__send__|abort|ancestors|' + r'at_exit|autoload|binding|callcc|caller|' + r'catch|chomp|chop|class_eval|class_variables|' + r'clone|const_defined\?|const_get|const_missing|const_set|constants|' + r'display|dup|eval|exec|exit|extend|fail|fork|' + r'format|freeze|getc|gets|global_variables|gsub|' + r'hash|id|included_modules|inspect|instance_eval|' + r'instance_method|instance_methods|' + r'instance_variable_get|instance_variable_set|instance_variables|' + r'lambda|load|local_variables|loop|' + r'method|method_missing|methods|module_eval|name|' + r'object_id|open|p|print|printf|private_class_method|' + r'private_instance_methods|' + r'private_methods|proc|protected_instance_methods|' + r'protected_methods|public_class_method|' + r'public_instance_methods|public_methods|' + r'putc|puts|raise|rand|readline|readlines|require|' + r'scan|select|self|send|set_trace_func|singleton_methods|sleep|' + r'split|sprintf|srand|sub|syscall|system|taint|' + r'test|throw|to_a|to_s|trace_var|trap|type|untaint|untrace_var|' + r'warn)\b', Name.Builtin), + (r'__(FILE|LINE)__\b', Name.Builtin.Pseudo), + # normal heredocs + (r'(?<!\w)(<<-?)(["`\']?)([a-zA-Z_]\w*)(\2)(.*?\n)', heredoc_callback), + # empty string heredocs + (r'(<<-?)("|\')()(\2)(.*?\n)', heredoc_callback), + (r'__END__', Comment.Preproc, 'end-part'), + # multiline regex (after keywords or assignemnts) + (r'(?:^|(?<=[=<>~!])|' + r'(?<=(?:\s|;)when\s)|' + r'(?<=(?:\s|;)or\s)|' + r'(?<=(?:\s|;)and\s)|' + r'(?<=(?:\s|;|\.)index\s)|' + r'(?<=(?:\s|;|\.)scan\s)|' + r'(?<=(?:\s|;|\.)sub\s)|' + r'(?<=(?:\s|;|\.)sub!\s)|' + r'(?<=(?:\s|;|\.)gsub\s)|' + r'(?<=(?:\s|;|\.)gsub!\s)|' + r'(?<=(?:\s|;|\.)match\s)|' + r'(?<=(?:\s|;)if\s)|' + r'(?<=(?:\s|;)elsif\s)|' + r'(?<=^when\s)|' + r'(?<=^index\s)|' + r'(?<=^scan\s)|' + r'(?<=^sub\s)|' + r'(?<=^gsub\s)|' + r'(?<=^sub!\s)|' + r'(?<=^gsub!\s)|' + r'(?<=^match\s)|' + r'(?<=^if\s)|' + r'(?<=^elsif\s)' + r')(\s*)(/)(?!=)', bygroups(Text, String.Regex), 'multiline-regex'), + # multiline regex (in method calls) + (r'(?<=\(|,)/', String.Regex, 'multiline-regex'), + # multiline regex (this time the funny no whitespace rule) + (r'(\s+)(/[^\s=])', String.Regex, 'multiline-regex'), + # lex numbers and ignore following regular expressions which + # are division operators in fact (grrrr. i hate that. any + # better ideas?) + # since pygments 0.7 we also eat a "?" operator after numbers + # so that the char operator does not work. Chars are not allowed + # there so that you can use the terner operator. + # stupid example: + # x>=0?n[x]:"" + (r'(0_?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?', + bygroups(Number.Oct, Text, Operator)), + (r'(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?', + bygroups(Number.Hex, Text, Operator)), + (r'(0b[01]+(?:_[01]+)*)(\s*)([/?])?', + bygroups(Number.Bin, Text, Operator)), + (r'([\d]+(?:_\d+)*)(\s*)([/?])?', + bygroups(Number.Integer, Text, Operator)), + # Names + (r'@@[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable.Class), + (r'@[a-zA-Z_][a-zA-Z0-9_]*', Name.Variable.Instance), + (r'\$[a-zA-Z0-9_]+', Name.Variable.Global), + (r'\$[!@&`\'+~=/\\,;.<>_*$?:"]', Name.Variable.Global), + (r'\$-[0adFiIlpvw]', Name.Variable.Global), + (r'::', Operator), + include('strings'), + # chars + (r'\?(\\[MC]-)*' # modifiers + r'(\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)' + r'(?!\w)', + String.Char), + (r'[A-Z][a-zA-Z0-9_]+', Name.Constant), + # this is needed because ruby attributes can look + # like keywords (class) or like this: ` ?!? + (r'(\.|::)([a-zA-Z_]\w*[\!\?]?|[*%&^`~+-/\[<>=])', + bygroups(Operator, Name)), + (r'[a-zA-Z_][\w_]*[\!\?]?', Name), + (r'(\[|\]|\*\*|<<?|>>?|>=|<=|<=>|=~|={3}|' + r'!~|&&?|\|\||\.{1,3})', Operator), + (r'[-+/*%=<>&!^|~]=?', Operator), + (r'[(){};,/?:\\]', Punctuation), + (r'\s+', Text) + ], + 'funcname': [ + (r'\(', Punctuation, 'defexpr'), + (r'(?:([a-zA-Z_][a-zA-Z0-9_]*)(\.))?' + r'([a-zA-Z_][\w_]*[\!\?]?|\*\*?|[-+]@?|' + r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)', + bygroups(Name.Class, Operator, Name.Function), '#pop'), + (r'', Text, '#pop') + ], + 'classname': [ + (r'\(', Punctuation, 'defexpr'), + (r'<<', Operator, '#pop'), + (r'[A-Z_][\w_]*', Name.Class, '#pop'), + (r'', Text, '#pop') + ], + 'defexpr': [ + (r'(\))(\.|::)?', bygroups(Punctuation, Operator), '#pop'), + (r'\(', Operator, '#push'), + include('root') + ], + 'in-intp': [ + ('}', String.Interpol, '#pop'), + include('root'), + ], + 'string-intp': [ + (r'#{', String.Interpol, 'in-intp'), + (r'#@@?[a-zA-Z_][a-zA-Z0-9_]*', String.Interpol), + (r'#\$[a-zA-Z_][a-zA-Z0-9_]*', String.Interpol) + ], + 'string-intp-escaped': [ + include('string-intp'), + (r'\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})', String.Escape) + ], + 'interpolated-regex': [ + include('string-intp'), + (r'[\\#]', String.Regex), + (r'[^\\#]+', String.Regex), + ], + 'interpolated-string': [ + include('string-intp'), + (r'[\\#]', String.Other), + (r'[^\\#]+', String.Other), + ], + 'multiline-regex': [ + include('string-intp'), + (r'\\/', String.Regex), + (r'[\\#]', String.Regex), + (r'[^\\/#]+', String.Regex), + (r'/[mixounse]*', String.Regex, '#pop'), + ], + 'end-part': [ + (r'.+', Comment.Preproc, '#pop') + ] + } + tokens.update(gen_rubystrings_rules()) + + def analyse_text(text): + return shebang_matches(text, r'ruby(1\.\d)?') + + +class RubyConsoleLexer(Lexer): + """ + For Ruby interactive console (**irb**) output like: + + .. sourcecode:: rbcon + + irb(main):001:0> a = 1 + => 1 + irb(main):002:0> puts a + 1 + => nil + """ + name = 'Ruby irb session' + aliases = ['rbcon', 'irb'] + mimetypes = ['text/x-ruby-shellsession'] + + _prompt_re = re.compile('irb\([a-zA-Z_][a-zA-Z0-9_]*\):\d{3}:\d+[>*] ') + + def get_tokens_unprocessed(self, text): + rblexer = RubyLexer(**self.options) + + curcode = '' + insertions = [] + for match in line_re.finditer(text): + line = match.group() + m = self._prompt_re.match(line) + if m is not None: + end = m.end() + insertions.append((len(curcode), + [(0, Generic.Prompt, line[:end])])) + curcode += line[end:] + else: + if curcode: + for item in do_insertions(insertions, + rblexer.get_tokens_unprocessed(curcode)): + yield item + curcode = '' + insertions = [] + yield match.start(), Generic.Output, line + if curcode: + for item in do_insertions(insertions, + rblexer.get_tokens_unprocessed(curcode)): + yield item + + +class PerlLexer(RegexLexer): + """ + For `Perl <http://www.perl.org>`_ source code. + """ + + name = 'Perl' + aliases = ['perl', 'pl'] + filenames = ['*.pl', '*.pm'] + mimetypes = ['text/x-perl', 'application/x-perl'] + + flags = re.DOTALL | re.MULTILINE + # TODO: give this a perl guy who knows how to parse perl... + tokens = { + 'balanced-regex': [ + (r'/(\\\\|\\/|[^/])*/[egimosx]*', String.Regex, '#pop'), + (r'!(\\\\|\\!|[^!])*![egimosx]*', String.Regex, '#pop'), + (r'\\(\\\\|[^\\])*\\[egimosx]*', String.Regex, '#pop'), + (r'{(\\\\|\\}|[^}])*}[egimosx]*', String.Regex, '#pop'), + (r'<(\\\\|\\>|[^>])*>[egimosx]*', String.Regex, '#pop'), + (r'\[(\\\\|\\\]|[^\]])*\][egimosx]*', String.Regex, '#pop'), + (r'\((\\\\|\\\)|[^\)])*\)[egimosx]*', String.Regex, '#pop'), + (r'@(\\\\|\\\@|[^\@])*@[egimosx]*', String.Regex, '#pop'), + (r'%(\\\\|\\\%|[^\%])*%[egimosx]*', String.Regex, '#pop'), + (r'\$(\\\\|\\\$|[^\$])*\$[egimosx]*', String.Regex, '#pop'), + (r'!(\\\\|\\!|[^!])*![egimosx]*', String.Regex, '#pop'), + ], + 'root': [ + (r'\#.*?$', Comment.Single), + (r'=[a-zA-Z0-9]+\s+.*?\n=cut', Comment.Multiline), + (r'(case|continue|do|else|elsif|for|foreach|if|last|my|' + r'next|our|redo|reset|then|unless|until|while|use|' + r'print|new|BEGIN|END|return)\b', Keyword), + (r'(format)(\s+)([a-zA-Z0-9_]+)(\s*)(=)(\s*\n)', + bygroups(Keyword, Text, Name, Text, Punctuation, Text), 'format'), + (r'(eq|lt|gt|le|ge|ne|not|and|or|cmp)\b', Operator.Word), + # common delimiters + (r's/(\\\\|\\/|[^/])*/(\\\\|\\/|[^/])*/[egimosx]*', String.Regex), + (r's!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*', String.Regex), + (r's\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*', String.Regex), + (r's@(\\\\|\\@|[^@])*@(\\\\|\\@|[^@])*@[egimosx]*', String.Regex), + (r's%(\\\\|\\%|[^%])*%(\\\\|\\%|[^%])*%[egimosx]*', String.Regex), + # balanced delimiters + (r's{(\\\\|\\}|[^}])*}\s*', String.Regex, 'balanced-regex'), + (r's<(\\\\|\\>|[^>])*>\s*', String.Regex, 'balanced-regex'), + (r's\[(\\\\|\\\]|[^\]])*\]\s*', String.Regex, 'balanced-regex'), + (r's\((\\\\|\\\)|[^\)])*\)\s*', String.Regex, 'balanced-regex'), + + (r'm?/(\\\\|\\/|[^/\n])*/[gcimosx]*', String.Regex), + (r'((?<==~)|(?<=\())\s*/(\\\\|\\/|[^/])*/[gcimosx]*', String.Regex), + (r'\s+', Text), + (r'(abs|accept|alarm|atan2|bind|binmode|bless|caller|chdir|' + r'chmod|chomp|chop|chown|chr|chroot|close|closedir|connect|' + r'continue|cos|crypt|dbmclose|dbmopen|defined|delete|die|' + r'dump|each|endgrent|endhostent|endnetent|endprotoent|' + r'endpwent|endservent|eof|eval|exec|exists|exit|exp|fcntl|' + r'fileno|flock|fork|format|formline|getc|getgrent|getgrgid|' + r'getgrnam|gethostbyaddr|gethostbyname|gethostent|getlogin|' + r'getnetbyaddr|getnetbyname|getnetent|getpeername|getpgrp|' + r'getppid|getpriority|getprotobyname|getprotobynumber|' + r'getprotoent|getpwent|getpwnam|getpwuid|getservbyname|' + r'getservbyport|getservent|getsockname|getsockopt|glob|gmtime|' + r'goto|grep|hex|import|index|int|ioctl|join|keys|kill|last|' + r'lc|lcfirst|length|link|listen|local|localtime|log|lstat|' + r'map|mkdir|msgctl|msgget|msgrcv|msgsnd|my|next|no|oct|open|' + r'opendir|ord|our|pack|package|pipe|pop|pos|printf|' + r'prototype|push|quotemeta|rand|read|readdir|' + r'readline|readlink|readpipe|recv|redo|ref|rename|require|' + r'reverse|rewinddir|rindex|rmdir|scalar|seek|seekdir|' + r'select|semctl|semget|semop|send|setgrent|sethostent|setnetent|' + r'setpgrp|setpriority|setprotoent|setpwent|setservent|' + r'setsockopt|shift|shmctl|shmget|shmread|shmwrite|shutdown|' + r'sin|sleep|socket|socketpair|sort|splice|split|sprintf|sqrt|' + r'srand|stat|study|substr|symlink|syscall|sysopen|sysread|' + r'sysseek|system|syswrite|tell|telldir|tie|tied|time|times|tr|' + r'truncate|uc|ucfirst|umask|undef|unlink|unpack|unshift|untie|' + r'utime|values|vec|wait|waitpid|wantarray|warn|write' + r')\b', Name.Builtin), + (r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo), + (r'<<([a-zA-Z_][a-zA-Z0-9_]*)\n.*?\n\1\n', String), + (r'__END__', Comment.Preproc, 'end-part'), + (r'\$\^[ADEFHILMOPSTWX]', Name.Variable.Global), + (r"\$[\\\"\[\]'&`+*.,;=%~?@$!<>(^|/-](?!\w)", Name.Variable.Global), + (r'[$@%#]+', Name.Variable, 'varname'), + (r'0_?[0-7]+(_[0-7]+)*', Number.Oct), + (r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex), + (r'0b[01]+(_[01]+)*', Number.Bin), + (r'\d+', Number.Integer), + (r"'(\\\\|\\'|[^'])*'", String), + (r'"(\\\\|\\"|[^"])*"', String), + (r'`(\\\\|\\`|[^`])*`', String.Backtick), + (r'<([^\s>]+)>', String.Regexp), + (r'(q|qq|qw|qr|qx)\{', String.Other, 'cb-string'), + (r'(q|qq|qw|qr|qx)\(', String.Other, 'rb-string'), + (r'(q|qq|qw|qr|qx)\[', String.Other, 'sb-string'), + (r'(q|qq|qw|qr|qx)\<', String.Other, 'lt-string'), + (r'(q|qq|qw|qr|qx)(.)[.\n]*?\1', String.Other), + (r'package\s+', Keyword, 'modulename'), + (r'sub\s+', Keyword, 'funcname'), + (r'(\[\]|\*\*|::|<<|>>|>=|<=|<=>|={3}|!=|=~|' + r'!~|&&?|\|\||\.{1,3})', Operator), + (r'[-+/*%=<>&^|!\\~]=?', Operator), + (r'[\(\)\[\]:;,<>/\?\{\}]', Punctuation), # yes, there's no shortage + # of punctuation in Perl! + (r'(?=\w)', Name, 'name'), + ], + 'format': [ + (r'\.\n', String.Interpol, '#pop'), + (r'[^\n]*\n', String.Interpol), + ], + 'varname': [ + (r'\s+', Text), + (r'\{', Punctuation, '#pop'), # hash syntax? + (r'\)|,', Punctuation, '#pop'), # argument specifier + (r'[a-zA-Z0-9_]+::', Name.Namespace), + (r'[a-zA-Z0-9_:]+', Name.Variable, '#pop'), + ], + 'name': [ + (r'[a-zA-Z0-9_]+::', Name.Namespace), + (r'[a-zA-Z0-9_:]+', Name, '#pop'), + (r'[A-Z_]+(?=[^a-zA-Z0-9_])', Name.Constant, '#pop'), + (r'(?=[^a-zA-Z0-9_])', Text, '#pop'), + ], + 'modulename': [ + (r'[a-zA-Z_][\w_]*', Name.Namespace, '#pop') + ], + 'funcname': [ + (r'[a-zA-Z_][\w_]*[\!\?]?', Name.Function), + (r'\s+', Text), + # argument declaration + (r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Text)), + (r'.*?{', Punctuation, '#pop'), + (r';', Punctuation, '#pop'), + ], + 'cb-string': [ + (r'\\[\{\}\\]', String.Other), + (r'\\', String.Other), + (r'\{', String.Other, 'cb-string'), + (r'\}', String.Other, '#pop'), + (r'[^\{\}\\]+', String.Other) + ], + 'rb-string': [ + (r'\\[\(\)\\]', String.Other), + (r'\\', String.Other), + (r'\(', String.Other, 'rb-string'), + (r'\)', String.Other, '#pop'), + (r'[^\(\)]+', String.Other) + ], + 'sb-string': [ + (r'\\[\[\]\\]', String.Other), + (r'\\', String.Other), + (r'\[', String.Other, 'sb-string'), + (r'\]', String.Other, '#pop'), + (r'[^\[\]]+', String.Other) + ], + 'lt-string': [ + (r'\\[\<\>\\]', String.Other), + (r'\\', String.Other), + (r'\<', String.Other, 'lt-string'), + (r'\>', String.Other, '#pop'), + (r'[^\<\>]]+', String.Other) + ], + 'end-part': [ + (r'.+', Comment.Preproc, '#pop') + ] + } + + def analyse_text(text): + return shebang_matches(text, r'perl(\d\.\d\.\d)?') + + +class LuaLexer(RegexLexer): + """ + For `Lua <http://www.lua.org>`_ source code. + + Additional options accepted: + + `func_name_highlighting` + If given and ``True``, highlight builtin function names + (default: ``True``). + `disabled_modules` + If given, must be a list of module names whose function names + should not be highlighted. By default all modules are highlighted. + + To get a list of allowed modules have a look into the + `_luabuiltins` module: + + .. sourcecode:: pycon + + >>> from pygments.lexers._luabuiltins import MODULES + >>> MODULES.keys() + ['string', 'coroutine', 'modules', 'io', 'basic', ...] + """ + + name = 'Lua' + aliases = ['lua'] + filenames = ['*.lua'] + mimetypes = ['text/x-lua', 'application/x-lua'] + + tokens = { + 'root': [ + (r'(?s)--\[(=*)\[.*?\]\1\]', Comment.Multiline), + ('--.*$', Comment.Single), + + (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float), + (r'(?i)\d+e[+-]?\d+', Number.Float), + ('(?i)0x[0-9a-f]*', Number.Hex), + (r'\d+', Number.Integer), + + (r'\n', Text), + (r'[^\S\n]', Text), + (r'[\[\]\{\}\(\)\.,:;]', Punctuation), + + (r'(==|~=|<=|>=|\.\.|\.\.\.|[=+\-*/%^<>#])', Operator), + (r'(and|or|not)\b', Operator.Word), + + ('(break|do|else|elseif|end|for|if|in|repeat|return|then|until|' + r'while)\b', Keyword), + (r'(local)\b', Keyword.Declaration), + (r'(true|false|nil)\b', Keyword.Constant), + + (r'(function)(\s+)', bygroups(Keyword, Text), 'funcname'), + (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), + + (r'[A-Za-z_][A-Za-z0-9_]*(\.[A-Za-z_][A-Za-z0-9_]*)?', Name), + + # multiline strings + (r'(?s)\[(=*)\[(.*?)\]\1\]', String), + ("'", String.Single, combined('stringescape', 'sqs')), + ('"', String.Double, combined('stringescape', 'dqs')) + ], + + 'funcname': [ + ('[A-Za-z_][A-Za-z0-9_]*', Name.Function, '#pop'), + # inline function + ('\(', Punctuation, '#pop'), + ], + + 'classname': [ + ('[A-Za-z_][A-Za-z0-9_]*', Name.Class, '#pop') + ], + + # if I understand correctly, every character is valid in a lua string, + # so this state is only for later corrections + 'string': [ + ('.', String) + ], + + 'stringescape': [ + (r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape) + ], + + 'sqs': [ + ("'", String, '#pop'), + include('string') + ], + + 'dqs': [ + ('"', String, '#pop'), + include('string') + ] + } + + def __init__(self, **options): + self.func_name_highlighting = get_bool_opt( + options, 'func_name_highlighting', True) + self.disabled_modules = get_list_opt(options, 'disabled_modules', []) + + self._functions = set() + if self.func_name_highlighting: + from pygments.lexers._luabuiltins import MODULES + for mod, func in MODULES.iteritems(): + if mod not in self.disabled_modules: + self._functions.update(func) + RegexLexer.__init__(self, **options) + + def get_tokens_unprocessed(self, text): + for index, token, value in \ + RegexLexer.get_tokens_unprocessed(self, text): + if token is Name: + if value in self._functions: + yield index, Name.Builtin, value + continue + elif '.' in value: + a, b = value.split('.') + yield index, Name, a + yield index + len(a), Punctuation, u'.' + yield index + len(a) + 1, Name, b + continue + yield index, token, value + + +class MiniDLexer(RegexLexer): + """ + For `MiniD <http://www.dsource.org/projects/minid>`_ (a D-like scripting + language) source. + """ + name = 'MiniD' + filenames = ['*.md'] + aliases = ['minid'] + mimetypes = ['text/x-minidsrc'] + + tokens = { + 'root': [ + (r'\n', Text), + (r'\s+', Text), + # Comments + (r'//(.*?)\n', Comment), + (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment), + (r'/\+', Comment, 'nestedcomment'), + # Keywords + (r'(as|break|case|class|catch|continue|coroutine|default' + r'|do|else|finally|for|foreach|function|global|namespace' + r'|if|import|in|is|local|module|return|super|switch' + r'|this|throw|try|vararg|while|with|yield)\b', Keyword), + (r'(false|true|null)\b', Keyword.Constant), + # FloatLiteral + (r'([0-9][0-9_]*)?\.[0-9_]+([eE][+\-]?[0-9_]+)?', Number.Float), + # IntegerLiteral + # -- Binary + (r'0[Bb][01_]+', Number), + # -- Octal + (r'0[Cc][0-7_]+', Number.Oct), + # -- Hexadecimal + (r'0[xX][0-9a-fA-F_]+', Number.Hex),