@node Texinfo@asis{::}Parser
@chapter Texinfo::Parser

@node Texinfo@asis{::}Parser NAME
@section Texinfo::Parser NAME

Texinfo::Parser - Parse Texinfo code into a Perl tree

@node Texinfo@asis{::}Parser SYNOPSIS
@section Texinfo::Parser SYNOPSIS

@verbatim
  use Texinfo::Parser;

  my $parser = Texinfo::Parser::parser();
  my $document = $parser->parse_texi_file("somefile.texi");

  my ($errors, $errors_count) = $document->parser_errors();
  foreach my $error_message (@$errors) {
    warn $error_message->{'error_line'};
  }
@end verbatim

@node Texinfo@asis{::}Parser NOTES
@section Texinfo::Parser NOTES

The Texinfo Perl module main purpose is to be used in @code{texi2any} to convert
Texinfo to other formats.  There is no promise of API stability.

@node Texinfo@asis{::}Parser DESCRIPTION
@section Texinfo::Parser DESCRIPTION

@code{Texinfo::Parser} will parse Texinfo text into a Perl tree.  In one pass
it expands user-defined @@-commands, conditionals (@code{@@ifset}, @code{@@ifinfo}...)
and @code{@@value} and constructs the tree.  Some extra information is gathered
while doing the tree: for example, the @code{@@quotation} associated to an @code{@@author}
command, the number of columns in a multitable, or the node associated with a
section.

@node Texinfo@asis{::}Parser METHODS
@section Texinfo::Parser METHODS

No method is exported in the default case.  The module allows both
an object-oriented syntax, or traditional function, with the parser
as an opaque data structure given as an argument to every function.

@node Texinfo@asis{::}Parser Initialization
@subsection Initialization

The following method is used to construct a new @code{Texinfo::Parser} object:

@table @asis
@item $parser = Texinfo::Parser::parser($options)
@anchor{Texinfo@asis{::}Parser $parser = Texinfo@asis{::}Parser@asis{::}parser($options)}
@cindex @code{Texinfo::Parser::parser}
@cindex Parser initialization

This method creates a new parser.  The options may be provided as a hash
reference.  Most of those options correspond to Texinfo customization options
described in the Texinfo manual.

@table @asis
@item CPP_LINE_DIRECTIVES
@anchor{Texinfo@asis{::}Parser CPP_LINE_DIRECTIVES}

Handle cpp like synchronization lines if set. Set in the default case.

@item EXPANDED_FORMATS
@anchor{Texinfo@asis{::}Parser EXPANDED_FORMATS}

An array reference of the output formats for which @code{@@if@emph{FORMAT}}
conditional blocks should be expanded.  Default is empty.

@item FORMAT_MENU
@anchor{Texinfo@asis{::}Parser FORMAT_MENU}

Possible values are @code{nomenu}, @code{menu} and @code{sectiontoc}.  Only report
menu-related errors for @code{menu}.

@item INCLUDE_DIRECTORIES
@anchor{Texinfo@asis{::}Parser INCLUDE_DIRECTORIES}

An array reference of directories in which @code{@@include} files should be
searched for.  Default contains the working directory, @file{.}.

@item IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME
@anchor{Texinfo@asis{::}Parser IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME}

If set, spaces after an @@-command name that take braces are ignored.
Default on.

@item MAX_MACRO_CALL_NESTING
@anchor{Texinfo@asis{::}Parser MAX_MACRO_CALL_NESTING}

Maximal number of nested user-defined macro calls.  Default is 100000.

@item documentlanguage
@anchor{Texinfo@asis{::}Parser documentlanguage}

A string corresponding to a document language set by @code{@@documentlanguage}.
It overrides the document @code{@@documentlanguage} information, if present.

@item values
@anchor{Texinfo@asis{::}Parser values}

A hash reference.  Keys are names, values are the corresponding values.
Same as values set by @code{@@set}.

@end table

@end table

@node Texinfo@asis{::}Parser Parsing Texinfo text
@subsection Parsing Texinfo text

Different methods may be called to parse some Texinfo code:
@code{parse_texi_line} for a line, @code{parse_texi_piece} for a fragment of
Texinfo, @code{parse_texi_text} for a string corresponding to a full document
and @code{parse_texi_file} for a file.  The first argument of these functions
is a parser.

When @code{parse_texi_line} is used, the resulting tree is rooted at
a @code{root_line} type container.  Otherwise, the resulting tree should be
rooted at a @code{document_root} type container.

@table @asis
@item $tree = $parser->parse_texi_line($text, $first_line_number)
@anchor{Texinfo@asis{::}Parser $tree = $parser->parse_texi_line($text@comma{} $first_line_number)}
@cindex @code{parse_texi_line}

This function is used to parse a short fragment of Texinfo code.

@emph{$text} is the string containing the texinfo line.  @emph{$first_line_number} is
the line number of the line, if undef, it will be set to 1.

@item $document = $parser->parse_texi_piece($text, $first_line_number)
@anchor{Texinfo@asis{::}Parser $document = $parser->parse_texi_piece($text@comma{} $first_line_number)}
@cindex @code{parse_texi_piece}

This function is used to parse Texinfo fragments.

@emph{$text} is the string containing the texinfo text.  @emph{$first_line_number} is
the line number of the first text line, if undef, it will be set to 1.

@item $document = $parser->parse_texi_text($text, $first_line_number)
@anchor{Texinfo@asis{::}Parser $document = $parser->parse_texi_text($text@comma{} $first_line_number)}
@cindex @code{parse_texi_text}

