+
    VBiu                        R t ^ RIHt Rt ^ RIt^ RIHt ^ RIHt Rt	^ RIHt . ROt ! R	 R
]4      t ! R R4      t ! R R4      tR#   ]
 d    Rt	 L6i ; i)z@Lexical analysis of formal languages (i.e. code) using Pygments.)annotationsreStructuredTextN)get_lexer_by_name)_get_ttype_classTF)ApplicationErrorc                      ] tR t^tRtR# )
LexerError N)__name__
__module____qualname____firstlineno____static_attributes__r	       A/usr/lib/python3.14/site-packages/docutils/utils/code_analyzer.pyr   r      s    r   r   c                  6    ] tR t^ tRtRR R lltR tR tRtR# )	Lexeraq  Parse `code` lines and yield "classified" tokens.

Arguments

  code       -- string of source code to parse,
  language   -- formal language the code is written in,
  tokennames -- either 'long', 'short', or 'none' (see below).

Merge subsequent tokens of the same token-type.

Iterating over an instance yields the tokens as ``(tokentype, value)``
tuples. The value of `tokennames` configures the naming of the tokentype:

  'long':  downcased full token type name,
  'short': short name defined by pygments.token.STANDARD_TYPES
           (= class argument used in pygments html output),
  'none':  skip lexical analysis.
c                   V ^8  d   QhRR/#    returnNoner	   )formats   "r   __annotate__Lexer.__annotate__4   s     M Md Mr   c                &   Wn         W n        W0n        RV n        VR9   g   VR8X  d   R# \        '       g   \        R4      h \        V P                  4      V n        R#   \        P                  P                   d    \        RT,          4      hi ; i)z5
Set up a lexical analyzer for `code` in `language`.
Nnonez0Cannot analyze code. Pygments package not found.z6Cannot analyze code. No Pygments lexer found for "%s".) text)
codelanguage
tokennameslexerwith_pygmentsr   r   pygmentsutilClassNotFound)selfr   r    r!   s   &&&&r   __init__Lexer.__init__4   s     	 $
|#zV';} ; < <	M*4==9DJ}}** 	M ACKL M M	Ms   A 2Bc              #     "   \        V4      p\        V4      w  r#V F  w  rEWBJ d   W5,          pK  W#3x  YEr2K  	  VP                  R4      pV'       d   W#3x  R# R# 5i)z_Merge subsequent tokens of same token-type.

Also strip the final newline (added by pygments).

N)iternextremovesuffix)r'   tokenslasttypelastvalttypevalues   &&    r   mergeLexer.mergeO   sg     
 f"6l"LE  ''',7 # &&t,## s   AA	Ac              #    "   V P                   f   . V P                  3x  R# \        P                  ! V P                  V P                   4      pV P	                  V4       Fm  w  r#V P
                  R8X  d*   \        V4      P                  4       P                  R4      pM\        V4      .pV Uu. uF  qU\        9  g   K  VNK  	  ppWC3x  Ko  	  R# u upi 5i)z7Parse self.code and yield "classified" tokens.
        Nlong.)r"   r   r$   lexr4   r!   strlowersplitr   unstyled_tokens)r'   r/   	tokentyper3   classesclss   &     r   __iter__Lexer.__iter__`   s      ::dii-dii4 $

6 2I&(i...066s;+I67&-LgsO1KssgGL.  !3
 Ms   B,C.C?CC)r   r    r"   r!   N)short)	r
   r   r   r   __doc__r(   r4   rA   r   r	   r   r   r   r       s    &M6$"!r   r   c                  ,    ] tR t^ptRtR R ltR tRtR# )NumberLinesaU  Insert linenumber-tokens at the start of every code line.

Arguments

   tokens    -- iterable of ``(classes, value)`` tuples
   startline -- first line number
   endline   -- last line number

Iterating over an instance yields the tokens with a
``(['ln'], '<the line number>')`` token added for every code line.
Multi-line tokens are split.c                   V ^8  d   QhRR/# r   r	   )r   s   "r   r   NumberLines.__annotate__}   s     1 1d 1r   c                	X    Wn         W n        R \        \        V4      4       R2V n        R# )%zd N)r/   	startlinelenr:   fmt_str)r'   r/   rK   endlines   &&&&r   r(   NumberLines.__init__}   s&    "3s7|,-R0r   c              #  	,  "   V P                   pR .V P                  V,          3x  V P                   F[  w  r#VP                  R4      pVRR  F0  pW%R,           3x  V^,          pR .V P                  V,          3x  K2  	  W$R,          3x  K]  	  R# 5i)lnr+   N)rK   rM   r/   r<   )r'   linenor2   r3   lineslines   &     r   rA   NumberLines.__iter__   s     fdllV+++ KKLEKK%Ecr
D[((!fdllV333 # r"" (s   BB)rM   rK   r/   N)r
   r   r   r   rD   r(   rA   r   r	   r   r   rF   rF   p   s    
$1	#r   rF   )tokenr   r   )rD   
__future__r   __docformat__r$   pygments.lexersr   pygments.formatters.htmlr   r#   ImportErrordocutilsr   r=   r   r   rF   r	   r   r   <module>r^      sm   
 G ""19M &	! 	M! M!`# #A  Ms   A	 		AA