texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: An alias referring to another alias at definition


From: Patrice Dumas
Subject: branch master updated: An alias referring to another alias at definition time is resolved
Date: Wed, 01 Mar 2023 10:16:34 -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 5019594c88 An alias referring to another alias at definition time is 
resolved
5019594c88 is described below

commit 5019594c88e165b7b4c80efea8e65ed1067bfda6
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Mar 1 16:16:22 2023 +0100

    An alias referring to another alias at definition time is resolved
    
    * NEWS, tp/Texinfo/ParserNonXS.pm (_parse_line_command_args),
    tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args),
    tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): resolve
    an alias referring to another alias, at @alias defintion time.
    
    * tp/Makefile.tres, tp/t/58alias.t: add texinfo_command_alias,
    texinfo_command_alias_indirect, texinfo_command_alias_indirect_before
    and recursive_alias tests.
---
 ChangeLog                                          |  15 +-
 NEWS                                               |   1 +
 tp/Makefile.tres                                   |   4 +
 tp/Texinfo/ParserNonXS.pm                          |  23 +-
 tp/Texinfo/XS/parsetexi/end_line.c                 |  35 ++-
 tp/Texinfo/XS/parsetexi/parser.c                   |  14 +
 tp/t/58alias.t                                     |  55 +++-
 tp/t/results/alias/recursive_alias.pl              | 249 +++++++++++++++++
 tp/t/results/alias/texinfo_command_alias.pl        | 296 +++++++++++++++++++++
 .../alias/texinfo_command_alias_indirect.pl        | 234 ++++++++++++++++
 .../alias/texinfo_command_alias_indirect_before.pl | 220 +++++++++++++++
 11 files changed, 1114 insertions(+), 32 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7855af48d7..7f461fca41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,17 @@
-2023-02-29  Patrice Dumas  <pertusus@free.fr>
+2023-03-01  Patrice Dumas  <pertusus@free.fr>
+
+       An alias referring to another alias at definition time is resolved
+
+       * NEWS, tp/Texinfo/ParserNonXS.pm (_parse_line_command_args),
+       tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args),
+       tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): resolve
+       an alias referring to another alias, at @alias defintion time.
+
+       * tp/Makefile.tres, tp/t/58alias.t: add texinfo_command_alias,
+       texinfo_command_alias_indirect, texinfo_command_alias_indirect_before
+       and recursive_alias tests.
+
+2023-03-01  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line)
        (_parse_line_command_args): unset previous alias when a macro is
diff --git a/NEWS b/NEWS
index 9e8c34635b..2d2eebfbf3 100644
--- a/NEWS
+++ b/NEWS
@@ -20,6 +20,7 @@ See the manual for detailed information.
    encoded characters are output instead of entities or commands for
    HTML, XML, DocBook and LaTeX; instead, the value of the OUTPUT_CHARACTERS
    customization variable is used.
+ . An alias referring to another alias at definition time is resolved.
  . Add source marks in the tree for all Texinfo source information that
    is not in the final tree (location of macro, values and included files
    expansion, @if* blocks, DEL comment, @ protecting end of line on @def*
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 098d288a7b..245b3a6116 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -72,7 +72,11 @@ test_files_generated_list = $(test_tap_files_generated_list) 
\
   t/results/alias/alias_table_command.pl \
   t/results/alias/bad_line.pl \
   t/results/alias/block_command_alias.pl \
+  t/results/alias/recursive_alias.pl \
   t/results/alias/simple.pl \
+  t/results/alias/texinfo_command_alias.pl \
+  t/results/alias/texinfo_command_alias_indirect.pl \
+  t/results/alias/texinfo_command_alias_indirect_before.pl \
   t/results/columnfractions/empty.pl \
   t/results/columnfractions/empty_comment.pl \
   t/results/columnfractions/good.pl \
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 7067cec3fe..36da2b192b 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -5040,13 +5040,10 @@ sub _process_remaining_on_line($$$$)
     $at_command_length = length($at_command) + 1;
     $command = $at_command;
 
-    my $alias_command;
     if (exists($self->{'aliases'}->{$command})) {
-      $alias_command = $command;
       $command = $self->{'aliases'}->{$command};
     }
 
-
     # handle user defined macros before anything else since
     # their expansion may lead to changes in the line
     if ($self->{'macros'}->{$command}) {
@@ -6980,15 +6977,19 @@ sub _parse_line_command_args($$$)
                            __("environment command %s as argument to \@%s"),
                            $existing_command, $command), $source_info);
       }
