return;
}
-sub link_sequence_items {
-
- # This has been merged into 'respace_tokens' but retained for reference
- my $self = shift;
- my $rlines = $self->[_rlines_];
- my $rLL = $self->[_rLL_];
-
- # We walk the token list and make links to the next sequence item.
- # We also define these hashes to container tokens using sequence number as
- # the key:
- my $K_opening_container = {}; # opening [ { or (
- my $K_closing_container = {}; # closing ] } or )
- my $K_opening_ternary = {}; # opening ? of ternary
- my $K_closing_ternary = {}; # closing : of ternary
-
- # sub to link preceding nodes forward to a new node type
- my $link_back = sub {
- my ( $Ktop, $key ) = @_;
-
- my $Kprev = $Ktop - 1;
- while ( $Kprev >= 0
- && !defined( $rLL->[$Kprev]->[$key] ) )
- {
- $rLL->[$Kprev]->[$key] = $Ktop;
- $Kprev -= 1;
- }
- };
-
- for ( my $KK = 0 ; $KK < @{$rLL} ; $KK++ ) {
-
- $rLL->[$KK]->[_KNEXT_SEQ_ITEM_] = undef;
-
- my $type = $rLL->[$KK]->[_TYPE_];
-
- next if ( $type eq 'b' );
-
- my $type_sequence = $rLL->[$KK]->[_TYPE_SEQUENCE_];
- if ($type_sequence) {
-
- $link_back->( $KK, _KNEXT_SEQ_ITEM_ );
-
- my $token = $rLL->[$KK]->[_TOKEN_];
- if ( $is_opening_token{$token} ) {
-
- $K_opening_container->{$type_sequence} = $KK;
- }
- elsif ( $is_closing_token{$token} ) {
-
- $K_closing_container->{$type_sequence} = $KK;
- }
-
- # These are not yet used but could be useful
- else {
- if ( $token eq '?' ) {
- $K_opening_ternary->{$type_sequence} = $KK;
- }
- elsif ( $token eq ':' ) {
- $K_closing_ternary->{$type_sequence} = $KK;
- }
- else {
- Fault(<<EOM);
-Unknown sequenced token type '$type'. Expecting one of '{[(?:)]}'
-EOM
- }
- }
- }
- }
-
- $self->[_K_opening_container_] = $K_opening_container;
- $self->[_K_closing_container_] = $K_closing_container;
- $self->[_K_opening_ternary_] = $K_opening_ternary;
- $self->[_K_closing_ternary_] = $K_closing_ternary;
- return;
-}
-
sub resync_lines_and_tokens {
my $self = shift;