
    d                         d Z ddlZddlZd ej        D             Zg dZdZdZd Zd Z	d	 Z
ddZ G d d          Z G d d          ZdS )aA  Utilities to compile possibly incomplete Python source code.

This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode'
and:

- Return code object if the command is complete and valid
- Return None if the command is incomplete
- Raise SyntaxError, ValueError or OverflowError if the command is a
  syntax error (OverflowError and ValueError can be produced by
  malformed literals).

The two interfaces are:

compile_command(source, filename, symbol):

    Compiles a single command in the manner described above.

CommandCompiler():

    Instances of this class have __call__ methods identical in
    signature to compile_command; the difference is that if the
    instance compiles program text containing a __future__ statement,
    the instance 'remembers' and compiles all subsequent program texts
    with the statement in force.

The module also provides another class:

Compile():

    Instances of this class act like the built-in function compile,
    but with 'memory' in the sense described above.
    Nc                 8    g | ]}t          t          |          S  )getattr
__future__).0fnames       /croot/python-split_1694437901252/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_plac/lib/python3.11/codeop.py
<listcomp>r
   &   s2     8 8 8 Z'' 8 8 8    )compile_commandCompileCommandCompileri   i @  c                 ,   |                     d          D ]&}|                                }|r|d         dk    r n	'|dk    rd}t          j                    5  t          j        dt
          t          f           	  | |||           ni# t          $ r\ 	  | |dz   ||           Y d d d            d S # t          $ r-}dt          |          v rY d }~Y d d d            d S Y d }~nd }~ww xY wY nw xY wd d d            n# 1 swxY w Y    | |||          S )N
r   #evalpassignorezincomplete input)	splitstripwarningscatch_warningssimplefilterSyntaxWarningDeprecationWarningSyntaxErrorstr)compilersourcefilenamesymbollinees         r	   _maybe_compiler$   1   s   T""  zz|| 	DGsNNEVF 
	 	"	" 
  
 h8J(KLLL	 HVXv.... 	  	  	  $&999
  
  
  
  
  
  
  
        %Q//4444
  
  
  
  
  
  
  
  0//// //	 	
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  8FHf---sl   "C>;B	C>	
C/B2$C>2
C)<C$C/C>C/$C))C/,C>.C//C>>DDc                 f    t          |           }t          |          }d|v rd|v rdS ||k    rdS dS )Nzwas never closedFT)repr)err1err2rep1rep2s       r	   _is_syntax_errorr+   L   sF    ::D::DT!!&8D&@&@ut||t5r   c                 @    t          | ||t          t          z            S N)compilePyCF_DONT_IMPLY_DEDENTPyCF_ALLOW_INCOMPLETE_INPUTr   r    r!   s      r	   _compiler2   U   s    68V-CFa-abbbr   <input>singlec                 0    t          t          | ||          S )a  Compile a command and determine whether it is incomplete.

    Arguments:

    source -- the source string; may contain \n characters
    filename -- optional filename from which source was read; default
                "<input>"
    symbol -- optional grammar start symbol; "single" (default), "exec"
              or "eval"

    Return value / exceptions raised:

    - Return a code object if the command is complete and valid
    - Return None if the command is incomplete
    - Raise SyntaxError, ValueError or OverflowError if the command is a
      syntax error (OverflowError and ValueError can be produced by
      malformed literals).
    )r$   r2   r1   s      r	   r   r   X   s    & (FHf===r   c                       e Zd ZdZd Zd ZdS )r   zInstances of this class behave much like the built-in compile
    function, but if one is used to compile text containing a future
    statement, it "remembers" and compiles all subsequent program texts
    with the statement in force.c                 .    t           t          z  | _        d S r-   )r/   r0   flagsselfs    r	   __init__zCompile.__init__r   s    +.II


r   c                     t          |||| j        d          }t          D ]&}|j        |j        z  r| xj        |j        z  c_        '|S )NT)r.   r8   	_featuresco_flagscompiler_flag)r:   r   r    r!   codeobfeatures         r	   __call__zCompile.__call__u   sS    64:tDD  	4 	4G!66 4

g33

r   N__name__
__module____qualname____doc__r;   rB   r   r   r	   r   r   m   s?        $ $J J J    r   r   c                        e Zd ZdZd ZddZdS )r   a(  Instances of this class have __call__ methods identical in
    signature to compile_command; the difference is that if the
    instance compiles program text containing a __future__ statement,
    the instance 'remembers' and compiles all subsequent program texts
    with the statement in force.c                 ,    t                      | _        d S r-   )r   r   r9   s    r	   r;   zCommandCompiler.__init__   s    		r   r3   r4   c                 0    t          | j        |||          S )a  Compile a command and determine whether it is incomplete.

        Arguments:

        source -- the source string; may contain \n characters
        filename -- optional filename from which source was read;
                    default "<input>"
        symbol -- optional grammar start symbol; "single" (default) or
                  "eval"

        Return value / exceptions raised:

        - Return a code object if the command is complete and valid
        - Return None if the command is incomplete
        - Raise SyntaxError, ValueError or OverflowError if the command is a
          syntax error (OverflowError and ValueError can be produced by
          malformed literals).
        )r$   r   )r:   r   r    r!   s       r	   rB   zCommandCompiler.__call__   s    & dmVXvFFFr   Nr3   r4   rC   r   r   r	   r   r   |   sG        $ $" " "G G G G G Gr   r   rK   )rG   r   r   all_feature_namesr=   __all__r/   r0   r$   r+   r2   r   r   r   r   r   r	   <module>rN      s     D     8 8$68 8 8	 <
;
;
  $ . . .6  c c c> > > >*       G G G G G G G G G Gr   