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 (_parse_texi), tp/Tex


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_parse_texi), tp/Texinfo/XS/parsetexi/parser.c (parse_texi): ignore empty line early such that it does not go through process_remaining_on_line where an empty line leads to next_text being called. Indeed, we want the next line to come from the parse_texi next_text.
Date: Sun, 08 Jan 2023 17:30:34 -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 7a381ab357 * tp/Texinfo/ParserNonXS.pm (_parse_texi), 
tp/Texinfo/XS/parsetexi/parser.c (parse_texi): ignore empty line early such 
that it does not go through process_remaining_on_line where an empty line leads 
to next_text being called.  Indeed, we want the next line to come from the 
parse_texi next_text.
7a381ab357 is described below

commit 7a381ab357db49a3300aa699c1e2b2611f340afd
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jan 8 23:30:24 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_parse_texi),
    tp/Texinfo/XS/parsetexi/parser.c (parse_texi): ignore empty line
    early such that it does not go through process_remaining_on_line
    where an empty line leads to next_text being called.  Indeed, we want
    the next line to come from the parse_texi next_text.
---
 ChangeLog                                          |  8 +++++++
 tp/Texinfo/ParserNonXS.pm                          |  6 ++++++
 tp/Texinfo/XS/parsetexi/parser.c                   |  8 +++++++
 .../coverage/delcomment_followed_by_cpp_line.pl    | 25 ++++++----------------
 4 files changed, 29 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 36d8f62432..bd67f94de5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-01-08  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_parse_texi),
+       tp/Texinfo/XS/parsetexi/parser.c (parse_texi): ignore empty line
+       early such that it does not go through process_remaining_on_line
+       where an empty line leads to next_text being called.  Indeed, we want
+       the next line to come from the parse_texi next_text.
+
 2023-01-08  Gavin Smith  <gavinsmith0123@gmail.com>
 
        * tp/Texinfo/Convert/LaTeX.pm (_convert) <@verb>:
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 888b472847..4adc4f8669 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -6027,6 +6027,12 @@ sub _parse_texi($$$)
     my $line;
     ($line, $source_info) = _next_text($self);
     last if (!defined($line));
+    # This makes sure that there is not an empty line going in
+    # _process_remaining_on_line where there is a special case if
+    # line is empty with _next_text called, while _next_text
+    # should be called here in order to have the code right below
+    # called.
+    next if ($line eq '');
 
     if ($self->{'DEBUG'}) {
       my $source_info_text = '';
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index bdb8d78904..de4b7bbdae 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2168,6 +2168,14 @@ parse_texi (ELEMENT *root_elt, ELEMENT *current_elt)
       if (!allocated_line)
         break; /* Out of input. */
 
+      /* This makes sure that there is not an empty line going in
+         process_remaining_on_line where there is a special case if
+         line is empty with next_text called, while next_text
+         should be called here in order to have the code right below
+         called. */
+      if (*line == '\0')
+        continue;
+
       debug_nonl ("NEW LINE %s", line);
 
       /* If not in 'raw' or 'conditional' and parent isn't a 'verb',
diff --git a/tp/t/results/coverage/delcomment_followed_by_cpp_line.pl 
b/tp/t/results/coverage/delcomment_followed_by_cpp_line.pl
index 47a76c0fb0..9e71037dd6 100644
--- a/tp/t/results/coverage/delcomment_followed_by_cpp_line.pl
+++ b/tp/t/results/coverage/delcomment_followed_by_cpp_line.pl
@@ -95,23 +95,14 @@ $result_trees{'delcomment_followed_by_cpp_line'} = {
               'text' => '
 ',
               'type' => 'empty_line'
-            }
-          ],
-          'type' => 'preamble_before_content'
-        },
-        {
-          'contents' => [
+            },
             {
-              'text' => '#line 46 "a_file_after_del_comment"
-'
+              'text' => '
+',
+              'type' => 'empty_line'
             }
           ],
-          'type' => 'paragraph'
-        },
-        {
-          'text' => '
-',
-          'type' => 'empty_line'
+          'type' => 'preamble_before_content'
         },
         {
           'contents' => [
@@ -150,7 +141,6 @@ $result_texis{'delcomment_followed_by_cpp_line'} = '\\input 
texinfo
 @c this tests both the del comment and a file without
 @c element.
 
-#line 46 "a_file_after_del_comment"
 
 
 
@@ -160,7 +150,6 @@ $result_texis{'delcomment_followed_by_cpp_line'} = '\\input 
texinfo
 
 $result_texts{'delcomment_followed_by_cpp_line'} = '
 
-#line 46 "a_file_after_del_comment"
 
 
 
@@ -170,8 +159,8 @@ $result_errors{'delcomment_followed_by_cpp_line'} = [
   {
     'error_line' => 'unknown command `unknown\'
 ',
-    'file_name' => 'delcomment_followed_by_cpp_line.texi',
-    'line_nr' => 10,
+    'file_name' => 'a_file_after_del_comment',
+    'line_nr' => 48,
     'macro' => '',
     'text' => 'unknown command `unknown\'',
     'type' => 'error'



reply via email to

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