This function is used to parse a text as a whole document.

@emph{$text} is the string containing the texinfo text.  @emph{$first_line_number} is
the line number of the first text line, if undef, it will be set to 1.

@item $document = $parser->parse_texi_file($file_name)
@anchor{Texinfo@asis{::}Parser $document = $parser->parse_texi_file($file_name)}
@cindex @code{parse_texi_file}

The file with name @emph{$file_name} is considered to be a Texinfo file and
is parsed into a tree.  @emph{$file_name} should be a binary string.

@end table

The errors collected during the tree parsing are available with
the resulting document @code{parser_errors}.  These errors are internally
registered in a @code{Texinfo::Report} object.

@table @asis
@item ($error_warnings_list, $error_count) = $document->parser_errors()
@anchor{Texinfo@asis{::}Parser ($error_warnings_list@comma{} $error_count) = $document->parser_errors()}
@cindex @code{parser_errors}

This function returns as @emph{$error_count} the count of parsing errors.
The @emph{$error_warnings_list} is an array of hash references
one for each error, warning or error line continuation.
They are described in detail in @ref{Texinfo@asis{::}Report ($error_warnings_list@comma{} $error_count) = errors($registrar),, Texinfo::Report::errors}.

@end table

@node Texinfo@asis{::}Parser TEXINFO TREE
@section TEXINFO TREE

@cindex Texinfo tree elements


A Texinfo tree element (called element because node is overloaded in
the Texinfo world) is an hash reference.  There are three main categories
of tree element.  Tree elements associated with an @@-command have a
@code{cmdname} key holding the @@-command name.  Tree elements corresponding
to text fragments have a @code{text} key holding the corresponding text.
Finally, the last category is other elements, which in most cases have
a @code{type} key holding their name.  Text fragments and @@-command elements
may also have an associated type when such information is needed.

The children of an @@-command or of other container element are in the array
referred to with the @code{args} key or with the @code{contents} key.  The @code{args} key
is for arguments of @@-commands, either in braces or on the rest of the line
after the command, depending on the type of command.  The @code{contents} key array
holds the contents of the texinfo code appearing within a block @@-command,
within a container, or within a @code{@@node} or sectioning @@-command.

Another important key for the elements is the @code{extra} key which is
associated to a hash reference and holds all kinds of information that
is gathered during the parsing and may help with the conversion.

You can see examples of the tree structure by running makeinfo like
this:

@verbatim
  makeinfo -c DUMP_TREE=1 -c TEXINFO_OUTPUT_FORMAT=parse document.texi
@end verbatim

For a simpler, more regular representation of the tree structure, you
can do:

@verbatim
  makeinfo -c TEXINFO_OUTPUT_FORMAT=debugtree document.texi
@end verbatim

@node Texinfo@asis{::}Parser Element keys
@subsection Element keys

@cindex Texinfo tree element structure


@table @asis
@item cmdname
@anchor{Texinfo@asis{::}Parser cmdname}

The command name of @@-command elements.

@item text
@anchor{Texinfo@asis{::}Parser text}

The text fragment of text elements.

@item type
@anchor{Texinfo@asis{::}Parser type}

The type of element considered, in general a container.  Frequent
types encountered are @emph{paragraph} for a paragraph container,
@emph{brace_container} for the container holding a brace @@-commands
content, @emph{line_arg} and @emph{block_line_arg} contain the arguments
appearing on the line of @@-commands.  Text fragments may have a type to
give an information of the kind of text fragment, for example
@emph{spaces_before_paragraph} is associated to spaces appearing
before a paragraph beginning.  Most @@-commands elements do not have
a type associated.

@item args
@anchor{Texinfo@asis{::}Parser args}

Arguments in braces or on @@-command line.  An array reference.

@item contents
@anchor{Texinfo@asis{::}Parser contents}

The Texinfo appearing in the element.  For block commands, other
containers, @code{@@node} and sectioning commands. An array reference.

@item parent
@anchor{Texinfo@asis{::}Parser parent}

The parent element.

@item source_info
@anchor{Texinfo@asis{::}Parser source_info}

An hash reference corresponding to information on the location of the
element in the Texinfo input manual.  It should mainly be available for
@@-command elements, and only for @@-commands that are considered to be
complex enough that the location in the document is needed, for example
to prepare an error message.

The keys of the line number hash references are

@table @asis
@item line_nr
@anchor{Texinfo@asis{::}Parser line_nr}

The line number of the @@-command.

@item file_name
@anchor{Texinfo@asis{::}Parser file_name}

The file name where @@-command appeared.

@item macro
@anchor{Texinfo@asis{::}Parser macro}

The user macro name the @@-command is expanded from.

@end table

@item info
@anchor{Texinfo@asis{::}Parser info}

A hash reference holding any other information that cannot be
obtained otherwise from the tree.
See @ref{Texinfo@asis{::}Parser Information available in the @code{info} key,, Information available in the @code{info} key}.

@item extra
@anchor{Texinfo@asis{::}Parser extra}

A hash reference holding information that could also be obtained
from the tree, but is directly associated to the element to simplify
downstream code.
See @ref{Texinfo@asis{::}Parser Information available in the @code{extra} key,, Information available in the @code{extra} key}.

@end table

@node Texinfo@asis{::}Parser Element types
@subsection Element types

@node Texinfo@asis{::}Parser Types for command elements
@subsubsection Types for command elements

Some types can be associated with @@-commands (in addition to @code{cmdname}),
although usually there will be no type at all.  The following are the
possible values of @code{type} for tree elements for @@-commands.

