[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Common.pm (relocate_source_marks): m
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Common.pm (relocate_source_marks): move from tp/Texinfo/ParserNonXS.pm. |
Date: |
Sat, 04 Mar 2023 16:21:13 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new 4fd9308080 * tp/Texinfo/Common.pm (relocate_source_marks): move from
tp/Texinfo/ParserNonXS.pm.
4fd9308080 is described below
commit 4fd93080805b3ed8be8511851d6f8cc377347248
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Mar 4 22:18:32 2023 +0100
* tp/Texinfo/Common.pm (relocate_source_marks): move from
tp/Texinfo/ParserNonXS.pm.
* tp/Texinfo/Common.pm (relocate_source_marks),
tp/Texinfo/ParserNonXS.pm (_isolate_last_space, _split_delimiters)
(_split_def_args), tp/Texinfo/XS/parsetexi/def.c (split_delimiters)
(split_def_args), tp/Texinfo/XS/parsetexi/parser.c
(isolate_last_space_internal), tp/Texinfo/XS/parsetexi/source_marks.c
(relocate_source_marks): pass current index and added length to
relocate_source_marks, and get the new current index in return.
* tp/Texinfo/XS/parsetexi/end_line.c (parse_node_manual),
tp/Texinfo/Common.pm (parse_node_manual): relocate source marks from
removed elements.
---
ChangeLog | 17 ++
tp/TODO | 3 -
tp/Texinfo/Common.pm | 72 ++++++-
tp/Texinfo/ParserNonXS.pm | 101 +++-------
tp/Texinfo/XS/parsetexi/def.c | 20 +-
tp/Texinfo/XS/parsetexi/end_line.c | 41 +++-
tp/Texinfo/XS/parsetexi/parser.c | 5 +-
tp/Texinfo/XS/parsetexi/source_marks.c | 17 +-
tp/Texinfo/XS/parsetexi/source_marks.h | 4 +-
tp/t/results/macro/macro_call_in_node_manual.pl | 240 ++++++++++++++++++++++++
10 files changed, 410 insertions(+), 110 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fff52819b0..e0e5e3b145 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,23 @@
* doc/texinfo.texi (Generic Definition Commands), NEWS:
Document @defblock, @defline.
+2023-03-04 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Common.pm (relocate_source_marks): move from
+ tp/Texinfo/ParserNonXS.pm.
+
+ * tp/Texinfo/Common.pm (relocate_source_marks),
+ tp/Texinfo/ParserNonXS.pm (_isolate_last_space, _split_delimiters)
+ (_split_def_args), tp/Texinfo/XS/parsetexi/def.c (split_delimiters)
+ (split_def_args), tp/Texinfo/XS/parsetexi/parser.c
+ (isolate_last_space_internal), tp/Texinfo/XS/parsetexi/source_marks.c
+ (relocate_source_marks): pass current index and added length to
+ relocate_source_marks, and get the new current index in return.
+
+ * tp/Texinfo/XS/parsetexi/end_line.c (parse_node_manual),
+ tp/Texinfo/Common.pm (parse_node_manual): relocate source marks from
+ removed elements.
+
2023-03-04 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Common.pm (parse_node_manual): use same code as XS
diff --git a/tp/TODO b/tp/TODO
index b0eb8afb3a..6e59273ebf 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -13,9 +13,6 @@ Before next release
Bugs
====
-source marks in parse_node_manual
-
-
HTML API
========
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 6b21eb1647..da0cb4b267 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -991,6 +991,56 @@ sub _count_opened_tree_braces($$)
return $braces_count;
}
+# relocate $SOURCE_MARKS source marks with position between
+# $BEGIN_POSITION and $BEGIN_POSITION + $ADDED_LEN to be relative to
+# $BEGIN_POSITION, and move to element $E.
+# return $BEGIN_POSITION + $ADDED_LEN if there were source marks
+sub relocate_source_marks($$$$)
+{
+ my $source_marks = shift;
+
+ return undef if (!$source_marks);
+
+ my $e = shift;
+ my $begin_position = shift;
+ my $added_len = shift;
+
+ my $end_position = $begin_position + $added_len;
+
+ my @indices_to_remove;
+ # collect source marks to remove starting from the beginning to keep
+ # the correct order in the $e element. Order indices to remove
+ # in the reverse order to start from the last in order not to change
+ # the array order when the entry is splice'd away.
+ for (my $i = 0; $i < scalar(@$source_marks); $i++) {
+ my $source_mark = $source_marks->[$i];
+ if (($begin_position == 0
+ and (!defined($source_marks->[$i]->{'position'})
+ # this should never happen
+ or $source_marks->[$i]->{'position'} == 0))
+ or ($source_marks->[$i]->{'position'} > $begin_position
+ and $source_marks->[$i]->{'position'} <= $end_position)) {
+ unshift @indices_to_remove, $i;
+ if ($source_mark->{'position'}) {
+ $source_mark->{'position'}
+ = $source_mark->{'position'} - $begin_position;
+ } elsif ($begin_position) {
+ warn "BUG: no $source_mark->{'position'} but $begin_position\n";
+ }
+ $e->{'source_marks'} = [] if (! defined($e->{'source_marks'}));
+ push @{$e->{'source_marks'}}, $source_mark;
+ } elsif ($source_marks->[$i]->{'position'} > $end_position) {
+ # only correct if positions are always monotonically increasing
+ # but should be the case for now
+ last;
+ }
+ }
+ foreach my $i (@indices_to_remove) {
+ splice (@$source_marks, $i, 1);
+ }
+ return $end_position;
+}
+
# retrieve a leading manual name in parentheses, if there is one.
# $LABEL_CONTENTS_CONTAINER->{'contents'} is the Texinfo for the specification
# of a node. It is relevant in any situation when a label is expected,
@@ -1026,7 +1076,6 @@ sub parse_node_manual($;$)
my $result;
my $node_content = [];
- # FIXME replace source marks
if ($contents->[0] and $contents->[0]->{'text'}
and $contents->[0]->{'text'} =~ /^\(/) {
my ($new_first, $opening_brace);
@@ -1066,6 +1115,8 @@ sub parse_node_manual($;$)
($before, $after, $braces_count) = _find_end_brace($content->{'text'},
$braces_count);
if ($braces_count == 0) {
+ my @remaining_source_marks;
+ my $current_position = 0;
# At this point, we are sure that there is a manual part,
# so the pending removal/addition of elements at the beginning
# of the manual can proceed (if modify_node).
@@ -1078,6 +1129,13 @@ sub parse_node_manual($;$)
unshift @$contents, $new_first;
unshift @$contents, $opening_brace;
$idx++;
+ if ($first->{'source_marks'}) {
+ my $current_position = relocate_source_marks(
+ $first->{'source_marks'}, $opening_brace,
+ 0, length($opening_brace->{'text'}));
+ relocate_source_marks($first->{'source_marks'}, $new_first,
+ $current_position, length($new_first->{'text'}));
+ }
}
# Remove current element $content with closing brace from the tree.
splice(@$contents, $idx, 1);
@@ -1094,6 +1152,9 @@ sub parse_node_manual($;$)
$last_manual_element->{'parent'} = $content->{'parent'};
splice(@$contents, $idx, 0, $last_manual_element);
$idx++;
+ $current_position = relocate_source_marks(
+ $content->{'source_marks'}, $last_manual_element,
+ $current_position, length($before));
}
}
if ($modify_node) {
@@ -1101,6 +1162,9 @@ sub parse_node_manual($;$)
'parent' => $content->{'parent'}};
splice(@$contents, $idx, 0, $closing_brace);
$idx++;
+ $current_position = relocate_source_marks(
+ $content->{'source_marks'}, $closing_brace,
+ $current_position, length($closing_brace->{'text'}));
}
$after =~ s/^(\s*)//;
my $spaces_after = $1;
@@ -1109,6 +1173,9 @@ sub parse_node_manual($;$)
'parent' => $content->{'parent'}};
splice(@$contents, $idx, 0, $spaces_element);
$idx++;
+ $current_position = relocate_source_marks(
+ $content->{'source_marks'}, $spaces_element,
+ $current_position, length($spaces_after));
}
if ($after ne '') {
# text after ), part of the node name.
@@ -1117,6 +1184,9 @@ sub parse_node_manual($;$)
if ($modify_node) {
$leading_node_content->{'parent'} = $content->{'parent'};
splice(@$contents, $idx, 0, $leading_node_content);
+ $current_position = relocate_source_marks(
+ $content->{'source_marks'}, $leading_node_content,
+ $current_position, length($after));
}
$idx++;
}
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 09024fa1c4..100c8de674 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2832,13 +2832,13 @@ sub _isolate_last_space
$current->{'info'}->{'spaces_after_argument'}
= $new_space_element;
} else {
- my $end_position = length($last_element->{'text'});
$last_element->{'text'} =~ s/(\s+)$//;
my $new_space_element = {'text' => $1,};
if ($last_element->{'source_marks'}) {
- my $begin_position = length($last_element->{'text'});
- _relocate_source_marks($last_element->{'source_marks'},
$new_space_element,
- $begin_position, $end_position);
+ my $current_position = length($last_element->{'text'});
+ Texinfo::Common::relocate_source_marks(
+ $last_element->{'source_marks'},
$new_space_element,
+ $current_position, length($1));
delete $last_element->{'source_marks'}
if (!scalar(@{$last_element->{'source_marks'}}));
}
@@ -2848,45 +2848,6 @@ sub _isolate_last_space
}
}
-# relocate $SOURCE_MARKS source marks with position between
-# $BEGIN_POSITION and $END_POSITION to be relative to $BEGIN_POSITION,
-# and move to element $E.
-sub _relocate_source_marks($$$$)
-{
- my $source_marks = shift;
- my $e = shift;
- my $begin_position = shift;
- my $end_position = shift;
-
- my @indices_to_remove;
- # collect source marks to remove starting from the beginning to keep
- # the correct order in the $e element. Order indices to remove
- # in the reverse order to start from the last in order not to change
- # the array order when the entry is splice'd away.
- for (my $i = 0; $i < scalar(@$source_marks); $i++) {
- my $source_mark = $source_marks->[$i];
- if (($begin_position == 0
- and (!defined($source_marks->[$i]->{'position'})
- # this should never happen
- or $source_marks->[$i]->{'position'} == 0))
- or ($source_marks->[$i]->{'position'} > $begin_position
- and $source_marks->[$i]->{'position'} <= $end_position)) {
- unshift @indices_to_remove, $i;
- $source_mark->{'position'}
- = $source_mark->{'position'} - $begin_position;
- $e->{'source_marks'} = [] if (! defined($e->{'source_marks'}));
- push @{$e->{'source_marks'}}, $source_mark;
- } elsif ($source_marks->[$i]->{'position'} > $end_position) {
- # only correct if positions are always monotonically increasing
- # but should be the case for now
- last;
- }
- }
- foreach my $i (@indices_to_remove) {
- splice (@$source_marks, $i, 1);
- }
-}
-
# split non-space text elements into strings without [ ] ( ) , and single
# character strings with one of them
sub _split_delimiters
@@ -2901,40 +2862,31 @@ sub _split_delimiters
my $type;
my $chars = quotemeta '[](),';
my $text = $root->{'text'};
- my @remaining_source_marks;
- my ($current_position, $previous_position);
+ my $remaining_source_marks;
+ my $current_position = 0;
if ($root->{'source_marks'}) {
- @remaining_source_marks = @{$root->{'source_marks'}};
- $current_position = 0;
- $previous_position = 0;
+ $remaining_source_marks = [@{$root->{'source_marks'}}];
delete $root->{'source_marks'};
}
while (1) {
if ($text =~ s/^([^$chars]+)//) {
push @elements, {'text' => $1, 'parent' => $root->{'parent'}};
- if (scalar(@remaining_source_marks)) {
- $current_position += length($1);
- _relocate_source_marks(\@remaining_source_marks, $elements[-1],
- $previous_position, $current_position);
- }
+ $current_position = Texinfo::Common::relocate_source_marks(
+ $remaining_source_marks, $elements[-1],
+ $current_position, length($1));
} elsif ($text =~ s/^([$chars])//) {
push @elements, {'text' => $1, 'type' => 'delimiter',
'parent' => $root->{'parent'}};
- if (scalar(@remaining_source_marks)) {
- $current_position += length($1);
- _relocate_source_marks(\@remaining_source_marks, $elements[-1],
- $previous_position, $current_position);
- }
+ $current_position = Texinfo::Common::relocate_source_marks(
+ $remaining_source_marks, $elements[-1],
+ $current_position, length($1));
} else {
last;
}
- if (scalar(@remaining_source_marks)) {
- $previous_position = $current_position;
- }
}
- if (scalar(@remaining_source_marks)) {
+ if ($remaining_source_marks and scalar(@$remaining_source_marks)) {
my $source_marks_str
- = join ('|', map {_debug_show_source_mark($_)}
(@remaining_source_marks));
+ = join ('|', map {_debug_show_source_mark($_)}
(@$remaining_source_marks));
$self->_bug_message(
"Remaining source mark in _split_delimiters: $source_marks_str",
$source_info, $current);
@@ -2958,21 +2910,17 @@ sub _split_def_args
if ($split_text[0] =~ /^\s*$/) {
$type = 'spaces';
}
- my @remaining_source_marks;
- my ($current_position, $previous_position);
+ my $remaining_source_marks;
+ my $current_position = 0;
if ($root->{'source_marks'}) {
- @remaining_source_marks = @{$root->{'source_marks'}};
- $current_position = 0;
- $previous_position = 0;
+ $remaining_source_marks = [@{$root->{'source_marks'}}];
$root->{'source_marks'} = undef;
}
foreach my $t (@split_text) {
my $e = {'text' => $t };
- if (scalar(@remaining_source_marks)) {
- $current_position += length($t);
- _relocate_source_marks(\@remaining_source_marks, $e,
$previous_position,
- $current_position);
- }
+ $current_position = Texinfo::Common::relocate_source_marks(
+ $remaining_source_marks, $e,
+ $current_position, length($t));
if ($type) {
$e->{'type'} = $type;
$type = undef;
@@ -2981,13 +2929,10 @@ sub _split_def_args
}
$e->{'parent'} = $root->{'parent'};
push @elements, $e;
- if (scalar(@remaining_source_marks)) {
- $previous_position = $current_position;
- }
}
- if (scalar(@remaining_source_marks)) {
+ if ($remaining_source_marks and scalar(@$remaining_source_marks)) {
my $source_marks_str
- = join ('|', map {_debug_show_source_mark($_)} @remaining_source_marks);
+ = join ('|', map {_debug_show_source_mark($_)}
@$remaining_source_marks);
$self->_bug_message(
"Remaining source mark in _split_def_args: $source_marks_str",
$source_info, $current);
diff --git a/tp/Texinfo/XS/parsetexi/def.c b/tp/Texinfo/XS/parsetexi/def.c
index 20ec3c749a..e122af8b7b 100644
--- a/tp/Texinfo/XS/parsetexi/def.c
+++ b/tp/Texinfo/XS/parsetexi/def.c
@@ -162,7 +162,6 @@ split_delimiters (ELEMENT *current, int starting_idx)
int len;
/* count UTF-8 encoded Unicode characters for source marks locations */
size_t current_position = 0;
- size_t previous_position = 0;
uint8_t *u8_text = 0;
uint8_t *u8_p;
@@ -188,16 +187,14 @@ split_delimiters (ELEMENT *current, int starting_idx)
{
u8_len = u8_mbsnlen (u8_p, 1);
u8_p += u8_len;
- current_position += u8_len;
}
- relocate_source_marks (&(e->source_mark_list), new,
- previous_position, current_position);
+ current_position = relocate_source_marks
(&(e->source_mark_list), new,
+ current_position, u8_len);
insert_into_contents (current, new, i++);
add_extra_string_dup (new, "def_role", "delimiter");
if (!*++p)
break;
- previous_position = current_position;
continue;
}
@@ -209,15 +206,13 @@ split_delimiters (ELEMENT *current, int starting_idx)
{
u8_len = u8_mbsnlen (u8_p, len);
u8_p += u8_len;
- current_position += u8_len;
}
- relocate_source_marks (&(e->source_mark_list), new,
- previous_position, current_position);
+ current_position = relocate_source_marks (&(e->source_mark_list),
new,
+ current_position, u8_len);
insert_into_contents (current, new, i++);
if (!*(p += len))
break;
- previous_position = current_position;
}
destroy_element (remove_from_contents (current, i--));
}
@@ -239,7 +234,6 @@ split_def_args (ELEMENT *current, int starting_idx)
int len;
/* count UTF-8 encoded Unicode characters for source marks locations */
size_t current_position = 0;
- size_t previous_position = 0;
uint8_t *u8_text = 0;
uint8_t *u8_p;
@@ -278,16 +272,14 @@ split_def_args (ELEMENT *current, int starting_idx)
{
u8_len = u8_mbsnlen (u8_p, len);
u8_p += u8_len;
- current_position += u8_len;
}
- relocate_source_marks (&(e->source_mark_list), new,
- previous_position, current_position);
+ current_position = relocate_source_marks (&(e->source_mark_list),
new,
+ current_position, u8_len);
text_append_n (&new->text, p, len);
insert_into_contents (current, new, i++);
if (!*(p += len))
break;
- previous_position = current_position;
}
destroy_element (remove_from_contents (current, i--));
free (u8_text);
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c
b/tp/Texinfo/XS/parsetexi/end_line.c
index e3ece6a5f4..80dac6cd13 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -957,6 +957,7 @@ parse_node_manual (ELEMENT *node, int modify_node)
add_to_contents_as_array (manual, e);
else /* end of filename component */
{
+ size_t current_position = 0;
/* At this point, we are sure that there is a manual part,
so the pending removal/addition of elements at the beginning
of the manual can proceed (if modify_node). */
@@ -970,10 +971,20 @@ parse_node_manual (ELEMENT *node, int modify_node)
/* remove the original first element and prepend the
split "(" and text elements */
remove_from_contents (node, 0); /* remove first element
*/
- destroy_element (first);
insert_into_contents (node, new_first, 0);
insert_into_contents (node, opening_brace, 0);
idx++;
+ if (first->source_mark_list.number > 0)
+ {
+ size_t current_position
+ = relocate_source_marks
(&(first->source_mark_list),
+ opening_brace, 0,
+ count_convert_u8
(opening_brace->text.text));
+ relocate_source_marks (&(first->source_mark_list),
+ new_first, current_position,
+ count_convert_u8
(new_first->text.text));
+ }
+ destroy_element (first);
}
remove_from_contents (node, idx); /* Remove current element e
with closing brace from
the tree. */
@@ -994,7 +1005,14 @@ parse_node_manual (ELEMENT *node, int modify_node)
p - e->text.text);
add_to_contents_as_array (manual, last_manual_element);
if (modify_node)
- insert_into_contents (node, last_manual_element, idx++);
+ {
+ insert_into_contents (node, last_manual_element, idx++);
+ current_position
+ = relocate_source_marks (&(e->source_mark_list),
+ last_manual_element,
+ current_position,
+ count_convert_u8 (last_manual_element->text.text));
+ }
else
result->out_of_tree_elements[1] = last_manual_element;
}
@@ -1004,6 +1022,11 @@ parse_node_manual (ELEMENT *node, int modify_node)
ELEMENT *closing_brace = new_element (0);
text_append_n (&closing_brace->text, ")", 1);
insert_into_contents (node, closing_brace, idx++);
+ current_position
+ = relocate_source_marks (&(e->source_mark_list),
+ closing_brace,
+ current_position,
+ count_convert_u8 (closing_brace->text.text));
}
/* Skip ')' and any following whitespace.
@@ -1016,6 +1039,11 @@ parse_node_manual (ELEMENT *node, int modify_node)
ELEMENT *spaces_element = new_element (0);
text_append_n (&spaces_element->text, p, q - p);
insert_into_contents (node, spaces_element, idx++);
+ current_position
+ = relocate_source_marks (&(e->source_mark_list),
+ spaces_element,
+ current_position,
+ count_convert_u8 (spaces_element->text.text));
}
p = q;
@@ -1029,7 +1057,14 @@ parse_node_manual (ELEMENT *node, int modify_node)
node_content = new_element (0);
add_to_contents_as_array (node_content,
leading_node_content);
if (modify_node)
- insert_into_contents (node, leading_node_content, idx);
+ {
+ insert_into_contents (node, leading_node_content, idx);
+ current_position
+ = relocate_source_marks (&(e->source_mark_list),
+ leading_node_content,
+ current_position,
+ count_convert_u8
(leading_node_content->text.text));
+ }
else
result->out_of_tree_elements[2] = leading_node_content;
idx++;
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 961c04fa39..b0082ca533 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -816,7 +816,6 @@ isolate_last_space_internal (ELEMENT *current)
else
{
int i, trailing_spaces;
- size_t end_position;
static TEXT t;
text_reset (&t);
@@ -831,14 +830,12 @@ isolate_last_space_internal (ELEMENT *current)
text + text_len - trailing_spaces,
trailing_spaces);
- if (last_elt->source_mark_list.number > 0)
- end_position = count_convert_u8 (text);
text[text_len - trailing_spaces] = '\0';
if (last_elt->source_mark_list.number > 0)
{
size_t begin_position = count_convert_u8 (text);
relocate_source_marks (&(last_elt->source_mark_list), spaces_element,
- begin_position, end_position);
+ begin_position, count_convert_u8 (t.text));
}
last_elt->text.end -= trailing_spaces;
diff --git a/tp/Texinfo/XS/parsetexi/source_marks.c
b/tp/Texinfo/XS/parsetexi/source_marks.c
index 67030ddc00..fe7b08b2d0 100644
--- a/tp/Texinfo/XS/parsetexi/source_marks.c
+++ b/tp/Texinfo/XS/parsetexi/source_marks.c
@@ -189,19 +189,25 @@ remove_from_source_mark_list (SOURCE_MARK_LIST *list, int
where)
}
/* relocate SOURCE_MARKS source marks with position between
- BEGIN_POSITION and END_POSITION to be relative to BEGIN_POSITION,
- and move to element E. */
-void
+ BEGIN_POSITION and BEGIN_POSITION + LEN to be relative to BEGIN_POSITION,
+ and move to element E.
+ Returns BEGIN_POSITION + LEN if there were source marks.
+*/
+size_t
relocate_source_marks (SOURCE_MARK_LIST *source_mark_list, ELEMENT *new_e,
- size_t begin_position, size_t end_position)
+ size_t begin_position, size_t len)
{
int i = 0;
int j;
int list_number = source_mark_list->number;
int *indices_to_remove;
+ size_t end_position;
if (list_number == 0)
- return;
+ return 0;
+
+ end_position = begin_position + len;
+
indices_to_remove = malloc (sizeof(int) * list_number);
memset (indices_to_remove, 0, sizeof(int) * list_number);
@@ -229,4 +235,5 @@ relocate_source_marks (SOURCE_MARK_LIST *source_mark_list,
ELEMENT *new_e,
if (indices_to_remove[j] == 1)
remove_from_source_mark_list (source_mark_list, j);
}
+ return end_position;
}
diff --git a/tp/Texinfo/XS/parsetexi/source_marks.h
b/tp/Texinfo/XS/parsetexi/source_marks.h
index 52add981fa..a1a0cbd020 100644
--- a/tp/Texinfo/XS/parsetexi/source_marks.h
+++ b/tp/Texinfo/XS/parsetexi/source_marks.h
@@ -24,8 +24,8 @@ void source_marks_reset_counters (void);
void transfer_source_marks (ELEMENT *from_e, ELEMENT *e);
void add_source_mark (SOURCE_MARK *source_mark, ELEMENT *e);
void place_source_mark (ELEMENT *e, SOURCE_MARK *source_mark);
-void relocate_source_marks (SOURCE_MARK_LIST *source_mark_list, ELEMENT *new_e,
- size_t previous_position, size_t current_position);
+size_t relocate_source_marks (SOURCE_MARK_LIST *source_mark_list, ELEMENT
*new_e,
+ size_t previous_position, size_t
current_position);
#endif
diff --git a/tp/t/results/macro/macro_call_in_node_manual.pl
b/tp/t/results/macro/macro_call_in_node_manual.pl
index 306f886290..dbe9ad5cd2 100644
--- a/tp/t/results/macro/macro_call_in_node_manual.pl
+++ b/tp/t/results/macro/macro_call_in_node_manual.pl
@@ -404,6 +404,30 @@ $result_trees{'macro_call_in_node_manual'} = {
{
'contents' => [
{
+ 'source_marks' => [
+ {
+ 'counter' => 1,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'openbrace'
+ },
+ 'type' => 'macro_call'
+ },
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ },
+ {
+ 'counter' => 1,
+ 'position' => 1,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => '('
},
{
@@ -455,9 +479,35 @@ $result_trees{'macro_call_in_node_manual'} = {
{
'contents' => [
{
+ 'source_marks' => [
+ {
+ 'counter' => 2,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'openbracetext'
+ },
+ 'type' => 'macro_call'
+ },
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ }
+ ],
'text' => '('
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 2,
+ 'position' => 5,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => 'begin'
},
{
@@ -506,9 +556,35 @@ $result_trees{'macro_call_in_node_manual'} = {
{
'contents' => [
{
+ 'source_marks' => [
+ {
+ 'counter' => 3,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'openbracetext'
+ },
+ 'type' => 'macro_call'
+ },
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ }
+ ],
'text' => '('
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 3,
+ 'position' => 5,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => 'begin'
},
{
@@ -564,9 +640,58 @@ $result_trees{'macro_call_in_node_manual'} = {
{
'contents' => [
{
+ 'source_marks' => [
+ {
+ 'counter' => 4,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'openbracetext'
+ },
+ 'type' => 'macro_call'
+ },
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ }
+ ],
'text' => '('
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 4,
+ 'position' => 5,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ },
+ {
+ 'counter' => 5,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'manualnameend'
+ },
+ 'type' => 'macro_call'
+ },
+ 'position' => 5,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ },
+ {
+ 'counter' => 5,
+ 'position' => 9,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => 'beginlast'
},
{
@@ -618,9 +743,36 @@ $result_trees{'macro_call_in_node_manual'} = {
'text' => '('
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 6,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'manualnameendbrace'
+ },
+ 'type' => 'macro_call'
+ },
+ 'position' => 3,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ }
+ ],
'text' => 'nomlast'
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 6,
+ 'position' => 1,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => ')'
},
{
@@ -676,9 +828,35 @@ $result_trees{'macro_call_in_node_manual'} = {
{
'contents' => [
{
+ 'source_marks' => [
+ {
+ 'counter' => 7,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'openbracetext'
+ },
+ 'type' => 'macro_call'
+ },
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ }
+ ],
'text' => '('
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 7,
+ 'position' => 5,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => 'begin'
},
{
@@ -721,6 +899,14 @@ $result_trees{'macro_call_in_node_manual'} = {
'text' => 'last'
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 8,
+ 'position' => 1,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => ')'
}
],
@@ -771,12 +957,39 @@ $result_trees{'macro_call_in_node_manual'} = {
'text' => '('
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 9,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'manualnameendbracespace'
+ },
+ 'type' => 'macro_call'
+ },
+ 'position' => 3,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ }
+ ],
'text' => 'nomlast'
},
{
'text' => ')'
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 9,
+ 'position' => 3,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => ' '
},
{
@@ -832,6 +1045,25 @@ $result_trees{'macro_call_in_node_manual'} = {
'text' => '('
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 10,
+ 'element' => {
+ 'args' => [
+ {
+ 'type' => 'brace_command_arg'
+ }
+ ],
+ 'extra' => {
+ 'name' => 'manualnameendbracespacetext'
+ },
+ 'type' => 'macro_call'
+ },
+ 'position' => 3,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ }
+ ],
'text' => 'nomlast'
},
{
@@ -841,6 +1073,14 @@ $result_trees{'macro_call_in_node_manual'} = {
'text' => ' '
},
{
+ 'source_marks' => [
+ {
+ 'counter' => 10,
+ 'position' => 6,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
'text' => 'mynodeand after'
}
],
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Common.pm (relocate_source_marks): move from tp/Texinfo/ParserNonXS.pm.,
Patrice Dumas <=