+
     h;)  c                   sF    ^ RI Ht  ! R R]4      t ! R R]4      tRtRtR# )	i    )Templatec                   s:   a  ] tR t^t o RR ltRR ltR tRtV tR# )ASTCodeGeneratorc                s    Wn         V P                  V4       UUu. uF  w  r#\        W#4      NK  	  uppV n        R# u uppi )z9Initialize the code generator from a configuration
file.
N)cfg_filenameparse_cfgfileNodeCfgnode_cfg)selfr   namecontents   &&  7/usr/lib/python3.14/site-packages/pycparser/_ast_gen.py__init__ZASTCodeGenerator.__init__   sD     )$($6$6|$DF$D  !0$DF Fs   <Nc                s    \        \        4      P                  V P                  R7      pV\        ,          pV P
                   F   pW#P                  4       R,           ,          pK"  	  VP                  V4       R# )z;Generates the code into file, an open file buffer.
        )r   z

N)r    _PROLOGUE_COMMENTZ
substituter   _PROLOGUE_CODEr   generate_sourceZwrite)r   Zfilesrcr   r	   r
   generateZASTCodeGenerator.generate   se     ()44** 5 , 	~H++-66C & 	

3    c           
   #  s<  "   \        VR4      ;_uu_ 4       pV F  pVP                  4       pV'       d   VP                  R4      '       d   K4  VP                  R4      pVP                  R4      pVP                  R4      pV^8  g   WT8:  g   We8:  d   \	        RV: RV: R24      hVR	V pW5^,           V pV'       d/   VP                  R
4       U	u. uF  qP                  4       NK  	  up	M. p
Wz3x  K  	  R	R	R	4       R	# u up	i   + '       g   i     R	# ; i5i)zPParse the configuration file and yield pairs of
(name, contents) for each node.
ZrZ#Z:Z[Z]zInvalid line in z:

NZ,)ZopenZstripZ
startswithZfindZRuntimeErrorZsplit)r   ZfilenameZfZlineZcolon_iZ
lbracket_iZ
rbracket_ir   ZvalZvZvallists   &&         r
   r   ZASTCodeGenerator.parse_cfgfile%   s      (C  Azz|ts33))C.!YYs^
!YYs^
Q;*"7:;S&hPT'UVVHW~>*5ADciin=n779n="m#  !  > !  s5   D4DBDD
+D9
DDD		D)r   r   )z
_c_ast.cfg)N)	__name__
__module____qualname____firstlineno__r   r   r   __static_attributes____classdictcell__Z__classdict__   @r
   r   r      s     F
$ $r   r   c                   sH   a  ] tR t^:t o RtR tR tR tR tR t	R t
RtV tR	# )
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                s   Wn         . V n        . V n        . V n        . V n        V F  pVP                  R 4      pV P                  P                  V4       VP                  R4      '       d   V P                  P                  V4       Kc  VP                  R 4      '       d   V P                  P                  V4       K  V P                  P                  V4       K  	  R# )Z*z**N)r   all_entriesattrchild	seq_childZrstripZappendZendswith)r   r   r   ZentryZclean_entrys   &&&  r
   r   ZNodeCfg.__init__B   s    		
E,,s+K##K0~~d##%%k2$$