@table @asis
@item definfoenclose_command
@anchor{Texinfo@asis{::}Parser definfoenclose_command}

This type is set for an @@-command that is redefined by @code{@@definfoenclose}.
The beginning is in @code{@{'extra'@}->@{'begin'@}} and the end in
@code{@{'extra'@}->@{'end'@}}.

The command name is the info @emph{command_name} value.

@item index_entry_command
@anchor{Texinfo@asis{::}Parser index_entry_command}

This is the type of index entry command like @code{@@cindex}, and, more
importantly user-defined index entry commands.  So for example if there
is:

@verbatim
 @defindex foo
  ...

 @fooindex index entry
@end verbatim

the @code{@@fooindex} @@-command element will have the @emph{index_entry_command}
type.

The command name is the info @emph{command_name} value.

@end table

@node Texinfo@asis{::}Parser Types for text elements
@subsubsection Types for text elements

The text elements may have the following types (or may have no type
at all):

@table @asis
@item after_menu_description_line
@anchor{Texinfo@asis{::}Parser after_menu_description_line}

@item space_at_end_menu_node
@anchor{Texinfo@asis{::}Parser space_at_end_menu_node}

Space after a node in the menu entry, when there is no description,
and space appearing after the description line.

@item delimiter
@anchor{Texinfo@asis{::}Parser delimiter}

@item spaces
@anchor{Texinfo@asis{::}Parser spaces}

Spaces on definition command line separating the definition command arguments.
Delimiters, such as comma, square brackets and parentheses appearing in
definition command line arguments at the end of the line, separated from
surrounding texts during the parsing phase.

@item empty_line
@anchor{Texinfo@asis{::}Parser empty_line}

An empty line (possibly containing whitespace characters only).

@item ignorable_spaces_after_command
@anchor{Texinfo@asis{::}Parser ignorable_spaces_after_command}

spaces appearing after an @@-command without braces that does not
take argument on the line, but which is followed by ignorable
spaces, such as @code{@@item} in @code{@@itemize} or @code{@@multitable}, or @code{@@noindent}.

@item spaces_after_close_brace
@anchor{Texinfo@asis{::}Parser spaces_after_close_brace}

Spaces appearing after a closing brace, for some rare commands for which
this space should be ignorable (like @code{@@caption} or @code{@@sortas}).

@item spaces_before_paragraph
@anchor{Texinfo@asis{::}Parser spaces_before_paragraph}

Space appearing before a paragraph beginning.

@item raw
@anchor{Texinfo@asis{::}Parser raw}

Text in an environment where it should be kept as is (in @code{@@verbatim},
@code{@@verb}, @code{@@macro} body).

@item rawline_arg
@anchor{Texinfo@asis{::}Parser rawline_arg}

Used for the arguments to some special line commands whose arguments
aren't subject to the usual macro expansion.  For example @code{@@set},
@code{@@clickstyle}, @code{@@unmacro}, @code{@@comment}.  The argument is associated to
the @emph{text} key.

@item spaces_at_end
@anchor{Texinfo@asis{::}Parser spaces_at_end}

Space within an index @@-command before an @@-command interrupting the
index command.

@item text_after_end
@anchor{Texinfo@asis{::}Parser text_after_end}

Text appearing after @@bye.

@item text_before_beginning
@anchor{Texinfo@asis{::}Parser text_before_beginning}

Text appearing before real content, including the @code{\input texinfo.tex}.

@item untranslated
@anchor{Texinfo@asis{::}Parser untranslated}

English text added by the parser that may need to be translated
during conversion.  Happens for definition line @@-commands aliases that
leads to prepending text such as ``Function''.

@end table

@node Texinfo@asis{::}Parser Tree container elements
@subsubsection Tree container elements

Some types of element are containers of portions of the tree,
either for the whole tree, or for contents appearing before @code{@@node}
and sectioning commands.

@table @asis
@item before_node_section
@anchor{Texinfo@asis{::}Parser before_node_section}

Content before nodes and sectioning commands at the beginning of
@code{document_root}.

@item document_root
@anchor{Texinfo@asis{::}Parser document_root}

@item root_line
@anchor{Texinfo@asis{::}Parser root_line}

@code{root_line} is the type of the root tree when parsing Texinfo line
fragments using @code{parse_texi_line}.  @code{document_root} is the document
root otherwise.

@code{document_root} first content should be @code{before_node_section}, then nodes and
sections @@-commands elements, @code{@@bye} element and @code{postamble_after_end}.

@item postamble_after_end
@anchor{Texinfo@asis{::}Parser postamble_after_end}

This container holds everything appearing after @@bye.

@item preamble_before_beginning
@anchor{Texinfo@asis{::}Parser preamble_before_beginning}

This container holds everything appearing before the first content, including
the @code{\input texinfo.tex} line and following blank lines.

@item preamble_before_setfilename
@anchor{Texinfo@asis{::}Parser preamble_before_setfilename}

This container holds everything that appears before @code{@@setfilename}.

@item preamble_before_content
@anchor{Texinfo@asis{::}Parser preamble_before_content}

This container holds everything appearing before the first formatted content,
corresponding to the @emph{preamble} in the Texinfo documentation.

@end table

@node Texinfo@asis{::}Parser Types of container elements
@subsubsection Types of container elements

