Files
ServerSync/lib/pycparser/__pycache__/_ast_gen.cpython-314.pyc

258 lines
14 KiB
Plaintext
Raw Normal View History

2026-02-12 02:28:23 +02:00
+
t<10>i,<00><00><><00>^RIHt^RIt^RIHt!RR4t!RR4tRtR t] R
8Xd<>]PP]PP] 44t]PP]R 4t]PP]R 4t]!]4t]!]R 4;_uu_4t]P+]4RRR4R#R# +'giR#;i)<0E>)<01>TemplateN)<01>IOc<00>Ba<00>]tRt^toRRltV3RlRltRtRtVtR#)<08>ASTCodeGeneratorc <0C><><00>WnVPV4UUu.uFwr#\W#4NK uppVnR#uuppi)z9Initialize the code generator from a configuration
file.
N)<04> cfg_filename<6D> parse_cfgfile<6C>NodeCfg<66>node_cfg)<04>selfr<00>name<6D>contentss&& <20>9/tmp/pip-target-zhdecbcm/lib/python/pycparser/_ast_gen.py<70>__init__<5F>ASTCodeGenerator.__init__sC<00><00>)<29><19>%)<29>$6<>$6<>|<7C>$D<>
<EFBFBD>$D<> <20><14> <14>D<EFBFBD> #<23>$D<>
<EFBFBD><04> <0A><>
s<00><c<00>4<<01>V^8<>dQhRS[S[,RR/#)<04><00>file<6C>returnN)r<00>str)<02>format<61> __classdict__s"<22>r<00> __annotate__<5F>ASTCodeGenerator.__annotate__ s<00><><00><18><18>R<EFBFBD><03>W<EFBFBD><18><14><18>c <0C><><00>\\4PVPR7pV\, pVP
F pW#P 4R,, pK" VPV4R#)z2Generates the code into file, an open file buffer.)rz
N)r<00>_PROLOGUE_COMMENT<4E>
substituter<00>_PROLOGUE_CODEr <00>generate_source<63>write)r r<00>srcr s&& r<00>generate<74>ASTCodeGenerator.generate s\<00><00><16>(<28>)<29>4<>4<>$<24>BS<42>BS<42>4<>T<><03> <0B>~<7E><1D><03><1C> <0A> <0A>H<EFBFBD> <0F>+<2B>+<2B>-<2D><06>6<> 6<>C<EFBFBD>&<26> <0A>
<EFBFBD>
<EFBFBD>3<EFBFBD>rc
# <0C>8"<00>\VR4;_uu_4pVF<>pVP4pV'dVPR4'dK4VPR4pVPR4pVPR4pV^8g WT8:gWe8:d\ RV RV R24hVR VpW5^,VpV'd/VP R
4U u.uFq<>P4NK up M.p
Wz3x<00>K<> R R R 4R #uup i +'giR #;i5i) zPParse the configuration file and yield pairs of
(name, contents) for each node.
<EFBFBD>r<>#<23>:<3A>[<5B>]zInvalid line in <20>:
<EFBFBD>
N<EFBFBD>,)<06>open<65>strip<69>
startswith<EFBFBD>find<6E> RuntimeError<6F>split) r <00>filename<6D>f<>line<6E>colon_i<5F>
lbracket_i<EFBFBD>
rbracket_ir <00>val<61>v<>vallists && rr <00>ASTCodeGenerator.parse_cfgfile*s<><00><00><00><12>(<28>C<EFBFBD> <20> <20>A<EFBFBD><19><04><1B>z<EFBFBD>z<EFBFBD>|<7C><04><1B>t<EFBFBD><EFBFBD><EFBFBD>s<EFBFBD>3<>3<><1C><1E>)<29>)<29>C<EFBFBD>.<2E><07>!<21>Y<EFBFBD>Y<EFBFBD>s<EFBFBD>^<5E>
<EFBFBD>!<21>Y<EFBFBD>Y<EFBFBD>s<EFBFBD>^<5E>
<EFBFBD><1A>Q<EFBFBD>;<3B>*<2A>"7<>:<3A>;S<>&<26>)9<>(<28><1A>3<EFBFBD>t<EFBFBD>f<EFBFBD>B<EFBFBD>'O<>P<>P<><1B>H<EFBFBD>W<EFBFBD>~<7E><04><1A><01>><3E>J<EFBFBD>7<><03>AD<41>c<EFBFBD>i<EFBFBD>i<EFBFBD><03>n<EFBFBD>=<3D>n<EFBFBD><11>7<EFBFBD>7<EFBFBD>9<EFBFBD>n<EFBFBD>=<3D>"<22><07><1A>m<EFBFBD>#<23><1A>!<21> <20><>><3E>!<21> <20> <20>s5<00>D<01>4D<05> BD<05>D
<EFBFBD>)D<05>7
D<01>D<05> D <09> D)rr N)<01>
_c_ast.cfg) <09>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__firstlineno__rr#r <00>__static_attributes__<5F>__classdictcell__<5F>rs@rrrs<00><><00><00>
<EFBFBD><18><18>$<24>$rrc<00>Ha<00>]tRt^?toRtRtRtRtRtRt Rt
Rt Vt R #)
r
z<>Node 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<08><><00>Wn.Vn.Vn.Vn.VnVF<>pVP R4pVPP V4VPR4'dVPP V4KcVPR4'dVPP V4K<>VPP V4K<> R#)<03>*z**N)r <00> all_entries<65>attr<74>child<6C> seq_child<6C>rstrip<69>append<6E>endswith)r r r<00>entry<72> clean_entrys&&& rr<00>NodeCfg.__init__Gs<><00><00><18> <09><1D><04><18><16><04> <09><17><04>
<EFBFBD><1B><04><0E><1D>E<EFBFBD><1F>,<2C>,<2C>s<EFBFBD>+<2B>K<EFBFBD> <10> <1C> <1C> #<23> #<23>K<EFBFBD> 0<><14>~<7E>~<7E>d<EFBFBD>#<23>#<23><14><0E><0E>%<25>%<25>k<EFBFBD>2<><16><1E><1E><03>$<24>$<24><14>
<EFBFBD>
<EFBFBD>!<21>!<21>+<2B>.<2E><14> <09> <09> <20> <20><15>'<27>rc<08><><00>VP4pVRVP4,, pVRVP4,, pVRVP4,, pV#)r,)<04> _gen_init<69> _gen_children<65> _gen_iter<65>_gen_attr_names<65>r r"s& rr <00>NodeCfg.generate_sourceYsY<00><00><12>n<EFBFBD>n<EFBFBD><1E><03> <0B>t<EFBFBD>d<EFBFBD>(<28>(<28>*<2A>*<2A>*<2A><03> <0B>t<EFBFBD>d<EFBFBD>n<EFBFBD>n<EFBFBD>&<26>&<26>&<26><03> <0B>t<EFBFBD>d<EFBFBD>*<2A>*<2A>,<2C>,<2C>,<2C><03><12>
rc<08>v<00>RVP R2pVP'dNRPVP4pRPRVP44pVR, pRV R2pMRpRpVR V R
2, pVR V R 2, pVPR .,FpVRV RV R2, pK V#)zclass z(Node):
<EFBFBD>, c3<00>."<00>TF pRV R2x<00>K R#5i)<02>'N<>)<02>.0<EFBFBD>es& r<00> <genexpr><3E>$NodeCfg._gen_init.<locals>.<genexpr>es<00><00><00>A<>0@<40>1<EFBFBD><01>!<21><13>A<EFBFBD>h<EFBFBD>0@<40>s<00>z, 'coord', '__weakref__'z(self, z , coord=None)z'coord', '__weakref__'z(self, coord=None)z __slots__ = (z)
z def __init__r+<00>coordz self.z = r,)r rI<00>join)r r"<00>args<67>slots<74>arglistr s& rrT<00>NodeCfg._gen_init`s<><00><00><16>t<EFBFBD>y<EFBFBD>y<EFBFBD>k<EFBFBD><19>+<2B><03> <0F> <1B> <1B> <1B><17>9<EFBFBD>9<EFBFBD>T<EFBFBD>-<2D>-<2D>.<2E>D<EFBFBD><18>I<EFBFBD>I<EFBFBD>A<><04>0@<40>0@<40>A<>A<>E<EFBFBD> <11>/<2F> /<2F>E<EFBFBD><1F><04>v<EFBFBD>]<5D>3<>G<EFBFBD>,<2C>E<EFBFBD>*<2A>G<EFBFBD> <0B>"<22>5<EFBFBD>'<27><13>-<2D>-<2D><03> <0B>!<21>'<27><19>#<23>.<2E>.<2E><03><18>$<24>$<24><07>y<EFBFBD>0<>0<>D<EFBFBD> <0F>]<5D>4<EFBFBD>&<26><03>D<EFBFBD>6<EFBFBD><12>4<> 4<>C<EFBFBD>1<><13>
rc<08>"<00>RpVP'drVR, pVPF pVRV R2, pVRV RV R2, pK" VPFpVRV R2, pVR V R
2, pK VR , pV#VR , pV#) z def children(self):
z nodelist = []
<EFBFBD> if self.<2E> is not None:
z nodelist.append(("z", self.z))
z' for i, child in enumerate(self.<2E> or []):
z nodelist.append((f"z[{i}]", child))
z return tuple(nodelist)
z return ()
<EFBFBD>rIrKrL<00>r r"rKrLs& rrU<00>NodeCfg._gen_childrents<><00><00>)<29><03> <0F> <1B> <1B> <1B> <0F>,<2C> ,<2C>C<EFBFBD><1D><1A><1A><05><13>)<29>%<25><17><0F>@<40>@<40><03><13>7<><05>w<EFBFBD>h<EFBFBD>u<EFBFBD>g<EFBFBD>T<EFBFBD>R<>R<><03>$<24>"<22>^<5E>^<5E> <09><13>@<40><19> <0B>:<3A>V<>V<><03><13>8<><19> <0B>CV<43>W<>W<><03>,<2C> <10>5<> 5<>C<EFBFBD><13>
<EFBFBD> <10>(<28> (<28>C<EFBFBD><12>
rc<08>J<00>RpVP'd<>VPFpVRV R2, pVRV R2, pK VPFpVRV R2, pVR, pK VP'gVP'g
VR, pV#VR, pV#) z def __iter__(self):
rjrkz yield self.r,z for child in (self.rlz yield child
z return
yield
rmrns& rrV<00>NodeCfg._gen_iter<65>s<><00><00>)<29><03> <0F> <1B> <1B> <1B><1D><1A><1A><05><13>)<29>%<25><17><0F>@<40>@<40><03><13>0<><15><07>r<EFBFBD>:<3A>:<3A><03>$<24>"<22>^<5E>^<5E> <09><13>4<>Y<EFBFBD>K<EFBFBD>z<EFBFBD>J<>J<><03><13>2<>2<><03>,<2C><19>J<EFBFBD>J<EFBFBD>J<EFBFBD>$<24>.<2E>.<2E>.<2E><13>=<3D>=<3D><03>
<13>
<EFBFBD> <10>9<> 9<>C<EFBFBD><12>
rc<08>f<00>RRPRVP44,R,pV#)z attr_names = (<28>c3<00>,"<00>TF
q: R2x<00>K R#5i)r[Nr^)r_<00>nms& rra<00>*NodeCfg._gen_attr_names.<locals>.<genexpr><3E>s<00><00><00>,M<>9<EFBFBD>R<EFBFBD>v<EFBFBD>R<EFBFBD>[<5B>9<EFBFBD>s<00><01>))rdrJrXs& rrW<00>NodeCfg._gen_attr_names<65>s*<00><00>"<22>R<EFBFBD>W<EFBFBD>W<EFBFBD>,M<>4<EFBFBD>9<EFBFBD>9<EFBFBD>,M<>%M<>M<>PS<50>S<><03><12>
r)rIrJrKr rLN) r?r@rArB<00>__doc__rr rTrUrVrWrCrDrEs@rr
r
?s-<00><><00><00><08>(<28>$<13><13>(<13>(<13>*<13>rr
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)
<EFBFBD>__main__r>zc_ast.py<70>w)<16>stringr<00>os<6F>typingrrr
rrr?<00>path<74>dirname<6D>abspath<74>__file__<5F>base_dirrd<00>cfg_path<74>out_path<74>ast_genr.<00>outr#r^rr<00><module>r<>s<><00><01> <1C> <09><15>'$<24>'$<24>T`<13>`<13>F<04><11>"g<04><0E>T <0C>z<EFBFBD><19><11>w<EFBFBD>w<EFBFBD><EFBFBD><EFBFBD>r<EFBFBD>w<EFBFBD>w<EFBFBD><EFBFBD><EFBFBD>x<EFBFBD>8<>9<>H<EFBFBD><11>w<EFBFBD>w<EFBFBD>|<7C>|<7C>H<EFBFBD>l<EFBFBD>3<>H<EFBFBD><11>w<EFBFBD>w<EFBFBD>|<7C>|<7C>H<EFBFBD>j<EFBFBD>1<>H<EFBFBD><1E>x<EFBFBD>(<28>G<EFBFBD> <0A>h<EFBFBD><03> <1C> <1C><03><0F><18><18><13><1D>
<1D> <1C> <1A>
<1D> <1C> <1C>s <00>5C<05> C$