texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line), tp/Texin


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line), tp/Texinfo/XS/parsetexi/end_line.c (end_line): use merge_text argument to transfer source marks when reconstructing text from an aborted menu entry line.
Date: Sun, 05 Feb 2023 08:14:41 -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 d1e7c23f57 * tp/Texinfo/ParserNonXS.pm (_end_line), 
tp/Texinfo/XS/parsetexi/end_line.c (end_line): use merge_text argument to 
transfer source marks when reconstructing text from an aborted menu entry line.
d1e7c23f57 is described below

commit d1e7c23f57501ee725c822a216b1c296c1f20fb0
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Feb 5 14:14:29 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_end_line),
    tp/Texinfo/XS/parsetexi/end_line.c (end_line): use merge_text argument
    to transfer source marks when reconstructing text from an aborted menu
    entry line.
    
    * tp/Makefile.tres, tp/t/60macro.t: add macro_in_menu_comment_like_entry
    with source marks in text finally not considered as a menu entry.
---
 ChangeLog                                          |  10 +
 tp/Makefile.tres                                   |   1 +
 tp/TODO                                            |   2 -
 tp/Texinfo/ParserNonXS.pm                          |   7 +-
 tp/Texinfo/XS/parsetexi/end_line.c                 |   6 +-
 tp/t/60macro.t                                     |  10 +
 .../macro/macro_in_menu_comment_like_entry.pl      | 306 +++++++++++++++++++++
 7 files changed, 334 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index b5b4436503..827c54d06b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2023-02-05  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_end_line),
+       tp/Texinfo/XS/parsetexi/end_line.c (end_line): use merge_text argument
+       to transfer source marks when reconstructing text from an aborted menu
+       entry line.
+
+       * tp/Makefile.tres, tp/t/60macro.t: add macro_in_menu_comment_like_entry
+       with source marks in text finally not considered as a menu entry.
+
 2023-02-05  Gavin Smith <gavinsmith0123@gmail.com>
 
        No more check for basic inline content in check_valid_nesting.
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 7095cbd705..216b9c486a 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -1216,6 +1216,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/macro/macro_in_macro_arg_simpler.pl \
   t/results/macro/macro_in_menu.pl \
   t/results/macro/macro_in_menu_comment_closed_by_detailmenu.pl \
+  t/results/macro/macro_in_menu_comment_like_entry.pl \
   t/results/macro/macro_in_menu_description.pl \
   t/results/macro/macro_in_misc_commands.pl \
   t/results/macro/macro_in_multitable_empty_before_item.pl \
diff --git a/tp/TODO b/tp/TODO
index 5c5d7ea1c1..5ae03c1b80 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -28,8 +28,6 @@ Source marks of element popped can lead to empty element 
readded for the source
 mark leading to an infinite loop. Such a situation should maybe be handled in
 _pop_element_from_contents
 
-# FIXME check that source marks are transfered
-
 Test for the cases of (but how to be sure that all possibilities are tested?)
       # FIXME if first in parent and with source mark, this
       # should lead to readding an element for the source mark.
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 9245941a1d..ca499f3124 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -4076,16 +4076,17 @@ sub _end_line($$$)
         $current = $current->{'contents'}->[-1];
         print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
       }
