[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch release/7.1 updated: Remove parent of @include or @setfilename so
From: |
Gavin D. Smith |
Subject: |
branch release/7.1 updated: Remove parent of @include or @setfilename source mark elements |
Date: |
Sun, 02 Jun 2024 19:01:57 -0400 |
This is an automated email from the git hooks/post-receive script.
gavin pushed a commit to branch release/7.1
in repository texinfo.
The following commit(s) were added to refs/heads/release/7.1 by this push:
new bd6921dba5 Remove parent of @include or @setfilename source mark
elements
bd6921dba5 is described below
commit bd6921dba51df65ae62ac339e608837bb6f4ac88
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed May 1 15:36:11 2024 +0200
Remove parent of @include or @setfilename source mark elements
* tp/Texinfo/ParserNonXS.pm (_end_line_misc_line),
tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): remove parent
of @include or @setfilename element removed from the tree and
registered as source mark element.
* tp/Makefile.am (test_files), tp/Makefile.tres, tp/t/80include.t
(include_in_removed_before_item): add test of @include in @table
before_item after a comment that holds the source mark, with
before_item removed from the tree.
Report from Christoph.
---
ChangeLog | 16 ++
tp/Makefile.am | 1 +
tp/Makefile.tres | 1 +
tp/Texinfo/ParserNonXS.pm | 5 +-
tp/Texinfo/XS/parsetexi/end_line.c | 5 +
tp/t/80include.t | 7 +
tp/t/include/only_comment.texi | 1 +
.../include/include_in_removed_before_item.pl | 204 +++++++++++++++++++++
8 files changed, 238 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 92e2c5afe4..1f511bdf30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-05-01 Patrice Dumas <pertusus@free.fr>
+
+ Remove parent of @include or @setfilename source mark elements
+
+ * tp/Texinfo/ParserNonXS.pm (_end_line_misc_line),
+ tp/Texinfo/XS/parsetexi/end_line.c (end_line_misc_line): remove parent
+ of @include or @setfilename element removed from the tree and
+ registered as source mark element.
+
+ * tp/Makefile.am (test_files), tp/Makefile.tres, tp/t/80include.t
+ (include_in_removed_before_item): add test of @include in @table
+ before_item after a comment that holds the source mark, with
+ before_item removed from the tree.
+
+ Report from Christoph.
+
2023-12-17 Gavin Smith <gavinsmith0123@gmail.com>
Do not distribute xsubpp-generated files
diff --git a/tp/Makefile.am b/tp/Makefile.am
index d52435195a..f98cf7e6a0 100644
--- a/tp/Makefile.am
+++ b/tp/Makefile.am
@@ -166,6 +166,7 @@ test_files = \
t/include/inc_file.texi \
t/include/incl-incl.txi \
t/include/macro_included.texi \
+ t/include/only_comment.texi \
t/include/section_file.texi \
t/include/section_file_no_node.texi \
t/include/section_file_no_node_include.texi \
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index e3f6926b8d..dbe54a502a 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -735,6 +735,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/include/double_include.pl \
t/results/include/include_at_end_line.pl \
t/results/include/include_comment.pl \
+ t/results/include/include_in_removed_before_item.pl \
t/results/include/include_setfilename_on_setfilename_line.pl \
t/results/include/include_space.pl \
t/results/include/include_space_comment.pl \
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 09455e561f..8a0c9f4d38 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -3813,11 +3813,12 @@ sub _end_line_misc_line($$$)
} else {
$source_mark = { 'sourcemark_type' => $command };
}
- # this is in order to keep source marks that are within a
- # removed element. For the XS parser it is also easier to
+ # keep the elements, also keeping source marks that are within
+ # removed elements. For the XS parser it is also easier to
# manage the source mark memory which can stay associated
# to the element.
my $removed_element = _pop_element_from_contents($self, $current);
+ delete $removed_element->{'parent'};
$source_mark->{'element'} = $removed_element;
_register_source_mark($self, $current, $source_mark);
}
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index 1a5ff19bfb..81605582d0 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -1679,6 +1679,11 @@ end_line_misc_line (ELEMENT *current)
manage the source mark memory which can stay associated
to the element. */
source_mark->element = pop_element_from_contents (current);
+ /* remove parent information, as the parent could be removed
+ from the tree (case of a before_item, for example), and also
+ because it seems incorrect to consider that there is a specific
+ parent in the tree. */
+ source_mark->element->parent = 0;
register_source_mark (current, source_mark);
}
}
diff --git a/tp/t/80include.t b/tp/t/80include.t
index af43b3e548..2961e9bfe0 100644
--- a/tp/t/80include.t
+++ b/tp/t/80include.t
@@ -141,6 +141,13 @@ macro_included.texi
'@include inc_file.texi@
After.'],
+['include_in_removed_before_item',
+'@table @code
+@c source mark holder comment
+@include only_comment.texi
+@item FOO
+@end table
+'],
['include_with_setfilename',
# for now the plaintext expansion do not test anything as the setfilename in
# included files is removed from the tree. But this may change in the future.
diff --git a/tp/t/include/only_comment.texi b/tp/t/include/only_comment.texi
new file mode 100644
index 0000000000..d3b17810f5
--- /dev/null
+++ b/tp/t/include/only_comment.texi
@@ -0,0 +1 @@
+@c in here
diff --git a/tp/t/results/include/include_in_removed_before_item.pl
b/tp/t/results/include/include_in_removed_before_item.pl
new file mode 100644
index 0000000000..aee44cbc28
--- /dev/null
+++ b/tp/t/results/include/include_in_removed_before_item.pl
@@ -0,0 +1,204 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'include_in_removed_before_item'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'cmdname' => 'code',
+ 'source_info' => {
+ 'line_nr' => 1
+ },
+ 'type' => 'command_as_argument'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'block_line_arg'
+ }
+ ],
+ 'cmdname' => 'table',
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'text' => ' source mark holder comment
+',
+ 'type' => 'rawline_arg'
+ }
+ ],
+ 'cmdname' => 'c',
+ 'source_marks' => [
+ {
+ 'counter' => 1,
+ 'element' => {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'only_comment.texi'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'include',
+ 'extra' => {
+ 'text_arg' => 'only_comment.texi'
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ },
+ 'sourcemark_type' => 'include',
+ 'status' => 'start'
+ }
+ ]
+ },
+ {
+ 'args' => [
+ {
+ 'text' => ' in here
+',
+ 'type' => 'rawline_arg'
+ }
+ ],
+ 'cmdname' => 'c',
+ 'source_marks' => [
+ {
+ 'counter' => 1,
+ 'sourcemark_type' => 'include',
+ 'status' => 'end'
+ }
+ ]
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'FOO'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'item',
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 4
+ }
+ }
+ ],
+ 'type' => 'table_term'
+ }
+ ],
+ 'type' => 'table_entry'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'table'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'table'
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 5
+ }
+ }
+ ],
+ 'extra' => {
+ 'command_as_argument' => {}
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+$result_trees{'include_in_removed_before_item'}{'contents'}[0]{'contents'}[0]{'extra'}{'command_as_argument'}
=
$result_trees{'include_in_removed_before_item'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+
+$result_texis{'include_in_removed_before_item'} = '@table @code
+@c source mark holder comment
+@c in here
+@item FOO
+@end table
+';
+
+
+$result_texts{'include_in_removed_before_item'} = 'FOO
+';
+
+$result_errors{'include_in_removed_before_item'} = [];
+
+
+$result_floats{'include_in_removed_before_item'} = {};
+
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch release/7.1 updated: Remove parent of @include or @setfilename source mark elements,
Gavin D. Smith <=