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_starting_b


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block) (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/end_line.c (end_line_starting_block), tp/Texinfo/XS/parsetexi/handle_commands.c (handle_block_command), tp/Texinfo/command_data.txt: do not handle especially conditional block commands opening in _process_remaining_on_line or handle_block_command, let non-specific code handle block command line parsing, and take care of their arguments in end_line_starting_block.
Date: Sun, 12 Feb 2023 11:40:12 -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 a6ffd1f6ee * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block) 
(_process_remaining_on_line), tp/Texinfo/XS/parsetexi/end_line.c 
(end_line_starting_block), tp/Texinfo/XS/parsetexi/handle_commands.c 
(handle_block_command), tp/Texinfo/command_data.txt: do not handle especially 
conditional block commands opening in _process_remaining_on_line or 
handle_block_command, let non-specific code handle block command line parsing, 
and take care of their arguments in end_line_starting_block.
a6ffd1f6ee is described below

commit a6ffd1f6ee0e4e0116c88776d5c8bf31dc7de7b6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Feb 12 17:35:26 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block)
    (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/end_line.c
    (end_line_starting_block), tp/Texinfo/XS/parsetexi/handle_commands.c
    (handle_block_command), tp/Texinfo/command_data.txt: do not handle
    especially conditional block commands opening in
    _process_remaining_on_line or handle_block_command, let non-specific
    code handle block command line parsing, and take care of their
    arguments in end_line_starting_block.
    
    * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
    tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): put
    ignored conditional block content in the block element.
---
 ChangeLog                                          |  15 ++
 tp/TODO                                            |   3 +
 tp/Texinfo/ParserNonXS.pm                          | 177 +++++++++++----------
 tp/Texinfo/XS/parsetexi/end_line.c                 |  95 ++++++++++-
 tp/Texinfo/XS/parsetexi/handle_commands.c          | 107 +------------
 tp/Texinfo/XS/parsetexi/handle_commands.h          |   8 +
 tp/Texinfo/XS/parsetexi/parser.c                   |   9 +-
 tp/Texinfo/command_data.txt                        |   8 +-
 .../conditionals/text_on_conditional_line.pl       |  12 +-
 .../text_on_conditional_line_expanded.pl           |  12 +-
 tp/t/results/invalid_nestings/ignored_text.pl      |  64 +++++++-
 11 files changed, 309 insertions(+), 201 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7cdff15d39..41044904f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,21 @@
        * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line):
        Avoid use of goto statements to reduce program run time.
 
+2023-02-12  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block)
+       (_process_remaining_on_line), tp/Texinfo/XS/parsetexi/end_line.c
+       (end_line_starting_block), tp/Texinfo/XS/parsetexi/handle_commands.c
+       (handle_block_command), tp/Texinfo/command_data.txt: do not handle
+       especially conditional block commands opening in
+       _process_remaining_on_line or handle_block_command, let non-specific
+       code handle block command line parsing, and take care of their
+       arguments in end_line_starting_block.
+
+       * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
+       tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): put
+       ignored conditional block content in the block element.
+
 2023-02-12  Patrice Dumas  <pertusus@free.fr>
 
        * tp/t/test_utils.pl (test): use the same expanded formats in the
diff --git a/tp/TODO b/tp/TODO
index 5bb89c24d5..67f0a9feef 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -10,6 +10,9 @@ This is the todo list for texi2any
 Before next release
 ===================
 
+invalid_nestings ignored_text test does not have the @ifinfo ignored_block
+source mark.
+
 Bugs
 ====
 
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index c44feab9c2..ddcffdc66b 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -4054,6 +4054,88 @@ sub _end_line_starting_block($$$)
                          __("unexpected argument on \@%s line: %s"),
                          $command, $texi_arg);
   }
