[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7969] _abort_empty_line simplify with a varible
From: |
gavinsmith0123 |
Subject: |
[7969] _abort_empty_line simplify with a varible |
Date: |
Mon, 25 Sep 2017 14:29:00 -0400 (EDT) |
Revision: 7969
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7969
Author: gavin
Date: 2017-09-25 14:28:59 -0400 (Mon, 25 Sep 2017)
Log Message:
-----------
_abort_empty_line simplify with a varible
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Parser.pm
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2017-09-24 19:59:05 UTC (rev 7968)
+++ trunk/ChangeLog 2017-09-25 18:28:59 UTC (rev 7969)
@@ -1,4 +1,8 @@
+2017-09-25 Gavin Smith <address@hidden>
+ * tp/Texinfo/Parser.pm (_abort_empty_line): Change the name of a
+ variable. Use a variable to simplify the code.
+
2017-09-24 Gavin Smith <address@hidden>
* tp/Texinfo/Parser.pm (_abort_empty_line): Remove
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2017-09-24 19:59:05 UTC (rev 7968)
+++ trunk/tp/Texinfo/Parser.pm 2017-09-25 18:28:59 UTC (rev 7969)
@@ -1,8 +1,8 @@
# $Id$
# Parser.pm: parse texinfo code into a tree.
#
-# Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016 Free Software Foundation,
-# Inc.
+# Copyright 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Free Software
+# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -2134,9 +2134,9 @@
# consisting only of spaces. This container is removed here, typically
# this is called when non-space happens on a line.
sub _abort_empty_line {
- my ($self, $current, $additional_text) = @_;
+ my ($self, $current, $additional_spaces) = @_;
- $additional_text = '' if (!defined($additional_text));
+ $additional_spaces = '' if (!defined($additional_spaces));
if ($current->{'contents'} and @{$current->{'contents'}}
and $current->{'contents'}->[-1]->{'type'}
and ($current->{'contents'}->[-1]->{'type'} eq 'empty_line'
@@ -2147,26 +2147,26 @@
my $spaces_element = $current->{'contents'}->[-1];
print STDERR "ABORT EMPTY "
- .$current->{'contents'}->[-1]->{'type'}
- ." additional text |$additional_text|,"
+ .$spaces_element->{'type'}
+ ." additional text |$additional_spaces|,"
." current |$current->{'contents'}->[-1]->{'text'}|\n"
if ($self->{'DEBUG'});
- $current->{'contents'}->[-1]->{'text'} .= $additional_text;
+ $spaces_element->{'text'} .= $additional_spaces;
# remove empty 'empty*before'.
- if ($current->{'contents'}->[-1]->{'text'} eq '') {
+ if ($spaces_element->{'text'} eq '') {
# as we remove 'empty_spaces_before_argument', 'spaces_before_argument'
# is removed from 'extra' too.
if ($current->{'extra'}
and $current->{'extra'}->{'spaces_before_argument'}
and $current->{'extra'}->{'spaces_before_argument'}
- eq $current->{'contents'}->[-1]) {
+ eq $spaces_element) {
delete ($current->{'extra'}->{'spaces_before_argument'});
delete ($current->{'extra'}) if !(keys(%{$current->{'extra'}}));
} elsif ($current->{'parent'} and $current->{'parent'}->{'extra'}
and $current->{'parent'}->{'extra'}->{'spaces_before_argument'}
and $current->{'parent'}->{'extra'}->{'spaces_before_argument'}
- eq $current->{'contents'}->[-1]) {
+ eq $spaces_element) {
delete ($current->{'parent'}->{'extra'}->{'spaces_before_argument'});
delete ($current->{'parent'}->{'extra'})
if !(keys(%{$current->{'parent'}->{'extra'}}));
@@ -2173,7 +2173,7 @@
} elsif ($current->{'extra'}
and $current->{'extra'}->{'spaces_after_command'}
and $current->{'extra'}->{'spaces_after_command'}
- eq $current->{'contents'}->[-1]) {
+ eq $spaces_element) {
delete ($current->{'extra'}->{'spaces_after_command'});
delete ($current->{'extra'})
if !(keys(%{$current->{'extra'}}));
@@ -2180,7 +2180,7 @@
} elsif ($current->{'parent'} and $current->{'parent'}->{'extra'}
and $current->{'parent'}->{'extra'}->{'spaces_after_command'}
and $current->{'parent'}->{'extra'}->{'spaces_after_command'}
- eq $current->{'contents'}->[-1]) {
+ eq $spaces_element) {
delete ($current->{'parent'}->{'extra'}->{'spaces_after_command'});
delete ($current->{'parent'}->{'extra'})
if !(keys(%{$current->{'parent'}->{'extra'}}));
@@ -2187,16 +2187,16 @@
}
pop @{$current->{'contents'}}
- } elsif ($current->{'contents'}->[-1]->{'type'} eq 'empty_line') {
+ } elsif ($spaces_element->{'type'} eq 'empty_line') {
# exactly the same condition than to begin a paragraph
if ((!$current->{'type'} or $type_with_paragraph{$current->{'type'}})
and !$no_paragraph_contexts{$self->{'context_stack'}->[-1]}) {
- $current->{'contents'}->[-1]->{'type'} =
'empty_spaces_before_paragraph';
+ $spaces_element->{'type'} = 'empty_spaces_before_paragraph';
} else {
- delete $current->{'contents'}->[-1]->{'type'};
+ delete $spaces_element->{'type'};
}
- } elsif ($current->{'contents'}->[-1]->{'type'} eq
'empty_line_after_command') {
- $current->{'contents'}->[-1]->{'type'} = 'empty_spaces_after_command';
+ } elsif ($spaces_element->{'type'} eq 'empty_line_after_command') {
+ $spaces_element->{'type'} = 'empty_spaces_after_command';
} elsif ($spaces_element->{'type'} eq 'empty_spaces_before_argument') {
# Remove element from main tree. It will still be referenced in
# the 'extra' hash as 'spaces_before_argument' or 'spaces_after_command'.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7969] _abort_empty_line simplify with a varible,
gavinsmith0123 <=