ó ÒMLc@sŽdZddlmZddlmZmZmZddlmZddl m Z ddgZ defd„ƒYZ defd „ƒYZ d S( sê pygments.formatters.other ~~~~~~~~~~~~~~~~~~~~~~~~~ Other formatters: NullFormatter, RawTokenFormatter. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. iÿÿÿÿ(t Formatter(t OptionErrortget_choice_opttb(tToken(tcolorizet NullFormattertRawTokenFormattercBs2eZdZdZddgZdgZd„ZRS(s; Output the text unchanged without any formatting. s Text onlyttexttnulls*.txtcCsP|j}x@|D]8\}}|r;|j|j|ƒƒq|j|ƒqWdS(N(tencodingtwritetencode(tselft tokensourcetoutfiletenctttypetvalue((s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pytformats  (t__name__t __module__t__doc__tnametaliasest filenamesR(((s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyRs   cBsAeZdZdZddgZdgZeZd„Zd„Z RS(s} Format tokens as a raw representation for storing token streams. The format is ``tokentyperepr(tokenstring)\n``. The output can later be converted to a token stream with the `RawTokenLexer`, described in the `lexer list `_. Only two options are 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.* s Raw tokenstrawttokenss*.rawcKsÖtj|||jr(tdƒ‚nd|_t|dddddgdƒ|_|jddƒ|_|jt kr…d |_n|jdk rÒyt |jdƒWqÒt k rÎt d |jƒ‚qÒXndS( Ns6the raw formatter does not support the encoding optiontasciitcompressttnonetgztbz2t error_colortredsInvalid color %r specified( Rt__init__R RRRtgettNoneR"tTrueRtKeyErrort ValueError(R toptions((s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyR$>s     c s•yˆjtdƒƒWntk r6tdƒ‚nX|jdkr…ddl}|jdddˆƒ‰‡fd†}ˆj}ni|jdkrÖddl}|jdƒ‰‡‡fd †}‡‡fd †}n‡fd †}ˆj}d}d }|j r_x„|D]N\} } d | | f} | t j krN|t |j | ƒƒq || ƒq Wn+x(|D] \} } |d | | fƒqfW|ƒdS(NRs3The raw tokens formatter needs a binary output fileR iÿÿÿÿtwbi csˆj|jƒƒdS(N(R R (R(R(s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyR YsR!cs ˆjˆj|jƒƒƒdS(N(R RR (R(t compressorR(s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyR _scs!ˆjˆjƒƒˆjƒdS(N(R tflush((R,R(s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyR-ascsˆj|jƒƒdS(N(R R (R(R(s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyR esus%s %r (R Rt TypeErrorRtgziptGzipFileR-R!t BZ2CompressorR&R"RtErrorR( R RRR/R R-R!tlasttypetlastvalRRtline((R,Rs=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyRPs6      ( RRRRRRtFalset unicodeoutputR$R(((s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyR%s   N(Rtpygments.formatterRt pygments.utilRRRtpygments.tokenRtpygments.consoleRt__all__RR(((s=/usr/lib/python2.7/site-packages/pygments/formatters/other.pyt s