texinfo-commits
[Top][All Lists]
Advanced

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

texinfo/tp Texinfo/Parser.pm t/10menu.t t/resul...


From: Patrice Dumas
Subject: texinfo/tp Texinfo/Parser.pm t/10menu.t t/resul...
Date: Sat, 30 Apr 2011 09:53:58 +0000

CVSROOT:        /sources/texinfo
Module name:    texinfo
Changes by:     Patrice Dumas <pertusus>        11/04/30 09:53:58

Modified files:
        tp/Texinfo     : Parser.pm 
        tp/t           : 10menu.t 
Added files:
        tp/t/results/menu: menu_entry_no_entry_location.pl 

Log message:
        Put aborted menu entry (line beginning with * but not menu entry) in 
        menu description if it happened after a menu description.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/Texinfo/Parser.pm?cvsroot=texinfo&r1=1.246&r2=1.247
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/10menu.t?cvsroot=texinfo&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/texinfo/tp/t/results/menu/menu_entry_no_entry_location.pl?cvsroot=texinfo&rev=1.1

Patches:
Index: Texinfo/Parser.pm
===================================================================
RCS file: /sources/texinfo/texinfo/tp/Texinfo/Parser.pm,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -b -r1.246 -r1.247
--- Texinfo/Parser.pm   23 Apr 2011 15:59:05 -0000      1.246
+++ Texinfo/Parser.pm   30 Apr 2011 09:53:57 -0000      1.247
@@ -2045,11 +2045,33 @@
           and $current->{'contents'}->[-1]->{'type'} eq 'preformatted') {
           $current = $current->{'contents'}->[-1];
         } else {
+          #push @{$self->{'context_stack'}}, 'preformatted';
           push @{$current->{'contents'}}, {'type' => 'preformatted',
                                     'parent' => $current,
                                     'contents' => [] };
           $current = $current->{'contents'}->[-1];
         }
+        push @{$self->{'context_stack'}}, 'preformatted';
+      } elsif (@{$menu->{'contents'}} and $menu->{'contents'}->[-1]->{'type'}
+         and $menu->{'contents'}->[-1]->{'type'} eq 'menu_entry') {
+        my $entry = $menu->{'contents'}->[-1];
+        my $description;
+        foreach my $entry_element (reverse(@{$entry->{'args'}})) {
+          if ($entry_element->{'type'} eq 'menu_entry_description') {
+            $description = $entry_element;
+            last;
+          }
+        }
+        if ($description) {
+          $current = $description;
+        } else {
+          # Normally this cannot happen
+          warn "BUG: No description in menu_entry";
+          push @{$entry->{'args'}}, {'type' => 'menu_entry_description',
+                                     'parent' => $entry,
+                                     'contents' => [] };
+          $current = $entry->{'args'}->[-1];
+        }
       } else {
         push @{$menu->{'contents'}}, {'type' => 'menu_comment',
                                     'parent' => $menu,
@@ -2059,6 +2081,7 @@
                                   'parent' => $current,
                                   'contents' => [] };
         $current = $current->{'contents'}->[-1];
+        push @{$self->{'context_stack'}}, 'preformatted';
         print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
       }
       while (@{$menu_entry->{'args'}}) {
@@ -2080,7 +2103,7 @@
         }
         $arg = undef;
       }
