OILS / _devbuild / gen / runtime_asdl.py View on Github | oils.pub

1527 lines, 1097 significant
1from asdl import pybase
2from mycpp import mops
3from typing import Optional, List, Tuple, Dict, Any, cast, TYPE_CHECKING
4
5if TYPE_CHECKING:
6 from _devbuild.gen.syntax_asdl import loc_t, Token, expr_t, word_t, command_t, CompoundWord, DoubleQuoted, ArgList, re_t, redir_loc_t, proc_sig_t, Func
7 from _devbuild.gen.value_asdl import value_t, Obj
8from _devbuild.gen.id_kind_asdl import Id_t
9from _devbuild.gen.id_kind_asdl import Id_str
10
11from asdl import runtime # For runtime.NO_SPID
12from asdl.runtime import NewRecord, NewLeaf, TraversalState
13from _devbuild.gen.hnode_asdl import color_e, hnode, hnode_e, hnode_t, Field
14
15class cmd_value_e(object):
16 Argv = 1
17 Assign = 2
18
19_cmd_value_str = {
20 1: 'Argv',
21 2: 'Assign',
22}
23
24def cmd_value_str(tag, dot=True):
25 # type: (int, bool) -> str
26 v = _cmd_value_str[tag]
27 if dot:
28 return "cmd_value.%s" % v
29 else:
30 return v
31
32class cmd_value_t(pybase.CompoundObj):
33 def tag(self):
34 # type: () -> int
35 return self._type_tag
36
37class cmd_value(object):
38 class Argv(cmd_value_t):
39 _type_tag = 1
40 __slots__ = ('argv', 'arg_locs', 'is_last_cmd', 'self_obj', 'proc_args')
41
42 def __init__(self, argv, arg_locs, is_last_cmd, self_obj, proc_args):
43 # type: (List[str], List[CompoundWord], bool, Optional[Obj], Optional[ProcArgs]) -> None
44 self.argv = argv
45 self.arg_locs = arg_locs
46 self.is_last_cmd = is_last_cmd
47 self.self_obj = self_obj
48 self.proc_args = proc_args
49
50 @staticmethod
51 def CreateNull(alloc_lists=False):
52 # type: () -> cmd_value.Argv
53 return cmd_value.Argv([] if alloc_lists else cast('List[str]', None), [] if alloc_lists else cast('List[CompoundWord]', None), False, cast('Optional[Obj]', None), cast('Optional[ProcArgs]', None))
54
55 def PrettyTree(self, do_abbrev, trav=None):
56 # type: (bool, Optional[TraversalState]) -> hnode_t
57 trav = trav or TraversalState()
58 heap_id = id(self)
59 if heap_id in trav.seen:
60 return hnode.AlreadySeen(heap_id)
61 trav.seen[heap_id] = True
62
63 out_node = NewRecord('cmd_value.Argv')
64 L = out_node.fields
65
66 if self.argv is not None: # List
67 x0 = hnode.Array([])
68 for i0 in self.argv:
69 x0.children.append(NewLeaf(i0, color_e.StringConst))
70 L.append(Field('argv', x0))
71
72 if self.arg_locs is not None: # List
73 x1 = hnode.Array([])
74 for i1 in self.arg_locs:
75 h = (hnode.Leaf("_", color_e.OtherConst) if i1 is None else
76 i1.PrettyTree(do_abbrev, trav=trav))
77 x1.children.append(h)
78 L.append(Field('arg_locs', x1))
79
80 x2 = hnode.Leaf('T' if self.is_last_cmd else 'F', color_e.OtherConst)
81 L.append(Field('is_last_cmd', x2))
82
83 if self.self_obj is not None: # Optional
84 x3 = self.self_obj.PrettyTree(do_abbrev, trav=trav)
85 L.append(Field('self_obj', x3))
86
87 if self.proc_args is not None: # Optional
88 x4 = self.proc_args.PrettyTree(do_abbrev, trav=trav)
89 L.append(Field('proc_args', x4))
90
91 return out_node
92
93 class Assign(cmd_value_t):
94 _type_tag = 2
95 __slots__ = ('builtin_id', 'argv', 'arg_locs', 'pairs')
96
97 def __init__(self, builtin_id, argv, arg_locs, pairs):
98 # type: (int, List[str], List[CompoundWord], List[AssignArg]) -> None
99 self.builtin_id = builtin_id
100 self.argv = argv
101 self.arg_locs = arg_locs
102 self.pairs = pairs
103
104 @staticmethod
105 def CreateNull(alloc_lists=False):
106 # type: () -> cmd_value.Assign
107 return cmd_value.Assign(-1, [] if alloc_lists else cast('List[str]', None), [] if alloc_lists else cast('List[CompoundWord]', None), [] if alloc_lists else cast('List[AssignArg]', None))
108
109 def PrettyTree(self, do_abbrev, trav=None):
110 # type: (bool, Optional[TraversalState]) -> hnode_t
111 trav = trav or TraversalState()
112 heap_id = id(self)
113 if heap_id in trav.seen:
114 return hnode.AlreadySeen(heap_id)
115 trav.seen[heap_id] = True
116
117 out_node = NewRecord('cmd_value.Assign')
118 L = out_node.fields
119
120 x0 = hnode.Leaf(str(self.builtin_id), color_e.OtherConst)
121 L.append(Field('builtin_id', x0))
122
123 if self.argv is not None: # List
124 x1 = hnode.Array([])
125 for i1 in self.argv:
126 x1.children.append(NewLeaf(i1, color_e.StringConst))
127 L.append(Field('argv', x1))
128
129 if self.arg_locs is not None: # List
130 x2 = hnode.Array([])
131 for i2 in self.arg_locs:
132 h = (hnode.Leaf("_", color_e.OtherConst) if i2 is None else
133 i2.PrettyTree(do_abbrev, trav=trav))
134 x2.children.append(h)
135 L.append(Field('arg_locs', x2))
136
137 if self.pairs is not None: # List
138 x3 = hnode.Array([])
139 for i3 in self.pairs:
140 h = (hnode.Leaf("_", color_e.OtherConst) if i3 is None else
141 i3.PrettyTree(do_abbrev, trav=trav))
142 x3.children.append(h)
143 L.append(Field('pairs', x3))
144
145 return out_node
146
147 pass
148
149class part_value_e(object):
150 String = 66
151 Array = 2
152 ExtGlob = 3
153
154_part_value_str = {
155 2: 'Array',
156 3: 'ExtGlob',
157 66: 'String',
158}
159
160def part_value_str(tag, dot=True):
161 # type: (int, bool) -> str
162 v = _part_value_str[tag]
163 if dot:
164 return "part_value.%s" % v
165 else:
166 return v
167
168class part_value_t(pybase.CompoundObj):
169 def tag(self):
170 # type: () -> int
171 return self._type_tag
172
173class part_value(object):
174 class Array(part_value_t):
175 _type_tag = 2
176 __slots__ = ('strs',)
177
178 def __init__(self, strs):
179 # type: (List[str]) -> None
180 self.strs = strs
181
182 @staticmethod
183 def CreateNull(alloc_lists=False):
184 # type: () -> part_value.Array
185 return part_value.Array([] if alloc_lists else cast('List[str]', None))
186
187 def PrettyTree(self, do_abbrev, trav=None):
188 # type: (bool, Optional[TraversalState]) -> hnode_t
189 trav = trav or TraversalState()
190 heap_id = id(self)
191 if heap_id in trav.seen:
192 return hnode.AlreadySeen(heap_id)
193 trav.seen[heap_id] = True
194
195 out_node = NewRecord('part_value.Array')
196 L = out_node.fields
197
198 if self.strs is not None: # List
199 x0 = hnode.Array([])
200 for i0 in self.strs:
201 x0.children.append(NewLeaf(i0, color_e.StringConst))
202 L.append(Field('strs', x0))
203
204 return out_node
205
206 class ExtGlob(part_value_t):
207 _type_tag = 3
208 __slots__ = ('part_vals',)
209
210 def __init__(self, part_vals):
211 # type: (List[part_value_t]) -> None
212 self.part_vals = part_vals
213
214 @staticmethod
215 def CreateNull(alloc_lists=False):
216 # type: () -> part_value.ExtGlob
217 return part_value.ExtGlob([] if alloc_lists else cast('List[part_value_t]', None))
218
219 def PrettyTree(self, do_abbrev, trav=None):
220 # type: (bool, Optional[TraversalState]) -> hnode_t
221 trav = trav or TraversalState()
222 heap_id = id(self)
223 if heap_id in trav.seen:
224 return hnode.AlreadySeen(heap_id)
225 trav.seen[heap_id] = True
226
227 out_node = NewRecord('part_value.ExtGlob')
228 L = out_node.fields
229
230 if self.part_vals is not None: # List
231 x0 = hnode.Array([])
232 for i0 in self.part_vals:
233 h = (hnode.Leaf("_", color_e.OtherConst) if i0 is None else
234 i0.PrettyTree(do_abbrev, trav=trav))
235 x0.children.append(h)
236 L.append(Field('part_vals', x0))
237
238 return out_node
239
240 pass
241
242class coerced_t(pybase.SimpleObj):
243 pass
244
245class coerced_e(object):
246 Int = coerced_t(1)
247 Float = coerced_t(2)
248 Neither = coerced_t(3)
249
250_coerced_str = {
251 1: 'Int',
252 2: 'Float',
253 3: 'Neither',
254}
255
256def coerced_str(val, dot=True):
257 # type: (coerced_t, bool) -> str
258 v = _coerced_str[val]
259 if dot:
260 return "coerced.%s" % v
261 else:
262 return v
263
264class scope_t(pybase.SimpleObj):
265 pass
266
267class scope_e(object):
268 Shopt = scope_t(1)
269 Dynamic = scope_t(2)
270 LocalOrGlobal = scope_t(3)
271 LocalOnly = scope_t(4)
272 GlobalOnly = scope_t(5)
273
274_scope_str = {
275 1: 'Shopt',
276 2: 'Dynamic',
277 3: 'LocalOrGlobal',
278 4: 'LocalOnly',
279 5: 'GlobalOnly',
280}
281
282def scope_str(val, dot=True):
283 # type: (scope_t, bool) -> str
284 v = _scope_str[val]
285 if dot:
286 return "scope.%s" % v
287 else:
288 return v
289
290class a_index_e(object):
291 Str = 1
292 Int = 2
293
294_a_index_str = {
295 1: 'Str',
296 2: 'Int',
297}
298
299def a_index_str(tag, dot=True):
300 # type: (int, bool) -> str
301 v = _a_index_str[tag]
302 if dot:
303 return "a_index.%s" % v
304 else:
305 return v
306
307class a_index_t(pybase.CompoundObj):
308 def tag(self):
309 # type: () -> int
310 return self._type_tag
311
312class a_index(object):
313 class Str(a_index_t):
314 _type_tag = 1
315 __slots__ = ('s',)
316
317 def __init__(self, s):
318 # type: (str) -> None
319 self.s = s
320
321 @staticmethod
322 def CreateNull(alloc_lists=False):
323 # type: () -> a_index.Str
324 return a_index.Str('')
325
326 def PrettyTree(self, do_abbrev, trav=None):
327 # type: (bool, Optional[TraversalState]) -> hnode_t
328 trav = trav or TraversalState()
329 heap_id = id(self)
330 if heap_id in trav.seen:
331 return hnode.AlreadySeen(heap_id)
332 trav.seen[heap_id] = True
333
334 out_node = NewRecord('a_index.Str')
335 L = out_node.fields
336
337 x0 = NewLeaf(self.s, color_e.StringConst)
338 L.append(Field('s', x0))
339
340 return out_node
341
342 class Int(a_index_t):
343 _type_tag = 2
344 __slots__ = ('i',)
345
346 def __init__(self, i):
347 # type: (int) -> None
348 self.i = i
349
350 @staticmethod
351 def CreateNull(alloc_lists=False):
352 # type: () -> a_index.Int
353 return a_index.Int(-1)
354
355 def PrettyTree(self, do_abbrev, trav=None):
356 # type: (bool, Optional[TraversalState]) -> hnode_t
357 trav = trav or TraversalState()
358 heap_id = id(self)
359 if heap_id in trav.seen:
360 return hnode.AlreadySeen(heap_id)
361 trav.seen[heap_id] = True
362
363 out_node = NewRecord('a_index.Int')
364 L = out_node.fields
365
366 x0 = hnode.Leaf(str(self.i), color_e.OtherConst)
367 L.append(Field('i', x0))
368
369 return out_node
370
371 pass
372
373class redirect_arg_e(object):
374 Path = 1
375 CopyFd = 2
376 MoveFd = 3
377 CloseFd = 4
378 HereDoc = 5
379
380_redirect_arg_str = {
381 1: 'Path',
382 2: 'CopyFd',
383 3: 'MoveFd',
384 4: 'CloseFd',
385 5: 'HereDoc',
386}
387
388def redirect_arg_str(tag, dot=True):
389 # type: (int, bool) -> str
390 v = _redirect_arg_str[tag]
391 if dot:
392 return "redirect_arg.%s" % v
393 else:
394 return v
395
396class redirect_arg_t(pybase.CompoundObj):
397 def tag(self):
398 # type: () -> int
399 return self._type_tag
400
401class redirect_arg__CloseFd(redirect_arg_t):
402 _type_tag = 4
403 __slots__ = ()
404
405 def __init__(self, ):
406 # type: () -> None
407 pass
408
409 def PrettyTree(self, do_abbrev, trav=None):
410 # type: (bool, Optional[TraversalState]) -> hnode_t
411 trav = trav or TraversalState()
412 heap_id = id(self)
413 if heap_id in trav.seen:
414 return hnode.AlreadySeen(heap_id)
415 trav.seen[heap_id] = True
416
417 out_node = NewRecord('redirect_arg.CloseFd')
418 L = out_node.fields
419
420 return out_node
421
422class redirect_arg(object):
423 class Path(redirect_arg_t):
424 _type_tag = 1
425 __slots__ = ('filename',)
426
427 def __init__(self, filename):
428 # type: (str) -> None
429 self.filename = filename
430
431 @staticmethod
432 def CreateNull(alloc_lists=False):
433 # type: () -> redirect_arg.Path
434 return redirect_arg.Path('')
435
436 def PrettyTree(self, do_abbrev, trav=None):
437 # type: (bool, Optional[TraversalState]) -> hnode_t
438 trav = trav or TraversalState()
439 heap_id = id(self)
440 if heap_id in trav.seen:
441 return hnode.AlreadySeen(heap_id)
442 trav.seen[heap_id] = True
443
444 out_node = NewRecord('redirect_arg.Path')
445 L = out_node.fields
446
447 x0 = NewLeaf(self.filename, color_e.StringConst)
448 L.append(Field('filename', x0))
449
450 return out_node
451
452 class CopyFd(redirect_arg_t):
453 _type_tag = 2
454 __slots__ = ('target_fd',)
455
456 def __init__(self, target_fd):
457 # type: (int) -> None
458 self.target_fd = target_fd
459
460 @staticmethod
461 def CreateNull(alloc_lists=False):
462 # type: () -> redirect_arg.CopyFd
463 return redirect_arg.CopyFd(-1)
464
465 def PrettyTree(self, do_abbrev, trav=None):
466 # type: (bool, Optional[TraversalState]) -> hnode_t
467 trav = trav or TraversalState()
468 heap_id = id(self)
469 if heap_id in trav.seen:
470 return hnode.AlreadySeen(heap_id)
471 trav.seen[heap_id] = True
472
473 out_node = NewRecord('redirect_arg.CopyFd')
474 L = out_node.fields
475
476 x0 = hnode.Leaf(str(self.target_fd), color_e.OtherConst)
477 L.append(Field('target_fd', x0))
478
479 return out_node
480
481 class MoveFd(redirect_arg_t):
482 _type_tag = 3
483 __slots__ = ('target_fd',)
484
485 def __init__(self, target_fd):
486 # type: (int) -> None
487 self.target_fd = target_fd
488
489 @staticmethod
490 def CreateNull(alloc_lists=False):
491 # type: () -> redirect_arg.MoveFd
492 return redirect_arg.MoveFd(-1)
493
494 def PrettyTree(self, do_abbrev, trav=None):
495 # type: (bool, Optional[TraversalState]) -> hnode_t
496 trav = trav or TraversalState()
497 heap_id = id(self)
498 if heap_id in trav.seen:
499 return hnode.AlreadySeen(heap_id)
500 trav.seen[heap_id] = True
501
502 out_node = NewRecord('redirect_arg.MoveFd')
503 L = out_node.fields
504
505 x0 = hnode.Leaf(str(self.target_fd), color_e.OtherConst)
506 L.append(Field('target_fd', x0))
507
508 return out_node
509
510 CloseFd = redirect_arg__CloseFd()
511
512 class HereDoc(redirect_arg_t):
513 _type_tag = 5
514 __slots__ = ('body',)
515
516 def __init__(self, body):
517 # type: (str) -> None
518 self.body = body
519
520 @staticmethod
521 def CreateNull(alloc_lists=False):
522 # type: () -> redirect_arg.HereDoc
523 return redirect_arg.HereDoc('')
524
525 def PrettyTree(self, do_abbrev, trav=None):
526 # type: (bool, Optional[TraversalState]) -> hnode_t
527 trav = trav or TraversalState()
528 heap_id = id(self)
529 if heap_id in trav.seen:
530 return hnode.AlreadySeen(heap_id)
531 trav.seen[heap_id] = True
532
533 out_node = NewRecord('redirect_arg.HereDoc')
534 L = out_node.fields
535
536 x0 = NewLeaf(self.body, color_e.StringConst)
537 L.append(Field('body', x0))
538
539 return out_node
540
541 pass
542
543class wait_status_e(object):
544 Proc = 1
545 Pipeline = 2
546 Cancelled = 3
547
548_wait_status_str = {
549 1: 'Proc',
550 2: 'Pipeline',
551 3: 'Cancelled',
552}
553
554def wait_status_str(tag, dot=True):
555 # type: (int, bool) -> str
556 v = _wait_status_str[tag]
557 if dot:
558 return "wait_status.%s" % v
559 else:
560 return v
561
562class wait_status_t(pybase.CompoundObj):
563 def tag(self):
564 # type: () -> int
565 return self._type_tag
566
567class wait_status(object):
568 class Proc(wait_status_t):
569 _type_tag = 1
570 __slots__ = ('code',)
571
572 def __init__(self, code):
573 # type: (int) -> None
574 self.code = code
575
576 @staticmethod
577 def CreateNull(alloc_lists=False):
578 # type: () -> wait_status.Proc
579 return wait_status.Proc(-1)
580
581 def PrettyTree(self, do_abbrev, trav=None):
582 # type: (bool, Optional[TraversalState]) -> hnode_t
583 trav = trav or TraversalState()
584 heap_id = id(self)
585 if heap_id in trav.seen:
586 return hnode.AlreadySeen(heap_id)
587 trav.seen[heap_id] = True
588
589 out_node = NewRecord('wait_status.Proc')
590 L = out_node.fields
591
592 x0 = hnode.Leaf(str(self.code), color_e.OtherConst)
593 L.append(Field('code', x0))
594
595 return out_node
596
597 class Pipeline(wait_status_t):
598 _type_tag = 2
599 __slots__ = ('codes',)
600
601 def __init__(self, codes):
602 # type: (List[int]) -> None
603 self.codes = codes
604
605 @staticmethod
606 def CreateNull(alloc_lists=False):
607 # type: () -> wait_status.Pipeline
608 return wait_status.Pipeline([] if alloc_lists else cast('List[int]', None))
609
610 def PrettyTree(self, do_abbrev, trav=None):
611 # type: (bool, Optional[TraversalState]) -> hnode_t
612 trav = trav or TraversalState()
613 heap_id = id(self)
614 if heap_id in trav.seen:
615 return hnode.AlreadySeen(heap_id)
616 trav.seen[heap_id] = True
617
618 out_node = NewRecord('wait_status.Pipeline')
619 L = out_node.fields
620
621 if self.codes is not None: # List
622 x0 = hnode.Array([])
623 for i0 in self.codes:
624 x0.children.append(hnode.Leaf(str(i0), color_e.OtherConst))
625 L.append(Field('codes', x0))
626
627 return out_node
628
629 class Cancelled(wait_status_t):
630 _type_tag = 3
631 __slots__ = ('sig_num',)
632
633 def __init__(self, sig_num):
634 # type: (int) -> None
635 self.sig_num = sig_num
636
637 @staticmethod
638 def CreateNull(alloc_lists=False):
639 # type: () -> wait_status.Cancelled
640 return wait_status.Cancelled(-1)
641
642 def PrettyTree(self, do_abbrev, trav=None):
643 # type: (bool, Optional[TraversalState]) -> hnode_t
644 trav = trav or TraversalState()
645 heap_id = id(self)
646 if heap_id in trav.seen:
647 return hnode.AlreadySeen(heap_id)
648 trav.seen[heap_id] = True
649
650 out_node = NewRecord('wait_status.Cancelled')
651 L = out_node.fields
652
653 x0 = hnode.Leaf(str(self.sig_num), color_e.OtherConst)
654 L.append(Field('sig_num', x0))
655
656 return out_node
657
658 pass
659
660class flow_t(pybase.SimpleObj):
661 pass
662
663class flow_e(object):
664 Nothing = flow_t(1)
665 Break = flow_t(2)
666 Raise = flow_t(3)
667
668_flow_str = {
669 1: 'Nothing',
670 2: 'Break',
671 3: 'Raise',
672}
673
674def flow_str(val, dot=True):
675 # type: (flow_t, bool) -> str
676 v = _flow_str[val]
677 if dot:
678 return "flow.%s" % v
679 else:
680 return v
681
682class span_t(pybase.SimpleObj):
683 pass
684
685class span_e(object):
686 Black = span_t(1)
687 Delim = span_t(2)
688 Backslash = span_t(3)
689
690_span_str = {
691 1: 'Black',
692 2: 'Delim',
693 3: 'Backslash',
694}
695
696def span_str(val, dot=True):
697 # type: (span_t, bool) -> str
698 v = _span_str[val]
699 if dot:
700 return "span.%s" % v
701 else:
702 return v
703
704emit_t = int # type alias for integer
705
706class emit_i(object):
707 Part = 1
708 Delim = 2
709 Empty = 3
710 Escape = 4
711 Nothing = 5
712 ARRAY_SIZE = 6
713
714_emit_str = {
715 1: 'Part',
716 2: 'Delim',
717 3: 'Empty',
718 4: 'Escape',
719 5: 'Nothing',
720}
721
722def emit_str(val, dot=True):
723 # type: (emit_t, bool) -> str
724 v = _emit_str[val]
725 if dot:
726 return "emit.%s" % v
727 else:
728 return v
729
730state_t = int # type alias for integer
731
732class state_i(object):
733 Invalid = 1
734 Start = 2
735 DE_White1 = 3
736 DE_Gray = 4
737 DE_White2 = 5
738 Black = 6
739 Backslash = 7
740 Done = 8
741 ARRAY_SIZE = 9
742
743_state_str = {
744 1: 'Invalid',
745 2: 'Start',
746 3: 'DE_White1',
747 4: 'DE_Gray',
748 5: 'DE_White2',
749 6: 'Black',
750 7: 'Backslash',
751 8: 'Done',
752}
753
754def state_str(val, dot=True):
755 # type: (state_t, bool) -> str
756 v = _state_str[val]
757 if dot:
758 return "state.%s" % v
759 else:
760 return v
761
762char_kind_t = int # type alias for integer
763
764class char_kind_i(object):
765 DE_White = 1
766 DE_Gray = 2
767 Black = 3
768 Backslash = 4
769 Sentinel = 5
770 ARRAY_SIZE = 6
771
772_char_kind_str = {
773 1: 'DE_White',
774 2: 'DE_Gray',
775 3: 'Black',
776 4: 'Backslash',
777 5: 'Sentinel',
778}
779
780def char_kind_str(val, dot=True):
781 # type: (char_kind_t, bool) -> str
782 v = _char_kind_str[val]
783 if dot:
784 return "char_kind.%s" % v
785 else:
786 return v
787
788class job_state_t(pybase.SimpleObj):
789 pass
790
791class job_state_e(object):
792 Running = job_state_t(1)
793 Done = job_state_t(2)
794 Stopped = job_state_t(3)
795
796_job_state_str = {
797 1: 'Running',
798 2: 'Done',
799 3: 'Stopped',
800}
801
802def job_state_str(val, dot=True):
803 # type: (job_state_t, bool) -> str
804 v = _job_state_str[val]
805 if dot:
806 return "job_state.%s" % v
807 else:
808 return v
809
810class error_code_t(pybase.SimpleObj):
811 pass
812
813class error_code_e(object):
814 OK = error_code_t(1)
815 IndexOutOfRange = error_code_t(2)
816
817_error_code_str = {
818 1: 'OK',
819 2: 'IndexOutOfRange',
820}
821
822def error_code_str(val, dot=True):
823 # type: (error_code_t, bool) -> str
824 v = _error_code_str[val]
825 if dot:
826 return "error_code.%s" % v
827 else:
828 return v
829
830class flag_type_t(pybase.SimpleObj):
831 pass
832
833class flag_type_e(object):
834 Bool = flag_type_t(1)
835 Int = flag_type_t(2)
836 Float = flag_type_t(3)
837 Str = flag_type_t(4)
838
839_flag_type_str = {
840 1: 'Bool',
841 2: 'Int',
842 3: 'Float',
843 4: 'Str',
844}
845
846def flag_type_str(val, dot=True):
847 # type: (flag_type_t, bool) -> str
848 v = _flag_type_str[val]
849 if dot:
850 return "flag_type.%s" % v
851 else:
852 return v
853
854class trace_e(object):
855 External = 1
856 CommandSub = 2
857 ForkWait = 3
858 Fork = 4
859 PipelinePart = 5
860 ProcessSub = 6
861 HereDoc = 7
862
863_trace_str = {
864 1: 'External',
865 2: 'CommandSub',
866 3: 'ForkWait',
867 4: 'Fork',
868 5: 'PipelinePart',
869 6: 'ProcessSub',
870 7: 'HereDoc',
871}
872
873def trace_str(tag, dot=True):
874 # type: (int, bool) -> str
875 v = _trace_str[tag]
876 if dot:
877 return "trace.%s" % v
878 else:
879 return v
880
881class trace_t(pybase.CompoundObj):
882 def tag(self):
883 # type: () -> int
884 return self._type_tag
885
886class trace__CommandSub(trace_t):
887 _type_tag = 2
888 __slots__ = ()
889
890 def __init__(self, ):
891 # type: () -> None
892 pass
893
894 def PrettyTree(self, do_abbrev, trav=None):
895 # type: (bool, Optional[TraversalState]) -> hnode_t
896 trav = trav or TraversalState()
897 heap_id = id(self)
898 if heap_id in trav.seen:
899 return hnode.AlreadySeen(heap_id)
900 trav.seen[heap_id] = True
901
902 out_node = NewRecord('trace.CommandSub')
903 L = out_node.fields
904
905 return out_node
906
907class trace__ForkWait(trace_t):
908 _type_tag = 3
909 __slots__ = ()
910
911 def __init__(self, ):
912 # type: () -> None
913 pass
914
915 def PrettyTree(self, do_abbrev, trav=None):
916 # type: (bool, Optional[TraversalState]) -> hnode_t
917 trav = trav or TraversalState()
918 heap_id = id(self)
919 if heap_id in trav.seen:
920 return hnode.AlreadySeen(heap_id)
921 trav.seen[heap_id] = True
922
923 out_node = NewRecord('trace.ForkWait')
924 L = out_node.fields
925
926 return out_node
927
928class trace__Fork(trace_t):
929 _type_tag = 4
930 __slots__ = ()
931
932 def __init__(self, ):
933 # type: () -> None
934 pass
935
936 def PrettyTree(self, do_abbrev, trav=None):
937 # type: (bool, Optional[TraversalState]) -> hnode_t
938 trav = trav or TraversalState()
939 heap_id = id(self)
940 if heap_id in trav.seen:
941 return hnode.AlreadySeen(heap_id)
942 trav.seen[heap_id] = True
943
944 out_node = NewRecord('trace.Fork')
945 L = out_node.fields
946
947 return out_node
948
949class trace__PipelinePart(trace_t):
950 _type_tag = 5
951 __slots__ = ()
952
953 def __init__(self, ):
954 # type: () -> None
955 pass
956
957 def PrettyTree(self, do_abbrev, trav=None):
958 # type: (bool, Optional[TraversalState]) -> hnode_t
959 trav = trav or TraversalState()
960 heap_id = id(self)
961 if heap_id in trav.seen:
962 return hnode.AlreadySeen(heap_id)
963 trav.seen[heap_id] = True
964
965 out_node = NewRecord('trace.PipelinePart')
966 L = out_node.fields
967
968 return out_node
969
970class trace__ProcessSub(trace_t):
971 _type_tag = 6
972 __slots__ = ()
973
974 def __init__(self, ):
975 # type: () -> None
976 pass
977
978 def PrettyTree(self, do_abbrev, trav=None):
979 # type: (bool, Optional[TraversalState]) -> hnode_t
980 trav = trav or TraversalState()
981 heap_id = id(self)
982 if heap_id in trav.seen:
983 return hnode.AlreadySeen(heap_id)
984 trav.seen[heap_id] = True
985
986 out_node = NewRecord('trace.ProcessSub')
987 L = out_node.fields
988
989 return out_node
990
991class trace__HereDoc(trace_t):
992 _type_tag = 7
993 __slots__ = ()
994
995 def __init__(self, ):
996 # type: () -> None
997 pass
998
999 def PrettyTree(self, do_abbrev, trav=None):
1000 # type: (bool, Optional[TraversalState]) -> hnode_t
1001 trav = trav or TraversalState()
1002 heap_id = id(self)
1003 if heap_id in trav.seen:
1004 return hnode.AlreadySeen(heap_id)
1005 trav.seen[heap_id] = True
1006
1007 out_node = NewRecord('trace.HereDoc')
1008 L = out_node.fields
1009
1010 return out_node
1011
1012class trace(object):
1013 class External(trace_t):
1014 _type_tag = 1
1015 __slots__ = ('argv',)
1016
1017 def __init__(self, argv):
1018 # type: (List[str]) -> None
1019 self.argv = argv
1020
1021 @staticmethod
1022 def CreateNull(alloc_lists=False):
1023 # type: () -> trace.External
1024 return trace.External([] if alloc_lists else cast('List[str]', None))
1025
1026 def PrettyTree(self, do_abbrev, trav=None):
1027 # type: (bool, Optional[TraversalState]) -> hnode_t
1028 trav = trav or TraversalState()
1029 heap_id = id(self)
1030 if heap_id in trav.seen:
1031 return hnode.AlreadySeen(heap_id)
1032 trav.seen[heap_id] = True
1033
1034 out_node = NewRecord('trace.External')
1035 L = out_node.fields
1036
1037 if self.argv is not None: # List
1038 x0 = hnode.Array([])
1039 for i0 in self.argv:
1040 x0.children.append(NewLeaf(i0, color_e.StringConst))
1041 L.append(Field('argv', x0))
1042
1043 return out_node
1044
1045 CommandSub = trace__CommandSub()
1046
1047 ForkWait = trace__ForkWait()
1048
1049 Fork = trace__Fork()
1050
1051 PipelinePart = trace__PipelinePart()
1052
1053 ProcessSub = trace__ProcessSub()
1054
1055 HereDoc = trace__HereDoc()
1056
1057 pass
1058
1059class word_style_t(pybase.SimpleObj):
1060 pass
1061
1062class word_style_e(object):
1063 Expr = word_style_t(1)
1064 Unquoted = word_style_t(2)
1065 DQ = word_style_t(3)
1066 SQ = word_style_t(4)
1067
1068_word_style_str = {
1069 1: 'Expr',
1070 2: 'Unquoted',
1071 3: 'DQ',
1072 4: 'SQ',
1073}
1074
1075def word_style_str(val, dot=True):
1076 # type: (word_style_t, bool) -> str
1077 v = _word_style_str[val]
1078 if dot:
1079 return "word_style.%s" % v
1080 else:
1081 return v
1082
1083class comp_action_t(pybase.SimpleObj):
1084 pass
1085
1086class comp_action_e(object):
1087 Other = comp_action_t(1)
1088 FileSystem = comp_action_t(2)
1089 BashFunc = comp_action_t(3)
1090
1091_comp_action_str = {
1092 1: 'Other',
1093 2: 'FileSystem',
1094 3: 'BashFunc',
1095}
1096
1097def comp_action_str(val, dot=True):
1098 # type: (comp_action_t, bool) -> str
1099 v = _comp_action_str[val]
1100 if dot:
1101 return "comp_action.%s" % v
1102 else:
1103 return v
1104
1105class AssignArg(pybase.CompoundObj):
1106 _type_tag = 64
1107 __slots__ = ('var_name', 'rval', 'plus_eq', 'blame_word')
1108
1109 def __init__(self, var_name, rval, plus_eq, blame_word):
1110 # type: (str, Optional[value_t], bool, CompoundWord) -> None
1111 self.var_name = var_name
1112 self.rval = rval
1113 self.plus_eq = plus_eq
1114 self.blame_word = blame_word
1115
1116 @staticmethod
1117 def CreateNull(alloc_lists=False):
1118 # type: () -> AssignArg
1119 return AssignArg('', cast('Optional[value_t]', None), False, cast('CompoundWord', None))
1120
1121 def PrettyTree(self, do_abbrev, trav=None):
1122 # type: (bool, Optional[TraversalState]) -> hnode_t
1123 trav = trav or TraversalState()
1124 heap_id = id(self)
1125 if heap_id in trav.seen:
1126 return hnode.AlreadySeen(heap_id)
1127 trav.seen[heap_id] = True
1128
1129 out_node = NewRecord('AssignArg')
1130 L = out_node.fields
1131
1132 x0 = NewLeaf(self.var_name, color_e.StringConst)
1133 L.append(Field('var_name', x0))
1134
1135 if self.rval is not None: # Optional
1136 x1 = self.rval.PrettyTree(do_abbrev, trav=trav)
1137 L.append(Field('rval', x1))
1138
1139 x2 = hnode.Leaf('T' if self.plus_eq else 'F', color_e.OtherConst)
1140 L.append(Field('plus_eq', x2))
1141
1142 assert self.blame_word is not None
1143 x3 = self.blame_word.PrettyTree(do_abbrev, trav=trav)
1144 L.append(Field('blame_word', x3))
1145
1146 return out_node
1147
1148class ProcArgs(pybase.CompoundObj):
1149 _type_tag = 65
1150 __slots__ = ('typed_args', 'pos_args', 'named_args', 'block_arg')
1151
1152 def __init__(self, typed_args, pos_args, named_args, block_arg):
1153 # type: (ArgList, Optional[List[value_t]], Optional[Dict[str, value_t]], Optional[value_t]) -> None
1154 self.typed_args = typed_args
1155 self.pos_args = pos_args
1156 self.named_args = named_args
1157 self.block_arg = block_arg
1158
1159 @staticmethod
1160 def CreateNull(alloc_lists=False):
1161 # type: () -> ProcArgs
1162 return ProcArgs(cast('ArgList', None), cast('Optional[List[value_t]]', None), cast('Optional[Dict[str, value_t]]', None), cast('Optional[value_t]', None))
1163
1164 def PrettyTree(self, do_abbrev, trav=None):
1165 # type: (bool, Optional[TraversalState]) -> hnode_t
1166 trav = trav or TraversalState()
1167 heap_id = id(self)
1168 if heap_id in trav.seen:
1169 return hnode.AlreadySeen(heap_id)
1170 trav.seen[heap_id] = True
1171
1172 out_node = NewRecord('ProcArgs')
1173 L = out_node.fields
1174
1175 assert self.typed_args is not None
1176 x0 = self.typed_args.PrettyTree(do_abbrev, trav=trav)
1177 L.append(Field('typed_args', x0))
1178
1179 if self.pos_args is not None: # List
1180 x1 = hnode.Array([])
1181 for i1 in self.pos_args:
1182 h = (hnode.Leaf("_", color_e.OtherConst) if i1 is None else
1183 i1.PrettyTree(do_abbrev, trav=trav))
1184 x1.children.append(h)
1185 L.append(Field('pos_args', x1))
1186
1187 if self.named_args is not None: # Dict
1188 unnamed2 = [] # type: List[hnode_t]
1189 x2 = hnode.Record("", "{", "}", [], unnamed2)
1190 for k2, v2 in self.named_args.iteritems():
1191 unnamed2.append(NewLeaf(k2, color_e.StringConst))
1192 unnamed2.append(v2.PrettyTree(do_abbrev, trav=trav))
1193 L.append(Field('named_args', x2))
1194
1195 if self.block_arg is not None: # Optional
1196 x3 = self.block_arg.PrettyTree(do_abbrev, trav=trav)
1197 L.append(Field('block_arg', x3))
1198
1199 return out_node
1200
1201class Piece(part_value_t):
1202 _type_tag = 66
1203 __slots__ = ('s', 'quoted', 'do_split')
1204
1205 def __init__(self, s, quoted, do_split):
1206 # type: (str, bool, bool) -> None
1207 self.s = s
1208 self.quoted = quoted
1209 self.do_split = do_split
1210
1211 @staticmethod
1212 def CreateNull(alloc_lists=False):
1213 # type: () -> Piece
1214 return Piece('', False, False)
1215
1216 def PrettyTree(self, do_abbrev, trav=None):
1217 # type: (bool, Optional[TraversalState]) -> hnode_t
1218 trav = trav or TraversalState()
1219 heap_id = id(self)
1220 if heap_id in trav.seen:
1221 return hnode.AlreadySeen(heap_id)
1222 trav.seen[heap_id] = True
1223
1224 out_node = NewRecord('Piece')
1225 L = out_node.fields
1226
1227 x0 = NewLeaf(self.s, color_e.StringConst)
1228 L.append(Field('s', x0))
1229
1230 x1 = hnode.Leaf('T' if self.quoted else 'F', color_e.OtherConst)
1231 L.append(Field('quoted', x1))
1232
1233 x2 = hnode.Leaf('T' if self.do_split else 'F', color_e.OtherConst)
1234 L.append(Field('do_split', x2))
1235
1236 return out_node
1237
1238class VarSubState(pybase.CompoundObj):
1239 _type_tag = 67
1240 __slots__ = ('join_array', 'h_value', 'array_ref')
1241
1242 def __init__(self, join_array, h_value, array_ref):
1243 # type: (bool, value_t, Token) -> None
1244 self.join_array = join_array
1245 self.h_value = h_value
1246 self.array_ref = array_ref
1247
1248 @staticmethod
1249 def CreateNull(alloc_lists=False):
1250 # type: () -> VarSubState
1251 return VarSubState(False, cast('value_t', None), cast('Token', None))
1252
1253 def PrettyTree(self, do_abbrev, trav=None):
1254 # type: (bool, Optional[TraversalState]) -> hnode_t
1255 trav = trav or TraversalState()
1256 heap_id = id(self)
1257 if heap_id in trav.seen:
1258 return hnode.AlreadySeen(heap_id)
1259 trav.seen[heap_id] = True
1260
1261 out_node = NewRecord('VarSubState')
1262 L = out_node.fields
1263
1264 x0 = hnode.Leaf('T' if self.join_array else 'F', color_e.OtherConst)
1265 L.append(Field('join_array', x0))
1266
1267 assert self.h_value is not None
1268 x1 = self.h_value.PrettyTree(do_abbrev, trav=trav)
1269 L.append(Field('h_value', x1))
1270
1271 assert self.array_ref is not None
1272 x2 = self.array_ref.PrettyTree(do_abbrev, trav=trav)
1273 L.append(Field('array_ref', x2))
1274
1275 return out_node
1276
1277class Cell(pybase.CompoundObj):
1278 _type_tag = 68
1279 __slots__ = ('exported', 'readonly', 'nameref', 'val')
1280
1281 def __init__(self, exported, readonly, nameref, val):
1282 # type: (bool, bool, bool, value_t) -> None
1283 self.exported = exported
1284 self.readonly = readonly
1285 self.nameref = nameref
1286 self.val = val
1287
1288 @staticmethod
1289 def CreateNull(alloc_lists=False):
1290 # type: () -> Cell
1291 return Cell(False, False, False, cast('value_t', None))
1292
1293 def PrettyTree(self, do_abbrev, trav=None):
1294 # type: (bool, Optional[TraversalState]) -> hnode_t
1295 trav = trav or TraversalState()
1296 heap_id = id(self)
1297 if heap_id in trav.seen:
1298 return hnode.AlreadySeen(heap_id)
1299 trav.seen[heap_id] = True
1300
1301 out_node = NewRecord('Cell')
1302 L = out_node.fields
1303
1304 x0 = hnode.Leaf('T' if self.exported else 'F', color_e.OtherConst)
1305 L.append(Field('exported', x0))
1306
1307 x1 = hnode.Leaf('T' if self.readonly else 'F', color_e.OtherConst)
1308 L.append(Field('readonly', x1))
1309
1310 x2 = hnode.Leaf('T' if self.nameref else 'F', color_e.OtherConst)
1311 L.append(Field('nameref', x2))
1312
1313 assert self.val is not None
1314 x3 = self.val.PrettyTree(do_abbrev, trav=trav)
1315 L.append(Field('val', x3))
1316
1317 return out_node
1318
1319class VTestPlace(pybase.CompoundObj):
1320 _type_tag = 69
1321 __slots__ = ('name', 'index')
1322
1323 def __init__(self, name, index):
1324 # type: (Optional[str], Optional[a_index_t]) -> None
1325 self.name = name
1326 self.index = index
1327
1328 @staticmethod
1329 def CreateNull(alloc_lists=False):
1330 # type: () -> VTestPlace
1331 return VTestPlace(cast('Optional[str]', None), cast('Optional[a_index_t]', None))
1332
1333 def PrettyTree(self, do_abbrev, trav=None):
1334 # type: (bool, Optional[TraversalState]) -> hnode_t
1335 trav = trav or TraversalState()
1336 heap_id = id(self)
1337 if heap_id in trav.seen:
1338 return hnode.AlreadySeen(heap_id)
1339 trav.seen[heap_id] = True
1340
1341 out_node = NewRecord('VTestPlace')
1342 L = out_node.fields
1343
1344 if self.name is not None: # Optional
1345 x0 = NewLeaf(self.name, color_e.StringConst)
1346 L.append(Field('name', x0))
1347
1348 if self.index is not None: # Optional
1349 x1 = self.index.PrettyTree(do_abbrev, trav=trav)
1350 L.append(Field('index', x1))
1351
1352 return out_node
1353
1354class RedirValue(pybase.CompoundObj):
1355 _type_tag = 70
1356 __slots__ = ('op_id', 'op_loc', 'loc', 'arg')
1357
1358 def __init__(self, op_id, op_loc, loc, arg):
1359 # type: (Id_t, loc_t, redir_loc_t, redirect_arg_t) -> None
1360 self.op_id = op_id
1361 self.op_loc = op_loc
1362 self.loc = loc
1363 self.arg = arg
1364
1365 @staticmethod
1366 def CreateNull(alloc_lists=False):
1367 # type: () -> RedirValue
1368 return RedirValue(-1, cast('loc_t', None), cast('redir_loc_t', None), cast('redirect_arg_t', None))
1369
1370 def PrettyTree(self, do_abbrev, trav=None):
1371 # type: (bool, Optional[TraversalState]) -> hnode_t
1372 trav = trav or TraversalState()
1373 heap_id = id(self)
1374 if heap_id in trav.seen:
1375 return hnode.AlreadySeen(heap_id)
1376 trav.seen[heap_id] = True
1377
1378 out_node = NewRecord('RedirValue')
1379 L = out_node.fields
1380
1381 x0 = hnode.Leaf(Id_str(self.op_id, dot=False), color_e.UserType)
1382 L.append(Field('op_id', x0))
1383
1384 assert self.op_loc is not None
1385 x1 = self.op_loc.PrettyTree(do_abbrev, trav=trav)
1386 L.append(Field('op_loc', x1))
1387
1388 assert self.loc is not None
1389 x2 = self.loc.PrettyTree(do_abbrev, trav=trav)
1390 L.append(Field('loc', x2))
1391
1392 assert self.arg is not None
1393 x3 = self.arg.PrettyTree(do_abbrev, trav=trav)
1394 L.append(Field('arg', x3))
1395
1396 return out_node
1397
1398class StatusArray(pybase.CompoundObj):
1399 _type_tag = 71
1400 __slots__ = ('codes', 'locs')
1401
1402 def __init__(self, codes, locs):
1403 # type: (Optional[List[int]], Optional[List[loc_t]]) -> None
1404 self.codes = codes
1405 self.locs = locs
1406
1407 @staticmethod
1408 def CreateNull(alloc_lists=False):
1409 # type: () -> StatusArray
1410 return StatusArray(cast('Optional[List[int]]', None), cast('Optional[List[loc_t]]', None))
1411
1412 def PrettyTree(self, do_abbrev, trav=None):
1413 # type: (bool, Optional[TraversalState]) -> hnode_t
1414 trav = trav or TraversalState()
1415 heap_id = id(self)
1416 if heap_id in trav.seen:
1417 return hnode.AlreadySeen(heap_id)
1418 trav.seen[heap_id] = True
1419
1420 out_node = NewRecord('StatusArray')
1421 L = out_node.fields
1422
1423 if self.codes is not None: # List
1424 x0 = hnode.Array([])
1425 for i0 in self.codes:
1426 x0.children.append(hnode.Leaf(str(i0), color_e.OtherConst))
1427 L.append(Field('codes', x0))
1428
1429 if self.locs is not None: # List
1430 x1 = hnode.Array([])
1431 for i1 in self.locs:
1432 h = (hnode.Leaf("_", color_e.OtherConst) if i1 is None else
1433 i1.PrettyTree(do_abbrev, trav=trav))
1434 x1.children.append(h)
1435 L.append(Field('locs', x1))
1436
1437 return out_node
1438
1439class CommandStatus(pybase.CompoundObj):
1440 _type_tag = 72
1441 __slots__ = ('check_errexit', 'show_code', 'pipe_negated', 'pipe_status',
1442 'pipe_locs')
1443
1444 def __init__(self, check_errexit, show_code, pipe_negated, pipe_status,
1445 pipe_locs):
1446 # type: (bool, bool, bool, Optional[List[int]], Optional[List[loc_t]]) -> None
1447 self.check_errexit = check_errexit
1448 self.show_code = show_code
1449 self.pipe_negated = pipe_negated
1450 self.pipe_status = pipe_status
1451 self.pipe_locs = pipe_locs
1452
1453 @staticmethod
1454 def CreateNull(alloc_lists=False):
1455 # type: () -> CommandStatus
1456 return CommandStatus(False, False, False, cast('Optional[List[int]]', None), cast('Optional[List[loc_t]]', None))
1457
1458 def PrettyTree(self, do_abbrev, trav=None):
1459 # type: (bool, Optional[TraversalState]) -> hnode_t
1460 trav = trav or TraversalState()
1461 heap_id = id(self)
1462 if heap_id in trav.seen:
1463 return hnode.AlreadySeen(heap_id)
1464 trav.seen[heap_id] = True
1465
1466 out_node = NewRecord('CommandStatus')
1467 L = out_node.fields
1468
1469 x0 = hnode.Leaf('T' if self.check_errexit else 'F', color_e.OtherConst)
1470 L.append(Field('check_errexit', x0))
1471
1472 x1 = hnode.Leaf('T' if self.show_code else 'F', color_e.OtherConst)
1473 L.append(Field('show_code', x1))
1474
1475 x2 = hnode.Leaf('T' if self.pipe_negated else 'F', color_e.OtherConst)
1476 L.append(Field('pipe_negated', x2))
1477
1478 if self.pipe_status is not None: # List
1479 x3 = hnode.Array([])
1480 for i3 in self.pipe_status:
1481 x3.children.append(hnode.Leaf(str(i3), color_e.OtherConst))
1482 L.append(Field('pipe_status', x3))
1483
1484 if self.pipe_locs is not None: # List
1485 x4 = hnode.Array([])
1486 for i4 in self.pipe_locs:
1487 h = (hnode.Leaf("_", color_e.OtherConst) if i4 is None else
1488 i4.PrettyTree(do_abbrev, trav=trav))
1489 x4.children.append(h)
1490 L.append(Field('pipe_locs', x4))
1491
1492 return out_node
1493
1494class HayNode(pybase.CompoundObj):
1495 _type_tag = 73
1496 __slots__ = ('children',)
1497
1498 def __init__(self, children):
1499 # type: (Dict[str, HayNode]) -> None
1500 self.children = children
1501
1502 @staticmethod
1503 def CreateNull(alloc_lists=False):
1504 # type: () -> HayNode
1505 return HayNode(cast('Dict[str, HayNode]', None))
1506
1507 def PrettyTree(self, do_abbrev, trav=None):
1508 # type: (bool, Optional[TraversalState]) -> hnode_t
1509 trav = trav or TraversalState()
1510 heap_id = id(self)
1511 if heap_id in trav.seen:
1512 return hnode.AlreadySeen(heap_id)
1513 trav.seen[heap_id] = True
1514
1515 out_node = NewRecord('HayNode')
1516 L = out_node.fields
1517
1518 if self.children is not None: # Dict
1519 unnamed0 = [] # type: List[hnode_t]
1520 x0 = hnode.Record("", "{", "}", [], unnamed0)
1521 for k0, v0 in self.children.iteritems():
1522 unnamed0.append(NewLeaf(k0, color_e.StringConst))
1523 unnamed0.append(v0.PrettyTree(do_abbrev, trav=trav))
1524 L.append(Field('children', x0))
1525
1526 return out_node
1527