The other types of element are containers with other elements appearing in
their @code{contents}.  The @code{paragraph} container holds normal text from the
Texinfo manual outside of any @@-commands, and within @@-commands with blocks of
text (@code{@@footnote}, @code{@@itemize} @code{@@item}, @code{@@quotation} for example).  The
@code{preformatted} container holds the content appearing in @@-commands like
@code{@@example} and the @code{rawpreformatted} container holds the content appearing in
format commands such as @code{@@html}.  The other containers are more specific.

The types of container element are the following:

@table @asis
@item balanced_braces
@anchor{Texinfo@asis{::}Parser balanced_braces}

Special type containing balanced braces content (braces included)
in the context where they are valid, and where balanced braces need to
be collected to know when a top-level brace command is closed.  In @code{@@math},
in raw output format brace commands and within brace @@-commands in raw output
format block commands.

@item before_defline
@anchor{Texinfo@asis{::}Parser before_defline}

A container for content before the first @code{@@defline} or @code{@@deftypeline}
in @code{@@defblock}.

@item before_item
@anchor{Texinfo@asis{::}Parser before_item}

A container for content before the first @code{@@item} of block @@-commands
with items (@code{@@table}, @code{@@multitable}, @code{@@enumerate}...).

@item brace_container
@anchor{Texinfo@asis{::}Parser brace_container}

@item brace_command_context
@anchor{Texinfo@asis{::}Parser brace_command_context}

@item brace_arg
@anchor{Texinfo@asis{::}Parser brace_arg}

@item line_arg
@anchor{Texinfo@asis{::}Parser line_arg}

@item block_line_arg
@anchor{Texinfo@asis{::}Parser block_line_arg}

@item following_arg
@anchor{Texinfo@asis{::}Parser following_arg}

Those containers occur within the @code{args} array of @@-commands taking an
argument.  @emph{brace_container} is used for the argument to commands
taking arguments surrounded by braces when the whole text in the braces
is in the argument.  @emph{brace_arg} is used for the arguments to commands taking
arguments surrounded by braces when the leading and, in most cases, trailing
spaces are not part of the argument, and for arguments in braces separated by
commas.  @emph{brace_command_context} is used for @@-commands with braces that start
a new context (@code{@@footnote}, @code{@@caption}, @code{@@math}).

@emph{line_arg} is used for commands that take the texinfo code on the rest of the
line as their argument, such as @code{@@settitle}, @code{@@node}, @code{@@section}.
@emph{block_line_arg} is similar but is used for commands that start a new block
(which is to be ended with @code{@@end}).

@emph{following_arg} is used for the accent @@-commands argument that did not use
braces but instead followed the @@-command, possibly after a space, as

@verbatim
  @~n
  @ringaccent A
@end verbatim

For example

@verbatim
 @code{in code}
@end verbatim

leads to

@verbatim
 {'cmdname' => 'code',
  'args' => [{'type' => 'brace_container',
              'contents' => [{'text' => 'in code'}]}]}
@end verbatim

@item bracketed_arg
@anchor{Texinfo@asis{::}Parser bracketed_arg}

Bracketed argument.  On definition command and on @code{@@multitable} line.

@item bracketed_linemacro_arg
@anchor{Texinfo@asis{::}Parser bracketed_linemacro_arg}

Argument of a user defined linemacro call in bracket.  It holds directly the
argument text (which does not contain the braces) and does not contain other
elements.  It should not appear directly in the tree as the user defined
linemacro call is replaced by the linemacro body.

@item def_category
@anchor{Texinfo@asis{::}Parser def_category}

@item def_class
@anchor{Texinfo@asis{::}Parser def_class}

@item def_type
@anchor{Texinfo@asis{::}Parser def_type}

@item def_name
@anchor{Texinfo@asis{::}Parser def_name}

@item def_typearg
@anchor{Texinfo@asis{::}Parser def_typearg}

@item def_arg
@anchor{Texinfo@asis{::}Parser def_arg}

Definition line arguments containers corresponding to the different parts of a
definition line command.  Contains one @code{bracketed_arg}, @code{def_line_arg} or
@code{untranslated_def_line_arg} container.

@item def_line
@anchor{Texinfo@asis{::}Parser def_line}

@item def_item
@anchor{Texinfo@asis{::}Parser def_item}

@item inter_def_item
@anchor{Texinfo@asis{::}Parser inter_def_item}

The @emph{def_line} type is associated with a container within a block definition
command.  It holds the definition line arguments in @emph{block_line_arg}.
A @code{@@def*} @@-command line command such as @code{@@deffnx} or @code{@@defline}
also holds the definition line arguments, in @emph{line_arg}.
The type of each definition line arguments element describes the meaning of the
element.  It is one of @emph{def_category}, @emph{def_name}, @emph{def_class}, @emph{def_type},
@emph{def_arg}, @emph{def_typearg}, @emph{spaces} or @emph{delimiter}, depending on the
definition.

The container with type @emph{def_item} holds the definition text content.
Content appearing before a definition command with a x form is in
an @emph{inter_def_item} container.

@item def_line_arg
@anchor{Texinfo@asis{::}Parser def_line_arg}

@item untranslated_def_line_arg
@anchor{Texinfo@asis{::}Parser untranslated_def_line_arg}

the @emph{def_line_arg} contains one or several elements that together are a single
unit on a definition command line.  This container is very similar with a
@emph{bracketed_arg} on a definition line, except that there is no bracket.
Appears in definition line arguments containers such as @emph{def_category},
@emph{def_arg} or similar.