-      # FIXME check that source marks are transfered
+      # source marks tested in t/*macro.t macro_in_menu_comment_like_entry
       while (@{$menu_entry->{'contents'}}) {
         my $arg = shift @{$menu_entry->{'contents'}};
         if (defined($arg->{'text'})) {
-          $current = _merge_text($self, $current, $arg->{'text'});
+          $current = _merge_text($self, $current, $arg->{'text'}, $arg);
         } elsif ($arg->{'contents'}) {
           while (@{$arg->{'contents'}}) {
             my $content = shift @{$arg->{'contents'}};
             if (defined($content->{'text'})) {
-              $current = _merge_text($self, $current, $content->{'text'});
+              $current = _merge_text($self, $current, $content->{'text'},
+                                     $content);
               $content = undef;
             } else {
               $content->{'parent'} = $current;
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 68df1ddc91..34114f962c 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -2255,13 +2255,13 @@ end_line (ELEMENT *current)
               debug ("THEN MENU_COMMENT OPEN");
             }
           {
-          /* FIXME check that source marks are transfered */
+          /* source marks tested in *macro.t macro_in_menu_comment_like_entry 
*/
           int i, j;
           for (i = 0; i < menu_entry->contents.number; i++)
             {
               ELEMENT *arg = contents_child_by_index(menu_entry, i);
               if (arg->text.end > 0)
-                current = merge_text (current, arg->text.text, 0);
+                current = merge_text (current, arg->text.text, arg);
               else
                 {
                   ELEMENT *e;
@@ -2270,7 +2270,7 @@ end_line (ELEMENT *current)
                       e = contents_child_by_index (arg, j);
                       if (e->text.end > 0)
                         {
-                          current = merge_text (current, e->text.text, 0);
+                          current = merge_text (current, e->text.text, e);
                           destroy_element (e);
                         }
                       else
diff --git a/tp/t/60macro.t b/tp/t/60macro.t
index 491b575749..e3cc5864b7 100644
--- a/tp/t/60macro.t
+++ b/tp/t/60macro.t
@@ -405,6 +405,16 @@ menu comment
 @end detailmenu
 @end menu
 '],
+['macro_in_menu_comment_like_entry',
+'
+@macro emptystring
+
+@end macro
+
+@menu
+*@emptystring{} a@emptystring{}5@b{b@emptystring{}}@emptystring{}: @c c
+@end menu
+'],
 ['macro_in_accent',
 '@macro aletter
 a
diff --git a/tp/t/results/macro/macro_in_menu_comment_like_entry.pl 
b/tp/t/results/macro/macro_in_menu_comment_like_entry.pl
new file mode 100644
index 0000000000..9f8e98fbeb
--- /dev/null
+++ b/tp/t/results/macro/macro_in_menu_comment_like_entry.pl
@@ -0,0 +1,306 @@
+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{'macro_in_menu_comment_like_entry'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'text' => 'emptystring',
+              'type' => 'macro_name'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'text' => '
+',
+              'type' => 'raw'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 4,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' emptystring
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 2,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'menu',
+          'contents' => [
+            {
+              'contents' => [
+                {
+                  'contents' => [
+                    {
+                      'source_marks' => [
+                        {
+                          'counter' => 1,
+                          'element' => {
+                            'args' => [
+                              {
+                                'text' => ''
+                              }
+                            ],
+                            'extra' => {
+                              'name' => 'emptystring'
+                            },
+                            'type' => 'macro_call'
+                          },
+                          'position' => 1,
+                          'sourcemark_type' => 'macro_expansion',
+                          'status' => 'start'
+                        },
+                        {
+                          'counter' => 1,
+                          'position' => 1,
+                          'sourcemark_type' => 'macro_expansion',
+                          'status' => 'end'
+                        },
+                        {
+                          'counter' => 2,
+                          'element' => {
+                            'args' => [
+                              {
+                                'text' => ''
+                              }
+                            ],
+                            'extra' => {
+                              'name' => 'emptystring'
+                            },
+                            'type' => 'macro_call'
+                          },
+                          'position' => 3,
+                          'sourcemark_type' => 'macro_expansion',
+                          'status' => 'start'
+                        },
+                        {
+                          'counter' => 2,
+                          'position' => 3,
+                          'sourcemark_type' => 'macro_expansion',
+                          'status' => 'end'
+                        }
+                      ],
+                      'text' => '* a5'
+                    },
+                    {
+                      'args' => [
+                        {
+                          'contents' => [
+                            {
+                              'source_marks' => [
+                                {
+                                  'counter' => 3,
+                                  'element' => {
+                                    'args' => [
+                                      {
+                                        'text' => ''
+                                      }
+                                    ],
+                                    'extra' => {
+                                      'name' => 'emptystring'
+                                    },
+                                    'type' => 'macro_call'
+                                  },
+                                  'position' => 1,
+                                  'sourcemark_type' => 'macro_expansion',
+                                  'status' => 'start'
+                                },
+                                {
+                                  'counter' => 3,
+                                  'position' => 1,
+                                  'sourcemark_type' => 'macro_expansion',
+                                  'status' => 'end'
+                                }
+                              ],
+                              'text' => 'b'
+                            }
+                          ],
+                          'type' => 'brace_command_arg'
+                        }
+                      ],
+                      'cmdname' => 'b',
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 7,
+                        'macro' => ''
+                      },
+                      'source_marks' => [
+                        {
+                          'counter' => 4,
+                          'element' => {
+                            'args' => [
+                              {
+                                'text' => ''
+                              }
+                            ],
+                            'extra' => {
+                              'name' => 'emptystring'
+                            },
+                            'type' => 'macro_call'
+                          },
+                          'sourcemark_type' => 'macro_expansion',
+                          'status' => 'start'
+                        },
+                        {
+                          'counter' => 4,
+                          'sourcemark_type' => 'macro_expansion',
+                          'status' => 'end'
+                        }
+                      ]
+                    },
+                    {
+                      'text' => ': '
+                    },
+                    {
+                      'args' => [
+                        {
+                          'text' => ' c
+',
+                          'type' => 'misc_arg'
+                        }
+                      ],
+                      'cmdname' => 'c',
+                      'extra' => {
+                        'misc_args' => [
+                          ' c
+'
+                        ]
+                      }
+                    }
+                  ],
+                  'type' => 'preformatted'
+                }
+              ],
+              'type' => 'menu_comment'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'menu'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'menu'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 8,
+                'macro' => ''
+              }
+            }
+          ],
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 6,
+            'macro' => ''
+          }
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'macro_in_menu_comment_like_entry'} = '
+@macro emptystring
+
+@end macro
+
+@menu
+* a5@b{b}: @c c
+@end menu
+';
+
+
+$result_texts{'macro_in_menu_comment_like_entry'} = '
+
+* a5b: ';
+
+$result_errors{'macro_in_menu_comment_like_entry'} = [];
+
+
+$result_floats{'macro_in_menu_comment_like_entry'} = {};
+
+
+1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]