!!+.		  ' r   c                s    V P                  4       pVR V P                  4       ,           ,          pVR V P                  4       ,           ,          pVR V P                  4       ,           ,          pV# )r   )	_gen_init_gen_children	_gen_iter_gen_attr_namesr   r      & r
   r   ZNodeCfg.generate_sourceT   sY    nntd((***tdnn&&&td**,,,
r   c                s   R V P                   ,          pV P                  '       dQ   RP                  V P                  4      pRP                  R V P                   4       4      pVR,          pRV,          pMRpRpVRV,          ,          pVRV,          ,          pV P                  R	.,            F  pVR
V: RV: R2,          pK  	  V# )zclass %s(Node):
z, c              3   sD   "   T F  pR P                  V4      x  K  	  R# 5i)z'{0}'N)Zformat).0Zer$   r
   	<genexpr>Z$NodeCfg._gen_init.<locals>.<genexpr>`   s     J9IAgnnQ//9Is    z, 'coord', '__weakref__'z(self, %s, coord=None)z'coord', '__weakref__'z(self, coord=None)z    __slots__ = (%s)
z    def __init__%s:
Zcoordz        self.z = r   )r   r   join)r   r   ZargsZslotsZarglistr   s   &     r
   r   ZNodeCfg._gen_init[   s    !DII-99T--.DIIJ9I9IJJE//E.5G,E*G'%//&00$$y00DtT::C 1 
r   c                s   R pV P                   '       do   VR,          pV P                   F  pVR\        VR7      ,          ,          pK  	  V P                   F  pVR\        VR7      ,          ,          pK  	  VR,          pV# VR,          pV# )z    def children(self):
z        nodelist = []
r   zu        for i, child in enumerate(self.%(child)s or []):
            nodelist.append(("%(child)s[%%d]" %% i, child))
z        return tuple(nodelist)
z        return ()
zV        if self.%(child)s is not None: nodelist.append(("%(child)s", self.%(child)s))
r   r   Zdictr   r   r   r   r      &   r
   r    ZNodeCfg._gen_childreno   s    ),,CH5)+ + $ "^^	T9-/ / , 55C 
 ((C
r   c                sR   R pV P                   '       d   V P                   F  pVR\        VR7      ,          ,          pK  	  V P                   F  pVR\        VR7      ,          ,          pK  	  V P                  '       g   V P                  '       g
   VR,          pV# VR,          pV# )z    def __iter__(self):
r(   zE        for child in (self.%(child)s or []):
            yield child
zH        if self.%(child)s is not None:
            yield self.%(child)s
z        return
        yield
r)   r*   r+   r
   r!   ZNodeCfg._gen_iter   s    )9=A=NP P $
 "^^	048y4IK K ,
 JJJ$...&' 
	 "#C 
r   c                sf    R RP                  R V P                   4       4      ,           R,           pV# )z    attr_names = (Z c              3   s4   "   T F  pR V,          x  K  	  R# 5i)z%r, N )r%   Znmr$   r
   r&   Z*NodeCfg._gen_attr_names.<locals>.<genexpr>   s     ,M9RVb[[9s   Z))r'   r   r#   r$   r
   r"   ZNodeCfg._gen_attr_names   s*    "RWW,M499,M%MMPSS
r   )r   r   r   r   r   N)r   r   r   r   Z__doc__r   r   r   r    r!   r"   r   r   r   r   r
   r   r   :   s-     ($(06 r   r   a  #-----------------------------------------------------------------
# ** ATTENTION **
# This code was automatically generated from the file:
# $cfg_filename
#
# 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
#-----------------------------------------------------------------

a3  
import sys

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(object):
    __slots__ = ()
    """ Abstract base class for AST nodes.
    """
    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=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=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.

            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:
            if attrnames:
                nvlist = [(n, getattr(self,n)) for n in self.attr_names]
                attrstr = ', '.join('%s=%s' % nv for nv in nvlist)
            else:
                vlist = [getattr(self, n) for n in self.attr_names]
                attrstr = ', '.join('%s' % v for v in vlist)
            buf.write(attrstr)

        if showcoord:
            buf.write(' (at %s)' % self.coord)
        buf.write('\n')

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


class NodeVisitor(object):
    """ 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):
        """ 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):
        """ Called if no explicit visitor function exists for a
            node. Implements preorder visiting of the node.
        """
        for c in node:
            self.visit(c)

N)Zstringr    Zobjectr   r   r   r   r,   r   r
   <module>r-      s8    '$v '$Tjf j\ (Ur   