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


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line) (_parse_line_command_args): unset previous alias when a macro is defined, unset macro, alias and definfoenclose when a @def*index command is defined and unset alias, macro and @def*index when a @definfoenclose command is defined.
Date: Wed, 01 Mar 2023 05:22:16 -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 e6f2350748 * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line) 
(_parse_line_command_args): unset previous alias when a macro is defined, unset 
macro, alias and definfoenclose when a @def*index command is defined and unset 
alias, macro and @def*index when a @definfoenclose command is defined.
e6f2350748 is described below

commit e6f235074843dd13fde76cbdf08ffb6c9373916c
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Wed Mar 1 11:22:10 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line)
    (_parse_line_command_args): unset previous alias when a macro is
    defined, unset macro, alias and definfoenclose when a @def*index
    command is defined and unset alias, macro and @def*index when a
    @definfoenclose command is defined.
    
    * tp/Texinfo/XS/parsetexi/commands.c (add_texinfo_command),
    tp/Texinfo/XS/parsetexi/macro.c (delete_macro, unset_macro_record):
    when adding a user-defined command, reuse the existing command but
    reset it, unsetting the macro record with the new function
    unset_macro_record based on part of delete_macro.
    
    * tp/Texinfo/XS/parsetexi/commands.c (add_texinfo_command)
    (remove_texinfo_command), tp/Texinfo/XS/parsetexi/commands.h,
    tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args),
    tp/Texinfo/XS/parsetexi/indices.c (add_index_command),
    tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
    pre-register @alias existing command if it does not actually exist,
    using the new flag CF_REGISTERED.  If the command is not defined, also
    set CF_UNKNOWN.  Keep CF_REGISTERED when redefining the command.
    
    * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args),
    tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args),
    tp/Texinfo/XS/parsetexi/indices.c (index_by_name): do not
    destroy an index if it is re-defined.  Reset the associated index
    command.
    
    * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args),
    tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args): warn if
    an alias refers to another alias and do not set it.
    
    * tp/Texinfo/XS/parsetexi/macro.c (lookup_macro_and_slot, new_macro):
    try to reuse empty macro_list slots instead of always adding a new
    macro.
    
    * tp/Makefile.tres (test_files_generated_list), tp/t/58alias.t,
    tp/t/60macro.t: add alias.t tests alias_non_existing_command,
    alias_of_macro, alias_of_macro_before_macro, alias_of_definfoenclose,
    alias_of_definfoenclose_before_definfoenclose, alias_of_added_index,
    alias_of_added_index_before_added_index to test for pre-registering of
    @alias referred to commands.  Add macro.t tests
    macro_replaced_by_definfoenclose, definfoenclose_replaced_by_macro,
    macro_alias_definfoenclose_defindex.
---
 ChangeLog                                          |   46 +
 tp/Makefile.tres                                   |   10 +
 tp/Texinfo/ParserNonXS.pm                          |   52 +-
 tp/Texinfo/XS/parsetexi/commands.c                 |   37 +-
 tp/Texinfo/XS/parsetexi/commands.h                 |    7 +-
 tp/Texinfo/XS/parsetexi/end_line.c                 |   31 +-
 tp/Texinfo/XS/parsetexi/indices.c                  |    7 +-
 tp/Texinfo/XS/parsetexi/macro.c                    |   63 +-
 tp/Texinfo/XS/parsetexi/macro.h                    |    1 +
 tp/Texinfo/XS/parsetexi/parser.c                   |   22 +-
 tp/t/58alias.t                                     |   72 +
 tp/t/60macro.t                                     |   78 +-
 tp/t/results/alias/alias_non_existing_command.pl   |  112 ++
 tp/t/results/alias/alias_of_added_index.pl         |  526 +++++++
 .../alias_of_added_index_before_added_index.pl     |  526 +++++++
 tp/t/results/alias/alias_of_definfoenclose.pl      |  165 ++
 ...lias_of_definfoenclose_before_definfoenclose.pl |  165 ++
 tp/t/results/alias/alias_of_macro.pl               |  187 +++
 tp/t/results/alias/alias_of_macro_before_macro.pl  |  187 +++
 .../macro/definfoenclose_replaced_by_macro.pl      |  202 +++
 .../macro/macro_alias_definfoenclose_defindex.pl   | 1606 ++++++++++++++++++++
 .../macro/macro_replaced_by_definfoenclose.pl      |  193 +++
 22 files changed, 4247 insertions(+), 48 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index d5c7a41cbe..7855af48d7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+2023-02-29  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line)
+       (_parse_line_command_args): unset previous alias when a macro is
+       defined, unset macro, alias and definfoenclose when a @def*index
+       command is defined and unset alias, macro and @def*index when a
+       @definfoenclose command is defined.
+
+       * tp/Texinfo/XS/parsetexi/commands.c (add_texinfo_command),
+       tp/Texinfo/XS/parsetexi/macro.c (delete_macro, unset_macro_record):
+       when adding a user-defined command, reuse the existing command but
+       reset it, unsetting the macro record with the new function
+       unset_macro_record based on part of delete_macro.
+
+       * tp/Texinfo/XS/parsetexi/commands.c (add_texinfo_command)
+       (remove_texinfo_command), tp/Texinfo/XS/parsetexi/commands.h,
+       tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args),
+       tp/Texinfo/XS/parsetexi/indices.c (add_index_command),
+       tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line):
+       pre-register @alias existing command if it does not actually exist,
+       using the new flag CF_REGISTERED.  If the command is not defined, also
+       set CF_UNKNOWN.  Keep CF_REGISTERED when redefining the command.
+
+       * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args),
+       tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args),
+       tp/Texinfo/XS/parsetexi/indices.c (index_by_name): do not
+       destroy an index if it is re-defined.  Reset the associated index
+       command.
+
+       * tp/Texinfo/ParserNonXS.pm (_parse_line_command_args),
+       tp/Texinfo/XS/parsetexi/end_line.c (parse_line_command_args): warn if
+       an alias refers to another alias and do not set it.
+
+       * tp/Texinfo/XS/parsetexi/macro.c (lookup_macro_and_slot, new_macro):
+       try to reuse empty macro_list slots instead of always adding a new
+       macro.
+
+       * tp/Makefile.tres (test_files_generated_list), tp/t/58alias.t,
+       tp/t/60macro.t: add alias.t tests alias_non_existing_command,
+       alias_of_macro, alias_of_macro_before_macro, alias_of_definfoenclose,
+       alias_of_definfoenclose_before_definfoenclose, alias_of_added_index,
+       alias_of_added_index_before_added_index to test for pre-registering of
+       @alias referred to commands.  Add macro.t tests
+       macro_replaced_by_definfoenclose, definfoenclose_replaced_by_macro,
+       macro_alias_definfoenclose_defindex.
+
 2023-02-28  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/XS/parsetexi/convert.c (convert_contents_to_texinfo),
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 800d25af5d..098d288a7b 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -62,6 +62,13 @@ test_tap_files_generated_list = \
   t/xml_tests.t
 
 test_files_generated_list = $(test_tap_files_generated_list) \
+  t/results/alias/alias_non_existing_command.pl \
+  t/results/alias/alias_of_added_index.pl \
+  t/results/alias/alias_of_added_index_before_added_index.pl \
+  t/results/alias/alias_of_definfoenclose.pl \
+  t/results/alias/alias_of_definfoenclose_before_definfoenclose.pl \
+  t/results/alias/alias_of_macro.pl \
+  t/results/alias/alias_of_macro_before_macro.pl \
   t/results/alias/alias_table_command.pl \
   t/results/alias/bad_line.pl \
   t/results/alias/block_command_alias.pl \
@@ -1194,6 +1201,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/macro/complex_argument.pl \
   t/results/macro/cpp_directives_after_macros.pl \
   t/results/macro/cpp_directives_in_macro.pl \
+  t/results/macro/definfoenclose_replaced_by_macro.pl \
   t/results/macro/double_macro_definition.pl \
   t/results/macro/double_recursive_macro_call.pl \
   t/results/macro/empty_end.pl \
@@ -1215,6 +1223,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/macro/leading_spaces_no_ignore.pl \
   t/results/macro/line_after_recursive_call.pl \
   t/results/macro/macro_after_paragraph.pl \
