
     
zi,                        S SK Jr  S SKrS SKJr   " S S5      r " S S5      rSrS	r\	S
:X  a  \R                  R                  \R                  R                  \5      5      r\R                  R                  \S5      r\R                  R                  \S5      r\" \5      r\" \S5       r\R+                  \5        SSS5        gg! , (       d  f       g= f)    )TemplateN)IOc                   <    \ rS rSrS	S jrS\\   SS4S jrS rSr	g)
ASTCodeGenerator   c                     Xl         U R                  U5       VVs/ s H  u  p#[        X#5      PM     snnU l        gs  snnf )z9Initialize the code generator from a configuration
file.
N)cfg_filenameparse_cfgfileNodeCfgnode_cfg)selfr	   namecontentss       E/var/www/html/venv/lib/python3.13/site-packages/pycparser/_ast_gen.py__init__ASTCodeGenerator.__init__   sC     ) %)$6$6|$D
$D  D#$D
 
s   <filereturnNc                     [        [        5      R                  U R                  S9nU[        -  nU R
                   H  nX#R                  5       S-   -  nM     UR                  U5        g)z2Generates the code into file, an open file buffer.)r	   z

N)r   _PROLOGUE_COMMENT
substituter	   _PROLOGUE_CODEr   generate_sourcewrite)r   r   srcr   s       r   generateASTCodeGenerator.generate    s\    ()44$BSBS4T~H++-66C & 	

3    c           	   #     #    [        US5       nU H  nUR                  5       nU(       a  UR                  S5      (       a  M2  UR                  S5      nUR                  S5      nUR                  S5      nUS:  d
  XT::  d  Xe::  a  [	        SU SU S	35      eUS
U nX5S-   U nU(       a/  UR                  S5       V	s/ s H  oR                  5       PM     sn	O/ n
Xz4v   M     S
S
S
5        g
s  sn	f ! , (       d  f       g
= f7f)zPParse the configuration file and yield pairs of
(name, contents) for each node.
r#:[]   zInvalid line in :

N,)openstrip
startswithfindRuntimeErrorsplit)r   filenameflinecolon_i
lbracket_i
rbracket_ir   valvvallists              r   r
   ASTCodeGenerator.parse_cfgfile*   s      (C Azz|ts33))C.!YYs^
!YYs^
Q;*"7:;S&)9(3tfB'OPPHW~>J7ADciin=n779n="m#  !  > ! s/   DB0C4?C/C4&	D/C44
D>D)r	   r   )
_c_ast.cfg)
__name__
__module____qualname____firstlineno__r   r   strr   r
   __static_attributes__ r   r   r   r      s#    
RW  $r   r   c                   <    \ rS rSrSrS rS rS rS rS r	S r
S	rg
)r   ?   zNode configuration.

name: node name
contents: a list of contents - attributes and child nodes
See comment at the top of the configuration file for details.
c                    Xl         / U l        / U l        / U l        / U l        U H  nUR                  S5      nU R                  R                  U5        UR                  S5      (       a  U R                  R                  U5        Mb  UR                  S5      (       a  U R                  R                  U5        M  U R                  R                  U5        M     g )N*z**)r   all_entriesattrchild	seq_childrstripappendendswith)r   r   r   entryclean_entrys        r   r   NodeCfg.__init__G   s    		
E,,s+K##K0~~d##%%k2$$

