sub split_words {
- # given a string containing words separated by whitespace,
- # return the list of words
+ # Given: a string containing words separated by whitespace,
+ # Return: the corresponding list of words
my ($str) = @_;
return unless defined($str);
$str =~ s/\s+$//;
sub K_next_code {
my ( $self, $KK, $rLL ) = @_;
- # return the index of the next nonblank, non-comment token after $KK
# Given:
- # $KK = index of the token in $rLL
- # $rLL = optional array to use (default is $self->[_rLL_])
+ # $KK = index of a token in $rLL
+ # $rLL = optional token array to use (default is $self->[_rLL_])
+ # Return:
+ # The index of the next nonblank, non-comment token after $KK, or
+ # undef if none
return if ( !defined($KK) );
return if ( $KK < 0 );
sub K_next_nonblank {
my ( $self, $KK, $rLL ) = @_;
- # Return the index of the next nonblank token after $KK
# Given:
- # $KK = index of the token in $rLL
- # $rLL = optional array to use (default is $self->[_rLL_])
+ # $KK = index of a token in $rLL
+ # $rLL = optional token array to use (default is $self->[_rLL_])
+ # Return:
+ # The index of the next nonblank token after $KK, or
+ # undef if none
# NOTE: does not skip over the leading type 'q' of a hanging side comment
# (use K_next_code)
my ( $self, $KK, $rLL ) = @_;
- # Return the index of the previous nonblank, non-comment token before $KK
# Given:
- # $KK = index of the token in $rLL
- # $rLL = optional array to use (default is $self->[_rLL_])
+ # $KK = index of a token in $rLL
+ # $rLL = optional token array to use (default is $self->[_rLL_])
+ # Return:
+ # The index of the previous nonblank, non-comment token after $KK, or
+ # undef if none
# Call with $KK=undef to start search at the top of the array
# The optional third arg is useful when we are copying tokens from an old
my ( $self, $KK, $rLL ) = @_;
- # Return the index of the previous nonblank token before $KK
# Given:
- # $KK = index of the token in $rLL
- # $rLL = optional array to use (default is $self->[_rLL_])
+ # $KK = index of a token in $rLL
+ # $rLL = optional token array to use (default is $self->[_rLL_])
+ # Return:
+ # The index of the previous nonblank token after $KK, or
+ # undef if none
# Call with $KK=undef to start search at the top of the array
# NOTE: does not skip over the leading type 'q' of a hanging side comment
# Given:
# $rLL = optional token array to override default
# Return:
- # index $K of first non-blank, non-comment code token
+ # index $K of first non-blank, non-comment code token, or
+ # undef if none (no tokens in the file)
$rLL = $self->[_rLL_] unless ( defined($rLL) );
# Given:
# $rLL = optional token array to override default
# Return:
- # index of last non-blank, non-comment code token, or undef
+ # index of last non-blank, non-comment code token, or
+ # undef if none (no tokens in the file)
$rLL = $self->[_rLL_] unless ( defined($rLL) );
# any blank after the comma will be added before the closing paren,
# below
$self->store_new_token( ',', ',', $Kp );
-
}
-
return;
} ## end sub add_trailing_comma