[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[5190] Improve error messages of @ -commands with braces closed
From: |
Patrice Dumas |
Subject: |
[5190] Improve error messages of @ -commands with braces closed because |
Date: |
Sat, 23 Feb 2013 00:06:38 +0000 |
Revision: 5190
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5190
Author: pertusus
Date: 2013-02-23 00:06:38 +0000 (Sat, 23 Feb 2013)
Log Message:
-----------
Improve error messages of @-commands with braces closed because
of seeing a command before the closing brace.
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Parser.pm
trunk/tp/t/results/coverage_braces/caption_not_closed.pl
trunk/tp/t/results/invalid_nestings/section_in_footnote.pl
trunk/tp/t/results/invalid_nestings/section_in_math.pl
trunk/tp/t/results/invalid_nestings/style_not_closed_in_block_command.pl
trunk/tp/t/results/invalid_nestings/style_not_closed_no_newline_root_commands.pl
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2013-02-22 23:59:31 UTC (rev 5189)
+++ trunk/ChangeLog 2013-02-23 00:06:38 UTC (rev 5190)
@@ -24,6 +24,8 @@
Accept that @set and @clear are not at the beginning of a line.
Do not warn for @end in style command, as it may be the @end of
a conditional that is correct in that context.
+ Improve error messages of @-commands with braces closed because
+ of seeing a command before the closing brace.
2013-02-21 Karl Berry <address@hidden>
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2013-02-22 23:59:31 UTC (rev 5189)
+++ trunk/tp/Texinfo/Parser.pm 2013-02-23 00:06:38 UTC (rev 5190)
@@ -1236,15 +1236,28 @@
# currently doesn't do much more than
# return $_[1]->{'parent'}
-sub _close_brace_command($$$)
+sub _close_brace_command($$$;$$)
{
my $self = shift;
my $current = shift;
my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
if ($current->{'cmdname'} ne 'verb' or $current->{'type'} eq '') {
- $self->_command_error($current, $line_nr,
- $self->__("%c%s missing close brace"), ord('@'), $current->{'cmdname'});
+ if (defined($closed_command)) {
+ $self->_command_error($current, $line_nr,
+ $self->__("address@hidden %s seen before address@hidden closing
brace"),
+ $closed_command, $current->{'cmdname'});
+ } elsif (defined($interrupting_command)) {
+ $self->_command_error($current, $line_nr,
+ $self->__("address@hidden seen before address@hidden closing brace"),
+ $interrupting_command, $current->{'cmdname'});
+
+ } else {
+ $self->_command_error($current, $line_nr,
+ $self->__("%c%s missing close brace"), ord('@'),
$current->{'cmdname'});
+ }
} else {
$self->_command_error($current, $line_nr,
$self->__("address@hidden missing closing delimiter sequence: %s}"),
@@ -1269,28 +1282,34 @@
}
# close brace commands, that don't set a new context (ie @caption, @footnote)
-sub _close_all_style_commands($$$)
+sub _close_all_style_commands($$$;$$)
{
my $self = shift;
my $current = shift;
my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
while ($current->{'parent'} and $current->{'parent'}->{'cmdname'}
and exists $brace_commands{$current->{'parent'}->{'cmdname'}}
and !exists
$context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
- $current = _close_brace_command($self, $current->{'parent'}, $line_nr);
+ $current = _close_brace_command($self, $current->{'parent'}, $line_nr,
+ $closed_command, $interrupting_command);
}
return $current;
}
# close brace commands except for @caption, @footnote then the paragraph
-sub _end_paragraph($$$)
+sub _end_paragraph($$$;$$)
{
my $self = shift;
my $current = shift;
my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
- $current = _close_all_style_commands($self, $current, $line_nr);
+ $current = _close_all_style_commands($self, $current, $line_nr,
+ $closed_command, $interrupting_command);
if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
print STDERR "CLOSE PARA\n" if ($self->{'DEBUG'});
$current = $current->{'parent'};
@@ -1299,13 +1318,16 @@
}
# close brace commands except for @caption, @footnote then the preformatted
-sub _end_preformatted($$$)
+sub _end_preformatted($$$;$$)
{
my $self = shift;
my $current = shift;
my $line_nr = shift;
+ my $closed_command = shift;
+ my $interrupting_command = shift;
- $current = _close_all_style_commands($self, $current, $line_nr);
+ $current = _close_all_style_commands($self, $current, $line_nr,
+ $closed_command, $interrupting_command);
if ($current->{'type'} and $preformatted_contexts{$current->{'type'}}) {
print STDERR "CLOSE PREFORMATTED $current->{'type'}\n" if
($self->{'DEBUG'});
# completly remove void preformatted contexts
@@ -1623,7 +1645,8 @@
if (exists($brace_commands{$current->{'cmdname'}})) {
pop @{$self->{'context_stack'}}
if (exists $context_brace_commands{$current->{'cmdname'}});
- $current = _close_brace_command($self, $current, $line_nr);
+ $current = _close_brace_command($self, $current, $line_nr,
+ $closed_command, $interrupting_command);
} elsif (exists($block_commands{$current->{'cmdname'}})) {
if (defined($closed_command)) {
$self->line_error(sprintf($self->__("address@hidden' expected `%s',
but saw `%s'"),
@@ -1696,8 +1719,10 @@
my $closed_command = shift;
my $interrupting_command = shift;;
- $current = _end_paragraph($self, $current, $line_nr);
- $current = _end_preformatted($self, $current, $line_nr);
+ $current = _end_paragraph($self, $current, $line_nr, $closed_command,
+ $interrupting_command);
+ $current = _end_preformatted($self, $current, $line_nr, $closed_command,
+ $interrupting_command);
# stop if the command is found
while (!($closed_command and $current->{'cmdname'}
Modified: trunk/tp/t/results/coverage_braces/caption_not_closed.pl
===================================================================
--- trunk/tp/t/results/coverage_braces/caption_not_closed.pl 2013-02-22
23:59:31 UTC (rev 5189)
+++ trunk/tp/t/results/coverage_braces/caption_not_closed.pl 2013-02-23
00:06:38 UTC (rev 5190)
@@ -268,12 +268,12 @@
$result_errors{'caption_not_closed'} = [
{
- 'error_line' => ':3: @caption missing close brace
+ 'error_line' => ':3: @end float seen before @caption closing brace
',
'file_name' => '',
'line_nr' => 3,
'macro' => '',
- 'text' => '@caption missing close brace',
+ 'text' => '@end float seen before @caption closing brace',
'type' => 'error'
}
];
Modified: trunk/tp/t/results/invalid_nestings/section_in_footnote.pl
===================================================================
--- trunk/tp/t/results/invalid_nestings/section_in_footnote.pl 2013-02-22
23:59:31 UTC (rev 5189)
+++ trunk/tp/t/results/invalid_nestings/section_in_footnote.pl 2013-02-23
00:06:38 UTC (rev 5190)
@@ -155,12 +155,12 @@
$result_errors{'section_in_footnote'} = [
{
- 'error_line' => ':2: @footnote missing close brace
+ 'error_line' => ':2: @section seen before @footnote closing brace
',
'file_name' => '',
'line_nr' => 2,
'macro' => '',
- 'text' => '@footnote missing close brace',
+ 'text' => '@section seen before @footnote closing brace',
'type' => 'error'
}
];
Modified: trunk/tp/t/results/invalid_nestings/section_in_math.pl
===================================================================
--- trunk/tp/t/results/invalid_nestings/section_in_math.pl 2013-02-22
23:59:31 UTC (rev 5189)
+++ trunk/tp/t/results/invalid_nestings/section_in_math.pl 2013-02-23
00:06:38 UTC (rev 5190)
@@ -320,21 +320,21 @@
'type' => 'error'
},
{
- 'error_line' => ':2: @math missing close brace
+ 'error_line' => ':2: @section seen before @math closing brace
',
'file_name' => '',
'line_nr' => 2,
'macro' => '',
- 'text' => '@math missing close brace',
+ 'text' => '@section seen before @math closing brace',
'type' => 'error'
},
{
- 'error_line' => ':6: @math missing close brace
+ 'error_line' => ':6: @section seen before @math closing brace
',
'file_name' => '',
'line_nr' => 6,
'macro' => '',
- 'text' => '@math missing close brace',
+ 'text' => '@section seen before @math closing brace',
'type' => 'error'
},
{
Modified:
trunk/tp/t/results/invalid_nestings/style_not_closed_in_block_command.pl
===================================================================
--- trunk/tp/t/results/invalid_nestings/style_not_closed_in_block_command.pl
2013-02-22 23:59:31 UTC (rev 5189)
+++ trunk/tp/t/results/invalid_nestings/style_not_closed_in_block_command.pl
2013-02-23 00:06:38 UTC (rev 5190)
@@ -138,12 +138,12 @@
$result_errors{'style_not_closed_in_block_command'} = [
{
- 'error_line' => ':2: @code missing close brace
+ 'error_line' => ':2: @end cartouche seen before @code closing brace
',
'file_name' => '',
'line_nr' => 2,
'macro' => '',
- 'text' => '@code missing close brace',
+ 'text' => '@end cartouche seen before @code closing brace',
'type' => 'error'
}
];
Modified:
trunk/tp/t/results/invalid_nestings/style_not_closed_no_newline_root_commands.pl
===================================================================
---
trunk/tp/t/results/invalid_nestings/style_not_closed_no_newline_root_commands.pl
2013-02-22 23:59:31 UTC (rev 5189)
+++
trunk/tp/t/results/invalid_nestings/style_not_closed_no_newline_root_commands.pl
2013-02-23 00:06:38 UTC (rev 5190)
@@ -635,12 +635,12 @@
$result_errors{'style_not_closed_no_newline_root_commands'} = [
{
- 'error_line' => ':8: @code missing close brace
+ 'error_line' => ':8: @node seen before @code closing brace
',
'file_name' => '',
'line_nr' => 8,
'macro' => '',
- 'text' => '@code missing close brace',
+ 'text' => '@node seen before @code closing brace',
'type' => 'error'
},
{
@@ -653,12 +653,12 @@
'type' => 'warning'
},
{
- 'error_line' => ':12: @code missing close brace
+ 'error_line' => ':12: @bye seen before @code closing brace
',
'file_name' => '',
'line_nr' => 12,
'macro' => '',
- 'text' => '@code missing close brace',
+ 'text' => '@bye seen before @code closing brace',
'type' => 'error'
},
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [5190] Improve error messages of @ -commands with braces closed because,
Patrice Dumas <=