[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Stricter check of @-commands not appearing at the
From: |
Patrice Dumas |
Subject: |
branch master updated: Stricter check of @-commands not appearing at the beginning of a line |
Date: |
Sun, 29 Sep 2024 08:25:48 -0400 |
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 924c79d4b8 Stricter check of @-commands not appearing at the beginning
of a line
924c79d4b8 is described below
commit 924c79d4b82bb6a964085f9e44b7c1b2e9c97586
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Jun 23 21:33:03 2024 +0200
Stricter check of @-commands not appearing at the beginning of a line
* tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): check
that an @-command is opened at the beginning of a line by checking
that the previous element is an empty_line text element.
---
ChangeLog | 9 +++++++
tp/Texinfo/ParserNonXS.pm | 9 ++++++-
tp/Texinfo/XS/parsetexi/parser.c | 5 +++-
.../indices_in_begin_tables_lists.pl | 11 ++++++++-
...ces_in_begin_tables_lists_entries_after_item.pl | 11 ++++++++-
.../format_on_first_footnote_line.pl | 17 ++++++++++++-
tp/t/results/invalid_nestings/center.pl | 14 +++++++++++
tp/t/results/invalid_nestings/in_table.pl | 28 ++++++++++++++++++++++
tp/t/results/invalid_nestings/raw_block_on_line.pl | 7 ++++++
.../invalid_nestings/section_on_cartouche_line.pl | 14 +++++++++++
.../invalid_nestings/section_on_itemize_line.pl | 7 ++++++
.../invalid_nestings/section_on_multitable_line.pl | 7 ++++++
.../invalid_nestings/section_on_xtable_line.pl | 7 ++++++
.../itemize/inter_item_commands_in_itemize.pl | 10 +++++++-
tp/t/results/misc_commands/double_exdent.pl | 7 ++++++
.../example_invalid_at_commands_arguments.pl | 7 ++++++
tp/t/results/value/set_on_item_line.pl | 14 +++++++++++
.../indices_in_begin_tables_lists.2 | 1 +
.../indices_in_begin_tables_lists.2 | 1 +
19 files changed, 180 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a7f213c74b..6d6f589c95 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-06-23 Patrice Dumas <pertusus@free.fr>
+
+ Stricter check of @-commands not appearing at the beginning of a line
+
+ * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
+ tp/Texinfo/XS/parsetexi/parser.c (process_remaining_on_line): check
+ that an @-command is opened at the beginning of a line by checking
+ that the previous element is an empty_line text element.
+
2024-06-23 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/ParserNonXS.pm (_in_begin_paragraph),
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 127346ce3a..086d6ea161 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -7411,13 +7411,20 @@ sub _process_remaining_on_line($$$$)
# warn on not appearing at line beginning. Need to do before closing
# paragraph as it also closes the empty line
- if (not _abort_empty_line($self, $current)
+ my $last_element;
+ if ($current->{'contents'}) {
+ $last_element = $current->{'contents'}->[-1];
+ }
+ if ((!$last_element or !$last_element->{'type'}
+ or $last_element->{'type'} ne 'empty_line')
and $begin_line_commands{$command}) {
$self->_line_warn(
sprintf(__("\@%s should only appear at the beginning of a line"),
$command), $source_info);
}
+ _abort_empty_line($self, $current);
+
if ($close_paragraph_commands{$command}) {
$current = _end_paragraph($self, $current, $source_info);
}
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 01c1663ab4..d488ebf623 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -2259,6 +2259,7 @@ process_remaining_on_line (ELEMENT **current_inout, const
char **line_inout)
@item command. */
enum command_id data_cmd = cmd;
ELEMENT *command_element;
+ ELEMENT *last_element = last_contents_child (current);
debug ("COMMAND @%s", debug_parser_command_name (cmd));
@@ -2380,7 +2381,7 @@ process_remaining_on_line (ELEMENT **current_inout, const
char **line_inout)
/* warn on not appearing at line beginning. Need to do before closing
paragraph as it also closes the empty line */
- if (!abort_empty_line (current)
+ if ((!last_element || last_element->type != ET_empty_line)
&& ((cmd == CM_node || cmd == CM_bye)
|| (command_data(cmd).flags & CF_block)
|| ((command_data(cmd).flags & CF_line)
@@ -2394,6 +2395,8 @@ process_remaining_on_line (ELEMENT **current_inout, const
char **line_inout)
command_name(cmd));
}
+ abort_empty_line (current);
+
if (cmd)
{
if (command_data(cmd).flags & CF_close_paragraph)
diff --git a/tp/t/results/converters_tests/indices_in_begin_tables_lists.pl
b/tp/t/results/converters_tests/indices_in_begin_tables_lists.pl
index f563962a4b..f8fa21f7a7 100644
--- a/tp/t/results/converters_tests/indices_in_begin_tables_lists.pl
+++ b/tp/t/results/converters_tests/indices_in_begin_tables_lists.pl
@@ -4215,7 +4215,16 @@ $result_menus{'indices_in_begin_tables_lists'} = [
}
];
-$result_errors{'indices_in_begin_tables_lists'} = [];
+$result_errors{'indices_in_begin_tables_lists'} = [
+ {
+ 'error_line' => 'warning: @cindex should only appear at the beginning of a
line
+',
+ 'file_name' => 'indices_in_begin_tables_lists.texi',
+ 'line_nr' => 18,
+ 'text' => '@cindex should only appear at the beginning of a line',
+ 'type' => 'warning'
+ }
+];
$result_floats{'indices_in_begin_tables_lists'} = {};
diff --git
a/tp/t/results/converters_tests/indices_in_begin_tables_lists_entries_after_item.pl
b/tp/t/results/converters_tests/indices_in_begin_tables_lists_entries_after_item.pl
index d9cf96ea72..908b6c66e8 100644
---
a/tp/t/results/converters_tests/indices_in_begin_tables_lists_entries_after_item.pl
+++
b/tp/t/results/converters_tests/indices_in_begin_tables_lists_entries_after_item.pl
@@ -4223,7 +4223,16 @@
$result_menus{'indices_in_begin_tables_lists_entries_after_item'} = [
}
];
-$result_errors{'indices_in_begin_tables_lists_entries_after_item'} = [];
+$result_errors{'indices_in_begin_tables_lists_entries_after_item'} = [
+ {
+ 'error_line' => 'warning: @cindex should only appear at the beginning of a
line
+',
+ 'file_name' => 'indices_in_begin_tables_lists.texi',
+ 'line_nr' => 18,
+ 'text' => '@cindex should only appear at the beginning of a line',
+ 'type' => 'warning'
+ }
+];
$result_floats{'indices_in_begin_tables_lists_entries_after_item'} = {};
diff --git a/tp/t/results/coverage_braces/format_on_first_footnote_line.pl
b/tp/t/results/coverage_braces/format_on_first_footnote_line.pl
index 51662dcd3c..7f2e951b5f 100644
--- a/tp/t/results/coverage_braces/format_on_first_footnote_line.pl
+++ b/tp/t/results/coverage_braces/format_on_first_footnote_line.pl
@@ -212,7 +212,22 @@ $result_texts{'format_on_first_footnote_line'} = 'Texte.
Last text
';
-$result_errors{'format_on_first_footnote_line'} = [];
+$result_errors{'format_on_first_footnote_line'} = [
+ {
+ 'error_line' => 'warning: @quotation should only appear at the beginning
of a line
+',
+ 'line_nr' => 1,
+ 'text' => '@quotation should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @example should only appear at the beginning of
a line
+',
+ 'line_nr' => 6,
+ 'text' => '@example should only appear at the beginning of a line',
+ 'type' => 'warning'
+ }
+];
$result_floats{'format_on_first_footnote_line'} = {};
diff --git a/tp/t/results/invalid_nestings/center.pl
b/tp/t/results/invalid_nestings/center.pl
index 53fe23ebb1..6e67463516 100644
--- a/tp/t/results/invalid_nestings/center.pl
+++ b/tp/t/results/invalid_nestings/center.pl
@@ -1336,6 +1336,13 @@ $result_errors{'center'} = [
'text' => 'entry for index `cp\' outside of any node',
'type' => 'warning'
},
+ {
+ 'error_line' => 'warning: @quotation should only appear at the beginning
of a line
+',
+ 'line_nr' => 5,
+ 'text' => '@quotation should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @quotation should not appear in @center
',
@@ -1469,6 +1476,13 @@ $result_errors{'center'} = [
'text' => '@item outside of table or list',
'type' => 'error'
},
+ {
+ 'error_line' => 'warning: @center should only appear at the beginning of a
line
+',
+ 'line_nr' => 31,
+ 'text' => '@center should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @center should not appear in @center
',
diff --git a/tp/t/results/invalid_nestings/in_table.pl
b/tp/t/results/invalid_nestings/in_table.pl
index 66b09ae9ec..3b2d778fea 100644
--- a/tp/t/results/invalid_nestings/in_table.pl
+++ b/tp/t/results/invalid_nestings/in_table.pl
@@ -1082,6 +1082,13 @@ $result_errors{'in_table'} = [
'text' => 'misplaced }',
'type' => 'error'
},
+ {
+ 'error_line' => 'warning: @center should only appear at the beginning of a
line
+',
+ 'line_nr' => 13,
+ 'text' => '@center should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @center should not appear in @item
',
@@ -1089,6 +1096,13 @@ $result_errors{'in_table'} = [
'text' => '@center should not appear in @item',
'type' => 'warning'
},
+ {
+ 'error_line' => 'warning: @cindex should only appear at the beginning of a
line
+',
+ 'line_nr' => 14,
+ 'text' => '@cindex should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @cindex should not appear in @item
',
@@ -1096,6 +1110,13 @@ $result_errors{'in_table'} = [
'text' => '@cindex should not appear in @item',
'type' => 'warning'
},
+ {
+ 'error_line' => 'warning: @cindex should only appear at the beginning of a
line
+',
+ 'line_nr' => 18,
+ 'text' => '@cindex should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @cindex should not appear in @item
',
@@ -1103,6 +1124,13 @@ $result_errors{'in_table'} = [
'text' => '@cindex should not appear in @item',
'type' => 'warning'
},
+ {
+ 'error_line' => 'warning: @cindex should only appear at the beginning of a
line
+',
+ 'line_nr' => 21,
+ 'text' => '@cindex should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @cindex should not appear in @item
',
diff --git a/tp/t/results/invalid_nestings/raw_block_on_line.pl
b/tp/t/results/invalid_nestings/raw_block_on_line.pl
index 3fbae27f7d..c3aef86716 100644
--- a/tp/t/results/invalid_nestings/raw_block_on_line.pl
+++ b/tp/t/results/invalid_nestings/raw_block_on_line.pl
@@ -66,6 +66,13 @@ $result_texis{'raw_block_on_line'} = '@cindex @tex
$result_texts{'raw_block_on_line'} = '';
$result_errors{'raw_block_on_line'} = [
+ {
+ 'error_line' => 'warning: @tex should only appear at the beginning of a
line
+',
+ 'line_nr' => 1,
+ 'text' => '@tex should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'no matching `@end tex\'
',
diff --git a/tp/t/results/invalid_nestings/section_on_cartouche_line.pl
b/tp/t/results/invalid_nestings/section_on_cartouche_line.pl
index 399f55b6d6..3dc491d672 100644
--- a/tp/t/results/invalid_nestings/section_on_cartouche_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_cartouche_line.pl
@@ -158,6 +158,13 @@
$result_sectioning{'section_on_cartouche_line'}{'extra'}{'section_childs'}[1]{'e
$result_sectioning{'section_on_cartouche_line'}{'extra'}{'section_childs'}[1]{'extra'}{'toplevel_directions'}{'prev'}
=
$result_sectioning{'section_on_cartouche_line'}{'extra'}{'section_childs'}[0];
$result_errors{'section_on_cartouche_line'} = [
+ {
+ 'error_line' => 'warning: @section should only appear at the beginning of
a line
+',
+ 'line_nr' => 1,
+ 'text' => '@section should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => '@section seen before @end cartouche
',
@@ -165,6 +172,13 @@ $result_errors{'section_on_cartouche_line'} = [
'text' => '@section seen before @end cartouche',
'type' => 'error'
},
+ {
+ 'error_line' => 'warning: @section should only appear at the beginning of
a line
+',
+ 'line_nr' => 3,
+ 'text' => '@section should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => '@section seen before @end cartouche
',
diff --git a/tp/t/results/invalid_nestings/section_on_itemize_line.pl
b/tp/t/results/invalid_nestings/section_on_itemize_line.pl
index b3d29f5b5a..9a87855121 100644
--- a/tp/t/results/invalid_nestings/section_on_itemize_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_itemize_line.pl
@@ -419,6 +419,13 @@ $result_errors{'section_on_itemize_line'} = [
'text' => '@section seen before @end itemize',
'type' => 'error'
},
+ {
+ 'error_line' => 'warning: @section should only appear at the beginning of
a line
+',
+ 'line_nr' => 5,
+ 'text' => '@section should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @section should not appear on @itemize line
',
diff --git a/tp/t/results/invalid_nestings/section_on_multitable_line.pl
b/tp/t/results/invalid_nestings/section_on_multitable_line.pl
index af1f6837df..0e16be28ac 100644
--- a/tp/t/results/invalid_nestings/section_on_multitable_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_multitable_line.pl
@@ -300,6 +300,13 @@
$result_sectioning{'section_on_multitable_line'}{'extra'}{'section_childs'}[2]{'
$result_sectioning{'section_on_multitable_line'}{'extra'}{'section_childs'}[2]{'extra'}{'toplevel_directions'}{'prev'}
=
$result_sectioning{'section_on_multitable_line'}{'extra'}{'section_childs'}[1];
$result_errors{'section_on_multitable_line'} = [
+ {
+ 'error_line' => 'warning: @section should only appear at the beginning of
a line
+',
+ 'line_nr' => 1,
+ 'text' => '@section should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @section should not appear on @multitable line
',
diff --git a/tp/t/results/invalid_nestings/section_on_xtable_line.pl
b/tp/t/results/invalid_nestings/section_on_xtable_line.pl
index 9a300b7306..c95e66df39 100644
--- a/tp/t/results/invalid_nestings/section_on_xtable_line.pl
+++ b/tp/t/results/invalid_nestings/section_on_xtable_line.pl
@@ -382,6 +382,13 @@
$result_sectioning{'section_on_xtable_line'}{'extra'}{'section_childs'}[3]{'extr
$result_sectioning{'section_on_xtable_line'}{'extra'}{'section_childs'}[3]{'extra'}{'toplevel_directions'}{'prev'}
= $result_sectioning{'section_on_xtable_line'}{'extra'}{'section_childs'}[2];
$result_errors{'section_on_xtable_line'} = [
+ {
+ 'error_line' => 'warning: @section should only appear at the beginning of
a line
+',
+ 'line_nr' => 1,
+ 'text' => '@section should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @section should not appear on @vtable line
',
diff --git a/tp/t/results/itemize/inter_item_commands_in_itemize.pl
b/tp/t/results/itemize/inter_item_commands_in_itemize.pl
index d5abb5a7bd..fda8e69f99 100644
--- a/tp/t/results/itemize/inter_item_commands_in_itemize.pl
+++ b/tp/t/results/itemize/inter_item_commands_in_itemize.pl
@@ -789,7 +789,15 @@ $result_menus{'inter_item_commands_in_itemize'} = [
}
];
-$result_errors{'inter_item_commands_in_itemize'} = [];
+$result_errors{'inter_item_commands_in_itemize'} = [
+ {
+ 'error_line' => 'warning: @cindex should only appear at the beginning of a
line
+',
+ 'line_nr' => 16,
+ 'text' => '@cindex should only appear at the beginning of a line',
+ 'type' => 'warning'
+ }
+];
$result_floats{'inter_item_commands_in_itemize'} = {};
diff --git a/tp/t/results/misc_commands/double_exdent.pl
b/tp/t/results/misc_commands/double_exdent.pl
index 4ae58f1ec2..76d90bcf0c 100644
--- a/tp/t/results/misc_commands/double_exdent.pl
+++ b/tp/t/results/misc_commands/double_exdent.pl
@@ -193,6 +193,13 @@ double exdented nested other line
';
$result_errors{'double_exdent'} = [
+ {
+ 'error_line' => 'warning: @exdent should only appear at the beginning of a
line
+',
+ 'line_nr' => 5,
+ 'text' => '@exdent should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @exdent should not appear in @exdent
',
diff --git a/tp/t/results/preformatted/example_invalid_at_commands_arguments.pl
b/tp/t/results/preformatted/example_invalid_at_commands_arguments.pl
index ff98c5dc5a..ffedd44dd6 100644
--- a/tp/t/results/preformatted/example_invalid_at_commands_arguments.pl
+++ b/tp/t/results/preformatted/example_invalid_at_commands_arguments.pl
@@ -213,6 +213,13 @@ $result_errors{'example_invalid_at_commands_arguments'} = [
'text' => '@anchor should not appear on @example line',
'type' => 'warning'
},
+ {
+ 'error_line' => 'warning: @center should only appear at the beginning of a
line
+',
+ 'line_nr' => 1,
+ 'text' => '@center should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
{
'error_line' => 'warning: @center should not appear on @example line
',
diff --git a/tp/t/results/value/set_on_item_line.pl
b/tp/t/results/value/set_on_item_line.pl
index 887048a3f8..bb3ef25853 100644
--- a/tp/t/results/value/set_on_item_line.pl
+++ b/tp/t/results/value/set_on_item_line.pl
@@ -537,6 +537,13 @@ vvv
$result_errors{'set_on_item_line'} = [
{
'error_line' => 'warning: @set should only appear at the beginning of a
line
+',
+ 'line_nr' => 2,
+ 'text' => '@set should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @set should only appear at the beginning of a
line
',
'line_nr' => 5,
'text' => '@set should only appear at the beginning of a line',
@@ -551,6 +558,13 @@ $result_errors{'set_on_item_line'} = [
},
{
'error_line' => 'warning: @set should only appear at the beginning of a
line
+',
+ 'line_nr' => 11,
+ 'text' => '@set should only appear at the beginning of a line',
+ 'type' => 'warning'
+ },
+ {
+ 'error_line' => 'warning: @set should only appear at the beginning of a
line
',
'line_nr' => 14,
'text' => '@set should only appear at the beginning of a line',
diff --git
a/tp/tests/formatting/res_parser/indices_in_begin_tables_lists/indices_in_begin_tables_lists.2
b/tp/tests/formatting/res_parser/indices_in_begin_tables_lists/indices_in_begin_tables_lists.2
index e69de29bb2..8c85062e1e 100644
---
a/tp/tests/formatting/res_parser/indices_in_begin_tables_lists/indices_in_begin_tables_lists.2
+++
b/tp/tests/formatting/res_parser/indices_in_begin_tables_lists/indices_in_begin_tables_lists.2
@@ -0,0 +1 @@
+indices_in_begin_tables_lists.texi:18: warning: @cindex should only appear at
the beginning of a line
diff --git
a/tp/tests/formatting/res_parser/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.2
b/tp/tests/formatting/res_parser/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.2
index e69de29bb2..8c85062e1e 100644
---
a/tp/tests/formatting/res_parser/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.2
+++
b/tp/tests/formatting/res_parser/indices_in_begin_tables_lists_latex/indices_in_begin_tables_lists.2
@@ -0,0 +1 @@
+indices_in_begin_tables_lists.texi:18: warning: @cindex should only appear at
the beginning of a line
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Stricter check of @-commands not appearing at the beginning of a line,
Patrice Dumas <=