+  t/results/macro/macro_alias_definfoenclose_defindex.pl \
   t/results/macro/macro_before_specific_line_command_args.pl \
   t/results/macro/macro_call_empty_middle_arg.pl \
   t/results/macro/macro_call_empty_two_arg.pl \
@@ -1266,6 +1275,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/macro/macro_no_argument.pl \
   t/results/macro/macro_not_closed.pl \
   t/results/macro/macro_one_arg_end_of_file.pl \
+  t/results/macro/macro_replaced_by_definfoenclose.pl \
   t/results/macro/macro_with_error_at_end_line_after_macro.pl \
   t/results/macro/macro_zero.pl \
   t/results/macro/nested_macro_call.pl \
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index ecb0518a19..7067cec3fe 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -4864,6 +4864,9 @@ sub _process_remaining_on_line($$$$)
                 'element' => $current,
                 'macrobody' => $macrobody
               };
+              delete $self->{'aliases'}->{$name};
+              # could be cleaner to delete definfoenclose'd too, but macros
+              # are expanded earlier
             }
           }
         }
@@ -6972,15 +6975,23 @@ sub _parse_line_command_args($$$)
       my $new_command = $1;
       my $existing_command = $3;
       $args = [$1, $3];
-      $self->{'aliases'}->{$new_command} = $existing_command;
       if (exists($block_commands{$existing_command})) {
         $self->_line_warn(sprintf(
-                             __("environment command %s as argument to \@%s"),
-                             $existing_command, $command), $source_info);
+                           __("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.
       }
     } else {
       $self->_line_error(sprintf(
-                             __("bad argument to \@%s"), $command), 
$source_info);
+                          __("bad argument to \@%s"), $command), $source_info);
     }
 
   } elsif ($command eq 'definfoenclose') {
@@ -6992,13 +7003,21 @@ sub _parse_line_command_args($$$)
       $self->{'definfoenclose'}->{$cmd_name} = [ $begin, $end ];
       print STDERR "DEFINFOENCLOSE \@$cmd_name: $begin, $end\n"
                if ($self->{'DEBUG'});
-      # consistent with XS parser, not actually used anywhere.
+      delete $self->{'macros'}->{$cmd_name};
+      delete $self->{'aliases'}->{$cmd_name};
+      # unset @def*index effect
+      delete $self->{'line_commands'}->{$cmd_name};
+      delete $self->{'close_paragraph_commands'}->{$cmd_name};
+      delete $self->{'no_paragraph_commands'}->{$cmd_name};
+      delete $self->{'basic_inline_commands'}->{$cmd_name};
+      delete $self->{'command_index'}->{$cmd_name};
+      # consistent with XS parser, value not actually used anywhere.
       $self->{'brace_commands'}->{$cmd_name} = 'style_other';
       # this allows to obtain the same result as the XS parser which checks
       # dynamically the brace_commands type
       $self->{'valid_nestings'}->{$cmd_name} = \%in_full_text_commands;
       # note that a built-in command previously in a hash classifying the
-      # @-command will remain there, possibly having specific effects.
+      # @-command otherwise will remain there, possibly having specific 
effects.
     } else {
       $self->_line_error(sprintf(__("bad argument to \@%s"), $command),
                          $source_info);
@@ -7037,18 +7056,27 @@ sub _parse_line_command_args($$$)
         my $in_code = 0;
         $in_code = 1 if ($command eq 'defcodeindex');
         $args = [$name];
-        $self->{'index_names'}->{$name} = {'in_code' => $in_code};
+        if (!exists($self->{'index_names'}->{$name})) {
+          $self->{'index_names'}->{$name} = {'in_code' => $in_code};
+        }
         if (!exists($self->{'index_names'}->{$name}->{'name'})) {
           $self->{'index_names'}->{$name}->{'name'} = $name;
         }
         if (!exists($self->{'index_names'}->{$name}->{'contained_indices'})) {
           $self->{'index_names'}->{$name}->{'contained_indices'} = {$name => 
1};
         }
-        $self->{'line_commands'}->{$name.'index'} = 'line';
-        $self->{'close_paragraph_commands'}->{$name.'index'} = 1;
-        $self->{'no_paragraph_commands'}->{$name.'index'} = 1;
-        $self->{'basic_inline_commands'}->{$name.'index'} = 1;
-        $self->{'command_index'}->{$name.'index'} = $name;
+        my $index_cmdname = $name.'index';
+        delete $self->{'macros'}->{$index_cmdname};
+        delete $self->{'aliases'}->{$index_cmdname};
+        # unset definfoenclose effect
+        delete $self->{'definfoenclose'}->{$index_cmdname};
+        delete $self->{'brace_commands'}->{$index_cmdname};
+        delete $self->{'valid_nestings'}->{$index_cmdname};
+        $self->{'line_commands'}->{$index_cmdname} = 'line';
+        $self->{'close_paragraph_commands'}->{$index_cmdname} = 1;
+        $self->{'no_paragraph_commands'}->{$index_cmdname} = 1;
+        $self->{'basic_inline_commands'}->{$index_cmdname} = 1;
+        $self->{'command_index'}->{$index_cmdname} = $name;
       }
     } else {
       $self->_line_error(sprintf(
diff --git a/tp/Texinfo/XS/parsetexi/commands.c 
b/tp/Texinfo/XS/parsetexi/commands.c
index de19e87c89..14024863cc 100644
--- a/tp/Texinfo/XS/parsetexi/commands.c
+++ b/tp/Texinfo/XS/parsetexi/commands.c
@@ -91,6 +91,28 @@ lookup_command (char *cmdname)
 enum command_id
 add_texinfo_command (char *name)
 {
+  enum command_id existing_cmd = lookup_command (name);
+
+  if (existing_cmd & USER_COMMAND_BIT)
+    {
+      enum command_id user_data_cmd = existing_cmd & ~USER_COMMAND_BIT;
+      /* FIXME it is consistent with silent replacement of macro
+         by another user-defined command to remove the information
+         on a previously defined macro, but it may not be right. */
+      if (user_defined_command_data[user_data_cmd].flags & CF_MACRO)
+        {
+          MACRO *m = lookup_macro (existing_cmd);
+          unset_macro_record (m);
+        }
+      if (user_defined_command_data[user_data_cmd].flags & CF_REGISTERED)
+        user_defined_command_data[user_data_cmd].flags = (0 & CF_REGISTERED);
+      else
+        user_defined_command_data[user_data_cmd].flags = 0;
+      user_defined_command_data[user_data_cmd].data = 0;
+      user_defined_command_data[user_data_cmd].args_number = 0;
+      return existing_cmd;
+    }
+
   if (user_defined_number == user_defined_space)
     {
       user_defined_command_data
@@ -113,8 +135,19 @@ void
 remove_texinfo_command (enum command_id cmd)
 {
   cmd &= ~USER_COMMAND_BIT;
-  free (user_defined_command_data[cmd].cmdname);
-  user_defined_command_data[cmd].cmdname = strdup ("");
+  /* only pretend to remove if REGISTERED, but reset */
+  if (user_defined_command_data[cmd].flags & CF_REGISTERED)
+    {
+      user_defined_command_data[cmd].data = 0;
+      user_defined_command_data[cmd].flags = (0 | CF_REGISTERED | CF_UNKNOWN);
+      user_defined_command_data[cmd].args_number = 0;
+    }
+  else
+    {
+      /* FIXME the cmd is never reused */
+      free (user_defined_command_data[cmd].cmdname);
+      user_defined_command_data[cmd].cmdname = strdup ("");
+    }
 }
 
 void
diff --git a/tp/Texinfo/XS/parsetexi/commands.h 
b/tp/Texinfo/XS/parsetexi/commands.h
index 259679853a..0941756c57 100644
--- a/tp/Texinfo/XS/parsetexi/commands.h
+++ b/tp/Texinfo/XS/parsetexi/commands.h
@@ -87,11 +87,14 @@ void wipe_user_commands (void);
 #define CF_preformatted                        0x00400000
 #define CF_preformatted_code           0x00800000
 #define CF_no_paragraph                        0x01000000
-/* unused                               0x02000000 */
+/* a user-defined command that is referenced to by another command,
+   which should keep its place in the user_defined_command_data table */
+#define CF_REGISTERED                  0x02000000
 #define CF_nobrace                     0x04000000
 /* blockitem commands have a possible content before an item */
 #define CF_blockitem                   0x08000000
-/* unused                               0x10000000 */
+/* used for REGISTERED commands before they have been set to something */
+#define CF_UNKNOWN                     0x10000000
 #define CF_MACRO                       0x20000000
 #define CF_index_entry_command         0x40000000
 /* command that affect the document as a whole and should appear only once */
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 71742d4f02..2303723ec8 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -340,22 +340,42 @@ parse_line_command_args (ELEMENT *line_command)
 
         existing_cmd = lookup_command (existing);
         if (!existing_cmd)
-          break; /* TODO: Error message */
+          {
+            /* 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;
+          }
         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;
+              }
           }
 
         /* Remember the alias. */
         new_cmd = add_texinfo_command (new);
         new_cmd &= ~USER_COMMAND_BIT;
         user_defined_command_data[new_cmd].flags |= CF_ALIAS;
-
         user_defined_command_data[new_cmd].data = existing_cmd;
-        user_defined_command_data[new_cmd].args_number
-                  = command_data(existing_cmd).args_number;
+
         /* Note the data field is an int, existing_cmd is
            enum command_id, so would have problems if enum command_id
            were wider than an int. */
@@ -499,9 +519,6 @@ parse_line_command_args (ELEMENT *line_command)
           for (ptr = forbidden_index_names; *ptr; ptr++)
             if (!strcmp (name, *ptr))
               goto defindex_reserved;
-
-          if (index_by_name (name))
-            { free (name); break; }
         }
 
         add_index (name, cmd == CM_defcodeindex ? 1 : 0);
diff --git a/tp/Texinfo/XS/parsetexi/indices.c 
b/tp/Texinfo/XS/parsetexi/indices.c
index cd107dce26..5c318944f3 100644
--- a/tp/Texinfo/XS/parsetexi/indices.c
+++ b/tp/Texinfo/XS/parsetexi/indices.c
@@ -71,7 +71,7 @@ add_index_command (char *cmdname, INDEX *idx)
 {
   enum command_id new = add_texinfo_command (cmdname);
   user_defined_command_data[new & ~USER_COMMAND_BIT].flags
-    = CF_line | CF_index_entry_command | CF_contain_basic_inline
+    |= CF_line | CF_index_entry_command | CF_contain_basic_inline
       | CF_close_paragraph | CF_no_paragraph;
   user_defined_command_data[new & ~USER_COMMAND_BIT].data = LINE_line;
   associate_command_to_index (new, idx);
@@ -116,10 +116,11 @@ index_by_name (char *name)
 void
 add_index (char *name, int in_code)
 {
-  INDEX *idx;
+  INDEX *idx = index_by_name (name);
   char *cmdname;
 
-  idx = add_index_internal (name, in_code);
+  if (!idx)
+    idx = add_index_internal (name, in_code);
 
   /* For example, "rq" -> "rqindex". */
   xasprintf (&cmdname, "%s%s", name, "index");
diff --git a/tp/Texinfo/XS/parsetexi/macro.c b/tp/Texinfo/XS/parsetexi/macro.c
index 78b440c86b..529a3a1301 100644
--- a/tp/Texinfo/XS/parsetexi/macro.c
+++ b/tp/Texinfo/XS/parsetexi/macro.c
@@ -34,30 +34,55 @@ static size_t macro_space;
 
 /* Macro definition. */
 
+MACRO *
+lookup_macro_and_slot (enum command_id cmd, size_t *free_slot)
+{
+  int i;
+  if (free_slot)
+    *free_slot = 0;
+
+  for (i = 0; i < macro_number; i++)
+    {
+      if (macro_list[i].cmd == cmd)
+        return &macro_list[i];
+      if (free_slot && !*free_slot && macro_list[i].cmd == 0)
+        *free_slot = i;
+    }
+  return 0;
+}
+
 void
 new_macro (char *name, ELEMENT *macro)
 {
   enum command_id new;
   MACRO *m = 0;
+  size_t free_slot = 0;
   ELEMENT *tmp;
 
   /* Check for an existing definition first for us to overwrite. */
   new = lookup_command (name);
   if (new)
-    m = lookup_macro (new);
+    m = lookup_macro_and_slot (new, &free_slot);
   if (!m)
     {
-      if (macro_number == macro_space)
+      size_t macro_index;
+      if (free_slot)
+        macro_index = free_slot;
+      else
         {
-          macro_list = realloc (macro_list,
-                                (macro_space += 5) * sizeof (MACRO));
-          if (!macro_list)
-            fatal ("realloc failed");
+          if (macro_number == macro_space)
+            {
+              macro_list = realloc (macro_list,
+                              (macro_space += 5) * sizeof (MACRO));
+              if (!macro_list)
+                fatal ("realloc failed");
+            }
+          macro_index = macro_number;
+          macro_number++;
         }
       new = add_texinfo_command (name);
-      m = &macro_list[macro_number];
+      m = &macro_list[macro_index];
       m->cmd = new;
-      macro_number++;
       new &= ~USER_COMMAND_BIT;
       user_defined_command_data[new].flags |= CF_MACRO;
     }
@@ -482,22 +507,29 @@ lookup_macro (enum command_id cmd)
 }
 
 void
-delete_macro (char *name)
+unset_macro_record (MACRO *m)
 {
-  enum command_id cmd;
-  MACRO *m;
-  cmd = lookup_command (name);
-  if (!cmd)
-    return;
-  m = lookup_macro (cmd);
   if (!m)
     return;
+
   m->cmd = 0;
   free (m->macro_name);
   m->macro_name = strdup ("");
   free (m->macrobody);
   m->macrobody = 0;
   m->element = 0;
+}
+
+void
+delete_macro (char *name)
+{
+  enum command_id cmd;
+  MACRO *m;
+  cmd = lookup_command (name);
+  if (!cmd)
+    return;
+  m = lookup_macro (cmd);
+  unset_macro_record (m);
   remove_texinfo_command (cmd);
 }
 
@@ -542,7 +574,6 @@ handle_macro (ELEMENT *current, char **line_inout, enum 
command_id cmd)
     arguments_container->type = ET_rmacro_call;
   add_extra_string_dup (arguments_container, "name", command_name(cmd));
 
-  macro_record = lookup_macro (cmd);
   /* Get number of args. - 1 for the macro name. */
   args_number = macro->args.number - 1;
 
diff --git a/tp/Texinfo/XS/parsetexi/macro.h b/tp/Texinfo/XS/parsetexi/macro.h
index 67867d9991..1819f83404 100644
--- a/tp/Texinfo/XS/parsetexi/macro.h
+++ b/tp/Texinfo/XS/parsetexi/macro.h
@@ -37,6 +37,7 @@ ELEMENT *parse_macro_command_line (enum command_id, char 
**line_inout,
 int handle_macro (ELEMENT *current, char **line_inout,
                   enum command_id cmd_id);
 void delete_macro (char *name);
+void unset_macro_record (MACRO *m);
 MACRO *lookup_macro (enum command_id cmd);
 void wipe_macros (void);
 
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 26b5500d35..9776aa7af6 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -1813,13 +1813,27 @@ process_remaining_on_line (ELEMENT **current_inout, 
char **line_inout)
     }
 
   /* Handle unknown command. */
-  if (!cmd && command)
+  if ((!cmd && command)
+      /* command marked as unknown, normally a registered user-defined command
+         that was set as @alias-ed but has not been defined since */
+      || (command_data(cmd).flags & CF_UNKNOWN))
     {
       ELEMENT *paragraph;
+      char *unknown_cmd;
 
-      line_error ("unknown command `%s'", command);
-      debug ("COMMAND (UNKNOWN) %s", command);
-      free (command);
+      if (cmd)
+        {
+          unknown_cmd = command_name (cmd);
+          debug ("COMMAND (REGISTERED UNKNOWN) %d %s", cmd, unknown_cmd);
+        }
+      else
+        {
+          unknown_cmd = command;
+          debug ("COMMAND (UNKNOWN) %s", command);
+        }
+      line_error ("unknown command `%s'", unknown_cmd);
+      if (!cmd)
+        free (command);
       abort_empty_line (&current, 0);
       paragraph = begin_paragraph (current);
       if (paragraph)
diff --git a/tp/t/58alias.t b/tp/t/58alias.t
index 6d64456b1b..f9706ed750 100644
--- a/tp/t/58alias.t
+++ b/tp/t/58alias.t
@@ -35,6 +35,78 @@ Should be verb: @o-theralias{!verb!}
 in lang
 @end lang
 '],
+['alias_non_existing_command',
+'@alias myalias = userdefined
+
+@myalias{hh}.
+',],
+['alias_of_macro',
+'@macro mymacro {thearg}
+||\\thearg||
+@end macro
+
+@alias new = mymacro
+
+@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
+
+@macro mymacro {thearg}
+||\\thearg||
+@end macro
+
+@new{tt}
+',],
+['alias_of_definfoenclose',
+'@definfoenclose phoo,;,:
+
+@alias new = phoo
+
+@new{aa}
+',{'test_formats' => ['plaintext']},],
+['alias_of_definfoenclose_before_definfoenclose',
+'@alias new = phoo
+
+@definfoenclose phoo,;,:
+
+@new{aa}
+',{'test_formats' => ['plaintext'],
+},],
+['alias_of_added_index',
+'@defindex sli
+
+@alias new = sliindex
+
+@node Top
+@top top
+
+@new entry
+
+@node chap
+@chapter Chapter
+
+@printindex sli
+',{'test_formats' => ['plaintext'],
+},],
+['alias_of_added_index_before_added_index',
+'@alias new = sliindex
+
+@defindex sli
+
+@node Top
+@top top
+
+@new entry
+
+@node chap
+@chapter Chapter
+
+@printindex sli
+',{'test_formats' => ['plaintext'],
+},],
 );
 
 run_all('alias', \@test_cases);
diff --git a/tp/t/60macro.t b/tp/t/60macro.t
index 87370c0cb3..bd723967c0 100644
--- a/tp/t/60macro.t
+++ b/tp/t/60macro.t
@@ -909,8 +909,8 @@ Defined
 @beginendcond{}set
 '],
 
-# the use of @unmacro dates from the time when macros needed
-# to be undefined before being redefined.  Left as test.
+# use @unmacro to silence a warning emitted when a @macro
+# is redefined.
 # texi2dvi breaks.
 ['arg_body_expansion_order',
 '
@@ -1353,6 +1353,80 @@ X\arg\X
 @mymacro
 @include inc_file.texi
 '],
+['macro_replaced_by_definfoenclose',
+'@macro phoo {arg}
+||\arg\||
+@end macro
+
+@definfoenclose phoo,;,:
+
+@phoo{aa}
+', {'test_formats' => ['plaintext'],}],
+['definfoenclose_replaced_by_macro',
+'@definfoenclose phoo,;,:
+
+@macro phoo {arg}
+||\arg\||
+@end macro
+
+@phoo{aa}
+', {'test_formats' => ['plaintext'],}],
+['macro_alias_definfoenclose_defindex',
+'@node Top
+@top top
+
+@node chap
+@chapter chap
+
+@macro phooindex {arg}
+||\arg\||
+@end macro
+@phooindex{maa}
+
+@definfoenclose phooindex,;,:
+@phooindex{dbb}
+
+@alias phooindex = strong
+@phooindex{acc}
+
+@defindex phoo
+@phooindex idd
+
+@definfoenclose phooindex,;,:
+@phooindex{dee}
+
+@macro phooindex {arg}
+!!\arg\!!
+@end macro
+@phooindex mff
+
+@defindex phoo
+@phooindex igg
+
+@macro phooindex {arg}
+!!\arg\!!
+@end macro
+@phooindex mhh
+
+@alias phooindex = strong
+@phooindex{aii}
+
+@definfoenclose phoo,;,:
+@phoo{djj}
+
+@defindex phoo
+@phooindex ikk
+
+@alias phooindex = strong
+@phooindex{all}
+
+@macro phoo {arg}
+%%\arg\%%
+@end macro
+@phoo{mmm}
+
+@printindex phoo
+', {'test_formats' => ['plaintext'],}],
 # shows that cpp directives are ignored in macros
 ['cpp_directives_in_macro',
   undef, {'test_file' => 'cpp_directives_in_macro.texi',},
diff --git a/tp/t/results/alias/alias_non_existing_command.pl 
b/tp/t/results/alias/alias_non_existing_command.pl
new file mode 100644
index 0000000000..0c76bf2aaa
--- /dev/null
+++ b/tp/t/results/alias/alias_non_existing_command.pl
@@ -0,0 +1,112 @@
+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{'alias_non_existing_command'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'myalias = userdefined'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'myalias',
+              'userdefined'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'text' => 'hh.
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'alias_non_existing_command'} = '@alias myalias = userdefined
+
+hh.
+';
+
+
+$result_texts{'alias_non_existing_command'} = '
+hh.
+';
+
+$result_errors{'alias_non_existing_command'} = [
+  {
+    'error_line' => 'unknown command `userdefined\'
+',
+    'file_name' => '',
+    'line_nr' => 3,
+    'macro' => '',
+    'text' => 'unknown command `userdefined\'',
+    'type' => 'error'
+  },
+  {
+    'error_line' => 'misplaced {
+',
+    'file_name' => '',
+    'line_nr' => 3,
+    'macro' => '',
+    'text' => 'misplaced {',
+    'type' => 'error'
+  },
+  {
+    'error_line' => 'misplaced }
+',
+    'file_name' => '',
+    'line_nr' => 3,
+    'macro' => '',
+    'text' => 'misplaced }',
+    'type' => 'error'
+  }
+];
+
+
+$result_floats{'alias_non_existing_command'} = {};
+
+
+1;
diff --git a/tp/t/results/alias/alias_of_added_index.pl 
b/tp/t/results/alias/alias_of_added_index.pl
new file mode 100644
index 0000000000..a7c8fce298
--- /dev/null
+++ b/tp/t/results/alias/alias_of_added_index.pl
@@ -0,0 +1,526 @@
+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{'alias_of_added_index'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'sli'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'defindex',
+          'extra' => {
+            'misc_args' => [
+              'sli'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = sliindex'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'sliindex'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'normalized' => 'Top'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 5,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'top',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'entry'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'sliindex',
+          'extra' => {
+            'element_node' => {},
+            'index_entry' => {
+              'entry_element' => {},
+              'entry_number' => 1,
+              'in_code' => 0,
+              'index_name' => 'sli'
+            }
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 8,
+            'macro' => ''
+          },
+          'type' => 'index_entry_command'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 6,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'chap'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'isindex' => 1,
+        'normalized' => 'chap'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 10,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Chapter'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'sli'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'printindex',
+          'extra' => {
+            'misc_args' => [
+              'sli'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 13,
+            'macro' => ''
+          }
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 11,
+        'macro' => ''
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'alias_of_added_index'}{'contents'}[2]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'alias_of_added_index'}{'contents'}[1];
+$result_trees{'alias_of_added_index'}{'contents'}[2]{'contents'}[1]{'extra'}{'index_entry'}{'entry_element'}
 = $result_trees{'alias_of_added_index'}{'contents'}[2]{'contents'}[1];
+
+$result_texis{'alias_of_added_index'} = '@defindex sli
+
+@alias new = sliindex
+
+@node Top
+@top top
+
+@sliindex entry
+
+@node chap
+@chapter Chapter
+
+@printindex sli
+';
+
+
+$result_texts{'alias_of_added_index'} = '
+
+top
+***
+
+
+1 Chapter
+*********
+
+';
+
+$result_sectioning{'alias_of_added_index'} = {
+  'structure' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'top',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'Top'
+            },
+            'info' => {},
+            'structure' => {}
+          }
+        },
+        'info' => {},
+        'structure' => {
+          'section_childs' => [
+            {
+              'cmdname' => 'chapter',
+              'extra' => {
+                'associated_node' => {
+                  'cmdname' => 'node',
+                  'extra' => {
+                    'isindex' => 1,
+                    'normalized' => 'chap'
+                  },
+                  'info' => {},
+                  'structure' => {}
+                }
+              },
+              'info' => {},
+              'structure' => {
+                'section_level' => 1,
+                'section_number' => 1,
+                'section_up' => {},
+                'toplevel_prev' => {},
+                'toplevel_up' => {}
+              }
+            }
+          ],
+          'section_level' => 0,
+          'section_up' => {}
+        }
+      }
+    ],
+    'section_level' => -1
+  }
+};
+$result_sectioning{'alias_of_added_index'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = $result_sectioning{'alias_of_added_index'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'alias_of_added_index'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_prev'}
 = $result_sectioning{'alias_of_added_index'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'alias_of_added_index'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_up'}
 = $result_sectioning{'alias_of_added_index'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'alias_of_added_index'}{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = $result_sectioning{'alias_of_added_index'};
+
+$result_nodes{'alias_of_added_index'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'associated_section' => {
+      'cmdname' => 'top',
+      'extra' => {},
+      'info' => {},
+      'structure' => {}
+    },
+    'normalized' => 'Top'
+  },
+  'info' => {},
+  'structure' => {
+    'node_next' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'chapter',
+          'extra' => {},
+          'info' => {},
+          'structure' => {
+            'section_number' => 1
+          }
+        },
+        'isindex' => 1,
+        'normalized' => 'chap'
+      },
+      'info' => {},
+      'structure' => {
+        'node_prev' => {},
+        'node_up' => {}
+      }
+    }
+  }
+};
+$result_nodes{'alias_of_added_index'}{'structure'}{'node_next'}{'structure'}{'node_prev'}
 = $result_nodes{'alias_of_added_index'};
+$result_nodes{'alias_of_added_index'}{'structure'}{'node_next'}{'structure'}{'node_up'}
 = $result_nodes{'alias_of_added_index'};
+
+$result_menus{'alias_of_added_index'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'Top'
+  },
+  'info' => {},
+  'structure' => {}
+};
+
+$result_errors{'alias_of_added_index'} = [];
+
+
+$result_indices{'alias_of_added_index'} = {
+  'index_names' => {
+    'cp' => {
+      'contained_indices' => {
+        'cp' => 1
+      },
+      'in_code' => 0,
+      'name' => 'cp'
+    },
+    'fn' => {
+      'contained_indices' => {
+        'fn' => 1
+      },
+      'in_code' => 1,
+      'name' => 'fn'
+    },
+    'ky' => {
+      'contained_indices' => {
+        'ky' => 1
+      },
+      'in_code' => 1,
+      'name' => 'ky'
+    },
+    'pg' => {
+      'contained_indices' => {
+        'pg' => 1
+      },
+      'in_code' => 1,
+      'name' => 'pg'
+    },
+    'sli' => {
+      'contained_indices' => {
+        'sli' => 1
+      },
+      'in_code' => 0,
+      'name' => 'sli'
+    },
+    'tp' => {
+      'contained_indices' => {
+        'tp' => 1
+      },
+      'in_code' => 1,
+      'name' => 'tp'
+    },
+    'vr' => {
+      'contained_indices' => {
+        'vr' => 1
+      },
+      'in_code' => 1,
+      'name' => 'vr'
+    }
+  }
+};
+
+
+$result_floats{'alias_of_added_index'} = {};
+
+
+$result_indices_sort_strings{'alias_of_added_index'} = {
+  'sli' => [
+    'entry'
+  ]
+};
+
+
+
+$result_converted{'plaintext'}->{'alias_of_added_index'} = 'top
+***
+
+1 Chapter
+*********
+
+* Menu:
+
+* entry:                                 Top.                   (line 2)
+
+';
+
+1;
diff --git a/tp/t/results/alias/alias_of_added_index_before_added_index.pl 
b/tp/t/results/alias/alias_of_added_index_before_added_index.pl
new file mode 100644
index 0000000000..679a15a9ff
--- /dev/null
+++ b/tp/t/results/alias/alias_of_added_index_before_added_index.pl
@@ -0,0 +1,526 @@
+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{'alias_of_added_index_before_added_index'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = sliindex'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'sliindex'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'sli'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'defindex',
+          'extra' => {
+            'misc_args' => [
+              'sli'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'normalized' => 'Top'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 5,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'top',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'entry'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'sliindex',
+          'extra' => {
+            'element_node' => {},
+            'index_entry' => {
+              'entry_element' => {},
+              'entry_number' => 1,
+              'in_code' => 0,
+              'index_name' => 'sli'
+            }
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 8,
+            'macro' => ''
+          },
+          'type' => 'index_entry_command'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 6,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'chap'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'isindex' => 1,
+        'normalized' => 'chap'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 10,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Chapter'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'sli'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'printindex',
+          'extra' => {
+            'misc_args' => [
+              'sli'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 13,
+            'macro' => ''
+          }
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 11,
+        'macro' => ''
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'alias_of_added_index_before_added_index'}{'contents'}[2]{'contents'}[1]{'extra'}{'element_node'}
 = $result_trees{'alias_of_added_index_before_added_index'}{'contents'}[1];
+$result_trees{'alias_of_added_index_before_added_index'}{'contents'}[2]{'contents'}[1]{'extra'}{'index_entry'}{'entry_element'}
 = 
$result_trees{'alias_of_added_index_before_added_index'}{'contents'}[2]{'contents'}[1];
+
+$result_texis{'alias_of_added_index_before_added_index'} = '@alias new = 
sliindex
+
+@defindex sli
+
+@node Top
+@top top
+
+@sliindex entry
+
+@node chap
+@chapter Chapter
+
+@printindex sli
+';
+
+
+$result_texts{'alias_of_added_index_before_added_index'} = '
+
+top
+***
+
+
+1 Chapter
+*********
+
+';
+
+$result_sectioning{'alias_of_added_index_before_added_index'} = {
+  'structure' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'top',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'Top'
+            },
+            'info' => {},
+            'structure' => {}
+          }
+        },
+        'info' => {},
+        'structure' => {
+          'section_childs' => [
+            {
+              'cmdname' => 'chapter',
+              'extra' => {
+                'associated_node' => {
+                  'cmdname' => 'node',
+                  'extra' => {
+                    'isindex' => 1,
+                    'normalized' => 'chap'
+                  },
+                  'info' => {},
+                  'structure' => {}
+                }
+              },
+              'info' => {},
+              'structure' => {
+                'section_level' => 1,
+                'section_number' => 1,
+                'section_up' => {},
+                'toplevel_prev' => {},
+                'toplevel_up' => {}
+              }
+            }
+          ],
+          'section_level' => 0,
+          'section_up' => {}
+        }
+      }
+    ],
+    'section_level' => -1
+  }
+};
+$result_sectioning{'alias_of_added_index_before_added_index'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = 
$result_sectioning{'alias_of_added_index_before_added_index'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'alias_of_added_index_before_added_index'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_prev'}
 = 
$result_sectioning{'alias_of_added_index_before_added_index'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'alias_of_added_index_before_added_index'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_up'}
 = 
$result_sectioning{'alias_of_added_index_before_added_index'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'alias_of_added_index_before_added_index'}{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = $result_sectioning{'alias_of_added_index_before_added_index'};
+
+$result_nodes{'alias_of_added_index_before_added_index'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'associated_section' => {
+      'cmdname' => 'top',
+      'extra' => {},
+      'info' => {},
+      'structure' => {}
+    },
+    'normalized' => 'Top'
+  },
+  'info' => {},
+  'structure' => {
+    'node_next' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'chapter',
+          'extra' => {},
+          'info' => {},
+          'structure' => {
+            'section_number' => 1
+          }
+        },
+        'isindex' => 1,
+        'normalized' => 'chap'
+      },
+      'info' => {},
+      'structure' => {
+        'node_prev' => {},
+        'node_up' => {}
+      }
+    }
+  }
+};
+$result_nodes{'alias_of_added_index_before_added_index'}{'structure'}{'node_next'}{'structure'}{'node_prev'}
 = $result_nodes{'alias_of_added_index_before_added_index'};
+$result_nodes{'alias_of_added_index_before_added_index'}{'structure'}{'node_next'}{'structure'}{'node_up'}
 = $result_nodes{'alias_of_added_index_before_added_index'};
+
+$result_menus{'alias_of_added_index_before_added_index'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'Top'
+  },
+  'info' => {},
+  'structure' => {}
+};
+
+$result_errors{'alias_of_added_index_before_added_index'} = [];
+
+
+$result_indices{'alias_of_added_index_before_added_index'} = {
+  'index_names' => {
+    'cp' => {
+      'contained_indices' => {
+        'cp' => 1
+      },
+      'in_code' => 0,
+      'name' => 'cp'
+    },
+    'fn' => {
+      'contained_indices' => {
+        'fn' => 1
+      },
+      'in_code' => 1,
+      'name' => 'fn'
+    },
+    'ky' => {
+      'contained_indices' => {
+        'ky' => 1
+      },
+      'in_code' => 1,
+      'name' => 'ky'
+    },
+    'pg' => {
+      'contained_indices' => {
+        'pg' => 1
+      },
+      'in_code' => 1,
+      'name' => 'pg'
+    },
+    'sli' => {
+      'contained_indices' => {
+        'sli' => 1
+      },
+      'in_code' => 0,
+      'name' => 'sli'
+    },
+    'tp' => {
+      'contained_indices' => {
+        'tp' => 1
+      },
+      'in_code' => 1,
+      'name' => 'tp'
+    },
+    'vr' => {
+      'contained_indices' => {
+        'vr' => 1
+      },
+      'in_code' => 1,
+      'name' => 'vr'
+    }
+  }
+};
+
+
+$result_floats{'alias_of_added_index_before_added_index'} = {};
+
+
+$result_indices_sort_strings{'alias_of_added_index_before_added_index'} = {
+  'sli' => [
+    'entry'
+  ]
+};
+
+
+
+$result_converted{'plaintext'}->{'alias_of_added_index_before_added_index'} = 
'top
+***
+
+1 Chapter
+*********
+
+* Menu:
+
+* entry:                                 Top.                   (line 2)
+
+';
+
+1;
diff --git a/tp/t/results/alias/alias_of_definfoenclose.pl 
b/tp/t/results/alias/alias_of_definfoenclose.pl
new file mode 100644
index 0000000000..b91d69158d
--- /dev/null
+++ b/tp/t/results/alias/alias_of_definfoenclose.pl
@@ -0,0 +1,165 @@
+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{'alias_of_definfoenclose'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo,;,:'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'definfoenclose',
+          'extra' => {
+            'misc_args' => [
+              'phoo',
+              ';',
+              ':'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = phoo'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'phoo'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'aa'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'phoo',
+              'extra' => {
+                'begin' => ';',
+                'end' => ':'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 5,
+                'macro' => ''
+              },
+              'type' => 'definfoenclose_command'
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'alias_of_definfoenclose'} = '@definfoenclose phoo,;,:
+
+@alias new = phoo
+
+@phoo{aa}
+';
+
+
+$result_texts{'alias_of_definfoenclose'} = '
+
+aa
+';
+
+$result_errors{'alias_of_definfoenclose'} = [
+  {
+    'error_line' => 'warning: @definfoenclose is obsolete
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => '@definfoenclose is obsolete',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'alias_of_definfoenclose'} = {};
+
+
+
+$result_converted{'plaintext'}->{'alias_of_definfoenclose'} = ';aa:
+';
+
+1;
diff --git 
a/tp/t/results/alias/alias_of_definfoenclose_before_definfoenclose.pl 
b/tp/t/results/alias/alias_of_definfoenclose_before_definfoenclose.pl
new file mode 100644
index 0000000000..f4372c51be
--- /dev/null
+++ b/tp/t/results/alias/alias_of_definfoenclose_before_definfoenclose.pl
@@ -0,0 +1,165 @@
+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{'alias_of_definfoenclose_before_definfoenclose'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = phoo'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'phoo'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo,;,:'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'definfoenclose',
+          'extra' => {
+            'misc_args' => [
+              'phoo',
+              ';',
+              ':'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'aa'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'phoo',
+              'extra' => {
+                'begin' => ';',
+                'end' => ':'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 5,
+                'macro' => ''
+              },
+              'type' => 'definfoenclose_command'
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'alias_of_definfoenclose_before_definfoenclose'} = '@alias new = 
phoo
+
+@definfoenclose phoo,;,:
+
+@phoo{aa}
+';
+
+
+$result_texts{'alias_of_definfoenclose_before_definfoenclose'} = '
+
+aa
+';
+
+$result_errors{'alias_of_definfoenclose_before_definfoenclose'} = [
+  {
+    'error_line' => 'warning: @definfoenclose is obsolete
+',
+    'file_name' => '',
+    'line_nr' => 3,
+    'macro' => '',
+    'text' => '@definfoenclose is obsolete',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'alias_of_definfoenclose_before_definfoenclose'} = {};
+
+
+
+$result_converted{'plaintext'}->{'alias_of_definfoenclose_before_definfoenclose'}
 = ';aa:
+';
+
+1;
diff --git a/tp/t/results/alias/alias_of_macro.pl 
b/tp/t/results/alias/alias_of_macro.pl
new file mode 100644
index 0000000000..a5d606ccc2
--- /dev/null
+++ b/tp/t/results/alias/alias_of_macro.pl
@@ -0,0 +1,187 @@
+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{'alias_of_macro'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'mymacro',
+              'type' => 'macro_name'
+            },
+            {
+              'text' => 'thearg',
+              'type' => 'macro_arg'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'text' => '||\\thearg||
+',
+              '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' => ' mymacro {thearg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = mymacro'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'mymacro'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 5,
+            'macro' => ''
+          }
+        },
+        {
+          'source_marks' => [
+            {
+              'counter' => 1,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'tt'
+                      }
+                    ],
+                    'type' => 'brace_command_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'mymacro'
+                },
+                'type' => 'macro_call'
+              },
+              'position' => 1,
+              'sourcemark_type' => 'macro_expansion',
+              'status' => 'start'
+            }
+          ],
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 1,
+                  'position' => 10,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'text' => '||thearg||
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'alias_of_macro'} = '@macro mymacro {thearg}
+||\\thearg||
+@end macro
+
+@alias new = mymacro
+
+||thearg||
+';
+
+
+$result_texts{'alias_of_macro'} = '
+
+||thearg||
+';
+
+$result_errors{'alias_of_macro'} = [];
+
+
+$result_floats{'alias_of_macro'} = {};
+
+
+1;
diff --git a/tp/t/results/alias/alias_of_macro_before_macro.pl 
b/tp/t/results/alias/alias_of_macro_before_macro.pl
new file mode 100644
index 0000000000..ea96a5853f
--- /dev/null
+++ b/tp/t/results/alias/alias_of_macro_before_macro.pl
@@ -0,0 +1,187 @@
+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{'alias_of_macro_before_macro'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'new = mymacro'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'new',
+              'mymacro'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'text' => 'mymacro',
+              'type' => 'macro_name'
+            },
+            {
+              'text' => 'thearg',
+              'type' => 'macro_arg'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'text' => '||\\thearg||
+',
+              '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' => 5,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' mymacro {thearg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          }
+        },
+        {
+          'source_marks' => [
+            {
+              'counter' => 1,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'tt'
+                      }
+                    ],
+                    'type' => 'brace_command_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'mymacro'
+                },
+                'type' => 'macro_call'
+              },
+              'position' => 1,
+              'sourcemark_type' => 'macro_expansion',
+              'status' => 'start'
+            }
+          ],
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 1,
+                  'position' => 10,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'text' => '||thearg||
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'alias_of_macro_before_macro'} = '@alias new = mymacro
+
+@macro mymacro {thearg}
+||\\thearg||
+@end macro
+
+||thearg||
+';
+
+
+$result_texts{'alias_of_macro_before_macro'} = '
+
+||thearg||
+';
+
+$result_errors{'alias_of_macro_before_macro'} = [];
+
+
+$result_floats{'alias_of_macro_before_macro'} = {};
+
+
+1;
diff --git a/tp/t/results/macro/definfoenclose_replaced_by_macro.pl 
b/tp/t/results/macro/definfoenclose_replaced_by_macro.pl
new file mode 100644
index 0000000000..24c7651de7
--- /dev/null
+++ b/tp/t/results/macro/definfoenclose_replaced_by_macro.pl
@@ -0,0 +1,202 @@
+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{'definfoenclose_replaced_by_macro'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo,;,:'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'definfoenclose',
+          'extra' => {
+            'misc_args' => [
+              'phoo',
+              ';',
+              ':'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'text' => 'phoo',
+              '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' => 5,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' phoo {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          }
+        },
+        {
+          'source_marks' => [
+            {
+              'counter' => 1,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'aa'
+                      }
+                    ],
+                    'type' => 'brace_command_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'phoo'
+                },
+                '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{'definfoenclose_replaced_by_macro'} = '@definfoenclose phoo,;,:
+
+@macro phoo {arg}
+||\\arg\\||
+@end macro
+
+||aa||
+';
+
+
+$result_texts{'definfoenclose_replaced_by_macro'} = '
+
+||aa||
+';
+
+$result_errors{'definfoenclose_replaced_by_macro'} = [
+  {
+    'error_line' => 'warning: @definfoenclose is obsolete
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => '@definfoenclose is obsolete',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'definfoenclose_replaced_by_macro'} = {};
+
+
+
+$result_converted{'plaintext'}->{'definfoenclose_replaced_by_macro'} = '||aa||
+';
+
+1;
diff --git a/tp/t/results/macro/macro_alias_definfoenclose_defindex.pl 
b/tp/t/results/macro/macro_alias_definfoenclose_defindex.pl
new file mode 100644
index 0000000000..04bdc46f58
--- /dev/null
+++ b/tp/t/results/macro/macro_alias_definfoenclose_defindex.pl
@@ -0,0 +1,1606 @@
+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{'macro_alias_definfoenclose_defindex'} = {
+  'contents' => [
+    {
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'normalized' => 'Top'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'top',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 2,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'chap'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'isindex' => 1,
+        'normalized' => 'chap'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 4,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'chap'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'text' => 'phooindex',
+              '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' => 9,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' phooindex {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 7,
+            'macro' => ''
+          },
+          'source_marks' => [
+            {
+              'counter' => 1,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'maa'
+                      }
+                    ],
+                    'type' => 'brace_command_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'phooindex'
+                },
+                'type' => 'macro_call'
+              },
+              'sourcemark_type' => 'macro_expansion',
+              'status' => 'start'
+            }
+          ]
+        },
+        {
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 1,
+                  'position' => 7,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'text' => '||maa||
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phooindex,;,:'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'definfoenclose',
+          'extra' => {
+            'misc_args' => [
+              'phooindex',
+              ';',
+              ':'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 12,
+            'macro' => ''
+          }
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'dbb'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'phooindex',
+              'extra' => {
+                'begin' => ';',
+                'end' => ':'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 13,
+                'macro' => ''
+              },
+              'type' => 'definfoenclose_command'
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phooindex = strong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'phooindex',
+              'strong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 15,
+            'macro' => ''
+          }
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'acc'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'strong',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 16,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'defindex',
+          'extra' => {
+            'misc_args' => [
+              'phoo'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 18,
+            'macro' => ''
+          }
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'idd'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'phooindex',
+          'extra' => {
+            'element_node' => {},
+            'index_entry' => {
+              'entry_element' => {},
+              'entry_number' => 1,
+              'in_code' => 0,
+              'index_name' => 'phoo'
+            }
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 19,
+            'macro' => ''
+          },
+          'type' => 'index_entry_command'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phooindex,;,:'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'definfoenclose',
+          'extra' => {
+            'misc_args' => [
+              'phooindex',
+              ';',
+              ':'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 21,
+            'macro' => ''
+          }
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'dee'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'phooindex',
+              'extra' => {
+                'begin' => ';',
+                'end' => ':'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 22,
+                'macro' => ''
+              },
+              'type' => 'definfoenclose_command'
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'text' => 'phooindex',
+              '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' => 26,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' phooindex {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 24,
+            'macro' => ''
+          },
+          'source_marks' => [
+            {
+              'counter' => 2,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'mff'
+                      }
+                    ],
+                    'type' => 'line_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'phooindex'
+                },
+                'info' => {
+                  'spaces_before_argument' => {
+                    'text' => ' '
+                  }
+                },
+                'type' => 'macro_call'
+              },
+              'sourcemark_type' => 'macro_expansion',
+              'status' => 'start'
+            }
+          ]
+        },
+        {
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 2,
+                  'position' => 7,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'text' => '!!mff!!
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'defindex',
+          'extra' => {
+            'misc_args' => [
+              'phoo'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 29,
+            'macro' => ''
+          }
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'igg'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'phooindex',
+          'extra' => {
+            'element_node' => {},
+            'index_entry' => {
+              'entry_element' => {},
+              'entry_number' => 2,
+              'in_code' => 0,
+              'index_name' => 'phoo'
+            }
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 30,
+            'macro' => ''
+          },
+          'type' => 'index_entry_command'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'text' => 'phooindex',
+              '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' => 34,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' phooindex {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 32,
+            'macro' => ''
+          },
+          'source_marks' => [
+            {
+              'counter' => 3,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'mhh'
+                      }
+                    ],
+                    'type' => 'line_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'phooindex'
+                },
+                'info' => {
+                  'spaces_before_argument' => {
+                    'text' => ' '
+                  }
+                },
+                'type' => 'macro_call'
+              },
+              'sourcemark_type' => 'macro_expansion',
+              'status' => 'start'
+            }
+          ]
+        },
+        {
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 3,
+                  'position' => 7,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'text' => '!!mhh!!
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phooindex = strong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'phooindex',
+              'strong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 37,
+            'macro' => ''
+          }
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'aii'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'strong',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 38,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo,;,:'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'definfoenclose',
+          'extra' => {
+            'misc_args' => [
+              'phoo',
+              ';',
+              ':'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 40,
+            'macro' => ''
+          }
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'djj'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'phoo',
+              'extra' => {
+                'begin' => ';',
+                'end' => ':'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 41,
+                'macro' => ''
+              },
+              'type' => 'definfoenclose_command'
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'defindex',
+          'extra' => {
+            'misc_args' => [
+              'phoo'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 43,
+            'macro' => ''
+          }
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'ikk'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'phooindex',
+          'extra' => {
+            'element_node' => {},
+            'index_entry' => {
+              'entry_element' => {},
+              'entry_number' => 3,
+              'in_code' => 0,
+              'index_name' => 'phoo'
+            }
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 44,
+            'macro' => ''
+          },
+          'type' => 'index_entry_command'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phooindex = strong'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'alias',
+          'extra' => {
+            'misc_args' => [
+              'phooindex',
+              'strong'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 46,
+            'macro' => ''
+          }
+        },
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'all'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'strong',
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 47,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'text' => 'phoo',
+              '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' => 51,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' phoo {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 49,
+            'macro' => ''
+          },
+          'source_marks' => [
+            {
+              'counter' => 4,
+              'element' => {
+                'args' => [
+                  {
+                    'contents' => [
+                      {
+                        'text' => 'mmm'
+                      }
+                    ],
+                    'type' => 'brace_command_arg'
+                  }
+                ],
+                'extra' => {
+                  'name' => 'phoo'
+                },
+                'type' => 'macro_call'
+              },
+              'sourcemark_type' => 'macro_expansion',
+              'status' => 'start'
+            }
+          ]
+        },
+        {
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 4,
+                  'position' => 7,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'text' => '%%mmm%%
+'
+            }
+          ],
+          'type' => 'paragraph'
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'printindex',
+          'extra' => {
+            'misc_args' => [
+              'phoo'
+            ]
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 54,
+            'macro' => ''
+          }
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 5,
+        'macro' => ''
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[11]{'extra'}{'element_node'}
 = $result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[3];