!!+.		  ' r   c                     U R                  5       nUSU R                  5       -   -  nUSU R                  5       -   -  nUSU R                  5       -   -  nU$ )Nr'   )	_gen_init_gen_children	_gen_iter_gen_attr_namesr   r   s     r   r   NodeCfg.generate_sourceY   sY    nntd((***tdnn&&&td**,,,
r   c                 L   SU R                    S3nU R                  (       aI  SR                  U R                  5      nSR                  S U R                   5       5      nUS-  nSU S3nOSnS	nUS
U S3-  nUSU S3-  nU R                  S/-    H  nUSU SU S3-  nM     U$ )Nzclass z(Node):
, c              3   .   #    U  H  nS U S 3v   M     g7f)'Nr@   ).0es     r   	<genexpr>$NodeCfg._gen_init.<locals>.<genexpr>e   s     A0@1!Ah0@s   z, 'coord', '__weakref__'z(self, z, coord=None)z'coord', '__weakref__'z(self, coord=None)z    __slots__ = (z)
z    def __init__r&   coordz        self.z = r'   )r   rE   join)r   r   argsslotsarglistr   s         r   rP   NodeCfg._gen_init`   s    tyyk+99T--.DIIA0@0@AAE//Ev]3G,E*G"5'--!'#..$$y0D]4&D644C 1 
r   c                     SnU R                   (       aY  US-  nU R                   H  nUSU S3-  nUSU SU S3-  nM     U R                   H  nUSU S	3-  nUS
U S3-  nM     US-  nU$ US-  nU$ )Nz    def children(self):
z        nodelist = []
        if self. is not None:
z            nodelist.append(("z", self.z))
z'        for i, child in enumerate(self.	 or []):
z            nodelist.append((f"z[{i}]", child))
z        return tuple(nodelist)
z        return ()
rE   rG   rH   r   r   rG   rH   s       r   rQ   NodeCfg._gen_childrent   s    ),,C)%@@7whugTRR $ "^^	@:VV8CVWW , 55C 
 ((C
r   c                    SnU R                   (       ao  U R                   H  nUSU S3-  nUSU S3-  nM     U R                   H  nUSU S3-  nUS-  nM     U R                  (       d  U R                  (       d  US	-  nU$ US	-  nU$ )
Nz    def __iter__(self):
re   rf   z            yield self.r'   z        for child in (self.rg   z            yield child
z        return
        yield
rh   ri   s       r   rR   NodeCfg._gen_iter   s    ))%@@0r:: $ "^^	4YKzJJ22 , JJ$..==
 
 99C
r   c                 V    SSR                  S U R                   5       5      -   S-   nU$ )Nz    attr_names = ( c              3   ,   #    U  H
  o< S 3v   M     g7f)rW   Nr@   )rZ   nms     r   r\   *NodeCfg._gen_attr_names.<locals>.<genexpr>   s     ,M9RvR[9s   ))r_   rF   rT   s     r   rS   NodeCfg._gen_attr_names   s*    "RWW,M499,M%MMPSS
