[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Patrice Dumas |
Date: |
Thu, 23 May 2024 13:15:52 -0400 (EDT) |
branch: master
commit a111bf75fed6bea4376c5b95d25d8e2ab789c802
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu May 23 13:33:30 2024 +0200
* tp/Texinfo/ParserNonXS.pm: access customization options in 'conf'
if they are not supposed to change during parsing.
---
ChangeLog | 5 +
tp/Texinfo/ParserNonXS.pm | 292 ++++++++++++++++++++++++----------------------
2 files changed, 160 insertions(+), 137 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 65ee138685..7215d02850 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-05-23 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm: access customization options in 'conf'
+ if they are not supposed to change during parsing.
+
2024-05-23 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/Document.pm (_add_element_to_identifiers_target): remove
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index be9cf2d7dc..7cdf0d1f47 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -624,7 +624,7 @@ sub _initialize_parsing()
my $parser = shift;
my $index_names;
- if (!$parser->{'NO_INDEX'}) {
+ if (!$parser->{'conf'}->{'NO_INDEX'}) {
$index_names = dclone(\%index_names);
} else {
# not needed, but not undef because it is exported to document
@@ -653,7 +653,7 @@ sub _initialize_parsing()
# In gdt(), both NO_INDEX and NO_USER_COMMANDS are set and this has a sizable
# effect on performance.
- if (!$parser->{'NO_INDEX'}) {
+ if (!$parser->{'conf'}->{'NO_INDEX'}) {
# Initialize command hash that are dynamically modified for index
# commands.
$parser_state->{'command_index'} = {%command_index};
@@ -666,7 +666,7 @@ sub _initialize_parsing()
$parser_state->{'index_entry_commands'} = \%index_entry_command_commands;
}
- if (!$parser->{'NO_USER_COMMANDS'}) {
+ if (!$parser->{'conf'}->{'NO_USER_COMMANDS'}) {
# Initialize command hash that are dynamically modified for
# definfoenclose, based on defaults.
$parser_state->{'brace_commands'} = dclone(\%brace_commands);
@@ -679,7 +679,8 @@ sub _initialize_parsing()
$parser_state->{'valid_nestings'} = \%default_valid_nestings;
}
- if ($parser->{'NO_USER_COMMANDS'} or $parser->{'NO_INDEX'}) {
+ if ($parser->{'conf'}->{'NO_USER_COMMANDS'}
+ or $parser->{'conf'}->{'NO_INDEX'}) {
# with NO_USER_COMMANDS or NO_INDEX, new index commands are not defined.
# Therefore, the default data can be used as it won't be modified.
$parser_state->{'line_commands'} = \%line_commands;
@@ -891,7 +892,7 @@ sub get_parser_info($)
my $perl_encoding
= Texinfo::Common::get_perl_encoding($document->{'commands_info'},
$self->{'registrar'},
- $self->{'DEBUG'});
+ $self->{'conf'}->{'DEBUG'});
if (defined($perl_encoding)) {
$document->{'global_info'}->{'input_perl_encoding'} = $perl_encoding
}
@@ -1087,7 +1088,7 @@ sub _line_warn
my $debug = shift;
my $registrar = $self->{'registrar'};
$registrar->line_warn($text, $error_location_info, $continuation,
- $self->{'DEBUG'});
+ $self->{'conf'}->{'DEBUG'});
}
sub _line_error
@@ -1099,7 +1100,7 @@ sub _line_error
my $registrar = $self->{'registrar'};
$registrar->line_error($text, $error_location_info, $continuation,
- $self->{'DEBUG'});
+ $self->{'conf'}->{'DEBUG'});
}
# Format a bug message
@@ -1252,7 +1253,7 @@ sub _place_source_mark
print STDERR "MARK "._debug_show_source_mark($source_mark)
." $add_element_string ".Texinfo::Common::debug_print_element($mark_element)
.' '.Texinfo::Common::debug_print_element($element)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if (!$mark_element->{'source_marks'}) {
$mark_element->{'source_marks'} = [];
@@ -1306,7 +1307,8 @@ sub _parse_macro_command_line($$$$$;$)
__("bad name for \@%s"), $command), $source_info);
$macro->{'extra'} = {'invalid_syntax' => 1};
} else {
- print STDERR "MACRO \@$command $macro_name\n" if ($self->{'DEBUG'});
+ print STDERR "MACRO \@$command $macro_name\n"
+ if ($self->{'conf'}->{'DEBUG'});
$macro->{'args'} = [
{ 'type' => 'macro_name', 'text' => $macro_name,
@@ -1380,7 +1382,7 @@ sub _begin_paragraph($$;$)
if ($indent) {
$current->{'extra'} = {$indent => 1};
}
- print STDERR "PARAGRAPH\n" if ($self->{'DEBUG'});
+ print STDERR "PARAGRAPH\n" if ($self->{'conf'}->{'DEBUG'});
return $current;
}
return 0;
@@ -1395,7 +1397,7 @@ sub _begin_preformatted($$)
{ 'type' => 'preformatted',
'parent' => $current };
$current = $current->{'contents'}->[-1];
- print STDERR "PREFORMATTED\n" if ($self->{'DEBUG'});
+ print STDERR "PREFORMATTED\n" if ($self->{'conf'}->{'DEBUG'});
}
return $current;
}
@@ -1564,7 +1566,7 @@ sub _close_all_style_commands($$$;$$)
->{$current->{'parent'}->{'cmdname'}} ne 'context')
{
print STDERR "CLOSING(all_style_commands) "
."\@$current->{'parent'}->{'cmdname'}\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
$current = _close_brace_command($self, $current->{'parent'}, $source_info,
$closed_block_command,
$interrupting_command, 1);
@@ -1583,7 +1585,7 @@ sub _end_paragraph($$$;$$)
$closed_block_command,
$interrupting_command);
if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
- print STDERR "CLOSE PARA\n" if ($self->{'DEBUG'});
+ print STDERR "CLOSE PARA\n" if ($self->{'conf'}->{'DEBUG'});
$current = _close_container($self, $current);
}
return $current;
@@ -1615,7 +1617,7 @@ sub _remove_empty_content($$)
print STDERR "REMOVE empty child "
.Texinfo::Common::debug_print_element($child_element)
.' from '.Texinfo::Common::debug_print_element($current)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
_pop_element_from_contents($self, $current);
}
}
@@ -1635,7 +1637,7 @@ sub _close_container($$)
.Texinfo::Common::debug_print_element($current, 1)
.' ('.($current->{'source_marks'}
? scalar(@{$current->{'source_marks'}}) : 0)." source marks)\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if ($current->{'source_marks'}) {
# Keep the element to keep the source mark, but remove some types.
# Keep before_item in order not to add empty table definition in
@@ -1656,7 +1658,7 @@ sub _close_container($$)
and $current->{'contents'}->[-1] eq $element_to_remove) {
print STDERR "REMOVE empty type "
.Texinfo::Common::debug_print_element($element_to_remove, 1)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
_pop_element_from_contents($self, $current);
}
return $current;
@@ -1673,7 +1675,7 @@ sub _end_preformatted($$$;$$)
$interrupting_command);
if ($current->{'type'} and $current->{'type'} eq 'preformatted') {
- print STDERR "CLOSE PREFORMATTED\n" if ($self->{'DEBUG'});
+ print STDERR "CLOSE PREFORMATTED\n" if ($self->{'conf'}->{'DEBUG'});
$current = _close_container($self, $current);
}
return $current;
@@ -2091,7 +2093,7 @@ sub _close_current($$$;$$)
if ($current->{'cmdname'}) {
my $command = $current->{'cmdname'};
print STDERR "CLOSING(close_current) \@$command\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if (exists($self->{'brace_commands'}->{$command})) {
$current = _close_brace_command($self, $current, $source_info,
$closed_block_command,
@@ -2125,7 +2127,8 @@ sub _close_current($$$;$$)
$current = $current->{'parent'};
}
} elsif ($current->{'type'}) {
- print STDERR "CLOSING type $current->{'type'}\n" if ($self->{'DEBUG'});
+ print STDERR "CLOSING type $current->{'type'}\n"
+ if ($self->{'conf'}->{'DEBUG'});
if ($current->{'type'} eq 'bracketed_arg') {
# unclosed bracketed argument
$self->_command_error($current, __("misplaced {"));
@@ -2287,14 +2290,15 @@ sub _merge_text {
print STDERR "MERGED TEXT: $text||| in "
.Texinfo::Common::debug_print_element($last_child)
." last of ".Texinfo::Common::debug_print_element($current)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
$last_child->{'text'} .= $text;
} else {
my $new_element = { 'text' => $text, 'parent' => $current };
_transfer_source_marks($transfer_marks_element, $new_element)
if ($transfer_marks_element);
push @{$current->{'contents'}}, $new_element;
- print STDERR "NEW TEXT (merge): $text|||\n" if ($self->{'DEBUG'});
+ print STDERR "NEW TEXT (merge): $text|||\n"
+ if ($self->{'conf'}->{'DEBUG'});
}
return $current;
}
@@ -2426,7 +2430,7 @@ sub _next_text($;$)
. ($input->{'input_source_info'}->{'line_nr'} + 1).
sprintf(": encoding error at byte 0x%2x\n", ord($error_byte)));
# show perl message but only with debugging
- print STDERR "input error: $@\n" if ($self->{'DEBUG'});
+ print STDERR "input error: $@\n" if ($self->{'conf'}->{'DEBUG'});
}
# do the decoding
my $line = Encode::decode($input->{'file_input_encoding'}, $input_line);
@@ -2457,7 +2461,7 @@ sub _next_text($;$)
# again. With numerous macros expansions on the last line, this
# place can be reached more than twice.
$input->{'after_end_fetch_nr'}++;
- if ($self->{'DEBUG'} and $input->{'after_end_fetch_nr'} > 1) {
+ if ($self->{'conf'}->{'DEBUG'} and $input->{'after_end_fetch_nr'} > 1) {
print STDERR "AFTER END FETCHED INPUT NR: "
.$input->{'after_end_fetch_nr'}."\n";
}
@@ -2525,7 +2529,7 @@ sub _next_text($;$)
_register_source_mark($self, $current,
$end_source_mark);
} else {
- if ($self->{'DEBUG'}) {
+ if ($self->{'conf'}->{'DEBUG'}) {
print STDERR "INPUT MARK MISSED: "
._debug_show_source_mark($input->{'input_source_mark'})."\n";
cluck();
@@ -2537,7 +2541,7 @@ sub _next_text($;$)
# source_info, even when nothing is returned and the first input
# file is closed.
if (scalar(@{$self->{'input'}}) == 1) {
- print STDERR "INPUT FINISHED\n" if ($self->{'DEBUG'});
+ print STDERR "INPUT FINISHED\n" if ($self->{'conf'}->{'DEBUG'});
$input->{'after_end_fetch_nr'} = 0
if (!defined($input->{'after_end_fetch_nr'}));
return (undef, { %{$input->{'input_source_info'}} });
@@ -2653,7 +2657,7 @@ sub _expand_macro_arguments($$$$$)
$argument->{'info'}
= {'spaces_before_argument' => {'text' => $1}};
}
- print STDERR "MACRO NEW ARG\n" if ($self->{'DEBUG'});
+ print STDERR "MACRO NEW ARG\n" if ($self->{'conf'}->{'DEBUG'});
} else {
# implicit quoting when there is one argument.
if ($args_total != 1) {
@@ -2676,7 +2680,7 @@ sub _expand_macro_arguments($$$$$)
$argument_content->{'text'} .= $separator;
}
} else {
- print STDERR "MACRO ARG end of line\n" if ($self->{'DEBUG'});
+ print STDERR "MACRO ARG end of line\n" if ($self->{'conf'}->{'DEBUG'});
$argument_content->{'text'} .= $line;
($line, $source_info) = _new_line($self, $argument);
@@ -2695,7 +2699,7 @@ sub _expand_macro_arguments($$$$$)
"macro `%s' declared without argument called with an argument"),
$name), $source_info);
}
- print STDERR "END MACRO ARGS EXPANSION\n" if ($self->{'DEBUG'});
+ print STDERR "END MACRO ARGS EXPANSION\n" if ($self->{'conf'}->{'DEBUG'});
return ($line, $source_info);
}
@@ -2736,7 +2740,7 @@ sub _expand_linemacro_arguments($$$$$)
$argument_content->{'text'} .= $cmdname;
substr($line, 0, length($cmdname)) = '';
if ((defined($self->{'brace_commands'}->{$cmdname})
- and $self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'})
+ and $self->{'conf'}->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'})
or $accent_commands{$cmdname}) {
$line =~ s/^(\s*)//;
$argument_content->{'text'} .= $1;
@@ -2770,12 +2774,12 @@ sub _expand_linemacro_arguments($$$$$)
push @{$argument->{'contents'}}, $argument_content;
$argument->{'info'}
= {'spaces_before_argument' => {'text' => $separator}};
- print STDERR "LINEMACRO NEW ARG\n" if ($self->{'DEBUG'});
+ print STDERR "LINEMACRO NEW ARG\n" if ($self->{'conf'}->{'DEBUG'});
}
}
} else {
print STDERR "LINEMACRO ARGS no separator $braces_level '"
- ._debug_protect_eol($line)."'\n" if ($self->{'DEBUG'});
+ ._debug_protect_eol($line)."'\n" if ($self->{'conf'}->{'DEBUG'});
if ($braces_level > 0) {
$argument_content->{'text'} .= $line;
@@ -2798,7 +2802,7 @@ sub _expand_linemacro_arguments($$$$$)
($line, $source_info) = _new_line($self, $argument);
if (!defined($line)) {
print STDERR "LINEMACRO ARGS end no EOL\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
$line = '';
last;
}
@@ -2821,24 +2825,24 @@ sub _expand_linemacro_arguments($$$$$)
if ($toplevel_braces_nr == 1 and $argument_content->{'text'} =~
/^\{(.*)\}$/s) {
print STDERR "TURN to bracketed $arg_idx "
.Texinfo::Common::debug_print_element($argument_content)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
$argument_content->{'text'} = $1;
$argument_content->{'type'} = 'bracketed_linemacro_arg';
# this message could be added to see all the arguments
#} else {
# print STDERR "NOT bracketed with bracket $arg_idx "
# .Texinfo::Common::debug_print_element($argument_content)."\n"
- # if ($self->{'DEBUG'});
+ # if ($self->{'conf'}->{'DEBUG'});
}
# this message could be added to see all the arguments
#} else {
# print STDERR "LVL0 no brace $arg_idx "
# .Texinfo::Common::debug_print_element($argument_content)."\n"
- # if ($self->{'DEBUG'});
+ # if ($self->{'conf'}->{'DEBUG'});
}
$arg_idx++;
}
- print STDERR "END LINEMACRO ARGS EXPANSION\n" if ($self->{'DEBUG'});
+ print STDERR "END LINEMACRO ARGS EXPANSION\n" if
($self->{'conf'}->{'DEBUG'});
return ($line, $source_info);
}
@@ -2962,7 +2966,7 @@ sub _abort_empty_line {
.$spaces_element->{'type'}
."; add |$additional_spaces|"
." to |$spaces_element->{'text'}|\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
$spaces_element->{'text'} .= $additional_spaces;
@@ -3054,7 +3058,7 @@ sub _isolate_last_space
}
my $debug_str;
- if ($self->{'DEBUG'}) {
+ if ($self->{'conf'}->{'DEBUG'}) {
$debug_str = 'p '.Texinfo::Common::debug_print_element($current).'; c ';
if ($current->{'contents'} and scalar(@{$current->{'contents'}})) {
$debug_str .=
@@ -3071,14 +3075,14 @@ sub _isolate_last_space
and $current->{'type'} ne 'block_line_arg')))
or $current->{'contents'}->[-1]->{'text'} !~ /\s+$/) {
print STDERR "NOT ISOLATING $debug_str\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
return;
}
my $last_element = $current->{'contents'}->[-1];
print STDERR "ISOLATE SPACE $debug_str\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if ($current->{'type'} and $current->{'type'} eq 'menu_entry_node') {
_isolate_trailing_space($current, 'space_at_end_menu_node');
@@ -3412,7 +3416,7 @@ sub _enter_index_entry($$$$)
{
my ($self, $command_container, $element, $source_info) = @_;
- return if $self->{'NO_INDEX'};
+ return if $self->{'conf'}->{'NO_INDEX'};
my $document = $self->{'document'};
@@ -3571,7 +3575,7 @@ sub _end_line_misc_line($$$)
my $arg_spec = $self->{'line_commands'}->{$data_cmdname};
print STDERR "MISC END $command\n" #: $arg_spec"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if ($arg_spec eq 'specific') {
my $args = _parse_line_command_args($self, $current, $source_info);
@@ -3603,7 +3607,8 @@ sub _end_line_misc_line($$$)
__("unknown \@end %s"), $end_command);
$end_command = undef;
} else {
- print STDERR "END BLOCK \@end $end_command\n" if
($self->{'DEBUG'});
+ print STDERR "END BLOCK \@end $end_command\n"
+ if ($self->{'conf'}->{'DEBUG'});
}
# non-ASCII spaces are also superfluous arguments.
# If there is superfluous text after @end argument, set
@@ -3634,7 +3639,8 @@ sub _end_line_misc_line($$$)
= _input_push_file($self, $included_file_path,
$file_name_encoding);
if ($status) {
$included_file = 1;
- print STDERR "Included $included_file_path\n" if
($self->{'DEBUG'});
+ print STDERR "Included $included_file_path\n"
+ if ($self->{'conf'}->{'DEBUG'});
$include_source_mark = {'sourcemark_type' => $command,
'status' => 'start'};
$self->{'input'}->[0]->{'input_source_mark'} =
$include_source_mark;
@@ -3822,7 +3828,7 @@ sub _end_line_misc_line($$$)
$current = $current->{'parent'};
if ($end_command) { # Set above
# More processing of @end
- print STDERR "END COMMAND $end_command\n" if ($self->{'DEBUG'});
+ print STDERR "END COMMAND $end_command\n" if ($self->{'conf'}->{'DEBUG'});
# Reparent the "@end" element to be a child of the block element.
my $end = _pop_element_from_contents($self, $current);
if ($block_commands{$end_command} ne 'conditional'
@@ -3845,7 +3851,7 @@ sub _end_line_misc_line($$$)
and defined($self->_top_context_command())
and $block_commands{$self->_top_context_command()} eq 'menu') {
print STDERR "CLOSE menu but still in menu context\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
push @{$current->{'contents'}}, {'type' => 'menu_comment',
'parent' => $current,
'contents' => [] };
@@ -3859,7 +3865,7 @@ sub _end_line_misc_line($$$)
my $cond_info = pop @{$self->{'conditional_stack'}};
my ($cond_command, $cond_source_mark) = @$cond_info;
print STDERR "POP END COND $end_command $cond_command\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
my $end_source_mark = {'sourcemark_type' =>
$cond_source_mark->{'sourcemark_type'},
'counter' =>
@@ -3968,7 +3974,7 @@ sub _end_line_def_line($$$)
print STDERR "END DEF LINE $def_command; current "
.Texinfo::Common::debug_print_element($current, 1)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
my $arguments = _parse_def($self, $def_command, $current, $source_info);
@@ -4071,7 +4077,7 @@ sub _end_line_starting_block($$$)
print STDERR "END BLOCK LINE: "
.Texinfo::Common::debug_print_element($current, 1)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
# @multitable args
if ($command eq 'multitable'
@@ -4322,7 +4328,7 @@ sub _end_line_starting_block($$$)
$ifvalue_true = 1;
}
print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
$bad_line = 0;
}
} else { # $command eq 'ifcommanddefined' or 'ifcommandnotdefined'
@@ -4342,7 +4348,7 @@ sub _end_line_starting_block($$$)
$ifvalue_true = 1;
}
print STDERR "CONDITIONAL \@$command $name: $ifvalue_true\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
$bad_line = 0;
}
}
@@ -4362,14 +4368,14 @@ sub _end_line_starting_block($$$)
or ($1 eq 'info'
and $self->{'expanded_formats_hash'}->{'plaintext'}));
print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
} else {
die unless ($command =~ /^if(.*)/);
$ifvalue_true = 1 if ($self->{'expanded_formats_hash'}->{$1}
or ($1 eq 'info'
and $self->{'expanded_formats_hash'}->{'plaintext'}));
print STDERR "CONDITIONAL \@$command format $1: $ifvalue_true\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
}
if ($ifvalue_true) {
my $conditional_element = $current;
@@ -4382,7 +4388,7 @@ sub _end_line_starting_block($$$)
'element' => $conditional_command};
_register_source_mark($self, $current, $source_mark);
print STDERR "PUSH BEGIN COND $command\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
push @{$self->{'conditional_stack'}}, [$command, $source_mark];
}
}
@@ -4391,7 +4397,7 @@ sub _end_line_starting_block($$$)
'parent' => $current,
'contents' => [] };
$current = $current->{'contents'}->[-1];
- print STDERR "MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
+ print STDERR "MENU_COMMENT OPEN\n" if ($self->{'conf'}->{'DEBUG'});
}
if ($block_commands{$command} eq 'format_raw'
and $self->{'expanded_formats_hash'}->{$command}) {
@@ -4435,7 +4441,7 @@ sub _end_line_menu_entry ($$$)
if ($empty_menu_entry_node or $current->{'type'} eq 'menu_entry_name') {
my $description_or_menu_comment;
my $menu_type_reopened = 'menu_description';
- print STDERR "FINALLY NOT MENU ENTRY\n" if ($self->{'DEBUG'});
+ print STDERR "FINALLY NOT MENU ENTRY\n" if ($self->{'conf'}->{'DEBUG'});
my $menu = $current->{'parent'}->{'parent'};
my $menu_entry = _pop_element_from_contents($self, $menu);
if ($menu->{'contents'} and scalar(@{$menu->{'contents'}})
@@ -4487,7 +4493,7 @@ sub _end_line_menu_entry ($$$)
push @{$current->{'contents'}}, {'type' => 'preformatted',
'parent' => $current, };
$current = $current->{'contents'}->[-1];
- print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'DEBUG'});
+ print STDERR "THEN MENU_COMMENT OPEN\n" if ($self->{'conf'}->{'DEBUG'});
}
# source marks tested in t/*macro.t macro_in_menu_comment_like_entry
while (@{$menu_entry->{'contents'}}) {
@@ -4512,7 +4518,7 @@ sub _end_line_menu_entry ($$$)
# MENU_COMMENT open
$menu_entry = undef;
} else {
- print STDERR "MENU ENTRY END LINE\n" if ($self->{'DEBUG'});
+ print STDERR "MENU ENTRY END LINE\n" if ($self->{'conf'}->{'DEBUG'});
$current = $current->{'parent'};
$current = _enter_menu_entry_node($self, $current, $source_info);
if (defined($end_comment)) {
@@ -4537,7 +4543,7 @@ sub _end_line($$$)
and $current->{'contents'}->[-1]->{'type'} eq 'empty_line') {
print STDERR "END EMPTY LINE in "
. Texinfo::Common::debug_print_element($current)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if ($current->{'type'} and $current->{'type'} eq 'paragraph') {
# Remove empty_line element.
my $empty_line = _pop_element_from_contents($self, $current);
@@ -4559,7 +4565,7 @@ sub _end_line($$$)
# as the source marks are either associated to the menu description
# or to the empty line after the menu description. Leave a message
# in case it happens in the future/some unexpected case.
- if ($self->{'TEST'}
+ if ($self->{'conf'}->{'TEST'}
and $empty_preformatted->{'source_marks'}) {
print STDERR "BUG: source_marks in menu description preformatted\n";
}
@@ -4582,7 +4588,8 @@ sub _end_line($$$)
'parent' => $current };
_transfer_source_marks($empty_line, $after_menu_description_line);
push @{$current->{'contents'}}, $after_menu_description_line;
- print STDERR "MENU: END DESCRIPTION, OPEN COMMENT\n" if
($self->{'DEBUG'});
+ print STDERR "MENU: END DESCRIPTION, OPEN COMMENT\n"
+ if ($self->{'conf'}->{'DEBUG'});
} elsif (!$no_paragraph_contexts{$self->_top_context()}) {
$current = _end_paragraph($self, $current, $source_info);
}
@@ -4609,7 +4616,7 @@ sub _end_line($$$)
if ($top_context eq 'ct_line' or $top_context eq 'ct_def') {
print STDERR "Still opened line/block command $top_context: "
.Texinfo::Common::debug_print_element($current, 1)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if ($top_context eq 'ct_def') {
while ($current->{'parent'} and !($current->{'parent'}->{'type'}
and $current->{'parent'}->{'type'} eq 'def_line')) {
@@ -4733,7 +4740,7 @@ sub _register_extra_menu_entry_information($$;$)
} elsif ($arg->{'type'} eq 'menu_entry_node') {
_isolate_last_space($self, $arg);
if (! $arg->{'contents'}) {
- if ($self->{'FORMAT_MENU'} eq 'menu') {
+ if ($self->{'conf'}->{'FORMAT_MENU'} eq 'menu') {
$self->_line_error(__("empty node name in menu entry"),
$source_info);
}
} else {
@@ -4800,7 +4807,8 @@ sub _register_command_as_argument($$)
my $self = shift;
my $cmd_as_arg = shift;
print STDERR "FOR PARENT \@$cmd_as_arg->{'parent'}->{'parent'}->{'cmdname'}
".
- "command_as_argument $cmd_as_arg->{'cmdname'}\n" if
($self->{'DEBUG'});
+ "command_as_argument $cmd_as_arg->{'cmdname'}\n"
+ if ($self->{'conf'}->{'DEBUG'});
$cmd_as_arg->{'type'} = 'command_as_argument' if (!$cmd_as_arg->{'type'});
$cmd_as_arg->{'parent'}->{'parent'}->{'extra'} = {}
if (!defined($cmd_as_arg->{'parent'}->{'parent'}->{'extra'}));
@@ -4873,7 +4881,7 @@ sub _parse_texi_regex {
sub _check_line_directive {
my ($self, $line, $source_info) = @_;
- if ($self->{'CPP_LINE_DIRECTIVES'}
+ if ($self->{'conf'}->{'CPP_LINE_DIRECTIVES'}
and defined($source_info->{'file_name'})
and $source_info->{'file_name'} ne ''
and !defined($source_info->{'macro'})
@@ -5057,15 +5065,16 @@ sub _handle_macro($$$$$)
# get the final new line from following text.
$self->{'macro_expansion_nr'}++;
print STDERR "MACRO EXPANSION NUMBER $self->{'macro_expansion_nr'}
$command\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
my $error;
# TODO use a different counter for linemacro?
- if ($self->{'MAX_MACRO_CALL_NESTING'}
- and $self->{'macro_expansion_nr'} > $self->{'MAX_MACRO_CALL_NESTING'}) {
+ if ($self->{'conf'}->{'MAX_MACRO_CALL_NESTING'}
+ and $self->{'macro_expansion_nr'}
+ > $self->{'conf'}->{'MAX_MACRO_CALL_NESTING'}) {
$self->_line_warn(sprintf(__(
"macro call nested too deeply (set MAX_MACRO_CALL_NESTING to override;
current value %d)"),
- $self->{'MAX_MACRO_CALL_NESTING'}), $source_info);
+ $self->{'conf'}->{'MAX_MACRO_CALL_NESTING'}), $source_info);
$error = 1;
}
@@ -5166,7 +5175,7 @@ sub _handle_macro($$$$$)
}
print STDERR "MACROBODY: $expanded_macro_text".'||||||'."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
my $sourcemark_type;
if ($expanded_macro->{'cmdname'} eq 'linemacro') {
@@ -5225,7 +5234,7 @@ sub _handle_menu_entry_separators($$$$$$)
and $current->{'contents'}->[-1]->{'type'}
and $current->{'contents'}->[-1]->{'type'} eq 'empty_line'
and $current->{'contents'}->[-1]->{'text'} eq '') {
- print STDERR "MENU STAR\n" if ($self->{'DEBUG'});
+ print STDERR "MENU STAR\n" if ($self->{'conf'}->{'DEBUG'});
_abort_empty_line($self, $current);
$$line_ref =~ s/^\*//;
push @{$current->{'contents'}}, { 'parent' => $current,
@@ -5237,10 +5246,10 @@ sub _handle_menu_entry_separators($$$$$$)
and $current->{'contents'}->[-1]->{'type'} eq 'internal_menu_star')
{
if ($$line_ref !~ /^\s+/) {
print STDERR "ABORT MENU STAR before: "
- ._debug_protect_eol($$line_ref)."\n" if ($self->{'DEBUG'});
+ ._debug_protect_eol($$line_ref)."\n" if ($self->{'conf'}->{'DEBUG'});
delete $current->{'contents'}->[-1]->{'type'};
} else {
- print STDERR "MENU ENTRY (certainly)\n" if ($self->{'DEBUG'});
+ print STDERR "MENU ENTRY (certainly)\n" if ($self->{'conf'}->{'DEBUG'});
# this is the menu star collected previously
my $menu_star_element = _pop_element_from_contents($self, $current);
$$line_ref =~ s/^(\s+)//;
@@ -5306,7 +5315,7 @@ sub _handle_menu_entry_separators($$$$$$)
and $current->{'contents'}->[-1]->{'type'} eq
'menu_entry_separator') {
my $separator = $current->{'contents'}->[-1]->{'text'};
print STDERR "AFTER menu_entry_separator $separator\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
# Separator is ::.
if ($separator eq ':' and $$line_ref =~ s/^(:)//) {
$current->{'contents'}->[-1]->{'text'} .= $1;
@@ -5327,14 +5336,15 @@ sub _handle_menu_entry_separators($$$$$$)
# :: after a menu entry name => change to a menu entry node
} elsif ($separator =~ /^::/) {
print STDERR "MENU NODE done (change from menu entry name) $separator\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
# Change from menu_entry_name (i.e. a label)
# to a menu entry node
$current->{'contents'}->[-2]->{'type'} = 'menu_entry_node';
$current = _enter_menu_entry_node($self, $current, $source_info);
# a :, but not ::, after a menu entry name => end of menu entry name
} elsif ($separator =~ /^:/) {
- print STDERR "MENU ENTRY done $separator\n" if ($self->{'DEBUG'});
+ print STDERR "MENU ENTRY done $separator\n"
+ if ($self->{'conf'}->{'DEBUG'});
push @{$current->{'contents'}}, { 'type' => 'menu_entry_node',
'parent' => $current };
$current = $current->{'contents'}->[-1];
@@ -5342,7 +5352,8 @@ sub _handle_menu_entry_separators($$$$$$)
# : and is after a menu node (itself following a menu_entry_name)
} else {
# NOTE $$line_ref can start with an @-command in that case
- print STDERR "MENU NODE done $separator\n" if ($self->{'DEBUG'});
+ print STDERR "MENU NODE done $separator\n"
+ if ($self->{'conf'}->{'DEBUG'});
$current = _enter_menu_entry_node($self, $current, $source_info);
}
} else {
@@ -5425,7 +5436,7 @@ sub _handle_other_command($$$$$)
# @itemize or @enumerate
if ($parent = _item_container_parent($current)) {
if ($command eq 'item') {
- print STDERR "ITEM CONTAINER\n" if ($self->{'DEBUG'});
+ print STDERR "ITEM CONTAINER\n" if ($self->{'conf'}->{'DEBUG'});
$parent->{'items_count'}++;
$command_e = { 'cmdname' => $command, 'parent' => $parent,
'extra' =>
@@ -5469,10 +5480,10 @@ sub _handle_other_command($$$$$)
{'cell_number' => $row->{'cells_count'}} };
push @{$row->{'contents'}}, $command_e;
$current = $row->{'contents'}->[-1];
- print STDERR "TAB\n" if ($self->{'DEBUG'});
+ print STDERR "TAB\n" if ($self->{'conf'}->{'DEBUG'});
}
} else {
- print STDERR "ROW\n" if ($self->{'DEBUG'});
+ print STDERR "ROW\n" if ($self->{'conf'}->{'DEBUG'});
my $row = { 'type' => 'row', 'contents' => [],
'cells_count' => 1,
'parent' => $parent };
@@ -5680,7 +5691,7 @@ sub _handle_line_command($$$$$$)
if ($command eq 'item' or $command eq 'itemx') {
my $parent;
if ($parent = _item_line_parent($current)) {
- print STDERR "ITEM LINE $command\n" if ($self->{'DEBUG'});
+ print STDERR "ITEM LINE $command\n" if ($self->{'conf'}->{'DEBUG'});
$current = $parent;
_gather_previous_item($self, $current, $command, $source_info);
} else {
@@ -5948,7 +5959,7 @@ sub _handle_block_command($$$$$)
$block if ($command eq 'direntry');
if ($self->{'current_node'}) {
if ($command eq 'direntry') {
- if ($self->{'FORMAT_MENU'} eq 'menu') {
+ if ($self->{'conf'}->{'FORMAT_MENU'} eq 'menu') {
$self->_line_warn(__("\@direntry after first node"),
$source_info);
}
@@ -6031,7 +6042,7 @@ sub _handle_brace_command($$$$)
my $source_info = shift;
print STDERR "OPEN BRACE \@$command\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
my $command_e = { 'cmdname' => $command, 'parent' => $current,};
$command_e->{'source_info'} = {%{$source_info}};
@@ -6185,7 +6196,7 @@ sub _handle_open_brace($$$$)
.(defined($current->{'parent'}->{'remaining_args'})
? $current->{'parent'}->{'remaining_args'} : '0')
.' '.Texinfo::Common::debug_print_element($current)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
} elsif ($current->{'parent'}
and (($current->{'parent'}->{'cmdname'}
and $current->{'parent'}->{'cmdname'} eq 'multitable')
@@ -6207,12 +6218,13 @@ sub _handle_open_brace($$$$)
'parent' => $current,
'extra' => {'spaces_associated_command' => $current}
};
- print STDERR "BRACKETED in def/multitable\n" if ($self->{'DEBUG'});
+ print STDERR "BRACKETED in def/multitable\n"
+ if ($self->{'conf'}->{'DEBUG'});
# lone braces accepted right in a rawpreformatted
} elsif ($current->{'type'}
and $current->{'type'} eq 'rawpreformatted') {
print STDERR "LONE OPEN BRACE in rawpreformatted\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
# this can happen in an expanded rawpreformatted
$current = _merge_text($self, $current, '{');
# matching braces accepted in a rawpreformatted, inline raw or
@@ -6231,7 +6243,7 @@ sub _handle_open_brace($$$$)
my $open_brace = {'text' => '{', 'parent' => $current};
push @{$current->{'contents'}}, $open_brace;
print STDERR "BALANCED BRACES in math/rawpreformatted/inlineraw\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
} else {
$self->_line_error(sprintf(__("misplaced {")), $source_info); #}
}
@@ -6245,7 +6257,7 @@ sub _handle_close_brace($$$)
my $current = shift;
my $source_info = shift;
- print STDERR "CLOSE BRACE\n" if ($self->{'DEBUG'});
+ print STDERR "CLOSE BRACE\n" if ($self->{'conf'}->{'DEBUG'});
# For footnote and caption closing, when there is a paragraph inside.
# This makes the brace command the parent element.
if ($current->{'parent'} and $current->{'parent'}->{'type'}
@@ -6253,7 +6265,7 @@ sub _handle_close_brace($$$)
and $current->{'type'} eq 'paragraph') {
_abort_empty_line($self, $current);
print STDERR "IN BRACE_COMMAND_CONTEXT end paragraph\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
$current = _end_paragraph($self, $current, $source_info);
}
@@ -6276,7 +6288,7 @@ sub _handle_close_brace($$$)
}
my $closed_command = $current->{'parent'}->{'cmdname'};
print STDERR "CLOSING(brace) \@$current->{'parent'}->{'cmdname'}\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if (defined($brace_commands{$closed_command})
and $brace_commands{$closed_command} eq 'noarg'
and $current->{'contents'}
@@ -6442,7 +6454,8 @@ sub _handle_close_brace($$$)
eval qq!use warnings FATAL => qw(all); hex("$arg")!;
if ($@) {
# leave clue in case something else went wrong.
- warn "\@U hex($arg) eval failed: $@\n" if ($self->{'DEBUG'});
+ warn "\@U hex($arg) eval failed: $@\n"
+ if ($self->{'conf'}->{'DEBUG'});
# argument likely exceeds size of integer
}
# ok, value can be given to hex(), so try it.
@@ -6545,9 +6558,9 @@ sub _handle_comma($$$$)
if (!defined($inline_type) or $inline_type eq '') {
# condition is missing for some reason
print STDERR "INLINE COND MISSING\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
} else {
- print STDERR "INLINE: $inline_type\n" if ($self->{'DEBUG'});
+ print STDERR "INLINE: $inline_type\n" if ($self->{'conf'}->{'DEBUG'});
if ($inline_format_commands{$current->{'cmdname'}}) {
if ($self->{'expanded_formats_hash'}->{$inline_type}) {
$expandp = 1;
@@ -6693,7 +6706,7 @@ sub _new_macro($$$)
my $name = shift;
my $current = shift;
- return if $self->{'NO_USER_COMMANDS'};
+ return if $self->{'conf'}->{'NO_USER_COMMANDS'};
my $macrobody;
if (defined($current->{'contents'})) {
@@ -6719,7 +6732,8 @@ sub _process_remaining_on_line($$$$)
my $retval = $STILL_MORE_TO_PROCESS;
- #print STDERR "PROCESS "._debug_protect_eol($line)."\n" if
($self->{'DEBUG'});
+ #print STDERR "PROCESS "._debug_protect_eol($line)."\n"
+ # if ($self->{'conf'}->{'DEBUG'});
# in a 'raw' (verbatim, ignore, (r)macro)
if ($current->{'cmdname'}
@@ -6735,7 +6749,7 @@ sub _process_remaining_on_line($$$$)
and $line =~ /^\s*\@(ignore)(\@|\s+)/)) {
push @{$self->{'raw_block_stack'}}, $1;
print STDERR "RAW SECOND LEVEL $1 in \@$current->{'cmdname'}\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
} elsif ($line =~ /^(\s*?)\@end\s+([a-zA-Z][\w-]*)/
and ((scalar(@{$self->{'raw_block_stack'}}) > 0
and $2 eq $self->{'raw_block_stack'}->[-1])
@@ -6775,7 +6789,8 @@ sub _process_remaining_on_line($$$$)
}
}
}
- print STDERR "CLOSED raw $current->{'cmdname'}\n" if
($self->{'DEBUG'});
+ print STDERR "CLOSED raw $current->{'cmdname'}\n"
+ if ($self->{'conf'}->{'DEBUG'});
# start a new line for the @end line (without the first spaces on
# the line that have already been put in a raw container).
# This is normally done at the beginning of a line, but not here,
@@ -6827,7 +6842,8 @@ sub _process_remaining_on_line($$$$)
$current->{'cmdname'}), $source_info);
}
- print STDERR "CLOSED conditional $end_command\n" if ($self->{'DEBUG'});
+ print STDERR "CLOSED conditional $end_command\n"
+ if ($self->{'conf'}->{'DEBUG'});
# see comment above for raw output formats
push @{$current->{'contents'}}, { 'type' => 'empty_line',
'text' => '',
@@ -6848,11 +6864,11 @@ sub _process_remaining_on_line($$$$)
push @{$current->{'contents'}},
{ 'text' => $1, 'type' => 'raw', 'parent' => $current }
if ($1 ne '');
- print STDERR "END VERB\n" if ($self->{'DEBUG'});
+ print STDERR "END VERB\n" if ($self->{'conf'}->{'DEBUG'});
} else {
push @{$current->{'contents'}},
{ 'text' => $line, 'type' => 'raw', 'parent' => $current };
- print STDERR "LINE VERB: $line" if ($self->{'DEBUG'});
+ print STDERR "LINE VERB: $line" if ($self->{'conf'}->{'DEBUG'});
return ($current, $line, $source_info, $GET_A_NEW_LINE);
# goto funexit; # used in XS code
}
@@ -6871,7 +6887,7 @@ sub _process_remaining_on_line($$$$)
# goto funexit; # used in XS code
} elsif ($line =~ /^\s*\@end\s+$current->{'cmdname'}/) {
print STDERR "CLOSED ignored raw preformated $current->{'cmdname'}\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
last;
} else {
my $raw_text = {'type' => 'raw', 'text' => $line,
@@ -6898,11 +6914,12 @@ sub _process_remaining_on_line($$$$)
while ($line eq '') {
print STDERR "EMPTY TEXT in: "
.Texinfo::Common::debug_print_element($current)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
($line, $source_info) = _next_text($self, $current);
if (!defined($line)) {
# End of the file or of a text fragment.
- print STDERR "NO MORE LINE for empty text\n" if ($self->{'DEBUG'});
+ print STDERR "NO MORE LINE for empty text\n"
+ if ($self->{'conf'}->{'DEBUG'});
return ($current, $line, $source_info, $retval);
# goto funexit; # used in XS code
}
@@ -6930,7 +6947,7 @@ sub _process_remaining_on_line($$$$)
$menu_separator = $menu_only_separator if (!$comma);
print STDERR "PARSED: "
.join(', ',map {!defined($_) ? 'UNDEF' : "'$_'"} @line_parsing)."\n"
- if ($self->{'DEBUG'} and $self->{'DEBUG'} > 3);
+ if ($self->{'conf'}->{'DEBUG'} and $self->{'conf'}->{'DEBUG'} > 3);
my $macro_call_element;
my $command;
@@ -6996,7 +7013,7 @@ sub _process_remaining_on_line($$$$)
my $remaining_line = $line;
substr($remaining_line, 0, $command_length) = '';
my $spaces_element;
- if ($self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'}
+ if ($self->{'conf'}->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'}
and $remaining_line =~ s/^(\s+)//) {
$spaces_element = {'text' => $1};
}
@@ -7004,12 +7021,12 @@ sub _process_remaining_on_line($$$$)
if ($remaining_line =~ s/^{([\w\-][^\s{\\}~`\^+"<>|@]*)}//) {
my $value = $1;
if (exists($self->{'values'}->{$value})) {
- if ($self->{'MAX_MACRO_CALL_NESTING'}
+ if ($self->{'conf'}->{'MAX_MACRO_CALL_NESTING'}
and $self->{'value_expansion_nr'}
- >= $self->{'MAX_MACRO_CALL_NESTING'}) {
+ >= $self->{'conf'}->{'MAX_MACRO_CALL_NESTING'}) {
$self->_line_warn(sprintf(__(
"value call nested too deeply (set MAX_MACRO_CALL_NESTING to override;
current value %d)"),
- $self->{'MAX_MACRO_CALL_NESTING'}),
$source_info);
+ $self->{'conf'}->{'MAX_MACRO_CALL_NESTING'}),
$source_info);
$line = $remaining_line;
return ($current, $line, $source_info, $retval);
# goto funexit; # used in XS code
@@ -7108,12 +7125,12 @@ sub _process_remaining_on_line($$$$)
print STDERR "BRACE CMD: no brace after \@$current->{'cmdname'}"
."||| "._debug_protect_eol($line)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
# Note that non ascii spaces do not count as spaces
if ($line =~ /^(\s+)/
and ($accent_commands{$current->{'cmdname'}}
- or $self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'})) {
+ or $self->{'conf'}->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'})) {
my $added_space = $1;
my $additional_newline;
if ($added_space =~ /\n/) {
@@ -7158,7 +7175,7 @@ sub _process_remaining_on_line($$$$)
= {'type' => 'internal_spaces_after_cmd_before_arg',
'text' => $spaces_after_command, 'parent' => $current};
$current->{'contents'} = [$e_spaces_after_cmd_before_arg];
- if ($self->{'DEBUG'}) {
+ if ($self->{'conf'}->{'DEBUG'}) {
my $spaces_after_command_str = $spaces_after_command;
$spaces_after_command_str =~ s/\n/\\n/g;
print STDERR "BRACE CMD before brace init spaces ".
@@ -7171,7 +7188,7 @@ sub _process_remaining_on_line($$$$)
# only ignore spaces and one newline, two newlines lead to
# an empty line before the brace or argument which is incorrect.
print STDERR "BRACE CMD before brace second newline stops spaces\n"
- if $self->{'DEBUG'};
+ if $self->{'conf'}->{'DEBUG'};
$self->_line_error(sprintf(__("\@%s expected braces"),
$current->{'cmdname'}), $source_info);
_gather_spaces_after_cmd_before_arg($self, $current);
@@ -7180,7 +7197,7 @@ sub _process_remaining_on_line($$$$)
$line =~ s/^(\s+)//;
$current->{'contents'}->[0]->{'text'} .= $added_space;
print STDERR "BRACE CMD before brace add spaces '$added_space'\n"
- if $self->{'DEBUG'};
+ if $self->{'conf'}->{'DEBUG'};
}
}
# special case for accent commands, use following character except @
@@ -7191,7 +7208,7 @@ sub _process_remaining_on_line($$$$)
and $line =~ s/^([^@])//) {
my $arg_char = $1;
print STDERR "ACCENT \@$current->{'cmdname'} following_arg: $arg_char\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if ($current->{'contents'}) {
_gather_spaces_after_cmd_before_arg($self, $current);
}
@@ -7226,12 +7243,12 @@ sub _process_remaining_on_line($$$$)
substr($line, 0, $command_length) = '';
print STDERR "COMMAND \@".Texinfo::Common::debug_command_name($command)
- ."\n" if ($self->{'DEBUG'});
+ ."\n" if ($self->{'conf'}->{'DEBUG'});
# @value not expanded (expansion is done above), and @txiinternalvalue
if ($command eq 'value' or $command eq 'txiinternalvalue') {
my $spaces_element;
- if ($self->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'}
+ if ($self->{'conf'}->{'IGNORE_SPACE_AFTER_BRACED_COMMAND_NAME'}
and $line =~ s/^(\s+)//) {
$spaces_element = {'text' => $1};
}
@@ -7393,7 +7410,7 @@ sub _process_remaining_on_line($$$$)
print STDERR "FORM FEED in "
.Texinfo::Common::debug_print_element($current, 1).": "
._debug_protect_eol($line)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if ($current->{'type'}
and $current->{'type'} eq 'paragraph') {
# A form feed stops and restart a paragraph.
@@ -7412,14 +7429,14 @@ sub _process_remaining_on_line($$$$)
$current = _merge_text($self, $current, $menu_only_separator);
# Misc text except end of line
} elsif (defined $misc_text) {
- #print STDERR "MISC TEXT: $misc_text\n" if ($self->{'DEBUG'});
+ #print STDERR "MISC TEXT: $misc_text\n" if ($self->{'conf'}->{'DEBUG'});
substr ($line, 0, length ($misc_text)) = '';
$current = _merge_text($self, $current, $misc_text);
# end of line
} else {
print STDERR "END LINE "
.Texinfo::Common::debug_print_element($current, 1)."\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
if ($line =~ s/^(\n)//) {
$current = _merge_text($self, $current, $1);
} else {
@@ -7451,13 +7468,13 @@ sub _parse_texi($$$)
#my $line;
($line, $source_info) = _next_text($self, $current);
if (!defined($line)) {
- print STDERR "NEXT_LINE NO MORE\n" if ($self->{'DEBUG'});
+ print STDERR "NEXT_LINE NO MORE\n" if ($self->{'conf'}->{'DEBUG'});
last;
}
#print STDERR
"@{$self->{'nesting_context'}->{'basic_inline_stack_on_line'}}|$line"
#if ($self->{'nesting_context'} and
$self->{'nesting_context'}->{'basic_inline_stack_on_line'});
- if ($self->{'DEBUG'}) {
+ if ($self->{'conf'}->{'DEBUG'}) {
my $additional_debug = '';
if (0) {
my $source_info_text = '';
@@ -7479,7 +7496,7 @@ sub _parse_texi($$$)
# generated within a line.
#if ($line eq '') {
# print STDERR "IGNORE EMPTY LINE\n"
- # if ($self->{'DEBUG'})
+ # if ($self->{'conf'}->{'DEBUG'})
# next;
#}
@@ -7499,7 +7516,7 @@ sub _parse_texi($$$)
# not def line
and $self->_top_context() ne 'ct_def') {
next NEXT_LINE if _check_line_directive ($self, $line, $source_info);
- print STDERR "BEGIN LINE\n" if ($self->{'DEBUG'});
+ print STDERR "BEGIN LINE\n" if ($self->{'conf'}->{'DEBUG'});
if ($current->{'contents'}
and $current->{'contents'}->[-1]->{'type'}
@@ -7520,17 +7537,17 @@ sub _parse_texi($$$)
($current, $line, $source_info, $status)
= _process_remaining_on_line($self, $current, $line, $source_info);
if ($status == $GET_A_NEW_LINE) {
- print STDERR "GET_A_NEW_LINE\n" if ($self->{'DEBUG'});
+ print STDERR "GET_A_NEW_LINE\n" if ($self->{'conf'}->{'DEBUG'});
last;
} elsif ($status == $FINISHED_TOTALLY) {
- print STDERR "FINISHED_TOTALLY\n" if ($self->{'DEBUG'});
+ print STDERR "FINISHED_TOTALLY\n" if ($self->{'conf'}->{'DEBUG'});
goto finished_totally;
}
# can happen if there is macro expansion at the end of a text fragment
# or at the end of a text fragment.
if (! defined($line)) {
print STDERR "END LINE in line loop STILL_MORE_TO_PROCESS\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
_abort_empty_line($self, $current);
$current = _end_line($self, $current, $source_info);
# It may happen that there was an @include file on the line, it
@@ -7567,7 +7584,7 @@ sub _parse_texi($$$)
# Gather text after @bye
if (defined($line) and $status == $FINISHED_TOTALLY) {
- print STDERR "GATHER AFTER BYE\n" if ($self->{'DEBUG'});
+ print STDERR "GATHER AFTER BYE\n" if ($self->{'conf'}->{'DEBUG'});
my $element_after_bye = {'type' => 'postamble_after_end', 'contents' => [],
'parent' => $current};
while (1) {
@@ -7613,9 +7630,9 @@ sub _parse_texi($$$)
# Setup identifier target elements based on 'labels_list'
Texinfo::Document::set_labels_identifiers_target($document,
- $self->{'registrar'}, $self->{'DEBUG'});
+ $self->{'registrar'}, $self->{'conf'}->{'DEBUG'});
Texinfo::Translations::complete_indices($document->{'indices'},
- $self->{'DEBUG'});
+ $self->{'conf'}->{'DEBUG'});
$document->register_tree($root);
@@ -7669,7 +7686,7 @@ sub _parse_rawline_command($$$$)
$args = [$1];
delete $self->{'macros'}->{$1};
$has_comment = 1 if (defined($3));
- print STDERR "UNMACRO $1\n" if ($self->{'DEBUG'});
+ print STDERR "UNMACRO $1\n" if ($self->{'conf'}->{'DEBUG'});
} elsif ($line !~ /\S/) {
$self->_line_error(__("\@unmacro requires a name"), $source_info);
} else {
@@ -7718,7 +7735,7 @@ sub _parse_line_command_args($$$)
# Not in XS parser. Could be added if deemded interesting, but
# arguments are already checked below.
- #if ($self->{'DEBUG'}) {
+ #if ($self->{'conf'}->{'DEBUG'}) {
# print STDERR "MISC ARGS \@$command\n";
# if ($arg->{'contents'}) {
# my $idx = 0;
@@ -7747,7 +7764,7 @@ sub _parse_line_command_args($$$)
if ($command eq 'alias') {
# REMACRO
- if ($self->{'NO_USER_COMMANDS'}) {
+ if ($self->{'conf'}->{'NO_USER_COMMANDS'}) {
# do nothing
} elsif ($line =~
s/^([[:alnum:]][[:alnum:]-]*)(\s*=\s*)([[:alnum:]][[:alnum:]-]*)$//) {
my $new_command = $1;
@@ -7779,7 +7796,7 @@ sub _parse_line_command_args($$$)
} elsif ($command eq 'definfoenclose') {
# REMACRO
# FIXME how to handle non ascii space? As space or in argument?
- if ($self->{'NO_USER_COMMANDS'}) {
+ if ($self->{'conf'}->{'NO_USER_COMMANDS'}) {
# do nothing
} elsif ($line =~
s/^([[:alnum:]][[:alnum:]\-]*)\s*,\s*([^\s,]*)\s*,\s*([^\s,]*)$//) {
$args = [$1, $2, $3 ];
@@ -7795,7 +7812,7 @@ sub _parse_line_command_args($$$)
} else {
$self->{'definfoenclose'}->{$cmd_name} = [ $begin, $end ];
print STDERR "DEFINFOENCLOSE \@$cmd_name: $begin, $end\n"
- if ($self->{'DEBUG'});
+ if ($self->{'conf'}->{'DEBUG'});
delete $self->{'macros'}->{$cmd_name};
delete $self->{'aliases'}->{$cmd_name};
# unset @def*index effect
@@ -7842,7 +7859,8 @@ sub _parse_line_command_args($$$)
}
} elsif ($command eq 'defindex' || $command eq 'defcodeindex') {
# REMACRO
- if ($self->{'NO_USER_COMMANDS'} or $self->{'NO_INDEX'}) {
+ if ($self->{'conf'}->{'NO_USER_COMMANDS'}
+ or $self->{'conf'}->{'NO_INDEX'}) {
# do nothing
} elsif ($line =~ /^([[:alnum:]][[:alnum:]\-]*)$/) {
my $name = $1;
@@ -7880,7 +7898,7 @@ sub _parse_line_command_args($$$)
} elsif ($command eq 'synindex' || $command eq 'syncodeindex') {
# REMACRO
if ($line =~
/^([[:alnum:]][[:alnum:]\-]*)\s+([[:alnum:]][[:alnum:]\-]*)$/) {
- if ($self->{'NO_INDEX'}) {
+ if ($self->{'conf'}->{'NO_INDEX'}) {
# do nothing
} else {
my $document = $self->{'document'};
@@ -7917,7 +7935,7 @@ sub _parse_line_command_args($$$)
$command, $line), $source_info);
}
} elsif ($command eq 'printindex') {
- if ($self->{'NO_INDEX'}) {
+ if ($self->{'conf'}->{'NO_INDEX'}) {
# do nothing
# REMACRO
} elsif ($line =~ /^([[:alnum:]][[:alnum:]\-]*)$/) {