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 (_parse_macro_command


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_parse_macro_command_line): reorganize code to be more similar with the corresponding C code.
Date: Tue, 24 Dec 2024 10:58:48 -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 5716d41476 * tp/Texinfo/ParserNonXS.pm (_parse_macro_command_line): 
reorganize code to be more similar with the corresponding C code.
5716d41476 is described below

commit 5716d414763b43d2cc313bbf23c53aaab70ab633
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Nov 24 18:22:33 2024 +0100

    * tp/Texinfo/ParserNonXS.pm (_parse_macro_command_line): reorganize
    code to be more similar with the corresponding C code.
---
 ChangeLog                 |  5 +++++
 tp/Texinfo/ParserNonXS.pm | 53 ++++++++++++++++++++++++-----------------------
 2 files changed, 32 insertions(+), 26 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 505c3e8f7a..a145647ed6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-11-24  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_parse_macro_command_line): reorganize
+       code to be more similar with the corresponding C code.
+
 2024-11-24  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_parse_macro_command_line),
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index de5b5901e0..dbd13544e4 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1337,40 +1337,41 @@ sub _parse_macro_command_line($$$$$;$)
     $self->_line_error(sprintf(
                     __("bad name for \@%s"), $command), $source_info);
     $macro->{'extra'} = {'invalid_syntax' => 1};
-  } else {
-    print STDERR "MACRO \@$command $macro_name\n"
+    return $macro;
+  }
+
+  print STDERR "MACRO \@$command $macro_name\n"
                            if ($self->{'conf'}->{'DEBUG'});
 
-    $macro->{'extra'} = {'macro_name' => $macro_name};
+  $macro->{'extra'} = {'macro_name' => $macro_name, 'misc_args' => []};
 
-    my $args_def = $line;
-    $args_def =~ s/^\s*//;
+  my $args_def = $line;
+  $args_def =~ s/^\s*//;
 
-    my @args;
-    if ($args_def =~ s/^{\s*(.*?)\s*}\s*//) {
-      @args = split(/\s*,\s*/, $1);
-    }
+  my @args;
+  if ($args_def =~ s/^{\s*(.*?)\s*}\s*//) {
+    @args = split(/\s*,\s*/, $1);
+  }
 
-    $macro->{'extra'}->{'misc_args'} = [];
-    foreach my $formal_arg (@args) {
-      push @{$macro->{'extra'}->{'misc_args'}}, $formal_arg;
-      if ($formal_arg !~ /^[\w\-]+$/) {
-        $self->_line_error(sprintf(__("bad or empty \@%s formal argument: %s"),
-                                   $command, $formal_arg), $source_info);
-        $macro->{'extra'}->{'invalid_syntax'} = 1;
-      }
-    }
-    # accept an @-command after the arguments in case there is a @c or
-    # @comment
-    if ($args_def =~ /^\s*[^\@]/) {
-      my $no_eol_args = $args_def;
-      chomp ($no_eol_args);
-      $self->_line_error(sprintf(__("bad syntax for \@%s argument: %s"),
-                                 $command, $no_eol_args),
-                         $source_info);
+  foreach my $formal_arg (@args) {
+    push @{$macro->{'extra'}->{'misc_args'}}, $formal_arg;
+    if ($formal_arg !~ /^[\w\-]+$/) {
+      $self->_line_error(sprintf(__("bad or empty \@%s formal argument: %s"),
+                                 $command, $formal_arg), $source_info);
       $macro->{'extra'}->{'invalid_syntax'} = 1;
     }
   }
+  # accept an @-command after the arguments in case there is a @c or
+  # @comment
+  if ($args_def =~ /^\s*[^\@]/) {
+    my $no_eol_args = $args_def;
+    chomp ($no_eol_args);
+    $self->_line_error(sprintf(__("bad syntax for \@%s argument: %s"),
+                               $command, $no_eol_args),
+                       $source_info);
+    $macro->{'extra'}->{'invalid_syntax'} = 1;
+  }
+
   return $macro;
 }
 



reply via email to

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