The @emph{untranslated_def_line_arg} is similar, but only happens for automatically
added categories and contains only a text element.  For example, the @code{deffun}
line @emph{def_category} container may contain an @emph{untranslated_def_line_arg} type
container containing itself a text element with ``Function'' as text, if the
document language demands a translation.  Note that the
@emph{untranslated_def_line_arg} is special, as, in general, it should not be
recursed into, as the text within is untranslated, but the untranslated text
should be gathered when converting the @emph{untranslated_def_line_arg} type
container.

@item macro_call
@anchor{Texinfo@asis{::}Parser macro_call}

@item macro_call_line
@anchor{Texinfo@asis{::}Parser macro_call_line}

@item rmacro_call
@anchor{Texinfo@asis{::}Parser rmacro_call}

@item rmacro_call_line
@anchor{Texinfo@asis{::}Parser rmacro_call_line}

@item linemacro_call
@anchor{Texinfo@asis{::}Parser linemacro_call}

Container holding the arguments of a user defined macro, linemacro
or rmacro.  It should not appear directly in the tree as the user defined
call is expanded.  The name of the macro, rmacro or linemacro is the the info
@emph{command_name} value.  The @emph{macro_call_line} or @emph{rmacro_call_line} elements
are used when there are no braces and the whole line is the argument.

@item macro_name
@anchor{Texinfo@asis{::}Parser macro_name}

@item macro_arg
@anchor{Texinfo@asis{::}Parser macro_arg}

Taken from @code{@@macro} definition and put in the @code{args} key array of
the macro, @emph{macro_name} is the type of the text fragment corresponding
to the macro name, @emph{macro_arg} is the type of the text fragments
corresponding to macro formal arguments.

@item menu_comment
@anchor{Texinfo@asis{::}Parser menu_comment}

The @emph{menu_comment} container holds what is between menu entries
in menus.  For example, in:

@verbatim
  @menu
  Menu title

  * entry::

  Between entries
  * other::
  @end menu
@end verbatim

Both

@verbatim
  Menu title
@end verbatim

and

@verbatim
  Between entries
@end verbatim

will be in a @emph{menu_comment}.

@item menu_entry
@anchor{Texinfo@asis{::}Parser menu_entry}

@item menu_entry_leading_text
@anchor{Texinfo@asis{::}Parser menu_entry_leading_text}

@item menu_entry_name
@anchor{Texinfo@asis{::}Parser menu_entry_name}

@item menu_entry_separator
@anchor{Texinfo@asis{::}Parser menu_entry_separator}

@item menu_entry_node
@anchor{Texinfo@asis{::}Parser menu_entry_node}

@item menu_entry_description
@anchor{Texinfo@asis{::}Parser menu_entry_description}

A @emph{menu_entry} holds a full menu entry, like

@verbatim
  * node::    description.
@end verbatim

The different elements of the menu entry are in the
@emph{menu_entry} @code{contents} array reference.

@emph{menu_entry_leading_text} holds the star and following spaces.
@emph{menu_entry_name} is the menu entry name (if present), @emph{menu_entry_node}
corresponds to the node in the menu entry, @emph{menu_entry_separator} holds
the text after the node and before the description, in most cases
@code{::   }.  Lastly, @emph{menu_entry_description} is for the description.

@item multitable_head
@anchor{Texinfo@asis{::}Parser multitable_head}

@item multitable_body
@anchor{Texinfo@asis{::}Parser multitable_body}

@item row
@anchor{Texinfo@asis{::}Parser row}

In @code{@@multitable}, a @emph{multitable_head} container contains all the rows
with @code{@@headitem}, while @emph{multitable_body} contains the rows associated
with @code{@@item}.  A @emph{row} container contains the @code{@@item} and @code{@@tab}
forming a row.

@item paragraph
@anchor{Texinfo@asis{::}Parser paragraph}

A paragraph.  The @code{contents} of a paragraph (like other container
elements for Texinfo content) are elements representing the contents of
the paragraph in the order they occur, such as text elements
without a @code{cmdname} or @code{type}, or @@-command elements for commands
appearing in the paragraph.

@item preformatted
@anchor{Texinfo@asis{::}Parser preformatted}

Texinfo code within a format that is not filled.  Happens within some
block commands like @code{@@example}, but also in menu (in menu descriptions,
menu comments...).

@item rawpreformatted
@anchor{Texinfo@asis{::}Parser rawpreformatted}

Texinfo code within raw output format block commands such as @code{@@tex}
or @code{@@html}.

@item table_entry
@anchor{Texinfo@asis{::}Parser table_entry}

@item table_term
@anchor{Texinfo@asis{::}Parser table_term}

@item table_definition
@anchor{Texinfo@asis{::}Parser table_definition}

@item inter_item
@anchor{Texinfo@asis{::}Parser inter_item}

Those containers appear in @code{@@table}, @code{@@ftable} and @code{@@vtable}.
A @emph{table_entry} container contains an entire row of the table.
It contains a @emph{table_term} container, which holds all the @code{@@item} and
@code{@@itemx} lines.  This is followed by a @emph{table_definition} container, which
holds the content that is to go into the second column of the table.

If there is any content before an @code{@@itemx} (normally only comments,
empty lines or maybe index entries are allowed), it will be in
a container with type @emph{inter_item} at the same level of @code{@@item}
and @code{@@itemx}, in a @emph{table_term}.

@end table

@node Texinfo@asis{::}Parser Information available in the @code{info} key
@subsection Information available in the @code{info} key

@table @asis
@item arg_line
@anchor{Texinfo@asis{::}Parser arg_line}

The string correspond to the line after the @@-command
for @@-commands that have special arguments on their line,
and for @code{@@macro} line.

