[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/Commands.pod, tp/Texinfo/Common.pm,
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/Commands.pod, tp/Texinfo/Common.pm, tp/Texinfo/XS/parsetexi/command_data.awk, tp/Texinfo/command_data.txt: move command classification out of Texinfo::Common to command_data.txt. Filter out flags not relevant for the XS parser when generating command_data.c. Update callers. |
Date: |
Mon, 14 Nov 2022 02:56:00 -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 b1d466b93c * tp/Texinfo/Commands.pod, tp/Texinfo/Common.pm,
tp/Texinfo/XS/parsetexi/command_data.awk, tp/Texinfo/command_data.txt: move
command classification out of Texinfo::Common to command_data.txt. Filter out
flags not relevant for the XS parser when generating command_data.c. Update
callers.
b1d466b93c is described below
commit b1d466b93c4db610d77268b955b388c23d32d096
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Nov 14 08:55:51 2022 +0100
* tp/Texinfo/Commands.pod, tp/Texinfo/Common.pm,
tp/Texinfo/XS/parsetexi/command_data.awk, tp/Texinfo/command_data.txt:
move command classification out of Texinfo::Common to
command_data.txt. Filter out flags not relevant for the XS parser
when generating command_data.c.
Update callers.
---
ChangeLog | 9 ++
tp/Texinfo/Commands.pod | 61 ++++++++++-
tp/Texinfo/Common.pm | 118 +++------------------
tp/Texinfo/Convert/Converter.pm | 2 +-
tp/Texinfo/Convert/DocBook.pm | 2 +-
tp/Texinfo/Convert/HTML.pm | 12 +--
tp/Texinfo/Convert/LaTeX.pm | 19 ++--
tp/Texinfo/Convert/Plaintext.pm | 12 +--
tp/Texinfo/Convert/TexinfoMarkup.pm | 4 +-
tp/Texinfo/Convert/Text.pm | 10 +-
tp/Texinfo/Convert/TextContent.pm | 6 +-
tp/Texinfo/ParserNonXS.pm | 6 +-
tp/Texinfo/XS/parsetexi/command_data.awk | 31 +++++-
tp/Texinfo/command_data.txt | 172 ++++++++++++++++---------------
tp/init/html32.pm | 4 +-
15 files changed, 240 insertions(+), 228 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 20c464dc4c..94295a8c06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2022-11-14 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/Commands.pod, tp/Texinfo/Common.pm,
+ tp/Texinfo/XS/parsetexi/command_data.awk, tp/Texinfo/command_data.txt:
+ move command classification out of Texinfo::Common to
+ command_data.txt. Filter out flags not relevant for the XS parser
+ when generating command_data.c.
+ Update callers.
+
2022-11-13 Patrice Dumas <pertusus@free.fr>
* tp/Makefile.am (EXTRA_DIST), tp/Texinfo/XS/Makefile.am,
diff --git a/tp/Texinfo/Commands.pod b/tp/Texinfo/Commands.pod
index c07d588a2b..b65e631a14 100644
--- a/tp/Texinfo/Commands.pod
+++ b/tp/Texinfo/Commands.pod
@@ -133,6 +133,12 @@ also classified by type of command, some type of commands
implying a
number of arguments, and the number of arguments may not be set if it
corresponds to the default (0 for block commands, 1 for other commands).
+=item %brace_code_commands
+X<C<%brace_code_commands>>
+
+Brace commands that have their argument in code style, like
+C<@code>.
+
=item %brace_commands
X<C<%brace_commands>>
@@ -151,6 +157,39 @@ X<C<%default_index_commands>>
Index entry commands corresponding to default indices. For example
C<@cindex>.
+=item %explained_commands
+X<C<%explained_commands>>
+
+@-commands whose second argument explain first argument and further
+@-command call without first argument, as C<@abbr> and C<@acronym>.
+
+=item %formattable_line_commands
+X<C<%formattable_line_commands>>
+
+Line commands which may be formatted as text, but that require constructing
+some replacement text, for example C<@printindex>, C<@need> or
+C<@verbatiminclude>. C<@contents> and C<@shortcontents> are not in this hash,
+since they are in a corresponding situation only when the tables of contents
+are formatted where the commands are.
+
+=item %formatted_nobrace_commands
+X<C<%formatted_nobrace_commands>>
+
+Commands not taking brace formatted as text or with text in the main
+document body, corresponding to symbol commands such as C<@@> or C<@:> and
+commands such as C<@item>. @-commands appearing only in headers are not
+in this hash, but in in C<%in_heading_spec_commands>.
+
+=item %formatted_line_commands
+X<C<%formatted_line_commands>>
+
+Line commands which arguments may be formatted as text, such as
+C<@center>, C<@author>, C<@item>, C<@node>, C<@chapter> and other.
+Index commands may be formatted as text too, but they may be added
+with C<@def*index>, therefore they are not in that hash. Also,
+in general, they are not formatted as text where they appear, only
+when an index is printed.
+
=item %heading_spec_commands
X<C<%heading_spec_commands>>
@@ -159,8 +198,21 @@ X<C<%heading_spec_commands>>
=item %in_heading_spec_commands
X<C<%in_heading_spec_commands>>
-Special @-commands appearing in custom headings, such as C<@thischapter>
-or C<@thistitle>.
+Special @-commands appearing in custom headings, such as C<@thischapter>,
+C<@thistitle> or C<@|>.
+
+=item %in_index_commands
+
+@-commands only valid in index entries, such as C<@sortas> or C<@subentry>.
+
+=item %inline_conditional_commands
+
+=item %inline_format_commands
+X<C<%inline_conditional_commands>>
+X<C<%inline_format_commands>>
+
+Inline conditional commands, like C<@inlineifclear>, and inline format
+commands like C<inlineraw> and C<inlinefmt>.
=item %letter_no_arg_commands
X<C<%letter_no_arg_commands>>
@@ -195,6 +247,11 @@ include C<@indent>, C<@tab> or C<@thissection>.
Note that C<@item> is in C<%nobrace_commands> for its role in C<@multitable>,
C<@itemize> and C<@enumerate>.
+=item %non_formatted_block_commands
+X<C<%non_formatted_block_commands>>
+
+Block commands not formatted as text, such as C<@ignore> or C<@macro>.
+
=item %preformatted_commands
=item %preformatted_code_commands
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 5db18e7d11..2a39bb4d2c 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -543,48 +543,16 @@ our %nobrace_symbol_text;
'\\', '\\', # should only appear in math
);
-# only valid in index entries
-our %in_index_commands;
-foreach my $in_index_command ('sortas', 'seeentry', 'seealso', 'subentry') {
- $in_index_commands{$in_index_command} = 1;
-}
-
-# also style_code brace commands
-our %brace_code_commands;
-foreach my $command ('code', 'command', 'env', 'file', 'indicateurl', 'kbd',
- 'key', 'option', 'samp', 't') {
- $brace_code_commands{$command} = 1;
-}
-
-# brace style command that are not style code commands
-$brace_code_commands{'verb'} = 1;
-
-our %explained_commands;
-foreach my $explained_command ('abbr', 'acronym') {
- $explained_commands{$explained_command} = 1;
-}
-
-our %inline_format_commands;
-foreach my $inline_format_command ('inlineraw', 'inlinefmt',
- 'inlinefmtifelse') {
- $inline_format_commands{$inline_format_command} = 1;
-}
-
-our %inline_conditional_commands;
-foreach my $inline_conditional_command ('inlineifclear', 'inlineifset') {
- $inline_conditional_commands{$inline_conditional_command} = 1;
-}
-
-
-# some classification to help converters
# brace command that is not replaced with text.
-my %unformatted_brace_commands;
-foreach my $unformatted_brace_command ('anchor', 'shortcaption',
+my %non_formatted_brace_commands;
+foreach my $non_formatted_brace_command ('anchor', 'shortcaption',
'caption', 'hyphenation', 'errormsg') {
- $unformatted_brace_commands{$unformatted_brace_command} = 1;
+ $non_formatted_brace_commands{$non_formatted_brace_command} = 1;
}
+# some classification to help converters
+
our %def_map = (
# basic commands.
# 'arg' and 'argtype' are for everything appearing after the other
@@ -650,11 +618,6 @@ foreach my $output_format_command ('info', 'plaintext',
$texinfo_output_formats{$output_format_command} = $output_format_command;
}
-my %unformatted_block_commands;
-foreach my $unformatted_block_command ('ignore', 'macro', 'rmacro') {
- $unformatted_block_commands{$unformatted_block_command} = 1;
-}
-
our %small_block_associated_command;
for my $cmd ('example', 'display', 'format', 'lisp', 'quotation',
'indentedblock') {
@@ -723,35 +686,6 @@ our %level_to_structuring_command;
}
-# line commands which arguments may be formatted as text.
-# index commands may be too, but index command may be added with
-# @def*index so they are not added here.
-our %formatted_line_commands;
-foreach my $formatted_line_command ('center', 'page',
- 'author', 'subtitle', 'title', 'exdent', 'item', 'itemx',
- 'node', keys(%Texinfo::Commands::sectioning_heading_commands)) {
- $formatted_line_commands{$formatted_line_command} = 1;
-}
-
-our %formatted_nobrace_commands;
-foreach my $formatted_command ('headitem', 'item', 'tab',
- keys(%nobrace_symbol_text)) {
- $formatted_nobrace_commands{$formatted_command} = 1;
-}
-
-# line commands which may be formatted as text, but that
-# require constructing some replacement text.
-# Depending on the case, @contents, @shortcontents and
-# @summarycontents may be formattable_line_commands too, but
-# they are global commands and are, in general, processed as such in
-# converters, so they are not put in formattable_line_commands.
-our %formattable_line_commands;
-foreach my $formattable_line_command ('insertcopying',
- 'printindex', 'listoffloats', 'need', 'sp', 'verbatiminclude',
- 'vskip') {
- $formattable_line_commands{$formattable_line_command} = 1;
-}
-
# %all_commands includes user-settable commands only.
# The internal commands are not in %all_commands.
# used in util/txicmdlist
@@ -772,15 +706,18 @@ foreach my $preamble_command ('direntry', 'hyphenation',
'errormsg',
(grep {$Texinfo::Commands::block_commands{$_} eq 'format_raw'
or $Texinfo::Commands::block_commands{$_} eq 'region'}
keys(%Texinfo::Commands::block_commands)),
- keys(%inline_format_commands), keys(%inline_conditional_commands),
- keys(%unformatted_block_commands),
keys(%Texinfo::Commands::line_commands),
+ keys(%Texinfo::Commands::inline_format_commands),
+ keys(%Texinfo::Commands::inline_conditional_commands),
+ keys(%Texinfo::Commands::non_formatted_block_commands),
+ keys(%Texinfo::Commands::line_commands),
keys(%Texinfo::Commands::nobrace_commands)) {
$preamble_commands{$preamble_command} = 1;
}
foreach my $formattable_or_formatted_misc_command (
- keys(%formattable_line_commands), keys(%formatted_line_commands),
- keys(%formatted_nobrace_commands),
+ keys(%Texinfo::Commands::formattable_line_commands),
+ keys(%Texinfo::Commands::formatted_line_commands),
+ keys(%Texinfo::Commands::formatted_nobrace_commands),
keys(%Texinfo::Commands::default_index_commands),
keys(%Texinfo::Commands::in_heading_spec_commands),
keys(%Texinfo::Commands::def_commands)) {
@@ -1485,20 +1422,20 @@ sub is_content_empty($;$)
}
}
if (exists($Texinfo::Commands::line_commands{$content->{'cmdname'}})) {
- if ($formatted_line_commands{$content->{'cmdname'}}
- or $formattable_line_commands{$content->{'cmdname'}}) {
+ if ($Texinfo::Commands::formatted_line_commands{$content->{'cmdname'}}
+ or
$Texinfo::Commands::formattable_line_commands{$content->{'cmdname'}}) {
return 0;
} else {
next;
}
} elsif
(exists($Texinfo::Commands::nobrace_commands{$content->{'cmdname'}})) {
- if ($formatted_nobrace_commands{$content->{'cmdname'}}) {
+ if
($Texinfo::Commands::formatted_nobrace_commands{$content->{'cmdname'}}) {
return 0;
} else {
next;
}
- } elsif ($unformatted_brace_commands{$content->{'cmdname'}}
- or $unformatted_block_commands{$content->{'cmdname'}}) {
+ } elsif ($non_formatted_brace_commands{$content->{'cmdname'}}
+ or
$Texinfo::Commands::non_formatted_block_commands{$content->{'cmdname'}}) {
next;
} else {
return 0;
@@ -2566,12 +2503,6 @@ X<C<%all_commands>>
All the @-commands.
-=item %brace_code_commands
-X<C<%brace_code_commands>>
-
-Brace commands that have their argument in code style, like
-C<@code>.
-
=item %def_aliases
=item %def_no_var_arg_commands
@@ -2587,21 +2518,6 @@ non-metasyntactic variables. For instance, it is true
for C<deftypevr>
but false for C<defun>, since C<@defun> I<argument> is supposed to contain
metasyntactic variables only.
-=item %explained_commands
-X<C<%explained_commands>>
-
-@-commands whose second argument explain first argument and further
-@-command call without first argument, as C<@abbr> and C<@acronym>.
-
-=item %inline_conditional_commands
-
-=item %inline_format_commands
-X<C<%inline_conditional_commands>>
-X<C<%inline_format_commands>>
-
-Inline conditional commands, like C<@inlineifclear>, and inline format
-commands like C<inlineraw> and C<inlinefmt>.
-
=item %nobrace_symbol_text
X<C<%nobrace_symbol_text>>
diff --git a/tp/Texinfo/Convert/Converter.pm b/tp/Texinfo/Convert/Converter.pm
index 740a0e330a..bbd13b872e 100644
--- a/tp/Texinfo/Convert/Converter.pm
+++ b/tp/Texinfo/Convert/Converter.pm
@@ -140,7 +140,7 @@ our %default_args_code_style = (
'float' => [1],
);
-foreach my $code_style_command (keys(%Texinfo::Common::brace_code_commands)) {
+foreach my $code_style_command (keys(%Texinfo::Commands::brace_code_commands))
{
$default_args_code_style{$code_style_command} = [1];
}
foreach my $ref_cmd ('pxref', 'xref', 'ref') {
diff --git a/tp/Texinfo/Convert/DocBook.pm b/tp/Texinfo/Convert/DocBook.pm
index 704f55dc88..976fcd4fb2 100644
--- a/tp/Texinfo/Convert/DocBook.pm
+++ b/tp/Texinfo/Convert/DocBook.pm
@@ -1391,7 +1391,7 @@ sub _convert($$;$)
} elsif ($Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq
'inline') {
my $expand = 0;
- if ($Texinfo::Common::inline_format_commands{$element->{'cmdname'}}) {
+ if ($Texinfo::Commands::inline_format_commands{$element->{'cmdname'}})
{
if ($element->{'cmdname'} eq 'inlinefmtifelse'
or ($element->{'extra'} and $element->{'extra'}->{'format'}
and
$self->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}})) {
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index 0e8020bc08..a1112b10f0 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -112,12 +112,12 @@ my %math_commands = %Texinfo::Commands::math_commands;
my %preformatted_code_commands =
%Texinfo::Commands::preformatted_code_commands;
my %letter_no_arg_commands = %Texinfo::Commands::letter_no_arg_commands;
-my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
-my %formatted_nobrace_commands = %Texinfo::Common::formatted_nobrace_commands;
-my %formattable_line_commands = %Texinfo::Common::formattable_line_commands;
-my %explained_commands = %Texinfo::Common::explained_commands;
-my %inline_format_commands = %Texinfo::Common::inline_format_commands;
-my %brace_code_commands = %Texinfo::Common::brace_code_commands;
+my %formatted_line_commands = %Texinfo::Commands::formatted_line_commands;
+my %formatted_nobrace_commands =
%Texinfo::Commands::formatted_nobrace_commands;
+my %formattable_line_commands = %Texinfo::Commands::formattable_line_commands;
+my %explained_commands = %Texinfo::Commands::explained_commands;
+my %inline_format_commands = %Texinfo::Commands::inline_format_commands;
+my %brace_code_commands = %Texinfo::Commands::brace_code_commands;
my %default_index_commands = %Texinfo::Commands::default_index_commands;
my %small_block_associated_command =
%Texinfo::Common::small_block_associated_command;
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 22b0390eeb..62e06ccb77 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -193,9 +193,9 @@ $VERSION = '7.0';
# commands that are of use for formatting.
-my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
-my %formatted_nobrace_commands = %Texinfo::Common::formatted_nobrace_commands;
-my %formattable_line_commands = %Texinfo::Common::formattable_line_commands;
+my %formatted_line_commands = %Texinfo::Commands::formatted_line_commands;
+my %formatted_nobrace_commands =
%Texinfo::Commands::formatted_nobrace_commands;
+my %formattable_line_commands = %Texinfo::Commands::formattable_line_commands;
my %paper_geometry_commands = (
'afourpaper' => 'papername=a4paper',
@@ -230,14 +230,13 @@ my %preformatted_code_commands =
%Texinfo::Commands::preformatted_code_commands;
my %default_index_commands = %Texinfo::Commands::default_index_commands;
my %heading_spec_commands = %Texinfo::Commands::heading_spec_commands;
my %letter_no_arg_commands = %Texinfo::Commands::letter_no_arg_commands;
+my %explained_commands = %Texinfo::Commands::explained_commands;
+my %inline_format_commands = %Texinfo::Commands::inline_format_commands;
+my %brace_code_commands = %Texinfo::Commands::brace_code_commands;
+my %non_formatted_brace_command =
%Texinfo::Commands::non_formatted_brace_command;
+my %preamble_commands = %Texinfo::Common::preamble_commands;
my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
-my %explained_commands = %Texinfo::Common::explained_commands;
-my %inline_format_commands = %Texinfo::Common::inline_format_commands;
-my %brace_code_commands = %Texinfo::Common::brace_code_commands;
-my %unformatted_brace_command = %Texinfo::Common::unformatted_brace_command;
-
-my %preamble_commands = %Texinfo::Common::preamble_commands;
foreach my $kept_command (keys(%informative_commands),
keys(%default_index_commands),
@@ -737,7 +736,7 @@ my %description_command_new_commands = ();
foreach my $command (keys(%{$LaTeX_style_brace_commands{'cmd_text'}})) {
# avoids hyphenation @-command
- next if ($unformatted_brace_command{$command});
+ next if ($non_formatted_brace_command{$command});
my $description_format = $LaTeX_style_brace_commands{'cmd_text'}->{$command};
if ($quotes_map{$command}) {
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 2cd3962928..b1a880ebbb 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -64,9 +64,9 @@ $VERSION = '7.0';
# commands that are of use for formatting.
-my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
-my %formatted_nobrace_commands = %Texinfo::Common::formatted_nobrace_commands;
-my %formattable_line_commands = %Texinfo::Common::formattable_line_commands;
+my %formatted_line_commands = %Texinfo::Commands::formatted_line_commands;
+my %formatted_nobrace_commands =
%Texinfo::Commands::formatted_nobrace_commands;
+my %formattable_line_commands = %Texinfo::Commands::formattable_line_commands;
my %brace_commands = %Texinfo::Commands::brace_commands;
@@ -108,9 +108,9 @@ my %default_index_commands =
%Texinfo::Commands::default_index_commands;
my %letter_no_arg_commands = %Texinfo::Commands::letter_no_arg_commands;
my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
-my %explained_commands = %Texinfo::Common::explained_commands;
-my %inline_format_commands = %Texinfo::Common::inline_format_commands;
-my %brace_code_commands = %Texinfo::Common::brace_code_commands;
+my %explained_commands = %Texinfo::Commands::explained_commands;
+my %inline_format_commands = %Texinfo::Commands::inline_format_commands;
+my %brace_code_commands = %Texinfo::Commands::brace_code_commands;
my @contents_commands = ('contents', 'shortcontents', 'summarycontents');
diff --git a/tp/Texinfo/Convert/TexinfoMarkup.pm
b/tp/Texinfo/Convert/TexinfoMarkup.pm
index 68a5194ebf..c75d51208a 100644
--- a/tp/Texinfo/Convert/TexinfoMarkup.pm
+++ b/tp/Texinfo/Convert/TexinfoMarkup.pm
@@ -199,7 +199,7 @@ foreach my $ref_cmd ('pxref', 'xref', 'ref') {
'xrefprintedname'];
}
-foreach my $explained_command (keys(%Texinfo::Common::explained_commands)) {
+foreach my $explained_command (keys(%Texinfo::Commands::explained_commands)) {
$commands_args_elements{$explained_command} = ["${explained_command}word",
"${explained_command}desc"];
}
@@ -982,7 +982,7 @@ sub _convert($$;$)
} elsif ($element->{'args'}
and exists($brace_commands{$element->{'cmdname'}})) {
- if ($Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
+ if ($Texinfo::Commands::inline_format_commands{$element->{'cmdname'}}
and $element->{'extra'} and $element->{'extra'}->{'format'}
and
$self->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}}) {
if ($element->{'cmdname'} eq 'inlineraw') {
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 7c84c23bb8..787b016fe2 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -147,7 +147,7 @@ foreach my $accent_letter ('o','O','l','L') {
my %accent_commands = %Texinfo::Commands::accent_commands;
my %nobrace_symbol_text = %Texinfo::Common::nobrace_symbol_text;
-my %formatted_line_commands = %Texinfo::Common::formatted_line_commands;
+my %formatted_line_commands = %Texinfo::Commands::formatted_line_commands;
# 'page' is a formatted_line_commands and therefore is replaced by an empty
line.
my %converted_formattable_line_commands;
@@ -400,11 +400,11 @@ sub _convert($;$)
or ($Texinfo::Commands::brace_commands{$element->{'cmdname'}}
and
$Texinfo::Commands::brace_commands{$element->{'cmdname'}} eq 'inline'
and $element->{'cmdname'} ne 'inlinefmtifelse'
- and
(($Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
+ and
(($Texinfo::Commands::inline_format_commands{$element->{'cmdname'}}
and (!$element->{'extra'}->{'format'}
or !$options->{'expanded_formats_hash'}
or
!$options->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}}))
- or
(!$Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
+ or
(!$Texinfo::Commands::inline_format_commands{$element->{'cmdname'}}
and
!defined($element->{'extra'}->{'expand_index'}))))
# here ignore most of the line commands
or ($element->{'args'} and $element->{'args'}->[0]
@@ -499,7 +499,7 @@ sub _convert($;$)
} else {
return $url;
}
- } elsif ($Texinfo::Common::explained_commands{$element->{'cmdname'}}
+ } elsif ($Texinfo::Commands::explained_commands{$element->{'cmdname'}}
and $element->{'args'} and $element->{'args'}->[1]) {
my $explanation = _convert($element->{'args'}->[1], $options);
if ($explanation ne '') {
@@ -530,7 +530,7 @@ sub _convert($;$)
my $result;
my $in_code;
$options->{'sc'}++ if ($element->{'cmdname'} eq 'sc');
- if ($Texinfo::Common::brace_code_commands{$element->{'cmdname'}}
+ if ($Texinfo::Commands::brace_code_commands{$element->{'cmdname'}}
or $Texinfo::Commands::math_commands{$element->{'cmdname'}}) {
$in_code = 1;
}
diff --git a/tp/Texinfo/Convert/TextContent.pm
b/tp/Texinfo/Convert/TextContent.pm
index 32ff10084f..ee93ac2504 100644
--- a/tp/Texinfo/Convert/TextContent.pm
+++ b/tp/Texinfo/Convert/TextContent.pm
@@ -71,7 +71,7 @@ sub converter_initialize($)
my $self = shift;
%{$self->{'formatted_line_commands'}}
- = %Texinfo::Common::formatted_line_commands;
+ = %Texinfo::Commands::formatted_line_commands;
if ($self->get_conf('TEXTCONTENT_COMMENT')) {
$self->{'formatted_line_commands'}->{'c'} = 1;
$self->{'formatted_line_commands'}->{'comment'} = 1;
@@ -108,7 +108,7 @@ sub _convert($$)
or ($ignored_block_commands{$element->{'cmdname'}}
and !(defined($self->{'expanded_formats_hash'})
and
$self->{'expanded_formats_hash'}->{$element->{'cmdname'}}))
- or
($Texinfo::Common::inline_format_commands{$element->{'cmdname'}}
+ or
($Texinfo::Commands::inline_format_commands{$element->{'cmdname'}}
and (!$element->{'extra'}->{'format'}
or
!$self->{'expanded_formats_hash'}->{$element->{'extra'}->{'format'}}))
or ($element->{'cmdname'} eq 'menu' and
$self->get_conf('FORMAT_MENU') eq 'nomenu')
@@ -147,7 +147,7 @@ sub _convert($$)
or !$Texinfo::Commands::blockitem_commands{$element->{'cmdname'}}))
{
my $args;
if ($element->{'cmdname'}
- and $Texinfo::Common::inline_format_commands{$element->{'cmdname'}}) {
+ and $Texinfo::Commands::inline_format_commands{$element->{'cmdname'}})
{
my @args = @{$element->{'args'}};
shift @args;
$args = \@args;
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index a4078a3c62..2c04504881 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -287,12 +287,12 @@ my %variadic_commands =
%Texinfo::Commands::variadic_commands;
my %default_index_commands = %Texinfo::Commands::default_index_commands;
my %global_multiple_commands = %Texinfo::Commands::global_commands;
my %global_unique_commands = %Texinfo::Commands::global_unique_commands;
+my %in_index_commands = %Texinfo::Commands::in_index_commands;
+my %explained_commands = %Texinfo::Commands::explained_commands;
+my %inline_format_commands = %Texinfo::Commands::inline_format_commands;
my %def_map = %Texinfo::Common::def_map;
my %def_aliases = %Texinfo::Common::def_aliases;
-my %in_index_commands = %Texinfo::Common::in_index_commands;
-my %explained_commands = %Texinfo::Common::explained_commands;
-my %inline_format_commands = %Texinfo::Common::inline_format_commands;
my %all_commands = %Texinfo::Common::all_commands;
diff --git a/tp/Texinfo/XS/parsetexi/command_data.awk
b/tp/Texinfo/XS/parsetexi/command_data.awk
index 133a1c044e..60783f2f71 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.awk
+++ b/tp/Texinfo/XS/parsetexi/command_data.awk
@@ -142,7 +142,34 @@ END {
}
if (commands[c] != "") {
- flags = "CF_" commands[c]
+ split(commands[c], flags_array, ",")
+ flags_str = ""
+ for (flag_idx in flags_array) {
+ if (flag_idx == 1) {
+ # first flag is always kept, corresponds to the category
+ flags_str = flags_array[flag_idx]
+ } else {
+ # filter out flags not relevant for the XS parser. Use
+ # an array and not a regexp because word boundary matching
+ # does not seems to be portable and we want to be sure to
+ # match correctly even if an ignored flag is a substring of
+ # another flag
+ if (flags_array[flag_idx] != "letter_no_arg" \
+ && flags_array[flag_idx] != "inline_format" \
+ && flags_array[flag_idx] != "inline_conditional" \
+ && flags_array[flag_idx] != "in_index" \
+ && flags_array[flag_idx] != "brace_code" \
+ && flags_array[flag_idx] != "explained" \
+ && flags_array[flag_idx] != "formatted_line" \
+ && flags_array[flag_idx] != "formatted_nobrace" \
+ && flags_array[flag_idx] != "formattable_line" \
+ && flags_array[flag_idx] != "non_formatted_block") {
+ old_str = flags_str
+ flags_str = old_str "," flags_array[flag_idx]
+ }
+ }
+ }
+ flags = "CF_" flags_str
gsub (/,/, " | CF_", flags)
} else {
flags = "0"
@@ -166,7 +193,7 @@ END {
if (commands[c] != "") {
where = match(commands[c], /block/)
if (where == 0) {
- where = match(commands[c], /^nobrace$/)
+ where = match(command_data, /^NOBRACE_/)
}
}
if (where != 0 || command_data == "BRACE_noarg") {
diff --git a/tp/Texinfo/command_data.txt b/tp/Texinfo/command_data.txt
index fd42bf8b36..43ea81f3eb 100644
--- a/tp/Texinfo/command_data.txt
+++ b/tp/Texinfo/command_data.txt
@@ -19,7 +19,11 @@
# builtin_command_data and the perl Parser commands classification
# hashes.
-# Some documentation of the flags (second column) is in commands.h.
+# The flags (second column) should be documented (with _commands
+# postpended) in Texinfo/Commands.pod.
+# Some documentation of the flags is in commands.h, but only for
+# flags used in the XS parser, not for the flags not used in the
+# XS parser and filtered out.
##############################################################
# Internal commands
@@ -38,32 +42,32 @@ txiinternalvalue internal,brace
INTERNAL_brace
# no brace commands - single letter commands
-* nobrace NOBRACE_symbol
+* nobrace,formatted_nobrace NOBRACE_symbol
# space
-\x20 nobrace NOBRACE_symbol
-\t nobrace NOBRACE_symbol
-\n nobrace NOBRACE_symbol
-- nobrace NOBRACE_symbol
+\x20 nobrace,formatted_nobrace NOBRACE_symbol
+\t nobrace,formatted_nobrace NOBRACE_symbol
+\n nobrace,formatted_nobrace NOBRACE_symbol
+- nobrace,formatted_nobrace NOBRACE_symbol
| nobrace,in_heading_spec NOBRACE_symbol
-/ nobrace NOBRACE_symbol
-: nobrace NOBRACE_symbol
-! nobrace NOBRACE_symbol
-? nobrace NOBRACE_symbol
-. nobrace NOBRACE_symbol
-@ nobrace NOBRACE_symbol
-& nobrace NOBRACE_symbol
-} nobrace NOBRACE_symbol
-{ nobrace NOBRACE_symbol
-\\ nobrace NOBRACE_symbol
+/ nobrace,formatted_nobrace NOBRACE_symbol
+: nobrace,formatted_nobrace NOBRACE_symbol
+! nobrace,formatted_nobrace NOBRACE_symbol
+? nobrace,formatted_nobrace NOBRACE_symbol
+. nobrace,formatted_nobrace NOBRACE_symbol
+@ nobrace,formatted_nobrace NOBRACE_symbol
+& nobrace,formatted_nobrace NOBRACE_symbol
+} nobrace,formatted_nobrace NOBRACE_symbol
+{ nobrace,formatted_nobrace NOBRACE_symbol
+\\ nobrace,formatted_nobrace NOBRACE_symbol
# no brace commands - miscellaneous commands
# formatting
noindent nobrace NOBRACE_skipspace
indent nobrace NOBRACE_skipspace
-headitem nobrace,close_paragraph NOBRACE_skipspace
-item nobrace,close_paragraph NOBRACE_skipspace
-tab nobrace,close_paragraph NOBRACE_skipspace
+headitem nobrace,formatted_nobrace,close_paragraph
NOBRACE_skipspace
+item nobrace,formatted_nobrace,close_paragraph
NOBRACE_skipspace
+tab nobrace,formatted_nobrace,close_paragraph
NOBRACE_skipspace
# only valid in heading or footing
thischapter nobrace,in_heading_spec NOBRACE_other
thischaptername nobrace,in_heading_spec NOBRACE_other
@@ -108,29 +112,29 @@ refill nobrace,deprecated
NOBRACE_other
# is not used anywhere in the code, it is here as documentation only.
# Root commands
-node line,root,contain_simple_text LINE_line
4
-top line,root,sectioning_heading,global_unique LINE_line
-chapter line,root,sectioning_heading LINE_line
-unnumbered line,root,sectioning_heading LINE_line
-chapheading line,sectioning_heading,close_paragraph LINE_line
-appendix line,root,sectioning_heading LINE_line
-section line,root,sectioning_heading LINE_line
-unnumberedsec line,root,sectioning_heading LINE_line
-heading line,sectioning_heading,close_paragraph LINE_line
-appendixsec line,root,sectioning_heading LINE_line
-subsection line,root,sectioning_heading LINE_line
-unnumberedsubsec line,root,sectioning_heading LINE_line
-subheading line,sectioning_heading,close_paragraph LINE_line
-appendixsubsec line,root,sectioning_heading LINE_line
-subsubsection line,root,sectioning_heading LINE_line
-unnumberedsubsubsec line,root,sectioning_heading LINE_line
-subsubheading line,sectioning_heading,close_paragraph LINE_line
-appendixsubsubsec line,root,sectioning_heading LINE_line
-
-part line,root,sectioning_heading,global LINE_line
-appendixsection line,root,sectioning_heading LINE_line
-majorheading line,sectioning_heading,close_paragraph LINE_line
-centerchap line,root,sectioning_heading,deprecated LINE_line
+node line,formatted_line,root,contain_simple_text
LINE_line 4
+top
line,formatted_line,root,sectioning_heading,global_unique LINE_line
+chapter line,formatted_line,root,sectioning_heading
LINE_line
+unnumbered line,formatted_line,root,sectioning_heading
LINE_line
+chapheading line,formatted_line,sectioning_heading,close_paragraph
LINE_line
+appendix line,formatted_line,root,sectioning_heading
LINE_line
+section line,formatted_line,root,sectioning_heading
LINE_line
+unnumberedsec line,formatted_line,root,sectioning_heading
LINE_line
+heading line,formatted_line,sectioning_heading,close_paragraph
LINE_line
+appendixsec line,formatted_line,root,sectioning_heading
LINE_line
+subsection line,formatted_line,root,sectioning_heading
LINE_line
+unnumberedsubsec line,formatted_line,root,sectioning_heading
LINE_line
+subheading line,formatted_line,sectioning_heading,close_paragraph
LINE_line
+appendixsubsec line,formatted_line,root,sectioning_heading
LINE_line
+subsubsection line,formatted_line,root,sectioning_heading
LINE_line
+unnumberedsubsubsec line,formatted_line,root,sectioning_heading
LINE_line
+subsubheading line,formatted_line,sectioning_heading,close_paragraph
LINE_line
+appendixsubsubsec line,formatted_line,root,sectioning_heading
LINE_line
+
+part line,formatted_line,root,sectioning_heading,global
LINE_line
+appendixsection line,formatted_line,root,sectioning_heading
LINE_line
+majorheading line,formatted_line,sectioning_heading,close_paragraph
LINE_line
+centerchap line,formatted_line,root,sectioning_heading,deprecated
LINE_line
# end of document, end of block
bye line LINE_skipline
@@ -153,16 +157,16 @@ alias line,contain_plain_text
LINE_specific 2
columnfractions line,contain_plain_text LINE_specific
# file names, only plain text in argument
-setfilename line,close_paragraph,global_unique,contain_plain_text
LINE_text
-verbatiminclude line,close_paragraph,contain_plain_text
LINE_text
-include line,contain_plain_text
LINE_text
+setfilename line,close_paragraph,global_unique,contain_plain_text
LINE_text
+verbatiminclude
line,formattable_line,close_paragraph,contain_plain_text LINE_text
+include line,contain_plain_text
LINE_text
raisesections line LINE_skipline
lowersections line LINE_skipline
contents line,close_paragraph,global LINE_skipline
shortcontents line,close_paragraph,global LINE_skipline
summarycontents line,close_paragraph,global LINE_skipline
-insertcopying line,close_paragraph,global LINE_skipline
+insertcopying line,formattable_line,close_paragraph,global
LINE_skipline
# more relevant in preamble
documentencoding line,global,contain_plain_text LINE_text
@@ -243,30 +247,30 @@ evenfootingmarks
line,global_unique,contain_plain_text LINE_specifi
oddfootingmarks line,global_unique,contain_plain_text
LINE_specific 1
# formatting
-center line,close_paragraph LINE_line
-printindex line,close_paragraph,global,contain_plain_text
LINE_specific 1
-listoffloats line,close_paragraph,global,contain_simple_text
LINE_line
-exdent line,close_paragraph LINE_line
+center line,formatted_line,close_paragraph
LINE_line
+printindex
line,formattable_line,close_paragraph,global,contain_plain_text
LINE_specific 1
+listoffloats
line,formattable_line,close_paragraph,global,contain_simple_text LINE_line
+exdent line,formatted_line,close_paragraph
LINE_line
# or nobrace skipspace, depending on the context
-item_LINE line,close_paragraph,contain_simple_text LINE_line
-itemx line,close_paragraph,contain_simple_text LINE_line
+item_LINE
line,formatted_line,close_paragraph,contain_simple_text LINE_line
+itemx
line,formatted_line,close_paragraph,contain_simple_text LINE_line
# in index entries
-subentry line,contain_simple_text LINE_line
+subentry line,in_index,contain_simple_text LINE_line
# not valid for info (should be in @iftex)
-vskip line LINE_lineraw
+vskip line,formattable_line
LINE_lineraw
# one numerical/real arg
-need line,close_paragraph,contain_plain_text
LINE_specific 1
+need
line,formattable_line,close_paragraph,contain_plain_text LINE_specific 1
# especially in titlepage
# shorttitle
shorttitlepage line,global_unique,contain_simple_text LINE_line
settitle line,global_unique,contain_simple_text LINE_line
-author line,global,contain_simple_text LINE_line
-subtitle line,global,contain_simple_text LINE_line
-title line,global_unique,contain_simple_text LINE_line
+author line,formatted_line,global,contain_simple_text
LINE_line
+subtitle line,formatted_line,global,contain_simple_text
LINE_line
+title line,formatted_line,global_unique,contain_simple_text
LINE_line
# numerical arg
-sp line,close_paragraph,contain_plain_text
LINE_specific 1
-page line,close_paragraph LINE_skipline
+sp
line,formattable_line,close_paragraph,contain_plain_text LINE_specific 1
+page line,formatted_line,close_paragraph
LINE_skipline
##########################################################
@@ -378,16 +382,16 @@ sub brace
BRACE_style_other
sup brace BRACE_style_other
# code style commands
-code brace BRACE_style_code
-command brace BRACE_style_code
-env brace BRACE_style_code
-file brace BRACE_style_code
-indicateurl brace BRACE_style_code
-kbd brace BRACE_style_code
-key brace,contain_plain_text BRACE_style_code
-option brace BRACE_style_code
-samp brace BRACE_style_code
-t brace BRACE_style_code
+code brace,brace_code BRACE_style_code
+command brace,brace_code BRACE_style_code
+env brace,brace_code BRACE_style_code
+file brace,brace_code BRACE_style_code
+indicateurl brace,brace_code BRACE_style_code
+kbd brace,brace_code BRACE_style_code
+key brace,brace_code,contain_plain_text BRACE_style_code
+option brace,brace_code BRACE_style_code
+samp brace,brace_code BRACE_style_code
+t brace,brace_code BRACE_style_code
# No code style commands
r brace BRACE_style_no_code
@@ -411,13 +415,13 @@ U brace
BRACE_arguments 1
hyphenation brace,global,contain_plain_text BRACE_arguments 1
anchor brace,contain_simple_text BRACE_arguments 1
errormsg brace,contain_simple_text BRACE_arguments 1
-sortas brace,contain_plain_text BRACE_arguments 1
-seeentry brace,contain_simple_text BRACE_arguments 1
-seealso brace,contain_simple_text BRACE_arguments 1
+sortas brace,in_index,contain_plain_text
BRACE_arguments 1
+seeentry brace,in_index,contain_simple_text
BRACE_arguments 1
+seealso brace,in_index,contain_simple_text
BRACE_arguments 1
# explained commands
-abbr brace,contain_simple_text BRACE_arguments 2
-acronym brace,contain_simple_text BRACE_arguments 2
+abbr brace,explained,contain_simple_text
BRACE_arguments 2
+acronym brace,explained,contain_simple_text
BRACE_arguments 2
email brace,contain_simple_text BRACE_arguments 2
@@ -432,19 +436,19 @@ image brace,contain_simple_text
BRACE_arguments 5
# leading space is ignored in inline brace commands, not trailing space
# inline format command
-inlineraw brace BRACE_inline 2
-inlinefmt brace BRACE_inline 2
-inlinefmtifelse brace BRACE_inline 3
+inlineraw brace,inline_format BRACE_inline 2
+inlinefmt brace,inline_format BRACE_inline 2
+inlinefmtifelse brace,inline_format BRACE_inline 3
# inline conditional commands
-inlineifclear brace BRACE_inline 2
-inlineifset brace BRACE_inline 2
+inlineifclear brace,inline_conditional BRACE_inline 2
+inlineifset brace,inline_conditional BRACE_inline 2
# verb is treated especially, it should not matter much in which category it
is.
# value also is treated especially.
# Leading and trailing spaces kept in main text.
value brace BRACE_special
-verb brace BRACE_special
+verb brace,brace_code BRACE_special
w brace,contain_simple_text BRACE_special
# other brace commands, leading and trailing spaces kept in main text
@@ -547,9 +551,9 @@ latex block
BLOCK_format_raw
# raw commands
verbatim block,close_paragraph BLOCK_raw
-ignore block BLOCK_raw
-macro block BLOCK_raw
-rmacro block BLOCK_raw
+ignore block,non_formatted_block BLOCK_raw
+macro block,non_formatted_block BLOCK_raw
+rmacro block,non_formatted_block BLOCK_raw
table block,close_paragraph,blockitem,contain_simple_text
BLOCK_item_line 1
ftable block,close_paragraph,blockitem,contain_simple_text
BLOCK_item_line 1
diff --git a/tp/init/html32.pm b/tp/init/html32.pm
index 941b84c2fc..50b7b941de 100644
--- a/tp/init/html32.pm
+++ b/tp/init/html32.pm
@@ -36,7 +36,7 @@ use strict;
# To check if there is no erroneous autovivification
#no autovivification qw(fetch delete exists store strict);
-use Texinfo::Common;
+use Texinfo::Commands;
use Texinfo::Convert::Text;
@@ -201,7 +201,7 @@ sub html32_convert_explained_command($$$$)
return $result;
}
-foreach my $explained_command (keys(%Texinfo::Common::explained_commands)) {
+foreach my $explained_command (keys(%Texinfo::Commands::explained_commands)) {
texinfo_register_command_formatting($explained_command,
\&html32_convert_explained_command);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/Commands.pod, tp/Texinfo/Common.pm, tp/Texinfo/XS/parsetexi/command_data.awk, tp/Texinfo/command_data.txt: move command classification out of Texinfo::Common to command_data.txt. Filter out flags not relevant for the XS parser when generating command_data.c. Update callers.,
Patrice Dumas <=