+$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[11]{'extra'}{'index_entry'}{'entry_element'}
 = 
$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[11];
+$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[20]{'extra'}{'element_node'}
 = $result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[3];
+$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[20]{'extra'}{'index_entry'}{'entry_element'}
 = 
$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[20];
+$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[32]{'extra'}{'element_node'}
 = $result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[3];
+$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[32]{'extra'}{'index_entry'}{'entry_element'}
 = 
$result_trees{'macro_alias_definfoenclose_defindex'}{'contents'}[4]{'contents'}[32];
+
+$result_texis{'macro_alias_definfoenclose_defindex'} = '@node Top
+@top top
+
+@node chap
+@chapter chap
+
+@macro phooindex {arg}
+||\\arg\\||
+@end macro
+||maa||
+
+@definfoenclose phooindex,;,:
+@phooindex{dbb}
+
+@alias phooindex = strong
+@strong{acc}
+
+@defindex phoo
+@phooindex idd
+
+@definfoenclose phooindex,;,:
+@phooindex{dee}
+
+@macro phooindex {arg}
+!!\\arg\\!!
+@end macro
+!!mff!!
+
+@defindex phoo
+@phooindex igg
+
+@macro phooindex {arg}
+!!\\arg\\!!
+@end macro
+!!mhh!!
+
+@alias phooindex = strong
+@strong{aii}
+
+@definfoenclose phoo,;,:
+@phoo{djj}
+
+@defindex phoo
+@phooindex ikk
+
+@alias phooindex = strong
+@strong{all}
+
+@macro phoo {arg}
+%%\\arg\\%%
+@end macro
+%%mmm%%
+
+@printindex phoo
+';
+
+
+$result_texts{'macro_alias_definfoenclose_defindex'} = 'top
+***
+
+1 chap
+******
+
+||maa||
+
+dbb
+
+acc
+
+
+dee
+
+!!mff!!
+
+
+!!mhh!!
+
+aii
+
+djj
+
+
+all
+
+%%mmm%%
+
+';
+
+$result_sectioning{'macro_alias_definfoenclose_defindex'} = {
+  'structure' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'top',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'Top'
+            },
+            'info' => {},
+            'structure' => {}
+          }
+        },
+        'info' => {},
+        'structure' => {
+          'section_childs' => [
+            {
+              'cmdname' => 'chapter',
+              'extra' => {
+                'associated_node' => {
+                  'cmdname' => 'node',
+                  'extra' => {
+                    'isindex' => 1,
+                    'normalized' => 'chap'
+                  },
+                  'info' => {},
+                  'structure' => {}
+                }
+              },
+              'info' => {},
+              'structure' => {
+                'section_level' => 1,
+                'section_number' => 1,
+                'section_up' => {},
+                'toplevel_prev' => {},
+                'toplevel_up' => {}
+              }
+            }
+          ],
+          'section_level' => 0,
+          'section_up' => {}
+        }
+      }
+    ],
+    'section_level' => -1
+  }
+};
+$result_sectioning{'macro_alias_definfoenclose_defindex'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = 
$result_sectioning{'macro_alias_definfoenclose_defindex'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'macro_alias_definfoenclose_defindex'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_prev'}
 = 
$result_sectioning{'macro_alias_definfoenclose_defindex'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'macro_alias_definfoenclose_defindex'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_up'}
 = 
$result_sectioning{'macro_alias_definfoenclose_defindex'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'macro_alias_definfoenclose_defindex'}{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = $result_sectioning{'macro_alias_definfoenclose_defindex'};
+
+$result_nodes{'macro_alias_definfoenclose_defindex'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'associated_section' => {
+      'cmdname' => 'top',
+      'extra' => {},
+      'info' => {},
+      'structure' => {}
+    },
+    'normalized' => 'Top'
+  },
+  'info' => {},
+  'structure' => {
+    'node_next' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'chapter',
+          'extra' => {},
+          'info' => {},
+          'structure' => {
+            'section_number' => 1
+          }
+        },
+        'isindex' => 1,
+        'normalized' => 'chap'
+      },
+      'info' => {},
+      'structure' => {
+        'node_prev' => {},
+        'node_up' => {}
+      }
+    }
+  }
+};
+$result_nodes{'macro_alias_definfoenclose_defindex'}{'structure'}{'node_next'}{'structure'}{'node_prev'}
 = $result_nodes{'macro_alias_definfoenclose_defindex'};
