[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[8029] do not allow customizing parser root context
From: |
gavinsmith0123 |
Subject: |
[8029] do not allow customizing parser root context |
Date: |
Thu, 9 Aug 2018 09:44:12 -0400 (EDT) |
Revision: 8029
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8029
Author: gavin
Date: 2018-08-09 09:44:11 -0400 (Thu, 09 Aug 2018)
Log Message:
-----------
do not allow customizing parser root context
Modified Paths:
--------------
trunk/ChangeLog
trunk/tp/Texinfo/Common.pm
trunk/tp/Texinfo/Parser.pm
trunk/tp/t/accents.t
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2018-08-09 13:03:51 UTC (rev 8028)
+++ trunk/ChangeLog 2018-08-09 13:44:11 UTC (rev 8029)
@@ -1,5 +1,15 @@
2018-08-09 Gavin Smith <address@hidden>
+ * tp/Texinfo/Common.pm (%default_parser_state_configuration):
+ Do not allow customizing the root parser context.
+ * tp/Texinfo/Parser.pm (parser, simple_parser, _parse_texi):
+ Hard-code '_root' as the root context.
+ * tp/t/accents.t (test_accent_stack, test_enable_encoding):
+ Do not set 'context' on created parser. Allow for an extra
+ level of element nesting on the tree returned from the parser.
+
+2018-08-09 Gavin Smith <address@hidden>
+
* tp/Texinfo/Parser.pm (_register_label): Remove a useless
variable assignment. Remove an unused argument. Do not return
a value.
Modified: trunk/tp/Texinfo/Common.pm
===================================================================
--- trunk/tp/Texinfo/Common.pm 2018-08-09 13:03:51 UTC (rev 8028)
+++ trunk/tp/Texinfo/Common.pm 2018-08-09 13:44:11 UTC (rev 8029)
@@ -95,10 +95,6 @@
# They are defined here, because they are used below and we
# don't want Texinfo::Common to use Texinfo::Parser.
our %default_parser_state_configuration = (
- # this is the initial context. It is put at the bottom of the
- # 'context_stack'. It is not clear if this is really useful to be
- # able to customize that value.
- 'context' => '_root',
'expanded_formats' => [],
'gettext' => sub {return $_[0];},
'pgettext' => sub {return $_[1];},
Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm 2018-08-09 13:03:51 UTC (rev 8028)
+++ trunk/tp/Texinfo/Parser.pm 2018-08-09 13:44:11 UTC (rev 8029)
@@ -699,7 +699,7 @@
$parser->{'explained_commands'}->{$explained_command} = {};
}
}
- $parser->{'context_stack'} = [ $parser->{'context'} ];
+ $parser->{'context_stack'} = [ '_root' ];
$parser->{'regions_stack'} = [];
$parser->{'macro_stack'} = [];
$parser->{'conditionals_stack'} = [];
@@ -753,7 +753,7 @@
$parser->{'explained_commands'}->{$explained_command} = {};
}
}
- $parser->{'context_stack'} = [ $parser->{'context'} ];
+ $parser->{'context_stack'} = [ '_root' ];
$parser->{'regions_stack'} = [];
$parser->{'macro_stack'} = [];
$parser->{'conditionals_stack'} = [];
@@ -5458,7 +5458,7 @@
if ($self->{'DEBUG'}) {
print STDERR "CONTEXT_STACK no empty end _parse_texi: ".join('|',
@{$self->{'context_stack'}})."\n";
}
- @{$self->{'context_stack'}} = ($self->{'context'});
+ @{$self->{'context_stack'}} = ('_root');
}
# Call 'labels_information' to initialize labels.
Modified: trunk/tp/t/accents.t
===================================================================
--- trunk/tp/t/accents.t 2018-08-09 13:03:51 UTC (rev 8028)
+++ trunk/tp/t/accents.t 2018-08-09 13:44:11 UTC (rev 8029)
@@ -23,10 +23,11 @@
my $texi = $test->[0];
my $name = $test->[1];
my $reference = $test->[2];
- my $parser = Texinfo::Parser::parser({'context' => 'preformatted'});
- my $tree = $parser->parse_texi_text($texi);
+ my $parser = Texinfo::Parser::parser();
+ my $text_root = $parser->parse_texi_text($texi);
+ my $tree = $text_root->{'contents'}->[0]->{'contents'}->[0];
my ($contents, $commands_stack) =
- Texinfo::Common::find_innermost_accent_contents($tree->{'contents'}->[0]);
+ Texinfo::Common::find_innermost_accent_contents($tree);
my $text = Texinfo::Convert::Text::convert({'contents' => $contents});
my @stack = map {$_->{'cmdname'}} @$commands_stack;
if (defined($reference)) {
@@ -71,9 +72,9 @@
my $reference_xml = $test->[3];
my $reference_xml_entity = $test->[4];
my $reference_unicode = $test->[5];
- my $parser = Texinfo::Parser::parser({'context' => 'preformatted'});
+ my $parser = Texinfo::Parser::parser();
my $text_root = $parser->parse_texi_text($texi);
- my $tree = $text_root->{'contents'}->[0];
+ my $tree = $text_root->{'contents'}->[0]->{'contents'}->[0];
my ($contents, $commands_stack) =
Texinfo::Common::find_innermost_accent_contents($tree);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [8029] do not allow customizing parser root context,
gavinsmith0123 <=