def _AddNextStateToQueue(penalty, previous_node, newline, count, p_queue):
 if (newline and (not previous_node.state.CanSplit())):
  return count
 must_split = previous_node.state.MustSplit()
 if ((not newline) and must_split):
  return count
 node = _StateNode(previous_node.state, newline, previous_node)
 penalty += node.state.AddTokenToState(newline=newline, dry_run=True, must_split=must_split)
 heapq.heappush(p_queue, _QueueItem(_OrderedPenalty(penalty, count), node))
 return (count + 1)

def _AddNextStateToQueue ( penalty , previous_node , newline , count , p_queue ) : if ( newline and ( not previous_node . state . CanSplit ( ) ) ) : return count must_split = previous_node . state . MustSplit ( ) if ( ( not newline ) and must_split ) : return count node = _StateNode ( previous_node . state , newline , previous_node ) penalty += node . state . AddTokenToState ( newline = newline , dry_run = True , must_split = must_split ) heapq . heappush ( p_queue , _QueueItem ( _OrderedPenalty ( penalty , count ) , node ) ) return ( count + 1 )
add the following state to the analysis queue .