[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[8160] simplify abort_empty_line
From: |
gavinsmith0123 |
Subject: |
[8160] simplify abort_empty_line |
Date: |
Sat, 8 Sep 2018 20:05:42 -0400 (EDT) |
Revision: 8160
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8160
Author: gavin
Date: 2018-09-08 20:05:42 -0400 (Sat, 08 Sep 2018)
Log Message:
-----------
simplify abort_empty_line
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Parser.pm
trunk/tp/Texinfo/XS/misc.c
trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
trunk/tp/t/results/coverage/def.pl
trunk/tp/t/results/coverage/symbol_after_command.pl
trunk/tp/t/results/def/empty_def_arguments.pl
trunk/tp/t/results/indices/encoding_index_latin1.pl
trunk/tp/t/results/indices/encoding_index_latin1_enable_encoding.pl
trunk/tp/t/results/indices/encoding_index_utf8.pl
trunk/tp/t/results/indices/encoding_index_utf8_enable_encoding.pl
trunk/tp/t/results/multitable/multitable_with_empty_item_tab.pl
trunk/tp/t/results/sectioning/node_empty_direction.pl
trunk/tp/t/results/value/set_flag_command_equivalent.pl
trunk/tp/tests/layout/res_parser/navigation_no_header/navigation.html
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2018-09-08 23:00:20 UTC (rev 8159)
+++ trunk/ChangeLog 2018-09-09 00:05:42 UTC (rev 8160)
@@ -1,5 +1,17 @@
2018-09-09 Gavin Smith <address@hidden>
+ * tp/Texinfo/Parser.pm (_abort_empty_line): Always get the
+ element that refers to the space element through the 'command'
+ value. This saves the trouble of looking at $current,
+ $current->{'parent'}, $current->{'parent'}->{'parent'} etc.
+ Delete the 'spaces_after_command_elt' value properly.
+ (_parse_texi): Set 'command' on created
+ 'empty_spaces_before_argument' elements.
+ * tp/Texinfo/XS/misc.c (xs_abort_empty_line): Make the same
+ change.
+
+2018-09-09 Gavin Smith <address@hidden>
+
* tp/Texinfo/Parser.pm (_start_empty_line_after_command):
Refer to spaces element at start of line as
'spaces_after_command_elt' instead of 'spaces_after_command'.
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2018-09-08 23:00:20 UTC (rev 8159)
+++ trunk/tp/Texinfo/Parser.pm 2018-09-09 00:05:42 UTC (rev 8160)
@@ -2126,26 +2126,6 @@
if ($spaces_element->{'extra'}
and $spaces_element->{'extra'}->{'command'}) {
$owning_element = $spaces_element->{'extra'}->{'command'};
- } elsif ($current->{'extra'}
- and $current->{'extra'}->{'spaces_before_argument_elt'}
- and $current->{'extra'}->{'spaces_before_argument_elt'}
- eq $spaces_element) {
- $owning_element = $current;
- } elsif ($current->{'parent'} and $current->{'parent'}->{'extra'}
- and $current->{'parent'}->{'extra'}->{'spaces_before_argument_elt'}
- and $current->{'parent'}->{'extra'}->{'spaces_before_argument_elt'}
- eq $spaces_element) {
- $owning_element = $current->{'parent'};
- } elsif ($current->{'extra'}
- and $current->{'extra'}->{'spaces_after_command_elt'}
- and $current->{'extra'}->{'spaces_after_command_elt'}
- eq $spaces_element) {
- $owning_element = $current;
- } elsif ($current->{'parent'} and $current->{'parent'}->{'extra'}
- and $current->{'parent'}->{'extra'}->{'spaces_after_command_elt'}
- and $current->{'parent'}->{'extra'}->{'spaces_after_command_elt'}
- eq $spaces_element) {
- $owning_element = $current->{'parent'};
}
print STDERR "ABORT EMPTY "
@@ -2165,8 +2145,8 @@
delete ($owning_element->{'extra'})
if !(keys(%{$owning_element->{'extra'}}));
} elsif ($owning_element
- and $owning_element->{'extra'}->{'spaces_after_command'}) {
- delete ($owning_element->{'extra'}->{'spaces_after_command'});
+ and $owning_element->{'extra'}->{'spaces_after_command_elt'}) {
+ delete ($owning_element->{'extra'}->{'spaces_after_command_elt'});
delete ($owning_element->{'extra'})
if !(keys(%{$owning_element->{'extra'}}));
}
@@ -4394,14 +4374,8 @@
my $misc_line_args = {'type' => 'misc_line_arg',
'parent' => $misc};
$misc->{'args'} = [$misc_line_args];
- my $spaces_after_command
- = { 'type' => 'empty_spaces_after_command',
- 'text' => ' ',
- 'parent' => $misc_line_args,
- };
- $misc->{'extra'}->{'spaces_after_command'}
- = $spaces_after_command;
- $misc_line_args->{'contents'} = [ $spaces_after_command,
+ $misc->{'extra'}->{'spaces_before_argument'} = ' ';
+ $misc_line_args->{'contents'} = [
{ 'text' => $arg,
'parent' => $misc_line_args, },
{ 'text' => "\n",
@@ -4991,8 +4965,10 @@
$line =~ s/([^\S\f\n]*)//;
$current->{'type'} = 'brace_command_context';
push @{$current->{'contents'}}, { 'type' =>
'empty_spaces_before_argument',
- 'text' => $1,
- 'parent' => $current };
+ 'text' => $1,
+ 'parent' => $current,
+ 'extra' => {'command' => $current->{'parent'}}
+ };
$current->{'parent'}->{'extra'}->{'spaces_before_argument_elt'}
= $current->{'contents'}->[-1];
} else {
@@ -5002,8 +4978,10 @@
or $simple_text_commands{$command})) {
push @{$current->{'contents'}},
{'type' => 'empty_spaces_before_argument',
- 'text' => '',
- 'parent' => $current };
+ 'text' => '',
+ 'parent' => $current,
+ 'extra' => {'command' => $current}
+ };
$current->{'extra'}->{'spaces_before_argument_elt'}
= $current->{'contents'}->[-1];
}
@@ -5032,7 +5010,9 @@
push @{$current->{'contents'}},
{'type' => 'empty_spaces_before_argument',
'text' => '',
- 'parent' => $current };
+ 'parent' => $current,
+ 'extra' => {'command' => $current}
+ };
print STDERR "BRACKETED in def/multitable\n" if ($self->{'DEBUG'});
$current->{'extra'}->{'spaces_before_argument_elt'}
= $current->{'contents'}->[-1];
@@ -5442,7 +5422,9 @@
push @{$current->{'contents'}},
{'type' => 'empty_spaces_before_argument',
'text' => '',
- 'parent' => $current };
+ 'parent' => $current,
+ 'extra' => {'command' => $current}
+ };
$current->{'extra'}->{'spaces_before_argument_elt'}
= $current->{'contents'}->[-1];
} elsif ($separator eq ',' and $current->{'type'}
Modified: trunk/tp/Texinfo/XS/misc.c
===================================================================
--- trunk/tp/Texinfo/XS/misc.c 2018-09-08 23:00:20 UTC (rev 8159)
+++ trunk/tp/Texinfo/XS/misc.c 2018-09-09 00:05:42 UTC (rev 8160)
@@ -54,8 +54,7 @@
SV **svp;
int contents_num;
HV *spaces_elt;
- char *key;
- HV *test_elt;
+ //char *key;
HV *test_extra;
HV *owning_elt = 0;
@@ -114,74 +113,16 @@
if (svp)
{
test_extra = (HV *) SvRV (*svp);
- key = "command";
- svp = hv_fetch (test_extra, key, strlen (key), 0);
+ svp = hv_fetch (test_extra, "command",
+ strlen ("command"), 0);
if (svp)
{
- test_elt = (HV *) SvRV (*svp);
- svp = hv_fetch (test_elt, "extra", strlen ("extra"), 0);
+ owning_elt = (HV *) SvRV (*svp);
+ svp = hv_fetch (owning_elt, "extra", strlen ("extra"), 0);
test_extra = (HV *) SvRV (*svp);
- goto found;
}
}
- /* Look for another reference to spaces_elt. */
-
- test_elt = current;
-
- svp = hv_fetch (test_elt, "extra", strlen ("extra"), 0);
- if (svp)
- {
- test_extra = (HV *) SvRV (*svp);
- key = "spaces_before_argument_elt";
- svp = hv_fetch (test_extra, key, strlen (key), 0);
- if (svp)
- {
- if ((HV *) SvRV (*svp) == spaces_elt)
- goto found;
- }
-
- key = "spaces_after_command_elt";
- svp = hv_fetch (test_extra, key, strlen (key), 0);
- if (svp)
- {
- if ((HV *) SvRV (*svp) == spaces_elt)
- goto found;
- }
- }
-
- svp = hv_fetch (current, "parent", strlen ("parent"), 0);
- if (svp)
- {
- test_elt = (HV *) SvRV (*svp);
- svp = hv_fetch (test_elt, "extra", strlen ("extra"), 0);
- if (svp)
- {
- test_extra = (HV *) SvRV (*svp);
- key = "spaces_before_argument_elt";
- svp = hv_fetch (test_extra, key, strlen (key), 0);
- if (svp)
- {
- if ((HV *) SvRV (*svp) == spaces_elt)
- goto found;
- }
-
- key = "spaces_after_command_elt";
- svp = hv_fetch (test_extra, key, strlen (key), 0);
- if (svp)
- {
- if ((HV *) SvRV (*svp) == spaces_elt)
- goto found;
- }
- }
- }
-
- if (0)
- {
-found:
- owning_elt = test_elt;
- }
-
svp = hv_fetch (spaces_elt, "text", strlen ("text"), 0);
if (!svp)
return 0; /* or create it? change last arg from 0 to 1 */
@@ -199,12 +140,19 @@
if (owning_elt)
{
/* We found an "extra" reference to this element. Remove it. */
- hv_delete (test_extra, key, strlen (key), G_DISCARD);
+ hv_delete (test_extra,
+ "spaces_before_argument_elt",
+ strlen ("spaces_before_argument_elt"),
+ G_DISCARD);
+ hv_delete (test_extra,
+ "spaces_after_command_elt",
+ strlen ("spaces_after_command_elt"),
+ G_DISCARD);
/* If the extra hash now empty, remove it as well. */
hv_iterinit (test_extra);
if (!hv_iternext (test_extra))
- hv_delete (test_elt, "extra", strlen ("extra"), G_DISCARD);
+ hv_delete (owning_elt, "extra", strlen ("extra"), G_DISCARD);
}
}
else if (!strcmp (type, "empty_line"))
Modified:
trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
===================================================================
---
trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
2018-09-08 23:00:20 UTC (rev 8159)
+++
trunk/tp/t/results/converters_tests/at_commands_in_refs_utf8/res_info/at_commands_in_refs_utf8.info
2018-09-09 00:05:42 UTC (rev 8160)
@@ -213,10 +213,10 @@
*note ≥ ≤ →::
*note ª º ★ £ ⊣ ¿ ®:: *note ⇒ ° a b a sunny day å:: *note Å æ œ Æ Œ ø
-Ø ß ł Ł Ð ð Þ þ:: *note ä ẽ î â à é ç ē e̊ e̋ ę:: *note ė ĕ e̲ ẹ ě j ee͡::
-*note ı Ḕ Ḉ:: *note “ ” ‘ ’ „ ‚:: *note « » « » ‹ ›:: *note `` '' --- --
-` ':: *note AAA (fff) AAA BBB:: *note CCC (rrr) CCC DDD:: *note the
-someone <address@hidden> <address@hidden>:: *note [f--ile1] [image
src="f--ile.png" alt="alt" text="Image description\"\"\\."