-      push @{$self->{'context_stack'}}, 'preformatted';
+      #push @{$self->{'context_stack'}}, 'preformatted';
       # MENU_COMMENT open
       $menu_entry = undef;
     } else {

Index: t/10menu.t
===================================================================
RCS file: /sources/texinfo/texinfo/tp/t/10menu.t,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- t/10menu.t  20 Mar 2011 13:00:31 -0000      1.16
+++ t/10menu.t  30 Apr 2011 09:53:58 -0000      1.17
@@ -151,6 +151,17 @@
 * address@hidden: @c c
 @end menu
 '],
+['menu_entry_no_entry_location',
+'@menu
+* (manual):: begin description
+* not an entry ?
+* (manual):: an entry
+  in description
+* and here ?
+with text.
+* (last manual)::
address@hidden menu
+'],
 ['example_in_menu_comment',
 '@menu
 * entry::

Index: t/results/menu/menu_entry_no_entry_location.pl
===================================================================
RCS file: t/results/menu/menu_entry_no_entry_location.pl
diff -N t/results/menu/menu_entry_no_entry_location.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ t/results/menu/menu_entry_no_entry_location.pl      30 Apr 2011 09:53:58 
-0000      1.1
@@ -0,0 +1,344 @@
+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);
+
+use utf8;
+
+$result_trees{'menu_entry_no_entry_location'} = {
+  'contents' => [
+    {
+      'cmdname' => 'menu',
+      'contents' => [
+        {
+          'parent' => {},
+          'text' => '
+',
+          'type' => 'empty_line_after_command'
+        },
+        {
+          'args' => [
+            {
+              'parent' => {},
+              'text' => '* ',
+              'type' => 'menu_entry_leading_text'
+            },
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => '(manual)'
+                }
+              ],
+              'parent' => {},
+              'type' => 'menu_entry_node'
+            },
+            {
+              'parent' => {},
+              'text' => ':: ',
+              'type' => 'menu_entry_separator'
+            },
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => 'begin description
+'
+                },
+                {
+                  'parent' => {},
+                  'text' => '* not an entry ?
+'
+                }
+              ],
+              'parent' => {},
+              'type' => 'menu_entry_description'
+            }
+          ],
+          'extra' => {
+            'menu_entry_description' => {},
+            'menu_entry_node' => {
+              'manual_content' => [
+                {
+                  'parent' => {},
+                  'text' => 'manual'
+                }
+              ]
+            }
+          },
+          'line_nr' => {
+            'file_name' => '',
+            'line_nr' => 2,
+            'macro' => ''
+          },
+          'parent' => {},
+          'type' => 'menu_entry'
+        },
+        {
+          'args' => [
+            {
+              'parent' => {},
+              'text' => '* ',
+              'type' => 'menu_entry_leading_text'
+            },
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => '(manual)'
+                }
+              ],
+              'parent' => {},
+              'type' => 'menu_entry_node'
+            },
+            {
+              'parent' => {},
+              'text' => ':: ',
+              'type' => 'menu_entry_separator'
+            },
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => 'an entry
+'
+                },
+                {
+                  'parent' => {},
+                  'text' => '  in description
+'
+                },
+                {
+                  'parent' => {},
+                  'text' => '* and here ?
+'
+                },
+                {
+                  'parent' => {},
+                  'text' => 'with text.
+'
+                }
+              ],
+              'parent' => {},
+              'type' => 'menu_entry_description'
+            }
+          ],
+          'extra' => {
+            'menu_entry_description' => {},
+            'menu_entry_node' => {
+              'manual_content' => [
+                {
+                  'parent' => {},
+                  'text' => 'manual'
+                }
+              ]
+            }
+          },
+          'line_nr' => {
+            'file_name' => '',
+            'line_nr' => 4,
+            'macro' => ''
+          },
+          'parent' => {},
+          'type' => 'menu_entry'
+        },
+        {
+          'args' => [
+            {
+              'parent' => {},
+              'text' => '* ',
+              'type' => 'menu_entry_leading_text'
+            },
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => '(last manual)'
+                }
+              ],
+              'parent' => {},
+              'type' => 'menu_entry_node'
+            },
+            {
+              'parent' => {},
+              'text' => '::',
+              'type' => 'menu_entry_separator'
+            },
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => '
+'
+                }
+              ],
+              'parent' => {},
+              'type' => 'menu_entry_description'
+            }
+          ],
+          'extra' => {
+            'menu_entry_description' => {},
+            'menu_entry_node' => {
+              'manual_content' => [
+                {
+                  'parent' => {},
+                  'text' => 'last manual'
+                }
+              ]
+            }
+          },
+          'line_nr' => {
+            'file_name' => '',
+            'line_nr' => 8,
+            'macro' => ''
+          },
+          'parent' => {},
+          'type' => 'menu_entry'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'parent' => {},
+                  'text' => ' ',
+                  'type' => 'empty_spaces_after_command'
+                },
+                {
+                  'parent' => {},
+                  'text' => 'menu'
+                },
+                {
+                  'parent' => {},
+                  'text' => '
+',
+                  'type' => 'spaces_at_end'
+                }
+              ],
+              'parent' => {},
+              'type' => 'misc_line_arg'
+            }
+          ],
+          'cmdname' => 'end',
+          'extra' => {
+            'command' => {},
+            'command_argument' => 'menu',
+            'text_arg' => 'menu'
+          },
+          'line_nr' => {
+            'file_name' => '',
+            'line_nr' => 9,
+            'macro' => ''
+          },
+          'parent' => {}
+        }
+      ],
+      'extra' => {
+        'end_command' => {}
+      },
+      'line_nr' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      },
+      'parent' => {}
+    }
+  ],
+  'type' => 'text_root'
+};
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[0]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[0]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[1]{'contents'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[1]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[2]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[3]{'contents'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[3]{'contents'}[1]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[3]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'extra'}{'menu_entry_description'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'extra'}{'menu_entry_node'}{'manual_content'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'args'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[1]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[1]{'contents'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[1]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[2]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3]{'contents'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3]{'contents'}[1]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3]{'contents'}[2]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3]{'contents'}[3]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'extra'}{'menu_entry_description'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'extra'}{'menu_entry_node'}{'manual_content'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'args'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[2]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[0]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[1]{'contents'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[1]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[2]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[3]{'contents'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[3]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'extra'}{'menu_entry_description'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[3];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'extra'}{'menu_entry_node'}{'manual_content'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'args'}[1];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[3]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'args'}[0]{'contents'}[0]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'args'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'args'}[0]{'contents'}[1]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'args'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'args'}[0]{'contents'}[2]{'parent'}
 = 
