texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/parser.c (process_remai


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): collect spaces at the beginning of the line to put in the last raw element, not at the end of the line.
Date: Sat, 10 Sep 2022 03:26:01 -0400

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 c52e58dbde * tp/Texinfo/XS/parsetexi/parser.c 
(process_remaining_on_line): collect spaces at the beginning of the line to put 
in the last raw element, not at the end of the line.
c52e58dbde is described below

commit c52e58dbde9b81f4f879c7936a5abc2ba3e1a046
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Sep 10 09:25:49 2022 +0200

    * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
    collect spaces at the beginning of the line to put in the last
    raw element, not at the end of the line.
---
 ChangeLog                            |   6 +
 tp/Texinfo/XS/parsetexi/parser.c     |   5 +-
 tp/t/16raw.t                         |  15 ++
 tp/t/results/raw/space_before_end.pl | 274 +++++++++++++++++++++++++++++++++++
 4 files changed, 297 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 43c68f8d70..ed4a550a1a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-10  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
+       collect spaces at the beginning of the line to put in the last
+       raw element, not at the end of the line.
+
 2022-09-09  Patrice Dumas  <pertusus@free.fr>
 
        Parse ignored raw format line like other block commands
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 0dbe37b0ba..64761f4ab8 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -1154,11 +1154,10 @@ process_remaining_on_line (ELEMENT **current_inout, 
char **line_inout)
           if (strchr (whitespace_chars, *p))
             {
               ELEMENT *e;
-              int n = strspn (line, whitespace_chars);
+              int n = strspn (p, whitespace_chars);
               e = new_element (ET_raw);
-              text_append_n (&e->text, line, n);
+              text_append_n (&e->text, p, n);
               add_to_element_contents (current, e);
-              line += n;
               line_warn ("@end %s should only appear at the "
                          "beginning of a line", command_name(end_cmd));
             }
diff --git a/tp/t/16raw.t b/tp/t/16raw.t
index 1979c0ce37..27bdb9997d 100644
--- a/tp/t/16raw.t
+++ b/tp/t/16raw.t
@@ -411,6 +411,21 @@ in html
 ',
 {'EXPANDED_FORMATS' => ['tex']}
 ],
+['space_before_end',
+'@tex
+in tex
+    @end  tex
+
+@verbatim
+in verbatim
+    @end  verbatim
+
+@html
+in html
+   @end html
+',
+{'EXPANDED_FORMATS' => ['tex']}
+],
 );
 
 my %html_tests = (
diff --git a/tp/t/results/raw/space_before_end.pl 
b/tp/t/results/raw/space_before_end.pl
new file mode 100644
index 0000000000..c23af31760
--- /dev/null
+++ b/tp/t/results/raw/space_before_end.pl
@@ -0,0 +1,274 @@
+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{'space_before_end'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [],
+              'extra' => {
+                'spaces_after_argument' => '
+'
+              },
+              'parent' => {},
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'tex',
+          'contents' => [
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => 'in tex
+'
+                },
+                {
+                  'parent' => {},
+                  'text' => '    '
+                }
+              ],
+              'parent' => {},
+              'type' => 'rawpreformatted'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'parent' => {},
+                      'text' => 'tex'
+                    }
+                  ],
+                  'extra' => {
+                    'spaces_after_argument' => '
+'
+                  },
+                  'parent' => {},
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'spaces_before_argument' => '  ',
+                'text_arg' => 'tex'
+              },
+              'parent' => {},
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              }
+            }
+          ],
+          'parent' => {},
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'parent' => {},
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [],
+              'extra' => {
+                'spaces_after_argument' => '
+'
+              },
+              'parent' => {},
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'verbatim',
+          'contents' => [
+            {
+              'parent' => {},
+              'text' => 'in verbatim
+',
+              'type' => 'raw'
+            },
+            {
+              'parent' => {},
+              'text' => '    ',
+              'type' => 'raw'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'parent' => {},
+                      'text' => 'verbatim'
+                    }
+                  ],
+                  'extra' => {
+                    'spaces_after_argument' => '
+'
+                  },
+                  'parent' => {},
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'spaces_before_argument' => '  ',
+                'text_arg' => 'verbatim'
+              },
+              'parent' => {}
+            }
+          ],
+          'parent' => {},
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 5,
+            'macro' => ''
+          }
+        },
+        {
+          'parent' => {},
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [],
+              'extra' => {
+                'spaces_after_argument' => '
+'
+              },
+              'parent' => {},
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'html',
+          'contents' => [
+            {
+              'contents' => [],
+              'parent' => {},
+              'type' => 'elided_block'
+            },
+            {
+              'parent' => {},
+              'text' => '   '
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'parent' => {},
+                      'text' => 'html'
+                    }
+                  ],
+                  'extra' => {
+                    'spaces_after_argument' => '
+'
+                  },
+                  'parent' => {},
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'spaces_before_argument' => ' ',
+                'text_arg' => 'html'
+              },
+              'parent' => {},
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 11,
+                'macro' => ''
+              }
+            }
+          ],
+          'parent' => {},
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 9,
+            'macro' => ''
+          }
+        }
+      ],
+      'parent' => {},
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'contents'}[1]{'parent'}
 = 
$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'args'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'args'}[0]{'parent'}
 = 
$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[1];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'contents'}[1]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[0]{'parent'} = 
$result_trees{'space_before_end'}{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[1]{'parent'} = 
$result_trees{'space_before_end'}{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'contents'}[0]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'contents'}[1]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'contents'}[2]{'args'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'contents'}[2]{'args'}[0]{'parent'}
 = 
$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'contents'}[2];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'contents'}[2]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[2]{'parent'} = 
$result_trees{'space_before_end'}{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[3]{'parent'} = 
$result_trees{'space_before_end'}{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'args'}[0]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'contents'}[0]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'contents'}[1]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'contents'}[2]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'contents'}[2]{'args'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'contents'}[2]{'args'}[0]{'parent'}
 = 
$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'contents'}[2];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'contents'}[2]{'parent'}
 = $result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4];
+$result_trees{'space_before_end'}{'contents'}[0]{'contents'}[4]{'parent'} = 
$result_trees{'space_before_end'}{'contents'}[0];
+$result_trees{'space_before_end'}{'contents'}[0]{'parent'} = 
$result_trees{'space_before_end'};
+
+$result_texis{'space_before_end'} = '@tex
+in tex
+    @end  tex
+
+@verbatim
+in verbatim
+    @end  verbatim
+
+@html
+   @end html
+';
+
+
+$result_texts{'space_before_end'} = '
+in verbatim
+    
+';
+
+$result_errors{'space_before_end'} = [
+  {
+    'error_line' => 'warning: @end verbatim should only appear at the 
beginning of a line
+',
+    'file_name' => '',
+    'line_nr' => 7,
+    'macro' => '',
+    'text' => '@end verbatim should only appear at the beginning of a line',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'space_before_end'} = {};
+
+
+1;



reply via email to

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