@item command_name
@anchor{Texinfo@asis{::}Parser command_name}

Name of commands that can be defined dynamically.
The name of index command or definfoenclose defined command (also
available in @emph{cmdname} for those commands).
The name of user defined macro, rmacro or linemacro called
associated with the element holding the arguments of the user defined command
call.

@item delimiter
@anchor{Texinfo@asis{::}Parser delimiter 1}

@code{@@verb} delimiter is in @emph{delimiter}.

@item inserted
@anchor{Texinfo@asis{::}Parser inserted}

Set if the element is not in the Texinfo input code, but is inserted
as a default for @@-command argument or as a definition command automatically
inserted category (for example @emph{Function} for @code{@@defun}).

@item spaces_after_argument
@anchor{Texinfo@asis{::}Parser spaces_after_argument}

A reference to an element containing the spaces after @@-command arguments
before a comma, a closing brace or at end of line, for some @@-commands and
bracketed content type with opening brace, and line commands and block command
lines taking Texinfo as argument and comma delimited arguments.  Depending on
the @@-command, the @emph{spaces_after_argument} is associated with the @@-command
element, or with each argument element.

@item spaces_after_cmd_before_arg
@anchor{Texinfo@asis{::}Parser spaces_after_cmd_before_arg}

For accent commands with spaces following the @@-command, like:

@verbatim
 @ringaccent A
 @^ u
@end verbatim

there is a @emph{spaces_after_cmd_before_arg} key linking to an element
containing the spaces appearing after the command in @emph{text}.

Space between a brace @@-command name and its opening brace also
ends up in @emph{spaces_after_cmd_before_arg}.  It is not recommended
to leave space between an @@-command name and its opening brace.

@item spaces_before_argument
@anchor{Texinfo@asis{::}Parser spaces_before_argument}

A reference to an element containing the spaces following the opening brace of
some @@-commands with braces and bracketed content type, spaces following
@@-commands for line commands and block command taking Texinfo as argument, and
spaces following comma delimited arguments.  For context brace commands, line
commands and block commands, @emph{spaces_before_argument} is associated with the
@@-command element, for other brace commands and for spaces after comma, it is
associated with each argument element.

@end table

@node Texinfo@asis{::}Parser Information available in the @code{extra} key
@subsection Information available in the @code{extra} key
@cindex Texinfo tree element extra key

@node Texinfo@asis{::}Parser Extra keys available for more than one @@-command
@subsubsection Extra keys available for more than one @@-command

@table @asis
@item element_node
@anchor{Texinfo@asis{::}Parser element_node}

The node element in the parsed tree containing the element.
Set for @@-commands elements that have an associated
index entry and for @code{@@nodedescription}.

@item element_region
@anchor{Texinfo@asis{::}Parser element_region}

The region command (@code{@@copying}, @code{@@titlepage}) containing the element,
if it is in such an environement.  Set for @@-commands elements that have an
associated index entry and for @@anchor.

@item index_entry
@anchor{Texinfo@asis{::}Parser index_entry}

The index entry information is associated to @@-commands that have an associated
index entry.  The associated information should not be directly accessed,
instead @ref{Texinfo@asis{::}Common ($index_entry@comma{} $index_info) = lookup_index_entry($index_entry_info@comma{} $indices_information),, @code{Texinfo::Common::lookup_index_entry}}
should be called on the @code{extra} @emph{index_entry} value:

@verbatim
   my ($index_entry, $index_info)
    = Texinfo::Common::lookup_index_entry(
                        $element->{'extra'}->{'index_entry'},
                        $indices_information);
@end verbatim

The @emph{$indices_information} is the information on a Texinfo manual indices
obtained from
@ref{Texinfo@asis{::}Document $indices_information = $document->indices_information(),, @code{Texinfo::Document::indices_information}}.
The index entry information hash returned by
@code{Texinfo::Common::lookup_index_entry} is described in
@ref{Texinfo@asis{::}Document index_entries}.

Currently, the @emph{index_entry} value is an array reference
with an index name as first element and the index entry number in that index
(1-based) as second element.

@item index_ignore_chars
@anchor{Texinfo@asis{::}Parser index_ignore_chars}

A string containing the characters flagged as ignored in key sorting in the
document by setting flags such as @emph{txiindexbackslashignore}.  Set, if
not empty, for @@-commands elements that have an associated index entry.

@item misc_args
@anchor{Texinfo@asis{::}Parser misc_args}

An array holding strings, the arguments of @@-commands taking simple
textual arguments as arguments, like @code{@@everyheadingmarks},
@code{@@frenchspacing}, @code{@@alias}, @code{@@synindex}, @code{@@columnfractions}.

@item text_arg
@anchor{Texinfo@asis{::}Parser text_arg}

The string correspond to the line after the @@-command for @@-commands
that have an argument interpreted as simple text, like @code{@@setfilename},
@code{@@end} or @code{@@documentencoding}.

@end table

@node Texinfo@asis{::}Parser Extra keys specific of certain @@-commands or containers
@subsubsection Extra keys specific of certain @@-commands or containers

@table @asis
@item @code{@@abbr}
@anchor{Texinfo@asis{::}Parser @code{@@abbr}}

@item @code{@@acronym}
@anchor{Texinfo@asis{::}Parser @code{@@acronym}}

The first argument normalized is in @emph{normalized}.

@item @code{@@anchor}
@anchor{Texinfo@asis{::}Parser @code{@@anchor}}

@item @code{@@float}
@anchor{Texinfo@asis{::}Parser @code{@@float}}

