texinfo-commits
[Top][All Lists]
Advanced

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

[8444] @inlineifset not closed


From: gavinsmith0123
Subject: [8444] @inlineifset not closed
Date: Mon, 29 Oct 2018 15:27:45 -0400 (EDT)

Revision: 8444
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8444
Author:   gavin
Date:     2018-10-29 15:27:45 -0400 (Mon, 29 Oct 2018)
Log Message:
-----------
@inlineifset not closed

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Parser.pm
    trunk/tp/t/55conditionals.t

Added Paths:
-----------
    trunk/tp/t/results/conditionals/inlineifset_false_not_closed.pl

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2018-10-29 19:21:35 UTC (rev 8443)
+++ trunk/ChangeLog     2018-10-29 19:27:45 UTC (rev 8444)
@@ -1,3 +1,18 @@
+2018-10-29  Gavin Smith  <address@hidden>
+
+       * tp/Texinfo/Parser.pm (_parse_texi) <inline conditionals>:
+       Avoid an infinite loop when skipping an unexpanded conditional
+       in case we run out of input.
+       * tp/t/55conditionals.t (inlineifset_false_not_closed): New test.
+
+2018-10-29  Gavin Smith  <address@hidden>
+
+       * tp/Texinfo/Parser.pm (_parse_texi) <@inlinefmtifelse>:
+       Avoid an infinite loop if there is no more input.
+       * tp/t/55conditionals.t
+       (inlineiffmtifelse_not_closed, inlineiffmtifelse_not_closed_two_arg)
+       (inlineiffmtifelse_not_closed_three_arg): New tests.
+
 2018-10-28  Gavin Smith  <address@hidden>
 
        * tp/Texinfo/Parser.pm (_check_line_directive): Fix code for

Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm  2018-10-29 19:21:35 UTC (rev 8443)
+++ trunk/tp/Texinfo/Parser.pm  2018-10-29 19:27:45 UTC (rev 8444)
@@ -5187,10 +5187,10 @@
                 } else {
                   my $new_text;
                   ($new_text, $line_nr) = _next_text($self, $line_nr);
+                  if (!$new_text) {
+                    next NEXT_LINE; # error - unbalanced brace
+                  }
                   $line .= $new_text;
-                  if (!$line) {
-                    # ERROR - unbalanced brace
-                  }
                 }
               }
               $current = $current->{'args'}->[-1];

Modified: trunk/tp/t/55conditionals.t
===================================================================
--- trunk/tp/t/55conditionals.t 2018-10-29 19:21:35 UTC (rev 8443)
+++ trunk/tp/t/55conditionals.t 2018-10-29 19:27:45 UTC (rev 8444)
@@ -473,6 +473,9 @@
 ['inlineiffmtifelse_not_closed_three_arg',
 '@inlinefmtifelse{html, hhhhh, ggggg
 '],
+['inlineifset_false_not_closed',
+'@inlineifset{aaa, bbb
+'],
 );
 
 for my $test (@test_cases) {

Added: trunk/tp/t/results/conditionals/inlineifset_false_not_closed.pl
===================================================================
--- trunk/tp/t/results/conditionals/inlineifset_false_not_closed.pl             
                (rev 0)
+++ trunk/tp/t/results/conditionals/inlineifset_false_not_closed.pl     
2018-10-29 19:27:45 UTC (rev 8444)
@@ -0,0 +1,73 @@
+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);
+
+use utf8;
+
+$result_trees{'inlineifset_false_not_closed'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => 'aaa'
+                }
+              ],
+              'parent' => {},
+              'type' => 'brace_command_arg'
+            },
+            {
+              'contents' => [],
+              'parent' => {},
+              'type' => 'elided'
+            }
+          ],
+          'cmdname' => 'inlineifset',
+          'contents' => [],
+          'extra' => {
+            'format' => 'aaa'
+          },
+          'line_nr' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          },
+          'parent' => {}
+        }
+      ],
+      'parent' => {},
+      'type' => 'paragraph'
+    }
+  ],
+  'type' => 'text_root'
+};
+$result_trees{'inlineifset_false_not_closed'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'inlineifset_false_not_closed'}{'contents'}[0]{'contents'}[0]{'args'}[0];
+$result_trees{'inlineifset_false_not_closed'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'parent'}
 = $result_trees{'inlineifset_false_not_closed'}{'contents'}[0]{'contents'}[0];
+$result_trees{'inlineifset_false_not_closed'}{'contents'}[0]{'contents'}[0]{'args'}[1]{'parent'}
 = $result_trees{'inlineifset_false_not_closed'}{'contents'}[0]{'contents'}[0];
+$result_trees{'inlineifset_false_not_closed'}{'contents'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'inlineifset_false_not_closed'}{'contents'}[0];
+$result_trees{'inlineifset_false_not_closed'}{'contents'}[0]{'parent'} = 
$result_trees{'inlineifset_false_not_closed'};
+
+$result_texis{'inlineifset_false_not_closed'} = '@inlineifset{aaa,}';
+
+
+$result_texts{'inlineifset_false_not_closed'} = '';
+
+$result_errors{'inlineifset_false_not_closed'} = [
+  {
+    'error_line' => ':1: @inlineifset missing closing brace
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => '@inlineifset missing closing brace',
+    'type' => 'error'
+  }
+];
+
+
+1;




reply via email to

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