r   )rE   rF   rG   r   rH   N)r:   r;   r<   r=   __doc__r   r   rP   rQ   rR   rS   r?   r@   r   r   r   r   ?   s%    ($((*r   r   a  #-----------------------------------------------------------------
# ** ATTENTION **
# This code was automatically generated from _c_ast.cfg
#
# Do not modify it directly. Modify the configuration file and
# run the generator again.
# ** ** *** ** **
#
# pycparser: c_ast.py
#
# AST Node classes.
#
# Eli Bendersky [https://eli.thegreenplace.net/]
# License: BSD
#-----------------------------------------------------------------

ae  
import sys
from typing import Any, ClassVar, IO, Optional

def _repr(obj):
    """
    Get the representation of an object, with dedicated pprint-like format for lists.
    """
    if isinstance(obj, list):
        return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]'
    else:
        return repr(obj)

class Node:
    __slots__ = ()
    """ Abstract base class for AST nodes.
    """
    attr_names: ClassVar[tuple[str, ...]] = ()
    coord: Optional[Any]
    def __repr__(self):
        """ Generates a python representation of the current node
        """
        result = self.__class__.__name__ + '('

        indent = ''
        separator = ''
        for name in self.__slots__[:-2]:
            result += separator
            result += indent
            result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n  ' + (' ' * (len(name) + len(self.__class__.__name__)))))

            separator = ','
            indent = '\n ' + (' ' * len(self.__class__.__name__))

        result += indent + ')'

        return result

    def children(self):
        """ A sequence of all children that are Nodes
        """
        pass

    def show(
        self,
        buf: IO[str] = sys.stdout,
        offset: int = 0,
        attrnames: bool = False,
        showemptyattrs: bool = True,
        nodenames: bool = False,
        showcoord: bool = False,
        _my_node_name: Optional[str] = None,
    ):
        """ Pretty print the Node and all its attributes and
            children (recursively) to a buffer.

            buf:
                Open IO buffer into which the Node is printed.

            offset:
                Initial offset (amount of leading spaces)

            attrnames:
                True if you want to see the attribute names in
                name=value pairs. False to only see the values.

            showemptyattrs:
                False if you want to suppress printing empty attributes.

            nodenames:
                True if you want to see the actual node names
                within their parents.

            showcoord:
                Do you want the coordinates of each Node to be
                displayed.
        """
        lead = ' ' * offset
        if nodenames and _my_node_name is not None:
            buf.write(lead + self.__class__.__name__+ ' <' + _my_node_name + '>: ')
        else:
            buf.write(lead + self.__class__.__name__+ ': ')

        if self.attr_names:
            def is_empty(v):
                v is None or (hasattr(v, '__len__') and len(v) == 0)
            nvlist = [(n, getattr(self,n)) for n in self.attr_names \
                        if showemptyattrs or not is_empty(getattr(self,n))]
            if attrnames:
                attrstr = ', '.join(f'{name}={value}' for name, value in nvlist)
            else:
                attrstr = ', '.join(f'{value}' for _, value in nvlist)
            buf.write(attrstr)

        if showcoord:
            buf.write(f' (at {self.coord})')
        buf.write('\n')

        for (child_name, child) in self.children():
            child.show(
                buf,
                offset=offset + 2,
                attrnames=attrnames,
                showemptyattrs=showemptyattrs,
                nodenames=nodenames,
                showcoord=showcoord,
                _my_node_name=child_name)


class NodeVisitor:
    """ A base NodeVisitor class for visiting c_ast nodes.
        Subclass it and define your own visit_XXX methods, where
        XXX is the class name you want to visit with these
        methods.

        For example:

        class ConstantVisitor(NodeVisitor):
            def __init__(self):
                self.values = []

            def visit_Constant(self, node):
                self.values.append(node.value)

        Creates a list of values of all the constant nodes
        encountered below the given node. To use it:

        cv = ConstantVisitor()
        cv.visit(node)

        Notes:

        *   generic_visit() will be called for AST nodes for which
            no visit_XXX method was defined.
        *   The children of nodes for which a visit_XXX was
            defined will not be visited - if you need this, call
            generic_visit() on the node.
            You can use:
                NodeVisitor.generic_visit(self, node)
        *   Modeled after Python's own AST visiting facilities
            (the ast module of Python 3.0)
    """

    _method_cache = None

    def visit(self, node: Node):
        """ Visit a node.
        """

        if self._method_cache is None:
            self._method_cache = {}

        visitor = self._method_cache.get(node.__class__.__name__, None)
        if visitor is None:
            method = 'visit_' + node.__class__.__name__
            visitor = getattr(self, method, self.generic_visit)
            self._method_cache[node.__class__.__name__] = visitor

        return visitor(node)

    def generic_visit(self, node: Node):
        """ Called if no explicit visitor function exists for a
            node. Implements preorder visiting of the node.
        """
        for _, c in node.children():
            self.visit(c)

__main__r9   zc_ast.pyw)stringr   ostypingr   r   r   r   r   r:   pathdirnameabspath__file__base_dirr_   cfg_pathout_pathast_genr)   outr   r@   r   r   <module>r      s      	 '$ '$T` `F "gT zwwrwwx89Hww||Hl3Hww||Hj1Hx(G	h	 
	 
 
	s   ,C
C