@@-commands that are targets for cross-references have a @emph{normalized} key for
the normalized label, built as specified in the Texinfo documentation in the
@emph{HTML Xref} node.  There is also a @emph{node_content} key for an element holding
the corresponding content.

@item @code{@@author}
@anchor{Texinfo@asis{::}Parser @code{@@author}}

If in a @code{@@titlepage}, the titlepage is in @emph{titlepage}, if in
@code{@@quotation} or @code{@@smallquotation}, the corresponding tree element
is in @emph{quotation}.

The author tree element is in the @emph{authors} array of the @code{@@titlepage}
or the @code{@@quotation} or @code{@@smallquotation} it is associated with.

@item @code{@@click}
@anchor{Texinfo@asis{::}Parser @code{@@click}}

In @emph{clickstyle} there is the current clickstyle command.

@item @code{def_line}
@anchor{Texinfo@asis{::}Parser @code{def_line} 1}

@item line definition command
@anchor{Texinfo@asis{::}Parser line definition command}

@emph{def_command} holds the line definition command name, without x if the line
definition command is an x form of a block definition command.  For a
@code{def_line} container, @emph{def_command} holds the command name associated
with the @code{def_line}.  @emph{original_def_cmdname} is the original def command
name.

If the element is a definition line command and is an x form of a block
definition command, it has @emph{not_after_command} set if not appearing
after the block definition command without x.

The @emph{def_index_element} is a Texinfo tree element corresponding to
the index entry associated to the definition line, based on the
name and class.  If needed this element is based on translated strings.
In that case, if @code{@@documentlanguage} is defined where the element
is located, @emph{documentlanguage} holds the documentlanguage value.
@emph{def_index_ref_element} is similar, but not translated, and only set if
there could have been a translation.

The @emph{omit_def_name_space} key value is set and true if the Texinfo variable
@code{txidefnamenospace} was set, signaling that the space between function
definition name and arguments should be omitted.

@item @code{@@definfoenclose} defined commands
@anchor{Texinfo@asis{::}Parser @code{@@definfoenclose} defined commands}

@emph{begin} holds the string beginning the @code{@@definfoenclose},
@emph{end} holds the string ending the @code{@@definfoenclose}.

@item @code{@@documentencoding}
@anchor{Texinfo@asis{::}Parser @code{@@documentencoding}}

The argument, normalized is in @emph{input_encoding_name}.

@item @code{@@enumerate}
@anchor{Texinfo@asis{::}Parser @code{@@enumerate}}

The @emph{enumerate_specification} @code{extra} key contains the enumerate argument.

@item @code{@@float}
@anchor{Texinfo@asis{::}Parser @code{@@float} 1}

@item @code{@@listoffloats}
@anchor{Texinfo@asis{::}Parser @code{@@listoffloats}}

If @code{@@float} has a first argument, and for @code{@@listoffloats} argument there
is a @emph{float_type} key with the normalized float type.

@emph{caption} and @emph{shortcaption} hold the corresponding tree elements
associated to a @code{@@float}.  The @code{@@caption} or @code{@@shortcaption} have the
float tree element stored in @emph{float}.

@item index entry @@-command
@anchor{Texinfo@asis{::}Parser index entry @@-command}

@item @code{@@subentry}
@anchor{Texinfo@asis{::}Parser @code{@@subentry}}

If an index entry @@-command, such as @code{@@cindex}, or a @code{@@subentry} contains
a @code{@@sortas} command, @emph{sortas} holds the @code{@@sortas} command content
formatted as plain text.

@emph{subentry} links to the next level @code{@@subentry} element.  @emph{subentry_parent}
links to the previous level element.

Index entry @@-command (but not @code{@@subentry}) can also have @emph{seentry}
and @emph{seealso} keys that link to the corresponding @@-commands elements.

@item @code{@@inlinefmt}
@anchor{Texinfo@asis{::}Parser @code{@@inlinefmt}}

@item @code{@@inlineraw}
@anchor{Texinfo@asis{::}Parser @code{@@inlineraw}}

@item @code{@@inlinefmtifelse}
@anchor{Texinfo@asis{::}Parser @code{@@inlinefmtifelse}}

@item @code{@@inlineifclear}
@anchor{Texinfo@asis{::}Parser @code{@@inlineifclear}}

@item @code{@@inlineifset}
@anchor{Texinfo@asis{::}Parser @code{@@inlineifset}}

The first argument is in @emph{format}.  If an argument has been determined
as being expanded by the Parser, the index of this argument is in
@emph{expand_index}.  Index numbering begins at 0, but the first argument is
always the format or flag name, so, if set, it should be 1 or 2 for
@code{@@inlinefmtifelse}, and 1 for other commands.

@item @code{@@item} in @code{@@enumerate} or @code{@@itemize}
@anchor{Texinfo@asis{::}Parser @code{@@item} in @code{@@enumerate} or @code{@@itemize}}

The @emph{item_number} @code{extra} key holds the number of this item.

@item @code{@@item} and @code{@@tab} in @code{@@multitable}
@anchor{Texinfo@asis{::}Parser @code{@@item} and @code{@@tab} in @code{@@multitable}}

The @emph{cell_number} index key holds the index of the column of
the cell.

@item @code{@@itemize}
@anchor{Texinfo@asis{::}Parser @code{@@itemize}}

@item @code{@@table}
@anchor{Texinfo@asis{::}Parser @code{@@table}}

@item @code{@@vtable}
@anchor{Texinfo@asis{::}Parser @code{@@vtable}}

