Package pyx12 :: Module map_walker :: Class walk_tree
[hide private]

Class walk_tree

source code

object --+
         |
        walk_tree

Walks a map_if tree. Tracks loop/segment counting, missing loop/segment.

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
node
walk(self, node, seg_data, errh, seg_count, cur_line, ls_id)
Walk the node tree from the starting node to the node matching seg_data.
source code
 
_seg_not_found(self, orig_node, seg_data, errh, seg_count, cur_line, ls_id)
Create error for not found segments
source code
 
_flush_mandatory_segs(self, errh, cur_pos=None)
Handle error reporting for any outstanding missing mandatory segments
source code
boolean
_is_loop_match(self, loop_node, seg_data, errh, seg_count, cur_line, ls_id)
Try to match the current loop to the segment Handle loop and segment counting.
source code
node
_goto_seg_match(self, loop_node, seg_data, errh, seg_count, cur_line, ls_id)
A child loop has matched the segment.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

walk(self, node, seg_data, errh, seg_count, cur_line, ls_id)

source code 

Walk the node tree from the starting node to the node matching seg_data. Catch any counting or requirement errors along the way.

Handle required segment/loop missed (not found in seg) Handle found segment = Not used

Parameters:
  • node (node) - Starting node
  • seg_data (segment) - Segment object
  • seg_count (int) - Count of current segment in the ST Loop
  • cur_line (int) - Current line number in the file
  • ls_id (string) - The current LS loop identifier
Returns: node
The matching x12_node

To Do: check single segment loop repeat

_seg_not_found(self, orig_node, seg_data, errh, seg_count, cur_line, ls_id)

source code 

Create error for not found segments

Parameters:

_flush_mandatory_segs(self, errh, cur_pos=None)

source code 

Handle error reporting for any outstanding missing mandatory segments

Parameters:

_is_loop_match(self, loop_node, seg_data, errh, seg_count, cur_line, ls_id)

source code 

Try to match the current loop to the segment Handle loop and segment counting. Check for used/missing

Parameters:
Returns: boolean
Does the segment match the first segment node in the loop?

_goto_seg_match(self, loop_node, seg_data, errh, seg_count, cur_line, ls_id)

source code 

A child loop has matched the segment. Return that segment node. Handle loop counting and requirement errors.

Parameters:
  • loop_node (node) - The starting loop node.
  • seg_data (segment) - Segment object
  • errh (error_handler.err_handler) - Error handler
  • seg_count (int) - Current segment count for ST loop
  • cur_line (int) - File line counter
  • ls_id (string)
Returns: node
The matching segment node