-      if ($self->{'aliases'}->{$existing_command}) {
-        $self->_line_warn(sprintf(
-                           __("recursive alias definition as %s is ignored"),
-                           $existing_command), $source_info);
-      } else {
-        $self->{'aliases'}->{$new_command} = $existing_command;
-        # could be cleaner to unset macro and definfoenclosed, but
-        # not needed in practice as alias are substituted the earliest.
+
+      if (exists($self->{'aliases'}->{$existing_command})) {
+        if ($self->{'aliases'}->{$existing_command} ne $new_command) {
+          $existing_command = $self->{'aliases'}->{$existing_command};
+        } else {
+          $self->_line_warn(sprintf(
+                __("recursive alias definition of %s through %s ignored"),
+                      $new_command, $existing_command), $source_info);
+        }
       }
+      $self->{'aliases'}->{$new_command} = $existing_command;
+      # could be cleaner to unset macro and definfoenclosed, but
+      # not needed in practice as alias are substituted the earliest.
     } else {
       $self->_line_error(sprintf(
                           __("bad argument to \@%s"), $command), $source_info);
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 2303723ec8..7995a326d5 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -343,31 +343,25 @@ parse_line_command_args (ELEMENT *line_command)
           {
             /* supposedly existing command not defined.  Pre-register a
                user-defined command */
-            enum command_id registered_cmd = add_texinfo_command (existing);
-            existing_cmd = registered_cmd;
-            registered_cmd &= ~USER_COMMAND_BIT;
-            user_defined_command_data[registered_cmd].flags |= CF_REGISTERED;
-            user_defined_command_data[registered_cmd].flags |= CF_UNKNOWN;
+            existing_cmd = add_texinfo_command (existing);
+            user_defined_command_data[existing_cmd & ~USER_COMMAND_BIT].flags
+                                                                 |= CF_UNKNOWN;
           }
         else
           {
             if (command_data(existing_cmd).flags & CF_block)
               line_warn ("environment command %s as argument to @alias",
                          command_name(existing_cmd));
+          }
 
-            if (command_data(existing_cmd).flags & CF_ALIAS)
-              {
-                line_warn ("recursive alias definition as %s is ignored",
-                           command_name(existing_cmd));
-                free (new); free (existing);
-                break;
-              }
-
-            if (existing_cmd & USER_COMMAND_BIT)
-              {
-                enum command_id user_data_cmd = existing_cmd & 
~USER_COMMAND_BIT;
-                user_defined_command_data[user_data_cmd].flags |= 
CF_REGISTERED;
-              }
+        if (command_data(existing_cmd).flags & CF_ALIAS)
+          {
+            enum command_id alias_exist_cmd = command_data(existing_cmd).data;
+            if (! strcmp(command_name(alias_exist_cmd), new))
+              line_warn ("recursive alias definition of %s through %s ignored",
+                            new, command_name(existing_cmd));
+            else
+              existing_cmd = alias_exist_cmd;
           }
 
         /* Remember the alias. */
@@ -375,6 +369,11 @@ parse_line_command_args (ELEMENT *line_command)
         new_cmd &= ~USER_COMMAND_BIT;
         user_defined_command_data[new_cmd].flags |= CF_ALIAS;
         user_defined_command_data[new_cmd].data = existing_cmd;
+        if (existing_cmd & USER_COMMAND_BIT)
+          {
+            enum command_id user_data_cmd = existing_cmd & ~USER_COMMAND_BIT;
+            user_defined_command_data[user_data_cmd].flags |= CF_REGISTERED;
+          }
 
         /* Note the data field is an int, existing_cmd is
            enum command_id, so would have problems if enum command_id
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 9776aa7af6..5cdd5a2e91 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2197,6 +2197,20 @@ process_remaining_on_line (ELEMENT **current_inout, char 
**line_inout)
         {
           current = handle_brace_command (current, &line, cmd);
         }
+      else
+        {
+          /* this can only happen if cmd is a user defined alias
+             as all the other types of command are either expanded
+             (user-defined macro) or are one of the types handled just above
+             (including user-defined index and definfoenclose commands).
+             This cmd is not resolved into a non alias command because
+             the command read was already an alias resolving to cmd
+             and not to a non alias command because there was an error at
+             the time of alias definition (because the alias was defined
+             recursively).
+           */
+          line_error ("unknown command `%s'", command_name(cmd));
+        }
     }
   /* "Separator" character */
   else if (*line != '\0' && strchr ("{}@,:\t.\f", *line))
