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): same err


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line): same error messages as the XS parser for @-commands in @end. Change a variable name.
Date: Mon, 19 Sep 2022 16:37:03 -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 20e9e95cac * tp/Texinfo/ParserNonXS.pm (_end_line): same error 
messages as the XS parser for @-commands in @end.  Change a variable name.
20e9e95cac is described below

commit 20e9e95cac21ffc04ca4d66de28e52a37b5cf6a3
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Sep 19 22:36:50 2022 +0200

    * tp/Texinfo/ParserNonXS.pm (_end_line): same error messages
    as the XS parser for @-commands in @end.  Change a variable name.
---
 ChangeLog                 |  5 +++++
 tp/Texinfo/ParserNonXS.pm | 12 ++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 2e33398e47..3b6abcea1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-09-19  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_end_line): same error messages
+       as the XS parser for @-commands in @end.  Change a variable name.
+
 2022-09-18  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Transformations.pm (complete_node_menu): handle empty
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index ad5a1a6cd0..9181ab8619 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -3231,14 +3231,14 @@ sub _end_line($$$)
           $self->_command_warn($current, $source_info,
                                __("\@%s missing argument"), $command);
         }
-        # Otherwise an error message is issued below.
+        # if there is superfluous arg, a more suitable error is issued below.
         $current->{'extra'}->{'missing_argument'} = 1;
       } else {
         $current->{'extra'}->{'text_arg'} = $text;
         if ($command eq 'end') {
           # REMACRO
-          my $line = $text;
-          if ($line =~ s/^([[:alnum:]][[:alnum:]-]+)//) {
+          my $remaining_on_line = $text;
+          if ($remaining_on_line =~ s/^([[:alnum:]][[:alnum:]-]*)//) {
             $end_command = $1;
 
             if (!exists $block_commands{$end_command}) {
@@ -3259,7 +3259,7 @@ sub _end_line($$$)
               }
             }
             # non ascii spaces are also superfluous arguments
-            if (($superfluous_arg or $line =~ /\S/)
+            if (($superfluous_arg or $remaining_on_line =~ /\S/)
                 and defined($end_command)) {
               my $texi_line
                 = Texinfo::Convert::Texinfo::convert_to_texinfo(
@@ -3267,7 +3267,7 @@ sub _end_line($$$)
               # FIXME an @-command will truncate the identifier, while it
               # could have been expanded above in $text.  Also the errors
               # are different if there are one or 2 leading letters
-              $texi_line =~ s/^\s*([[:alnum:]][[:alnum:]-]+)//;
+              $texi_line =~ s/^\s*([[:alnum:]][[:alnum:]-]*)//;
               $self->_command_error($current, $source_info,
                              __("superfluous argument to \@%s %s: %s"),
                              $command, $end_command, $texi_line);
@@ -3278,7 +3278,7 @@ sub _end_line($$$)
             # error message below
             $self->_command_error($current, $source_info,
                               __("bad argument to \@%s: %s"),
-                              $command, $line);
+                              $command, $remaining_on_line);
           }
         } elsif ($superfluous_arg) {
           # @-command effects are ignored, an error message is issued below.



reply via email to

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