texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sun, 29 Sep 2024 08:24:41 -0400 (EDT)

branch: master
commit 8ff6857c29f09348c1a684b5a012a88daa378336
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jun 23 20:45:05 2024 +0200

    * tp/Texinfo/ParserNonXS.pm (_in_begin_paragraph),
    tp/Texinfo/XS/parsetexi/parser.c (in_begin_paragraph): rename
    begin_paragraph_p as in_begin_paragraph.
---
 ChangeLog                        |  6 ++++++
 tp/Texinfo/ParserNonXS.pm        | 12 ++++++------
 tp/Texinfo/XS/parsetexi/parser.c | 16 +++++++++-------
 3 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6a8a12aea2..a7f213c74b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-06-23  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_in_begin_paragraph),
+       tp/Texinfo/XS/parsetexi/parser.c (in_begin_paragraph): rename
+       begin_paragraph_p as in_begin_paragraph.
+
 2024-06-23  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_begin_paragraph_p, _begin_paragraph),
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index d6a041ff9e..127346ce3a 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1359,7 +1359,7 @@ sub _parse_macro_command_line($$$$$;$)
 }
 
 # return true if in a context where paragraphs are to be started.
-sub _begin_paragraph_p($$)
+sub _in_begin_paragraph($$)
 {
   # we want to avoid
   # brace_container, brace_arg, root_line (ct_line),
@@ -2280,7 +2280,7 @@ sub _merge_text {
           my $popped_element = _pop_element_from_contents($self, $current);
           delete $popped_element->{'type'};
           $popped_element->{'text'} = $text;
-          if (_begin_paragraph_p($self, $current)) {
+          if (_in_begin_paragraph($self, $current)) {
             $current = _begin_paragraph($self, $current);
           }
           # do not jump with a goto as in C, as it is not possible
@@ -2303,7 +2303,7 @@ sub _merge_text {
           # we do not merge these special types
           $last_element = undef;
         } elsif ($last_elt_type eq 'empty_line') {
-          if (_begin_paragraph_p($self, $current)) {
+          if (_in_begin_paragraph($self, $current)) {
             $last_element->{'type'} = 'spaces_before_paragraph';
             $paragraph = _begin_paragraph($self, $current);
             $current = $paragraph;
@@ -2316,7 +2316,7 @@ sub _merge_text {
           if ($last_elt_type eq 'internal_spaces_before_context_argument') {
             _move_last_space_to_element($self, $current);
           }
-          if (_begin_paragraph_p($self, $current)) {
+          if (_in_begin_paragraph($self, $current)) {
             $current = _begin_paragraph($self, $current);
           }
           # we do not merge these special types
@@ -2324,7 +2324,7 @@ sub _merge_text {
         }
       }
     } else {
-      if (_begin_paragraph_p($self, $current)) {
+      if (_in_begin_paragraph($self, $current)) {
         $paragraph = _begin_paragraph($self, $current);
         $current = $paragraph;
       }
@@ -7456,7 +7456,7 @@ sub _process_remaining_on_line($$$$)
     }
 
     unless ($self->{'no_paragraph_commands'}->{$data_cmdname}) {
-      if (_begin_paragraph_p($self, $current)) {
+      if (_in_begin_paragraph($self, $current)) {
         $current = _begin_paragraph($self, $current);
       }
     }
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 174a21415b..01c1663ab4 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -567,7 +567,7 @@ parse_texi_document (void)
 /* If in a context where paragraphs are to be started, return 1,
    else return 0 */
 static int
-begin_paragraph_p (const ELEMENT *current)
+in_begin_paragraph (const ELEMENT *current)
 {
   /* we want to avoid
      brace_container, brace_arg, root_line (ct_line),
@@ -747,7 +747,7 @@ do_abort_empty_line (ELEMENT *current, ELEMENT *last_elt)
     }
   else if (last_elt->type == ET_empty_line)
     {
-      last_elt->type = begin_paragraph_p (current)
+      last_elt->type = in_begin_paragraph (current)
                          ? ET_spaces_before_paragraph : ET_normal_text;
     }
   else if (last_elt->type == ET_internal_spaces_after_command
@@ -821,7 +821,7 @@ merge_text (ELEMENT *current, const char *text, size_t 
len_text,
               e = pop_element_from_contents (current);
               e->type = ET_normal_text;
 
-              if (begin_paragraph_p (current))
+              if (in_begin_paragraph (current))
                 {
                   current = begin_paragraph (current);
                 }
@@ -840,10 +840,12 @@ merge_text (ELEMENT *current, const char *text, size_t 
len_text,
             }
           else if (last_elt_type == ET_empty_line)
             {
-              if (begin_paragraph_p (current))
+              if (in_begin_paragraph (current))
                 {
                   last_element->type = ET_spaces_before_paragraph;
                   current = begin_paragraph (current);
+          /* shortcut the case with text as last content child as
+             it cannot happen if a new paragraph is started */
                   goto new_text;
                 }
               /* in that case, we can merge */
@@ -853,13 +855,13 @@ merge_text (ELEMENT *current, const char *text, size_t 
len_text,
             {/* other special spaces, in general in paragraph begin context */
               if (last_elt_type == ET_internal_spaces_before_context_argument)
                 move_last_space_to_element (current);
-              if (begin_paragraph_p (current))
+              if (in_begin_paragraph (current))
                 current = begin_paragraph (current);
               /* we do not merge these special types */
               goto new_text;
             }
         }
-      else if (begin_paragraph_p (current))
+      else if (in_begin_paragraph (current))
         {
           /* NOTE a new paragraph happens necessarily after a special
              space as handled just above, or after a no_paragraph
@@ -2449,7 +2451,7 @@ process_remaining_on_line (ELEMENT **current_inout, const 
char **line_inout)
       /* check command doesn't start a paragraph */
       if (!(command_data(data_cmd).flags & CF_no_paragraph))
         {
-          if (begin_paragraph_p (current))
+          if (in_begin_paragraph (current))
             current = begin_paragraph (current);
         }
 



reply via email to

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