diff --git a/tp/t/58alias.t b/tp/t/58alias.t
index f9706ed750..4771d10a88 100644
--- a/tp/t/58alias.t
+++ b/tp/t/58alias.t
@@ -49,8 +49,6 @@ in lang
 
 @new{tt}
 '],
-# to show that the XS parser requires the command to exist when
-# the alias is defined
 ['alias_of_macro_before_macro',
 '@alias new = mymacro
 
@@ -107,6 +105,59 @@ in lang
 @printindex sli
 ',{'test_formats' => ['plaintext'],
 },],
+['texinfo_command_alias',
+'@macro mystrong {arg}
+!!\arg\!!
+@end macro
+
+@alias strong = mystrong
+
+@strong{aa}
+
+@definfoenclose mystrong,;,:
+
+@strong{bb}
+
+',{'test_formats' => ['plaintext']},
+],
+['texinfo_command_alias_indirect',
+'@macro mystrong {arg}
+!!\arg\!!
+@end macro
+
+@alias strong = mystrong
+
+@alias new = strong
+
+@new{aa}
+',{'test_formats' => ['plaintext']},
+],
+# the alias to the texinfo command is done while
+# it is not already aliased itself.
+['texinfo_command_alias_indirect_before',
+'@macro mystrong {arg}
+!!\arg\!!
+@end macro
+
+@alias new = strong
+
+@alias strong = mystrong
+
+@new{aa}
+',{'test_formats' => ['plaintext']},
+],
+['recursive_alias',
+'@alias new = strong
+
+@alias other = new
+
+@alias strong = other
+
+@other{aa}.
+
+@strong{bb}.
+',{'test_formats' => ['plaintext']}
+,],
 );
 
 run_all('alias', \@test_cases);