$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'args'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'args'}[0]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'extra'}{'command'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4]{'parent'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'extra'}{'end_command'}
 = $result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'contents'}[4];
+$result_trees{'menu_entry_no_entry_location'}{'contents'}[0]{'parent'} = 
$result_trees{'menu_entry_no_entry_location'};
+
+$result_texis{'menu_entry_no_entry_location'} = '@menu
+* (manual):: begin description
+* not an entry ?
+* (manual):: an entry
+  in description
+* and here ?
+with text.
+* (last manual)::
address@hidden menu
+';
+
+
+$result_texts{'menu_entry_no_entry_location'} = '* (manual):: begin description
+* not an entry ?
+* (manual):: an entry
+  in description
+* and here ?
+with text.
+* (last manual)::
+';
+
+$result_errors{'menu_entry_no_entry_location'} = [
+  {
+    'error_line' => ':1: @menu seen before first @node
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => '@menu seen before first @node',
+    'type' => 'error'
+  },
+  {
+    'error_line' => ':1: perhaps your @top node should be wrapped in @ifnottex 
rather than @ifinfo?
+',
+    'file_name' => '',
+    'line_nr' => 1,
+    'macro' => '',
+    'text' => 'perhaps your @top node should be wrapped in @ifnottex rather 
than @ifinfo?',
+    'type' => 'error continuation'
+  }
+];
+
+
+
+$result_converted{'plaintext'}->{'menu_entry_no_entry_location'} = '* Menu:
+
+* (manual):: begin description
+* not an entry ?
+* (manual):: an entry
+  in description
+* and here ?
+with text.
+* (last manual)::
+';
+
+1;



reply via email to

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