+$result_nodes{'macro_alias_definfoenclose_defindex'}{'structure'}{'node_next'}{'structure'}{'node_up'}
 = $result_nodes{'macro_alias_definfoenclose_defindex'};
+
+$result_menus{'macro_alias_definfoenclose_defindex'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'Top'
+  },
+  'info' => {},
+  'structure' => {}
+};
+
+$result_errors{'macro_alias_definfoenclose_defindex'} = [
+  {
+    'error_line' => 'warning: @definfoenclose is obsolete
+',
+    'file_name' => '',
+    'line_nr' => 12,
+    'macro' => '',
+    'text' => '@definfoenclose is obsolete',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @definfoenclose is obsolete
+',
+    'file_name' => '',
+    'line_nr' => 21,
+    'macro' => '',
+    'text' => '@definfoenclose is obsolete',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @definfoenclose is obsolete
+',
+    'file_name' => '',
+    'line_nr' => 40,
+    'macro' => '',
+    'text' => '@definfoenclose is obsolete',
+    'type' => 'warning'
+  }
+];
+
+
+$result_indices{'macro_alias_definfoenclose_defindex'} = {
+  'index_names' => {
+    'cp' => {
+      'contained_indices' => {
+        'cp' => 1
+      },
+      'in_code' => 0,
+      'name' => 'cp'
+    },
+    'fn' => {
+      'contained_indices' => {
+        'fn' => 1
+      },
+      'in_code' => 1,
+      'name' => 'fn'
+    },
+    'ky' => {
+      'contained_indices' => {
+        'ky' => 1
+      },
+      'in_code' => 1,
+      'name' => 'ky'
+    },
+    'pg' => {
+      'contained_indices' => {
+        'pg' => 1
+      },
+      'in_code' => 1,
+      'name' => 'pg'
+    },
+    'phoo' => {
+      'contained_indices' => {
+        'phoo' => 1
+      },
+      'in_code' => 0,
+      'name' => 'phoo'
+    },
+    'tp' => {
+      'contained_indices' => {
+        'tp' => 1
+      },
+      'in_code' => 1,
+      'name' => 'tp'
+    },
+    'vr' => {
+      'contained_indices' => {
+        'vr' => 1
+      },
+      'in_code' => 1,
+      'name' => 'vr'
+    }
+  }
+};
+
+
+$result_floats{'macro_alias_definfoenclose_defindex'} = {};
+
+
+$result_indices_sort_strings{'macro_alias_definfoenclose_defindex'} = {
+  'phoo' => [
+    'idd',
+    'igg',
+    'ikk'
+  ]
+};
+
+
+
+$result_converted{'plaintext'}->{'macro_alias_definfoenclose_defindex'} = 'top
+***
+
+1 chap
+******
+
+||maa||
+
+   ;dbb:
+
+   *acc*
+
+   ;dee:
+
+   !!mff!!
+
+   !!mhh!!
+
+   *aii*
+
+   ;djj:
+
+   *all*
+
+   %%mmm%%
+
+* Menu:
+
+* idd:                                   chap.                 (line 12)
+* igg:                                   chap.                 (line 16)
+* ikk:                                   chap.                 (line 22)
+
+';
+
+1;
diff --git a/tp/t/results/macro/macro_replaced_by_definfoenclose.pl 
b/tp/t/results/macro/macro_replaced_by_definfoenclose.pl
new file mode 100644
index 0000000000..29aaaafff6
--- /dev/null
+++ b/tp/t/results/macro/macro_replaced_by_definfoenclose.pl
@@ -0,0 +1,193 @@
+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{'macro_replaced_by_definfoenclose'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'phoo',
+              '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' => ' phoo {arg}
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'text' => 'phoo,;,:'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'line_arg'
+            }
+          ],
+          'cmdname' => 'definfoenclose',
+          'extra' => {
+            'misc_args' => [
+              'phoo',
+              ';',
+              ':'
+            ]
+          },
+          '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' => 'phoo',
+              'extra' => {
+                'begin' => ';',
+                'end' => ':'
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 7,
+                'macro' => ''
+              },
+              'type' => 'definfoenclose_command'
+            },
+            {
+              'text' => '
+'
+            }
+          ],
+          'type' => 'paragraph'
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'macro_replaced_by_definfoenclose'} = '@macro phoo {arg}
+||\\arg\\||
+@end macro
+
+@definfoenclose phoo,;,:
+
+@phoo{aa}
+';
+
+
+$result_texts{'macro_replaced_by_definfoenclose'} = '
+
+aa
+';
+
+$result_errors{'macro_replaced_by_definfoenclose'} = [
+  {
+    'error_line' => 'warning: @definfoenclose is obsolete
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@definfoenclose is obsolete',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'macro_replaced_by_definfoenclose'} = {};
+
+
+
+$result_converted{'plaintext'}->{'macro_replaced_by_definfoenclose'} = ';aa:
+';
+
+1;



reply via email to

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