diff --git a/tp/t/results/alias/recursive_alias.pl 
b/tp/t/results/alias/recursive_alias.pl
new file mode 100644
index 0000000000..9200509be2
--- /dev/null
+++ b/tp/t/results/alias/recursive_alias.pl
@@ -0,0 +1,249 @@
+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{'recursive_alias'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = strong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'strong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'other = new'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'other',
+              'new'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'strong = other'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'strong',
+              'other'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 5,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'aa'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'strong',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 7,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '.
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'text' => 'bb.
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'recursive_alias'} = '@alias new = strong
+
+@alias other = new
+
+@alias strong = other
+
+@strong{aa}.
+
+bb.
+';
+
+
+$result_texts{'recursive_alias'} = '
+
+
+aa.
+
+bb.
+';
+
+$result_errors{'recursive_alias'} = [
+  {
+    'error_line' => 'warning: recursive alias definition of strong through 
other ignored
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => 'recursive alias definition of strong through other ignored',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'unknown command `other\'
+',
+    'file_name' => '',
+    'line_nr' => 9,
+    'macro' => '',
+    'text' => 'unknown command `other\'',
+    'type' => 'error'
+  },
+  {
+    'error_line' => 'misplaced {
+',
+    'file_name' => '',
+    'line_nr' => 9,
+    'macro' => '',
+    'text' => 'misplaced {',
+    'type' => 'error'
+  },
+  {
+    'error_line' => 'misplaced }
+',
+    'file_name' => '',
+    'line_nr' => 9,
+    'macro' => '',
+    'text' => 'misplaced }',
+    'type' => 'error'
+  }
+];
+
+
+$result_floats{'recursive_alias'} = {};
+
+
+
+$result_converted{'plaintext'}->{'recursive_alias'} = '*aa*.
+
+   bb.
+';
+
+1;
diff --git a/tp/t/results/alias/texinfo_command_alias.pl 
b/tp/t/results/alias/texinfo_command_alias.pl
new file mode 100644
index 0000000000..88b1cc1b21
--- /dev/null
+++ b/tp/t/results/alias/texinfo_command_alias.pl
@@ -0,0 +1,296 @@
+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{'texinfo_command_alias'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'mystrong',
+              'type' => 'macro_name'
+            },
+            {
+              'text' => 'arg',
+              'type' => 'macro_arg'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'text' => '!!\\arg\\!!
+',
+              'type' => 'raw'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' mystrong {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'strong = mystrong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'strong',
+              'mystrong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 5,
+            'macro' => ''
+          }
+        },
+        {
+          'source_marks' => [
+            {
+              'counter' => 1,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'aa'
+                      }
+                    ],
+                    'type' => 'brace_command_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'mystrong'
+                },
+                'type' => 'macro_call'
+              },
+              'position' => 1,
+              'sourcemark_type' => 'macro_expansion',
+              'status' => 'start'
+            }
+          ],
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 1,
+                  'position' => 6,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'text' => '!!aa!!
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'mystrong,;,:'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'definfoenclose',
+          'extra' => {
+            'misc_args' => [
+              'mystrong',
+              ';',
+              ':'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 9,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'bb'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'mystrong',
+              'extra' => {
+                'begin' => ';',
+                'end' => ':'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 11,
+                'macro' => ''
+              },
+              'type' => 'definfoenclose_command'
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'texinfo_command_alias'} = '@macro mystrong {arg}
+!!\\arg\\!!
+@end macro
+
+@alias strong = mystrong
+
+!!aa!!
+
+@definfoenclose mystrong,;,:
+
+@mystrong{bb}
+
+';
+
+
+$result_texts{'texinfo_command_alias'} = '
+
+!!aa!!
+
+
+bb
+
+';
+
+$result_errors{'texinfo_command_alias'} = [
+  {
+    'error_line' => 'warning: @definfoenclose is obsolete
+',
+    'file_name' => '',
+    'line_nr' => 9,
+    'macro' => '',
+    'text' => '@definfoenclose is obsolete',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'texinfo_command_alias'} = {};
+
+
+
+$result_converted{'plaintext'}->{'texinfo_command_alias'} = '!!aa!!
+
+   ;bb:
+
+';
+
+1;
diff --git a/tp/t/results/alias/texinfo_command_alias_indirect.pl 
b/tp/t/results/alias/texinfo_command_alias_indirect.pl
new file mode 100644
index 0000000000..26d0fcdbe0
--- /dev/null
+++ b/tp/t/results/alias/texinfo_command_alias_indirect.pl
@@ -0,0 +1,234 @@
+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{'texinfo_command_alias_indirect'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'mystrong',
+              'type' => 'macro_name'
+            },
+            {
+              'text' => 'arg',
+              'type' => 'macro_arg'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'text' => '!!\\arg\\!!
+',
+              'type' => 'raw'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' mystrong {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'strong = mystrong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'strong',
+              'mystrong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 5,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = strong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'strong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 7,
+            'macro' => ''
+          }
+        },
+        {
+          'source_marks' => [
+            {
+              'counter' => 1,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'aa'
+                      }
+                    ],
+                    'type' => 'brace_command_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'mystrong'
+                },
+                'type' => 'macro_call'
+              },
+              'position' => 1,
+              'sourcemark_type' => 'macro_expansion',
+              'status' => 'start'
+            }
+          ],
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 1,
+                  'position' => 6,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'text' => '!!aa!!
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'texinfo_command_alias_indirect'} = '@macro mystrong {arg}
+!!\\arg\\!!
+@end macro
+
+@alias strong = mystrong
+
+@alias new = strong
+
+!!aa!!
+';
+
+
+$result_texts{'texinfo_command_alias_indirect'} = '
+
+
+!!aa!!
+';
+
+$result_errors{'texinfo_command_alias_indirect'} = [];
+
+
+$result_floats{'texinfo_command_alias_indirect'} = {};
+
+
+
+$result_converted{'plaintext'}->{'texinfo_command_alias_indirect'} = '!!aa!!
+';
+
+1;
diff --git a/tp/t/results/alias/texinfo_command_alias_indirect_before.pl 
b/tp/t/results/alias/texinfo_command_alias_indirect_before.pl
new file mode 100644
index 0000000000..d2f5fa8c42
--- /dev/null
+++ b/tp/t/results/alias/texinfo_command_alias_indirect_before.pl
@@ -0,0 +1,220 @@
+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{'texinfo_command_alias_indirect_before'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'mystrong',
+              'type' => 'macro_name'
+            },
+            {
+              'text' => 'arg',
+              'type' => 'macro_arg'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'text' => '!!\\arg\\!!
+',
+              'type' => 'raw'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 3,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' mystrong {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = strong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'strong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 5,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'strong = mystrong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'strong',
+              'mystrong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 7,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'aa'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'strong',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 9,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'texinfo_command_alias_indirect_before'} = '@macro mystrong {arg}
+!!\\arg\\!!
+@end macro
+
+@alias new = strong
+
+@alias strong = mystrong
+
+@strong{aa}
+';
+
+
+$result_texts{'texinfo_command_alias_indirect_before'} = '
+
+
+aa
+';
+
+$result_errors{'texinfo_command_alias_indirect_before'} = [];
+
+
+$result_floats{'texinfo_command_alias_indirect_before'} = {};
+
+
+
+$result_converted{'plaintext'}->{'texinfo_command_alias_indirect_before'} = 
'*aa*
+';
+
+1;



reply via email to

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