python-cc 0.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pcc/ast/c_ast.py ADDED
@@ -0,0 +1,800 @@
1
+ #-----------------------------------------------------------------
2
+ # ** ATTENTION **
3
+ # This code was automatically generated from the file:
4
+ # _c_ast.cfg
5
+ #
6
+ # Do not modify it directly. Modify the configuration file and
7
+ # run the generator again.
8
+ # ** ** *** ** **
9
+ #
10
+ # pycparser: c_ast.py
11
+ #
12
+ # AST Node classes.
13
+ #
14
+ # Copyright (C) 2008-2015, Eli Bendersky
15
+ # License: BSD
16
+ #-----------------------------------------------------------------
17
+
18
+
19
+ import sys
20
+
21
+
22
+ class Node(object):
23
+ __slots__ = ()
24
+ """ Abstract base class for AST nodes.
25
+ """
26
+ def children(self):
27
+ """ A sequence of all children that are Nodes
28
+ """
29
+ pass
30
+
31
+ def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
32
+ """ Pretty print the Node and all its attributes and
33
+ children (recursively) to a buffer.
34
+
35
+ buf:
36
+ Open IO buffer into which the Node is printed.
37
+
38
+ offset:
39
+ Initial offset (amount of leading spaces)
40
+
41
+ attrnames:
42
+ True if you want to see the attribute names in
43
+ name=value pairs. False to only see the values.
44
+
45
+ nodenames:
46
+ True if you want to see the actual node names
47
+ within their parents.
48
+
49
+ showcoord:
50
+ Do you want the coordinates of each Node to be
51
+ displayed.
52
+ """
53
+ lead = ' ' * offset
54
+ if nodenames and _my_node_name is not None:
55
+ buf.write(lead + self.__class__.__name__+ ' <' + _my_node_name + '>: ')
56
+ else:
57
+ buf.write(lead + self.__class__.__name__+ ': ')
58
+
59
+ if self.attr_names:
60
+ if attrnames:
61
+ nvlist = [(n, getattr(self,n)) for n in self.attr_names]
62
+ attrstr = ', '.join('%s=%s' % nv for nv in nvlist)
63
+ else:
64
+ vlist = [getattr(self, n) for n in self.attr_names]
65
+ attrstr = ', '.join('%s' % v for v in vlist)
66
+ buf.write(attrstr)
67
+
68
+ if showcoord:
69
+ buf.write(' (at %s)' % self.coord)
70
+ buf.write('\n')
71
+
72
+ for (child_name, child) in self.children():
73
+ child.show(
74
+ buf,
75
+ offset=offset + 2,
76
+ attrnames=attrnames,
77
+ nodenames=nodenames,
78
+ showcoord=showcoord,
79
+ _my_node_name=child_name)
80
+
81
+
82
+ class NodeVisitor(object):
83
+ """ A base NodeVisitor class for visiting c_ast nodes.
84
+ Subclass it and define your own visit_XXX methods, where
85
+ XXX is the class name you want to visit with these
86
+ methods.
87
+
88
+ For example:
89
+
90
+ class ConstantVisitor(NodeVisitor):
91
+ def __init__(self):
92
+ self.values = []
93
+
94
+ def visit_Constant(self, node):
95
+ self.values.append(node.value)
96
+
97
+ Creates a list of values of all the constant nodes
98
+ encountered below the given node. To use it:
99
+
100
+ cv = ConstantVisitor()
101
+ cv.visit(node)
102
+
103
+ Notes:
104
+
105
+ * generic_visit() will be called for AST nodes for which
106
+ no visit_XXX method was defined.
107
+ * The children of nodes for which a visit_XXX was
108
+ defined will not be visited - if you need this, call
109
+ generic_visit() on the node.
110
+ You can use:
111
+ NodeVisitor.generic_visit(self, node)
112
+ * Modeled after Python's own AST visiting facilities
113
+ (the ast module of Python 3.0)
114
+ """
115
+ def visit(self, node):
116
+ """ Visit a node.
117
+ """
118
+ method = 'visit_' + node.__class__.__name__
119
+ visitor = getattr(self, method, self.generic_visit)
120
+ return visitor(node)
121
+
122
+ def generic_visit(self, node):
123
+ """ Called if no explicit visitor function exists for a
124
+ node. Implements preorder visiting of the node.
125
+ """
126
+ for c_name, c in node.children():
127
+ self.visit(c)
128
+
129
+
130
+ class ArrayDecl(Node):
131
+ __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__')
132
+ def __init__(self, type, dim, dim_quals, coord=None):
133
+ self.type = type
134
+ self.dim = dim
135
+ self.dim_quals = dim_quals
136
+ self.coord = coord
137
+
138
+ def children(self):
139
+ nodelist = []
140
+ if self.type is not None: nodelist.append(("type", self.type))
141
+ if self.dim is not None: nodelist.append(("dim", self.dim))
142
+ return tuple(nodelist)
143
+
144
+ attr_names = ('dim_quals', )
145
+
146
+ class ArrayRef(Node):
147
+ # The ir_type should be auto fill when type checked?
148
+ __slots__ = ('name', 'subscript', 'coord', '__weakref__', "ir_type", "dim_array")
149
+ def __init__(self, name, subscript, coord=None):
150
+ self.name = name
151
+ self.subscript = subscript
152
+ self.coord = coord
153
+
154
+ def children(self):
155
+ nodelist = []
156
+ if self.name is not None: nodelist.append(("name", self.name))
157
+ if self.subscript is not None: nodelist.append(("subscript", self.subscript))
158
+ return tuple(nodelist)
159
+
160
+ attr_names = ()
161
+
162
+ class Assignment(Node):
163
+ __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__')
164
+ def __init__(self, op, lvalue, rvalue, coord=None):
165
+ self.op = op
166
+ self.lvalue = lvalue
167
+ self.rvalue = rvalue
168
+ self.coord = coord
169
+
170
+ def children(self):
171
+ nodelist = []
172
+ if self.lvalue is not None: nodelist.append(("lvalue", self.lvalue))
173
+ if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue))
174
+ return tuple(nodelist)
175
+
176
+ attr_names = ('op', )
177
+
178
+ class BinaryOp(Node):
179
+ __slots__ = ('op', 'left', 'right', 'coord', '__weakref__')
180
+ def __init__(self, op, left, right, coord=None):
181
+ self.op = op
182
+ self.left = left
183
+ self.right = right
184
+ self.coord = coord
185
+
186
+ def children(self):
187
+ nodelist = []
188
+ if self.left is not None: nodelist.append(("left", self.left))
189
+ if self.right is not None: nodelist.append(("right", self.right))
190
+ return tuple(nodelist)
191
+
192
+ attr_names = ('op', )
193
+
194
+ class Break(Node):
195
+ __slots__ = ('coord', '__weakref__')
196
+ def __init__(self, coord=None):
197
+ self.coord = coord
198
+
199
+ def children(self):
200
+ return ()
201
+
202
+ attr_names = ()
203
+
204
+ class Case(Node):
205
+ __slots__ = ('expr', 'stmts', 'coord', '__weakref__')
206
+ def __init__(self, expr, stmts, coord=None):
207
+ self.expr = expr
208
+ self.stmts = stmts
209
+ self.coord = coord
210
+
211
+ def children(self):
212
+ nodelist = []
213
+ if self.expr is not None: nodelist.append(("expr", self.expr))
214
+ for i, child in enumerate(self.stmts or []):
215
+ nodelist.append(("stmts[%d]" % i, child))
216
+ return tuple(nodelist)
217
+
218
+ attr_names = ()
219
+
220
+ class Cast(Node):
221
+ __slots__ = ('to_type', 'expr', 'coord', '__weakref__')
222
+ def __init__(self, to_type, expr, coord=None):
223
+ self.to_type = to_type
224
+ self.expr = expr
225
+ self.coord = coord
226
+
227
+ def children(self):
228
+ nodelist = []
229
+ if self.to_type is not None: nodelist.append(("to_type", self.to_type))
230
+ if self.expr is not None: nodelist.append(("expr", self.expr))
231
+ return tuple(nodelist)
232
+
233
+ attr_names = ()
234
+
235
+ class Compound(Node):
236
+ __slots__ = ('block_items', 'coord', '__weakref__')
237
+ def __init__(self, block_items, coord=None):
238
+ self.block_items = block_items
239
+ self.coord = coord
240
+
241
+ def children(self):
242
+ nodelist = []
243
+ for i, child in enumerate(self.block_items or []):
244
+ nodelist.append(("block_items[%d]" % i, child))
245
+ return tuple(nodelist)
246
+
247
+ attr_names = ()
248
+
249
+ class CompoundLiteral(Node):
250
+ __slots__ = ('type', 'init', 'coord', '__weakref__')
251
+ def __init__(self, type, init, coord=None):
252
+ self.type = type
253
+ self.init = init
254
+ self.coord = coord
255
+
256
+ def children(self):
257
+ nodelist = []
258
+ if self.type is not None: nodelist.append(("type", self.type))
259
+ if self.init is not None: nodelist.append(("init", self.init))
260
+ return tuple(nodelist)
261
+
262
+ attr_names = ()
263
+
264
+ class Constant(Node):
265
+ __slots__ = ('type', 'value', 'coord', '__weakref__')
266
+ def __init__(self, type, value, coord=None):
267
+ self.type = type
268
+ self.value = value
269
+ self.coord = coord
270
+
271
+ def children(self):
272
+ nodelist = []
273
+ return tuple(nodelist)
274
+
275
+ attr_names = ('type', 'value', )
276
+
277
+ class Continue(Node):
278
+ __slots__ = ('coord', '__weakref__')
279
+ def __init__(self, coord=None):
280
+ self.coord = coord
281
+
282
+ def children(self):
283
+ return ()
284
+
285
+ attr_names = ()
286
+
287
+ class Decl(Node):
288
+ __slots__ = ('name', 'quals', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__')
289
+ def __init__(self, name, quals, storage, funcspec, type, init, bitsize, coord=None):
290
+ self.name = name
291
+ self.quals = quals
292
+ self.storage = storage
293
+ self.funcspec = funcspec
294
+ self.type = type
295
+ self.init = init
296
+ self.bitsize = bitsize
297
+ self.coord = coord
298
+
299
+ def children(self):
300
+ nodelist = []
301
+ if self.type is not None: nodelist.append(("type", self.type))
302
+ if self.init is not None: nodelist.append(("init", self.init))
303
+ if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize))
304
+ return tuple(nodelist)
305
+
306
+ attr_names = ('name', 'quals', 'storage', 'funcspec', )
307
+
308
+ class DeclList(Node):
309
+ __slots__ = ('decls', 'coord', '__weakref__')
310
+ def __init__(self, decls, coord=None):
311
+ self.decls = decls
312
+ self.coord = coord
313
+
314
+ def children(self):
315
+ nodelist = []
316
+ for i, child in enumerate(self.decls or []):
317
+ nodelist.append(("decls[%d]" % i, child))
318
+ return tuple(nodelist)
319
+
320
+ attr_names = ()
321
+
322
+ class Default(Node):
323
+ __slots__ = ('stmts', 'coord', '__weakref__')
324
+ def __init__(self, stmts, coord=None):
325
+ self.stmts = stmts
326
+ self.coord = coord
327
+
328
+ def children(self):
329
+ nodelist = []
330
+ for i, child in enumerate(self.stmts or []):
331
+ nodelist.append(("stmts[%d]" % i, child))
332
+ return tuple(nodelist)
333
+
334
+ attr_names = ()
335
+
336
+ class DoWhile(Node):
337
+ __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
338
+ def __init__(self, cond, stmt, coord=None):
339
+ self.cond = cond
340
+ self.stmt = stmt
341
+ self.coord = coord
342
+
343
+ def children(self):
344
+ nodelist = []
345
+ if self.cond is not None: nodelist.append(("cond", self.cond))
346
+ if self.stmt is not None: nodelist.append(("stmt", self.stmt))
347
+ return tuple(nodelist)
348
+
349
+ attr_names = ()
350
+
351
+ class EllipsisParam(Node):
352
+ __slots__ = ('coord', '__weakref__')
353
+ def __init__(self, coord=None):
354
+ self.coord = coord
355
+
356
+ def children(self):
357
+ return ()
358
+
359
+ attr_names = ()
360
+
361
+ class EmptyStatement(Node):
362
+ __slots__ = ('coord', '__weakref__')
363
+ def __init__(self, coord=None):
364
+ self.coord = coord
365
+
366
+ def children(self):
367
+ return ()
368
+
369
+ attr_names = ()
370
+
371
+ class Enum(Node):
372
+ __slots__ = ('name', 'values', 'coord', '__weakref__')
373
+ def __init__(self, name, values, coord=None):
374
+ self.name = name
375
+ self.values = values
376
+ self.coord = coord
377
+
378
+ def children(self):
379
+ nodelist = []
380
+ if self.values is not None: nodelist.append(("values", self.values))
381
+ return tuple(nodelist)
382
+
383
+ attr_names = ('name', )
384
+
385
+ class Enumerator(Node):
386
+ __slots__ = ('name', 'value', 'coord', '__weakref__')
387
+ def __init__(self, name, value, coord=None):
388
+ self.name = name
389
+ self.value = value
390
+ self.coord = coord
391
+
392
+ def children(self):
393
+ nodelist = []
394
+ if self.value is not None: nodelist.append(("value", self.value))
395
+ return tuple(nodelist)
396
+
397
+ attr_names = ('name', )
398
+
399
+ class EnumeratorList(Node):
400
+ __slots__ = ('enumerators', 'coord', '__weakref__')
401
+ def __init__(self, enumerators, coord=None):
402
+ self.enumerators = enumerators
403
+ self.coord = coord
404
+
405
+ def children(self):
406
+ nodelist = []
407
+ for i, child in enumerate(self.enumerators or []):
408
+ nodelist.append(("enumerators[%d]" % i, child))
409
+ return tuple(nodelist)
410
+
411
+ attr_names = ()
412
+
413
+ class ExprList(Node):
414
+ __slots__ = ('exprs', 'coord', '__weakref__')
415
+ def __init__(self, exprs, coord=None):
416
+ self.exprs = exprs
417
+ self.coord = coord
418
+
419
+ def children(self):
420
+ nodelist = []
421
+ for i, child in enumerate(self.exprs or []):
422
+ nodelist.append(("exprs[%d]" % i, child))
423
+ return tuple(nodelist)
424
+
425
+ attr_names = ()
426
+
427
+ class FileAST(Node):
428
+ __slots__ = ('ext', 'coord', '__weakref__')
429
+ def __init__(self, ext, coord=None):
430
+ self.ext = ext
431
+ self.coord = coord
432
+
433
+ def children(self):
434
+ nodelist = []
435
+ for i, child in enumerate(self.ext or []):
436
+ nodelist.append(("ext[%d]" % i, child))
437
+ return tuple(nodelist)
438
+
439
+ attr_names = ()
440
+
441
+ class For(Node):
442
+ __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__')
443
+ def __init__(self, init, cond, next, stmt, coord=None):
444
+ self.init = init
445
+ self.cond = cond
446
+ self.next = next
447
+ self.stmt = stmt
448
+ self.coord = coord
449
+
450
+ def children(self):
451
+ nodelist = []
452
+ if self.init is not None: nodelist.append(("init", self.init))
453
+ if self.cond is not None: nodelist.append(("cond", self.cond))
454
+ if self.next is not None: nodelist.append(("next", self.next))
455
+ if self.stmt is not None: nodelist.append(("stmt", self.stmt))
456
+ return tuple(nodelist)
457
+
458
+ attr_names = ()
459
+
460
+ class FuncCall(Node):
461
+ __slots__ = ('name', 'args', 'coord', '__weakref__')
462
+ def __init__(self, name, args, coord=None):
463
+ self.name = name
464
+ self.args = args
465
+ self.coord = coord
466
+
467
+ def children(self):
468
+ nodelist = []
469
+ if self.name is not None: nodelist.append(("name", self.name))
470
+ if self.args is not None: nodelist.append(("args", self.args))
471
+ return tuple(nodelist)
472
+
473
+ attr_names = ()
474
+
475
+ class FuncDecl(Node):
476
+ __slots__ = ('args', 'type', 'coord', '__weakref__')
477
+ def __init__(self, args, type, coord=None):
478
+ self.args = args
479
+ self.type = type
480
+ self.coord = coord
481
+
482
+ def children(self):
483
+ nodelist = []
484
+ if self.args is not None: nodelist.append(("args", self.args))
485
+ if self.type is not None: nodelist.append(("type", self.type))
486
+ return tuple(nodelist)
487
+
488
+ attr_names = ()
489
+
490
+ class FuncDef(Node):
491
+ __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__')
492
+ def __init__(self, decl, param_decls, body, coord=None):
493
+ self.decl = decl
494
+ self.param_decls = param_decls
495
+ self.body = body
496
+ self.coord = coord
497
+
498
+ def children(self):
499
+ nodelist = []
500
+ if self.decl is not None: nodelist.append(("decl", self.decl))
501
+ if self.body is not None: nodelist.append(("body", self.body))
502
+ for i, child in enumerate(self.param_decls or []):
503
+ nodelist.append(("param_decls[%d]" % i, child))
504
+ return tuple(nodelist)
505
+
506
+ attr_names = ()
507
+
508
+ class Goto(Node):
509
+ __slots__ = ('name', 'coord', '__weakref__')
510
+ def __init__(self, name, coord=None):
511
+ self.name = name
512
+ self.coord = coord
513
+
514
+ def children(self):
515
+ nodelist = []
516
+ return tuple(nodelist)
517
+
518
+ attr_names = ('name', )
519
+
520
+ class ID(Node):
521
+ __slots__ = ('name', 'coord', '__weakref__', "ir_type")
522
+ def __init__(self, name, coord=None):
523
+ self.name = name
524
+ self.coord = coord
525
+ self.ir_type = None
526
+
527
+ def children(self):
528
+ nodelist = []
529
+ return tuple(nodelist)
530
+
531
+ attr_names = ('name', )
532
+
533
+ class IdentifierType(Node):
534
+ __slots__ = ('names', 'coord', '__weakref__')
535
+ def __init__(self, names, coord=None):
536
+ self.names = names
537
+ self.coord = coord
538
+
539
+ def children(self):
540
+ nodelist = []
541
+ return tuple(nodelist)
542
+
543
+ attr_names = ('names', )
544
+
545
+ class If(Node):
546
+ __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
547
+ def __init__(self, cond, iftrue, iffalse, coord=None):
548
+ self.cond = cond
549
+ self.iftrue = iftrue
550
+ self.iffalse = iffalse
551
+ self.coord = coord
552
+
553
+ def children(self):
554
+ nodelist = []
555
+ if self.cond is not None: nodelist.append(("cond", self.cond))
556
+ if self.iftrue is not None: nodelist.append(("iftrue", self.iftrue))
557
+ if self.iffalse is not None: nodelist.append(("iffalse", self.iffalse))
558
+ return tuple(nodelist)
559
+
560
+ attr_names = ()
561
+
562
+ class InitList(Node):
563
+ __slots__ = ('exprs', 'coord', '__weakref__')
564
+ def __init__(self, exprs, coord=None):
565
+ self.exprs = exprs
566
+ self.coord = coord
567
+
568
+ def children(self):
569
+ nodelist = []
570
+ for i, child in enumerate(self.exprs or []):
571
+ nodelist.append(("exprs[%d]" % i, child))
572
+ return tuple(nodelist)
573
+
574
+ attr_names = ()
575
+
576
+ class Label(Node):
577
+ __slots__ = ('name', 'stmt', 'coord', '__weakref__')
578
+ def __init__(self, name, stmt, coord=None):
579
+ self.name = name
580
+ self.stmt = stmt
581
+ self.coord = coord
582
+
583
+ def children(self):
584
+ nodelist = []
585
+ if self.stmt is not None: nodelist.append(("stmt", self.stmt))
586
+ return tuple(nodelist)
587
+
588
+ attr_names = ('name', )
589
+
590
+ class NamedInitializer(Node):
591
+ __slots__ = ('name', 'expr', 'coord', '__weakref__')
592
+ def __init__(self, name, expr, coord=None):
593
+ self.name = name
594
+ self.expr = expr
595
+ self.coord = coord
596
+
597
+ def children(self):
598
+ nodelist = []
599
+ if self.expr is not None: nodelist.append(("expr", self.expr))
600
+ for i, child in enumerate(self.name or []):
601
+ nodelist.append(("name[%d]" % i, child))
602
+ return tuple(nodelist)
603
+
604
+ attr_names = ()
605
+
606
+ class ParamList(Node):
607
+ __slots__ = ('params', 'coord', '__weakref__')
608
+ def __init__(self, params, coord=None):
609
+ self.params = params
610
+ self.coord = coord
611
+
612
+ def children(self):
613
+ nodelist = []
614
+ for i, child in enumerate(self.params or []):
615
+ nodelist.append(("params[%d]" % i, child))
616
+ return tuple(nodelist)
617
+
618
+ attr_names = ()
619
+
620
+ class PtrDecl(Node):
621
+ __slots__ = ('quals', 'type', 'coord', '__weakref__')
622
+ def __init__(self, quals, type, coord=None):
623
+ self.quals = quals
624
+ self.type = type
625
+ self.coord = coord
626
+
627
+ def children(self):
628
+ nodelist = []
629
+ if self.type is not None: nodelist.append(("type", self.type))
630
+ return tuple(nodelist)
631
+
632
+ attr_names = ('quals', )
633
+
634
+ class Return(Node):
635
+ __slots__ = ('expr', 'coord', '__weakref__')
636
+ def __init__(self, expr, coord=None):
637
+ self.expr = expr
638
+ self.coord = coord
639
+
640
+ def children(self):
641
+ nodelist = []
642
+ if self.expr is not None: nodelist.append(("expr", self.expr))
643
+ return tuple(nodelist)
644
+
645
+ attr_names = ()
646
+
647
+ class Struct(Node):
648
+ __slots__ = ('name', 'decls', 'coord', '__weakref__')
649
+ def __init__(self, name, decls, coord=None):
650
+ self.name = name
651
+ self.decls = decls
652
+ self.coord = coord
653
+
654
+ def children(self):
655
+ nodelist = []
656
+ for i, child in enumerate(self.decls or []):
657
+ nodelist.append(("decls[%d]" % i, child))
658
+ return tuple(nodelist)
659
+
660
+ attr_names = ('name', )
661
+
662
+ class StructRef(Node):
663
+ __slots__ = ('name', 'type', 'field', 'coord', '__weakref__')
664
+ def __init__(self, name, type, field, coord=None):
665
+ self.name = name
666
+ self.type = type
667
+ self.field = field
668
+ self.coord = coord
669
+
670
+ def children(self):
671
+ nodelist = []
672
+ if self.name is not None: nodelist.append(("name", self.name))
673
+ if self.field is not None: nodelist.append(("field", self.field))
674
+ return tuple(nodelist)
675
+
676
+ attr_names = ('type', )
677
+
678
+ class Switch(Node):
679
+ __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
680
+ def __init__(self, cond, stmt, coord=None):
681
+ self.cond = cond
682
+ self.stmt = stmt
683
+ self.coord = coord
684
+
685
+ def children(self):
686
+ nodelist = []
687
+ if self.cond is not None: nodelist.append(("cond", self.cond))
688
+ if self.stmt is not None: nodelist.append(("stmt", self.stmt))
689
+ return tuple(nodelist)
690
+
691
+ attr_names = ()
692
+
693
+ class TernaryOp(Node):
694
+ __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
695
+ def __init__(self, cond, iftrue, iffalse, coord=None):
696
+ self.cond = cond
697
+ self.iftrue = iftrue
698
+ self.iffalse = iffalse
699
+ self.coord = coord
700
+
701
+ def children(self):
702
+ nodelist = []
703
+ if self.cond is not None: nodelist.append(("cond", self.cond))
704
+ if self.iftrue is not None: nodelist.append(("iftrue", self.iftrue))
705
+ if self.iffalse is not None: nodelist.append(("iffalse", self.iffalse))
706
+ return tuple(nodelist)
707
+
708
+ attr_names = ()
709
+
710
+ class TypeDecl(Node):
711
+ __slots__ = ('declname', 'quals', 'type', 'coord', '__weakref__')
712
+ def __init__(self, declname, quals, type, coord=None):
713
+ self.declname = declname
714
+ self.quals = quals
715
+ self.type = type
716
+ self.coord = coord
717
+
718
+ def children(self):
719
+ nodelist = []
720
+ if self.type is not None: nodelist.append(("type", self.type))
721
+ return tuple(nodelist)
722
+
723
+ attr_names = ('declname', 'quals', )
724
+
725
+ class Typedef(Node):
726
+ __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__')
727
+ def __init__(self, name, quals, storage, type, coord=None):
728
+ self.name = name
729
+ self.quals = quals
730
+ self.storage = storage
731
+ self.type = type
732
+ self.coord = coord
733
+
734
+ def children(self):
735
+ nodelist = []
736
+ if self.type is not None: nodelist.append(("type", self.type))
737
+ return tuple(nodelist)
738
+
739
+ attr_names = ('name', 'quals', 'storage', )
740
+
741
+ class Typename(Node):
742
+ __slots__ = ('name', 'quals', 'type', 'coord', '__weakref__')
743
+ def __init__(self, name, quals, type, coord=None):
744
+ self.name = name
745
+ self.quals = quals
746
+ self.type = type
747
+ self.coord = coord
748
+
749
+ def children(self):
750
+ nodelist = []
751
+ if self.type is not None: nodelist.append(("type", self.type))
752
+ return tuple(nodelist)
753
+
754
+ attr_names = ('name', 'quals', )
755
+
756
+ class UnaryOp(Node):
757
+ __slots__ = ('op', 'expr', 'coord', '__weakref__')
758
+ def __init__(self, op, expr, coord=None):
759
+ self.op = op
760
+ self.expr = expr
761
+ self.coord = coord
762
+
763
+ def children(self):
764
+ nodelist = []
765
+ if self.expr is not None: nodelist.append(("expr", self.expr))
766
+ return tuple(nodelist)
767
+
768
+ attr_names = ('op', )
769
+
770
+ class Union(Node):
771
+ __slots__ = ('name', 'decls', 'coord', '__weakref__')
772
+ def __init__(self, name, decls, coord=None):
773
+ self.name = name
774
+ self.decls = decls
775
+ self.coord = coord
776
+
777
+ def children(self):
778
+ nodelist = []
779
+ for i, child in enumerate(self.decls or []):
780
+ nodelist.append(("decls[%d]" % i, child))
781
+ return tuple(nodelist)
782
+
783
+ attr_names = ('name', )
784
+
785
+ class While(Node):
786
+ __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
787
+ def __init__(self, cond, stmt, coord=None):
788
+ self.cond = cond
789
+ self.stmt = stmt
790
+ self.coord = coord
791
+
792
+ def children(self):
793
+ nodelist = []
794
+ if self.cond is not None: nodelist.append(("cond", self.cond))
795
+ if self.stmt is not None: nodelist.append(("stmt", self.stmt))
796
+ return tuple(nodelist)
797
+
798
+ attr_names = ()
799
+
800
+