texinfo-commits
[Top][All Lists]
Advanced

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

[7246] don't support @-commands in @errormsg


From: gavinsmith0123
Subject: [7246] don't support @-commands in @errormsg
Date: Sat, 9 Jul 2016 18:58:10 +0000 (UTC)

Revision: 7246
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7246
Author:   gavin
Date:     2016-07-09 18:58:10 +0000 (Sat, 09 Jul 2016)
Log Message:
-----------
don't support @-commands in @errormsg

Modified Paths:
--------------
    trunk/tp/Texinfo/Parser.pm
    trunk/tp/t/results/coverage/test_errormsg.pl
    trunk/tp/t/results/invalid_nestings/in_errormsg.pl

Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm  2016-07-05 19:22:09 UTC (rev 7245)
+++ trunk/tp/Texinfo/Parser.pm  2016-07-09 18:58:10 UTC (rev 7246)
@@ -57,8 +57,6 @@
 # encoding_alias
 use Texinfo::Encoding;
 
-# to expand file names in @include and similar @-commands
-use Texinfo::Convert::Text;
 # to normalize node name, anchor, float arg, listoffloats and first *ref 
argument.
 use Texinfo::Convert::NodeNameNormalization;
 # in error messages, and for macro body expansion
@@ -100,12 +98,6 @@
   return $_[0];
 }
 
-#sub __($$)
-#{
-#  my $self = shift;
-#  return &{$self->{'gettext'}}(@_);
-#}
-
 # Customization variables obeyed by the Parser, and the default values.
 our %default_customization_values = (
   'TEST' => 0,
@@ -441,6 +433,12 @@
   $simple_text_commands{$command} = 1;
 }
 
+# Commands that don't contain other @-commands.
+my %no_command_commands;
+foreach my $command ('errormsg', 'U') {
+  $no_command_commands{$command} = 1;
+}
+
 # commands that accept full text, but no block or top-level commands
 my %full_text_commands;
 foreach my $brace_command (keys (%brace_commands)) {  
@@ -477,6 +475,9 @@
 foreach my $command (keys(%simple_text_commands)) {
   $default_valid_nestings{$command} = \%in_simple_text_commands;
 }
+foreach my $command (keys(%no_command_commands)) {
+  $default_valid_nestings{$command} = {};
+}
 foreach my $command (keys(%full_line_commands)) {
   $default_valid_nestings{$command} = \%in_full_line_commands;
 }
@@ -632,9 +633,6 @@
 
   _setup_conf($parser, $conf, "Texinfo::Parser::parser");
 
-  #foreach my $value (keys %{$parser->{'values'}}) {
-  #  print STDERR "   ->  $value $parser->{'values'}->{$value}\n";
-  #}
   # Now initialize command hash that are dynamically modified, notably
   # those for index commands, and lists, based on defaults and user provided.
   $parser->{'misc_commands'} = dclone(\%misc_commands);
@@ -5205,14 +5203,15 @@
                            $current_command->{'cmdname'}), $line_nr);
               }
             } elsif ($current->{'parent'}->{'cmdname'} eq 'errormsg') {
-              my $error_message_text 
-               = Texinfo::Convert::Text::convert($current,
-                          {Texinfo::Common::_convert_text_options($self)});
-              $self->line_error($error_message_text, $line_nr);
+              my @contents = @{$current->{'contents'}};
+              _trim_spaces_comment_from_content (address@hidden);
+              my $error_message_text = $contents[0]->{'text'};
+              $self->line_error($error_message_text, $line_nr)
+                if $error_message_text;
             } elsif ($current->{'parent'}->{'cmdname'} eq 'U') {
-              my $arg 
-               = Texinfo::Convert::Text::convert($current,
-                          {Texinfo::Common::_convert_text_options($self)});
+              my @contents = @{$current->{'contents'}};
+              _trim_spaces_comment_from_content (address@hidden);
+              my $arg = $contents[0]->{'text'};
               if (!defined($arg) || !$arg) {
                 $self->line_warn($self->__("no argument specified for 
address@hidden"),
                   $line_nr);

Modified: trunk/tp/t/results/coverage/test_errormsg.pl
===================================================================
--- trunk/tp/t/results/coverage/test_errormsg.pl        2016-07-05 19:22:09 UTC 
(rev 7245)
+++ trunk/tp/t/results/coverage/test_errormsg.pl        2016-07-09 18:58:10 UTC 
(rev 7246)
@@ -37,6 +37,9 @@
                   ],
                   'cmdname' => '~',
                   'contents' => [],
+                  'extra' => {
+                    'invalid_nesting' => 1
+                  },
                   'line_nr' => {
                     'file_name' => '',
                     'line_nr' => 2,
@@ -63,6 +66,9 @@
                   ],
                   'cmdname' => 'code',
                   'contents' => [],
+                  'extra' => {
+                    'invalid_nesting' => 1
+                  },
                   'line_nr' => {},
                   'parent' => {}
                 }
@@ -129,12 +135,30 @@
 
 $result_errors{'test_errormsg'} = [
   {
-    'error_line' => ':2: Text e~ code
+    'error_line' => ':2: warning: @~ should not appear in @errormsg
 ',
     'file_name' => '',
     'line_nr' => 2,
     'macro' => '',
-    'text' => 'Text e~ code',
+    'text' => '@~ should not appear in @errormsg',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => ':2: warning: @code should not appear in @errormsg
+',
+    'file_name' => '',
+    'line_nr' => 2,
+    'macro' => '',
+    'text' => '@code should not appear in @errormsg',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => ':2: Text 
+',
+    'file_name' => '',
+    'line_nr' => 2,
+    'macro' => '',
+    'text' => 'Text ',
     'type' => 'error'
   }
 ];

Modified: trunk/tp/t/results/invalid_nestings/in_errormsg.pl
===================================================================
--- trunk/tp/t/results/invalid_nestings/in_errormsg.pl  2016-07-05 19:22:09 UTC 
(rev 7245)
+++ trunk/tp/t/results/invalid_nestings/in_errormsg.pl  2016-07-09 18:58:10 UTC 
(rev 7246)
@@ -444,15 +444,6 @@
     'type' => 'warning'
   },
   {
-    'error_line' => ':3: in ref
-',
-    'file_name' => '',
-    'line_nr' => 3,
-    'macro' => '',
-    'text' => 'in ref',
-    'type' => 'error'
-  },
-  {
     'error_line' => ':5: @errormsg missing closing brace
 ',
     'file_name' => '',




reply via email to

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