@item @code{@@ftable}
@anchor{Texinfo@asis{::}Parser @code{@@ftable}}

The @emph{command_as_argument} @code{extra} key points to the @@-command
as argument on the @@-command line.

If the command in argument for @code{@@table}, @code{@@vtable} or @code{@@ftable}
is @code{@@kbd} and the context and @code{@@kbdinputstyle} is such that @code{@@kbd}
should be formatted as code, the @emph{command_as_argument_kbd_code}
@code{extra} key is set to 1.

@item @code{@@kbd}
@anchor{Texinfo@asis{::}Parser @code{@@kbd}}

@emph{code} is set depending on the context and @code{@@kbdinputstyle}.

@item @code{@@macro}
@anchor{Texinfo@asis{::}Parser @code{@@macro}}

@emph{invalid_syntax} is set if there was an error on the @code{@@macro}
line.  @code{info} key hash @emph{arg_line} holds the line after @code{@@macro}.

@item @code{menu_entry_node}
@anchor{Texinfo@asis{::}Parser @code{menu_entry_node} 1}

Extra keys with information about the node entry label same as those
appearing in the @code{@@node} @emph{line_arg} explicit directions arguments
@code{extra} hash labels information.

@item @code{@@multitable}
@anchor{Texinfo@asis{::}Parser @code{@@multitable}}

The key @emph{max_columns} holds the maximal number of columns.  If there is a
@code{@@columnfractions} as argument, then the @emph{columnfractions} key is associated
with the element for the @@columnfractions command.

@item @code{@@node}
@anchor{Texinfo@asis{::}Parser @code{@@node}}

Explicit directions labels information are available in the @emph{line_arg}
node directions arguments of @code{@@node}.  Each @emph{line_arg} argument element
@code{extra} hash @emph{node_content} key value is an element holding the
contents corresponding to the node name.  There is also a @emph{manual_content} key
if there is an associated external manual name, and a @emph{normalized} key for the
normalized label, built as specified in the @emph{HTML Xref} Texinfo documentation
node.

If you called @ref{Texinfo@asis{::}Structuring $nodes_list = nodes_tree($document),, Texinfo::Structuring::nodes_tree},
the @emph{node_directions} hash in the @code{@@node} element @code{extra} associates
@emph{up}, @emph{next} and @emph{prev} keys to the elements corresponding to the node
line directions.

An @emph{associated_section} key holds the tree element of the
sectioning command that follows the node.  An @emph{node_preceding_part}
key holds the tree element of the @code{@@part} that precedes the node,
if there is no sectioning command between the @code{@@part} and the node.
A @emph{node_description} key holds the first @code{@@nodedescription} associated
to the node.

A node containing a menu have a @emph{menus} key which refers to an array of
references to menu elements occuring in the node.

The first node containing a @code{@@printindex} @@-command has the @emph{isindex}
key set.

@item @code{paragraph}
@anchor{Texinfo@asis{::}Parser @code{paragraph} 1}

The @emph{indent} or @emph{noindent} key value is set if the corresponding
@@-commands are associated with that paragraph.

@item @code{@@part}
@anchor{Texinfo@asis{::}Parser @code{@@part}}

The next sectioning command tree element is in @emph{part_associated_section}.
The following node tree element is in @emph{part_following_node} if there is
no sectioning command between the @code{@@part} and the node.

@item @code{@@ref}
@anchor{Texinfo@asis{::}Parser @code{@@ref}}

@item @code{@@xref}
@anchor{Texinfo@asis{::}Parser @code{@@xref}}

@item @code{@@pxref}
@anchor{Texinfo@asis{::}Parser @code{@@pxref}}

@item @code{@@inforef}
@anchor{Texinfo@asis{::}Parser @code{@@inforef}}

The @emph{brace_arg} corresponding to the node argument holds information on
the label, with the same information in the @code{extra} hash as for the
@code{@@node} @emph{line_arg} explicit directions arguments.

@item @code{row}
@anchor{Texinfo@asis{::}Parser @code{row} 1}

The @emph{row_number} index key holds the index of the row in
the @code{@@multitable}.

@item sectioning command
@anchor{Texinfo@asis{::}Parser sectioning command}

The node preceding the command is in @emph{associated_node}.
The part preceding the command is in @emph{associated_part}.
If the level of the document was modified by @code{@@raisections}
or @code{@@lowersections}, the differential level is in @emph{level_modifier}.

Other @code{extra} keys are set when you call @ref{Texinfo@asis{::}Structuring $sections_list = sectioning_structure($document),, Texinfo::Structuring::sectioning_structure}.

@item @code{untranslated_def_line_arg}
@anchor{Texinfo@asis{::}Parser @code{untranslated_def_line_arg} 1}

@emph{documentlanguage} holds the @code{@@documentlanguage} value.
If there is a translation context, it should be in @emph{translation_context}.

@end table

@node Texinfo@asis{::}Parser SEE ALSO
@section Texinfo::Parser SEE ALSO

@url{https://www.gnu.org/software/texinfo/manual/texinfo/, Texinfo manual}.

@node Texinfo@asis{::}Parser AUTHOR
@section Texinfo::Parser AUTHOR

Patrice Dumas, <pertusus@@free.fr>

@node Texinfo@asis{::}Parser COPYRIGHT AND LICENSE
@section Texinfo::Parser COPYRIGHT AND LICENSE

Copyright 2010- Free Software Foundation, Inc.  See the source file for
all copyright years.

This library is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or (at
your option) any later version.