+  if ($block_commands{$command} eq 'conditional') {
+    my $ifvalue_true = 0;
+    my $bad_line = 1;
+    if ($command eq 'ifclear' or $command eq 'ifset'
+        or $command eq 'ifcommanddefined'
+        or $command eq 'ifcommandnotdefined') {
+      if ($current->{'args'} and scalar(@{$current->{'args'}} == 1)
+          and $current->{'args'}->[0]->{'contents'}
+          and scalar(@{$current->{'args'}->[0]->{'contents'}} == 1)) {
+        if (defined($current->{'args'}->[0]->{'contents'}->[0]->{'text'})) {
+          my $name = $current->{'args'}->[0]->{'contents'}->[0]->{'text'};
+          if ($name !~ /\S/) {
+            $self->_line_error(sprintf(
+                __("%c%s requires a name"), ord('@'), $command), $source_info);
+            $bad_line = 0;
+          } else {
+            if ($command eq 'ifclear' or $command eq 'ifset') {
+              # REVALUE
+              if ($name =~ /^[\w\-][^\s{\\}~`\^+"<>|@]*$/) {
+                if ((exists($self->{'values'}->{$name}) and $command eq 
'ifset')
+                     or (!exists($self->{'values'}->{$name})
+                         and $command eq 'ifclear')) {
+                  $ifvalue_true = 1;
+                }
+                print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n"
+                                                        if ($self->{'DEBUG'});
+                $bad_line = 0;
+              }
+            } else { # $command eq 'ifcommanddefined' or 'ifcommandnotdefined'
+              # REMACRO
+              if ($name =~ /^[[:alnum:]][[:alnum:]\-]*$/) {
+                my $command_is_defined = (
+                  exists($all_commands{$name})
+                  or $self->{'macros'}->{$name}
+                  or $self->{'definfoenclose'}->{$name}
+                  or $self->{'aliases'}->{$name}
+                  or $self->{'command_index'}->{$name}
+                );
+                if (($command_is_defined
+                     and $command eq 'ifcommanddefined')
+                    or (! $command_is_defined
+                         and $command eq 'ifcommandnotdefined')) {
+                  $ifvalue_true = 1;
+                }
+                print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n"
+                                                        if ($self->{'DEBUG'});
+                $bad_line = 0;
+              }
+            }
+          }
+        }
+      } else {
+        $self->_line_error(sprintf(
+            __("%c%s requires a name"), ord('@'), $command), $source_info);
+        $bad_line = 0;
+      }
+      $self->_line_error(sprintf(
+        __("bad name for \@%s"), $command), $source_info)
+         if ($bad_line);
+    } elsif ($command =~ /^ifnot(.*)/) {
+      $ifvalue_true = 1 if !($self->{'expanded_formats_hash'}->{$1}
+                     # exception as explained in the texinfo manual
+                     or ($1 eq 'info'
+                         and $self->{'expanded_formats_hash'}->{'plaintext'}));
+      print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n"
+                                                         if ($self->{'DEBUG'});
+    } else {
+      die unless ($command =~ /^if(.*)/);
+      $ifvalue_true = 1 if ($self->{'expanded_formats_hash'}->{$1}
+              or ($1 eq 'info'
+                  and $self->{'expanded_formats_hash'}->{'plaintext'}));
+      print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n"
+                                                     if ($self->{'DEBUG'});
+    }
+    if ($ifvalue_true) {
+      my $conditional_element = $current;
+      $current = $current->{'parent'};
+      my $conditional_command = _pop_element_from_contents($self, $current);
+      die "BUG popping\n" if ($conditional_element ne $conditional_command);
+      push @{$self->{'conditional_stack'}}, $command;
+    }
+  }
   if ($block_commands{$command} eq 'menu') {
     push @{$current->{'contents'}}, {'type' => 'menu_comment',
                                      'parent' => $current,
@@ -4069,7 +4151,8 @@ sub _end_line_starting_block($$$)
     $current = $current->{'contents'}->[-1];
   }
   $current = _begin_preformatted($self, $current)
-    unless ($block_commands{$command} eq 'raw');
+    unless ($block_commands{$command} eq 'raw'
+            or $block_commands{$command} eq 'conditional');
 
   return $current;
 }
@@ -4842,10 +4925,10 @@ sub _process_remaining_on_line($$$$)
     # check for nested @ifset (so that @end ifset doesn't end the
     # outermost @ifset).  It is discarded when the outermost is.
     if (($current->{'cmdname'} eq 'ifclear'
-              or $current->{'cmdname'} eq 'ifset'
-              or $current->{'cmdname'} eq 'ifcommanddefined'
-              or $current->{'cmdname'} eq 'ifcommandnotdefined')
-            and $line =~ /^\s*\@$current->{'cmdname'}/) {
+         or $current->{'cmdname'} eq 'ifset'
+         or $current->{'cmdname'} eq 'ifcommanddefined'
+         or $current->{'cmdname'} eq 'ifcommandnotdefined')
+        and $line =~ /^\s*\@$current->{'cmdname'}/) {
       push @{$current->{'contents'}}, { 'cmdname' => $current->{'cmdname'},
                                         'parent' => $current,
                                         'contents' => [],
@@ -4867,6 +4950,10 @@ sub _process_remaining_on_line($$$$)
       $current = $current->{'parent'};
       # Remove an ignored block @if*
       my $conditional = _pop_element_from_contents($self, $current);
+      delete $conditional->{'parent'};
+      #my $source_mark = {'sourcemark_type' => 'ignored_block',
+      #                   'element' => $conditional};
+      #_register_source_mark($self, $current, $source_mark);
       if (!defined($conditional->{'cmdname'}
           or $conditional->{'cmdname'} ne $end_command)) {
         $self->_bug_message(
@@ -4877,12 +4964,16 @@ sub _process_remaining_on_line($$$$)
       print STDERR "CLOSED conditional $end_command\n" if ($self->{'DEBUG'});
       # Ignore until end of line
       # FIXME this is not the same as for other commands.  Change?
+      # FIXME only done once, could be needed more time.  Add test for this
+      # situation too.
       if ($line !~ /\n/) {
         ($line, $source_info) = _new_line($self, $current);
         print STDERR "IGNORE CLOSE line: $line" if ($self->{'DEBUG'});
       }
+    } else {
+      push @{$current->{'contents'}}, { 'type' => 'raw', 'text' => $line,
+                                        'parent' => $current, };
     }
-    # anything remaining on the line and any other line is ignored here
     return ($current, $line, $source_info, $GET_A_NEW_LINE);
     # goto funexit;  # used in XS code
   # in @verb. type should be 'brace_command_arg'
@@ -5824,80 +5915,6 @@ sub _process_remaining_on_line($$$$)
         $current = $current->{'contents'}->[-1];
         return ($current, $line, $source_info, $GET_A_NEW_LINE);
         # goto funexit;  # used in XS code
-      } elsif ($block_commands{$command} eq 'conditional') {
-        my $ifvalue_true = 0;
-        if ($command eq 'ifclear' or $command eq 'ifset') {
-          # REVALUE
-          if ($line =~ 
/^\s+([\w\-][^\s{\\}~`\^+"<>|@]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
-            my $name = $1;
-            if ((exists($self->{'values'}->{$name}) and $command eq 'ifset')
-                or (!exists($self->{'values'}->{$name})
-                     and $command eq 'ifclear')) {
-              $ifvalue_true = 1;
-            }
-            print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n"
-                                                        if ($self->{'DEBUG'});
-          } elsif ($line !~ /\S/) {
-              $self->_line_error(sprintf(
-                __("%c%s requires a name"), ord('@'), $command), $source_info);
-          } else {
-            $self->_line_error(sprintf(
-                __("bad name for \@%s"), $command), $source_info);
-          }
-        } elsif ($command eq 'ifcommanddefined'
-                 or $command eq 'ifcommandnotdefined') {
-          # REMACRO
-          if ($line =~ 
/^\s+([[:alnum:]][[:alnum:]\-]*)\s*(\@(c|comment)((\@|\s+).*)?)?$/) {
-            my $name = $1;
-            my $command_is_defined = (
-              exists($all_commands{$name})
-              or $self->{'macros'}->{$name}
-              or $self->{'definfoenclose'}->{$name}
-              or $self->{'aliases'}->{$name}
-              or $self->{'command_index'}->{$name}
-            );
-            if (($command_is_defined
-                 and $command eq 'ifcommanddefined')
-                or (! $command_is_defined
-                     and $command eq 'ifcommandnotdefined')) {
-              $ifvalue_true = 1;
-            }
-            print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n"
-                                                        if ($self->{'DEBUG'});
-          } elsif ($line !~ /\S/) {
-              $self->_line_error(sprintf(
-                __("%c%s requires a name"), ord('@'), $command), $source_info);
-          } else {
-            $self->_line_error(sprintf(
-                __("bad name for \@%s"), $command), $source_info);
-          }
-        } elsif ($command =~ /^ifnot(.*)/) {
-          $ifvalue_true = 1 if !($self->{'expanded_formats_hash'}->{$1}
-                # exception as explained in the texinfo manual
-                or ($1 eq 'info'
-                    and $self->{'expanded_formats_hash'}->{'plaintext'}));
-          print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n"
-                                                         if ($self->{'DEBUG'});
-        } else {
-          die unless ($command =~ /^if(.*)/);
-          $ifvalue_true = 1 if ($self->{'expanded_formats_hash'}->{$1}
-                  or ($1 eq 'info'
-                      and $self->{'expanded_formats_hash'}->{'plaintext'}));
-          print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n"
-                                                         if ($self->{'DEBUG'});
-        }
-        if ($ifvalue_true) {
-          push @{$self->{'conditional_stack'}}, $command;
-        } else {
-          push @{$current->{'contents'}}, { 'cmdname' => $command,
-                                            'parent' => $current,
-                                            'contents' => [] };
-          $current = $current->{'contents'}->[-1];
-        }
-        # FIXME(Karl) ignore what is remaining on the line, to eat
-        # the end of line?
-        return ($current, $line, $source_info, $GET_A_NEW_LINE);
-        # goto funexit;  # used in XS code
       } else {
         my $block;
         # a menu command closes a menu_comment, but not the other
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index cf75c1c335..a65eff37ed 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -26,6 +26,7 @@
 #include "labels.h"
 #include "indices.h"
 #include "source_marks.h"
+#include "handle_commands.h"
 
 void
 check_internal_node (NODE_SPEC_EXTRA *nse)
@@ -1345,6 +1346,97 @@ end_line_starting_block (ELEMENT *current)
                      command_name(command), texi_arg);
     }
 
+  if (command_data(command).data == BLOCK_conditional)
+    {
+      int iftrue = 0; /* Whether the conditional is true. */
+      int bad_line = 1;
+      if (command == CM_ifclear || command == CM_ifset
+          || command == CM_ifcommanddefined
+          || command == CM_ifcommandnotdefined)
+        {
+          if (current->args.number == 1
+              && current->args.list[0]->contents.number == 1)
+            {
+              ELEMENT *arg_elt = current->args.list[0]->contents.list[0];
+              if (arg_elt->text.end > 0)
+                {
+                  char *name = arg_elt->text.text;
+                  char *p = name + strspn (name, whitespace_chars);
+                  if (!*p)
+                    {
+                      line_error ("@%s requires a name", 
command_name(command));
+                      bad_line = 0;
+                    }
+                  else
+                    {
+                      char *p = name;
+                      char *flag = read_flag_name (&p);
+                      if (flag && !*p)
+                        {
+                          bad_line = 0;
+                          if (command == CM_ifclear || command == CM_ifset)
+                            {
+                              char *val = fetch_value (flag);
+                              if (val)
+                                iftrue = 1;
+                              if (command == CM_ifclear)
+                                iftrue = !iftrue;
+                            }
+                          else /* command == CM_ifcommanddefined
+                                  || command == CM_ifcommandnotdefined */
+                            {
+                              enum command_id c = lookup_command (flag);
+                              if (c)
+                                iftrue = 1;
+                              if (command == CM_ifcommandnotdefined)
+                                iftrue = !iftrue;
+                            }
+                        }
+                      free (flag);
+                    }
+                }
+            }
+          else
+            {
+              line_error ("@%s requires a name", command_name(command));
+              bad_line = 0;
+            }
+          if (bad_line)
+            line_error ("bad name for @%s", command_name(command));
+        }
+      else if (!memcmp (command_name(command), "if", 2)) /* e.g. @ifhtml */
+        {
+          int i; char *p;
+          /* Handle @if* and @ifnot* */
+
+          p = command_name(command) + 2; /* After "if". */
+          if (!memcmp (p, "not", 3))
+            p += 3; /* After "not". */
+          for (i = 0; i < sizeof (expanded_formats)/sizeof (*expanded_formats);
+               i++)
+            {
+              if (!strcmp (p, expanded_formats[i].format))
+                {
+                  iftrue = expanded_formats[i].expandedp;
+                  break;
+                }
+            }
+          if (!memcmp (command_name(command), "ifnot", 5))
+            iftrue = !iftrue;
+        }
+      else
+        bug_message ("unknown conditional command @%s", command_name(command));
+
+      debug ("CONDITIONAL %s %d", command_name(command), iftrue);
+      if (iftrue)
+        {
+          push_conditional_stack (command);
+          current = current->parent;
+          /* TODO not destroy but source mark */
+          destroy_element_and_children (pop_element_from_contents (current));
+        }
+    }
+
   if (command_data(command).data == BLOCK_menu)
     {
       /* Start reading a menu.  Processing will continue in
@@ -1362,7 +1454,8 @@ end_line_starting_block (ELEMENT *current)
       add_to_element_contents (current, rawpreformatted);
       current = rawpreformatted;
     }
-  if (command_data(command).data != BLOCK_raw)
+  if (command_data(command).data != BLOCK_raw
+      && command_data(command).data != BLOCK_conditional)
     current = begin_preformatted (current);
 
   return current;
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c 
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 0e060d7b54..ec0bab1d98 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -709,12 +709,7 @@ funexit:
   return current;
 }
 
-
-struct expanded_format {
-    char *format;
-    int expandedp;
-};
-static struct expanded_format expanded_formats[] = {
+struct expanded_format expanded_formats[] = {
     "html", 0,
     "docbook", 0,
     "plaintext", 1,
@@ -788,106 +783,6 @@ handle_block_command (ELEMENT *current, char **line_inout,
       *get_new_line = 1;
       goto funexit;
     }
-  else if (command_data(cmd).data == BLOCK_conditional)
-    {
-      int iftrue = 0; /* Whether the conditional is true. */
-      if (cmd == CM_ifclear || cmd == CM_ifset
-          || cmd == CM_ifcommanddefined || cmd == CM_ifcommandnotdefined)
-        {
-          char *p = line;
-          p = line + strspn (line, whitespace_chars);
-          if (!*p)
-            line_error ("@%s requires a name", command_name(cmd));
-          else
-            {
-              char *flag = read_flag_name (&p);
-              if (!flag)
-                goto bad_value;
-              else
-                {
-                  p += strspn (p, whitespace_chars);
-                  /* Check for a comment at the end of the line. */
-                  if (*p)
-                    {
-                      int has_comment;
-
-                      read_comment (p, &has_comment);
-                      if (!has_comment)
-                        goto bad_value;
-                    }
-                }
-              if (1)
-                {
-                  if (cmd == CM_ifclear || cmd == CM_ifset)
-                    {
-                      char *val = fetch_value (flag);
-                      if (val)
-                        iftrue = 1;
-                      if (cmd == CM_ifclear)
-                        iftrue = !iftrue;
-                    }
-                  else /* cmd == CM_ifcommanddefined
-                          || cmd == CM_ifcommandnotdefined */
-                    {
-                      enum command_id c = lookup_command (flag);
-                      if (c)
-                        iftrue = 1;
-                      if (cmd == CM_ifcommandnotdefined)
-                        iftrue = !iftrue;
-                    }
-                }
-              else if (0)
-                {
-              bad_value:
-                  line_error ("bad name for @%s", command_name(cmd));
-                }
-              free (flag);
-            }
-        }
-      else if (!memcmp (command_name(cmd), "if", 2)) /* e.g. @ifhtml */
-        {
-          int i; char *p;
-          /* Handle @if* and @ifnot* */
-
-          p = command_name(cmd) + 2; /* After "if". */
-          if (!memcmp (p, "not", 3))
-            p += 3; /* After "not". */
-          for (i = 0; i < sizeof (expanded_formats)/sizeof (*expanded_formats);
-               i++)
-            {
-              if (!strcmp (p, expanded_formats[i].format))
-                {
-                  iftrue = expanded_formats[i].expandedp;
-                  break;
-                }
-            }
-          if (!memcmp (command_name(cmd), "ifnot", 5))
-            iftrue = !iftrue;
-        }
-      else
-        bug_message ("unknown conditional command @%s", command_name(cmd));
-
-
-      /* If conditional true, push onto conditional stack.  Otherwise
-         open a new element (which we shall later remove, in
-         process_remaining_on_line ("CLOSED conditional")). */
-
-      debug ("CONDITIONAL %s %d", command_name(cmd), iftrue);
-      if (iftrue)
-        push_conditional_stack (cmd);
-      else
-        {
-          /* Ignored. */
-          ELEMENT *e;
-          e = new_element (ET_NONE);
-          e->cmd = cmd;
-          add_to_element_contents (current, e);
-          current = e;
-        }
-      line = strchr (line, '\0');
-      *get_new_line = 1;
-      goto funexit;
-    }
   else
     {
       ELEMENT *block = 0;
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.h 
b/tp/Texinfo/XS/parsetexi/handle_commands.h
index 08673a2d5c..c281d1656f 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.h
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.h
@@ -16,4 +16,12 @@ int check_no_text (ELEMENT *current);
 
 void clear_expanded_formats (void);
 void add_expanded_format (char *format);
+
+struct expanded_format {
+    char *format;
+    int expandedp;
+};
+
+extern struct expanded_format expanded_formats[7];
+
 #endif
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 6c075f54ae..e19b49cb29 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -1451,6 +1451,8 @@ process_remaining_on_line (ELEMENT **current_inout, char 
**line_inout)
           popped = pop_element_from_contents (current);
           if (popped->cmd != end_cmd)
             fatal ("command mismatch for ignored block");
+          popped->parent = 0;
+          /* TODO add source mark */
 
           /* 'line' is now advanced past the "@end ...".  Check if
              there's anything after it. */
@@ -1484,7 +1486,12 @@ process_remaining_on_line (ELEMENT **current_inout, char 
**line_inout)
           destroy_element_and_children (popped);
 
         }
-      /* anything remaining on the line and any other line is ignored here */
+      else
+        {
+          ELEMENT *e = new_element (ET_raw);
+          text_append (&(e->text), line);
+          add_to_element_contents (current, e);
+        }
       retval = GET_A_NEW_LINE;
       goto funexit;
     } /********* (ignored) BLOCK_conditional *************/
diff --git a/tp/Texinfo/command_data.txt b/tp/Texinfo/command_data.txt
index 3efa630370..860dff878b 100644
--- a/tp/Texinfo/command_data.txt
+++ b/tp/Texinfo/command_data.txt
@@ -582,8 +582,8 @@ ifplaintext             block                           
BLOCK_conditional
 ifnotplaintext          block                           BLOCK_conditional
 iflatex                 block                           BLOCK_conditional
 ifnotlatex              block                           BLOCK_conditional
-ifset                   block                           BLOCK_conditional
-ifclear                 block                           BLOCK_conditional
-ifcommanddefined        block                           BLOCK_conditional
-ifcommandnotdefined     block                           BLOCK_conditional
+ifset                   block                           BLOCK_conditional      
       1
+ifclear                 block                           BLOCK_conditional      
       1
+ifcommanddefined        block                           BLOCK_conditional      
       1
+ifcommandnotdefined     block                           BLOCK_conditional      
       1
 
diff --git a/tp/t/results/conditionals/text_on_conditional_line.pl 
b/tp/t/results/conditionals/text_on_conditional_line.pl
index 8a9cecb999..aba6f97cd6 100644
--- a/tp/t/results/conditionals/text_on_conditional_line.pl
+++ b/tp/t/results/conditionals/text_on_conditional_line.pl
@@ -19,7 +19,17 @@ $result_texis{'text_on_conditional_line'} = '';
 
 $result_texts{'text_on_conditional_line'} = '';
 
-$result_errors{'text_on_conditional_line'} = [];
+$result_errors{'text_on_conditional_line'} = [
+  {
+    'error_line' => 'warning: unexpected argument on @ifnothtml line: text 
following ifnothtml,
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'unexpected argument on @ifnothtml line: text following 
ifnothtml,',
+    'type' => 'warning'
+  }
+];
 
 
 $result_floats{'text_on_conditional_line'} = {};
diff --git a/tp/t/results/conditionals/text_on_conditional_line_expanded.pl 
b/tp/t/results/conditionals/text_on_conditional_line_expanded.pl
index 519b368216..c45cecaacb 100644
--- a/tp/t/results/conditionals/text_on_conditional_line_expanded.pl
+++ b/tp/t/results/conditionals/text_on_conditional_line_expanded.pl
@@ -32,7 +32,17 @@ $result_texis{'text_on_conditional_line_expanded'} = 'a
 $result_texts{'text_on_conditional_line_expanded'} = 'a
 ';
 
-$result_errors{'text_on_conditional_line_expanded'} = [];
+$result_errors{'text_on_conditional_line_expanded'} = [
+  {
+    'error_line' => 'warning: unexpected argument on @ifnothtml line: text 
following ifnothtml,
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'unexpected argument on @ifnothtml line: text following 
ifnothtml,',
+    'type' => 'warning'
+  }
+];
 
 
 $result_floats{'text_on_conditional_line_expanded'} = {};
diff --git a/tp/t/results/invalid_nestings/ignored_text.pl 
b/tp/t/results/invalid_nestings/ignored_text.pl
index 6b07750ced..baebe67e38 100644
--- a/tp/t/results/invalid_nestings/ignored_text.pl
+++ b/tp/t/results/invalid_nestings/ignored_text.pl
@@ -27,6 +27,43 @@ $result_trees{'ignored_text'} = {
         }
       ],
       'cmdname' => 'node',
+      'contents' => [
+        {
+          'contents' => [
+            {
+              'text' => 'in ifinfo
+'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'ifinfo on the node line'
+                    }
+                  ],
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'ifinfo on the node line'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              }
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
       'extra' => {
         'node_content' => [
           {}
@@ -58,10 +95,12 @@ $result_trees{'ignored_text'} = {
 $result_trees{'ignored_text'}{'contents'}[1]{'extra'}{'node_content'}[0] = 
$result_trees{'ignored_text'}{'contents'}[1]{'args'}[0]{'contents'}[0];
 
$result_trees{'ignored_text'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
 = $result_trees{'ignored_text'}{'contents'}[1]{'args'}[0]{'contents'}[0];
 
-$result_texis{'ignored_text'} = '@node before ignore ';
+$result_texis{'ignored_text'} = '@node before ignore in ifinfo
+@end ifinfo on the node line';
 
 
-$result_texts{'ignored_text'} = '';
+$result_texts{'ignored_text'} = 'in ifinfo
+';
 
 $result_nodes{'ignored_text'} = {
   'cmdname' => 'node',
@@ -90,13 +129,22 @@ $result_errors{'ignored_text'} = [
     'type' => 'warning'
   },
   {
-    'error_line' => 'warning: superfluous argument to @end ifinfo:  on the 
node line
+    'error_line' => 'no matching `@end ifinfo\'
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'no matching `@end ifinfo\'',
+    'type' => 'error'
+  },
+  {
+    'error_line' => 'unmatched `@end\'
 ',
     'file_name' => '',
     'line_nr' => 3,
     'macro' => '',
-    'text' => 'superfluous argument to @end ifinfo:  on the node line',
-    'type' => 'warning'
+    'text' => 'unmatched `@end\'',
+    'type' => 'error'
   }
 ];
 
@@ -105,9 +153,11 @@ $result_floats{'ignored_text'} = {};
 
 
 
-$result_converted{'plaintext'}->{'ignored_text'} = '';
+$result_converted{'plaintext'}->{'ignored_text'} = 'in ifinfo
+';
 
 
-$result_converted{'xml'}->{'ignored_text'} = '<node name="before-ignore" 
spaces=" "><nodename trailingspaces=" ">before ignore</nodename></node>';
+$result_converted{'xml'}->{'ignored_text'} = '<node name="before-ignore" 
spaces=" "><nodename trailingspaces=" ">before ignore</nodename></node><para>in 
ifinfo
+</para>';
 
 1;



reply via email to

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