← Index
NYTProf Performance Profile   « line view »
For ../prof.pl
  Run on Thu Dec 15 15:23:56 2022
Reported on Thu Dec 15 15:27:04 2022

Filename/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Parser.pm
StatementsExecuted 2750907 statements in 1.64s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111637ms5.21sYAML::PP::Parser::::parse_tokensYAML::PP::Parser::parse_tokens
1335621203ms1.26sYAML::PP::Parser::::lex_next_tokensYAML::PP::Parser::lex_next_tokens
2076441202ms994msYAML::PP::Parser::::scalar_eventYAML::PP::Parser::scalar_event
3584013185.7ms1.12sYAML::PP::Parser::::__ANON__[:62]YAML::PP::Parser::__ANON__[:62]
66861156.0ms227msYAML::PP::Parser::::start_mappingYAML::PP::Parser::start_mapping
27952152.7ms222msYAML::PP::Parser::::remove_nodesYAML::PP::Parser::remove_nodes
66861151.1ms591msYAML::PP::Parser::::cb_insert_mapYAML::PP::Parser::cb_insert_map
120701147.9ms53.8msYAML::PP::Parser::::cb_start_plainYAML::PP::Parser::cb_start_plain
74154145.2ms393msYAML::PP::Parser::::cb_send_scalarYAML::PP::Parser::cb_send_scalar
545567144.5ms44.5msYAML::PP::Parser::::set_ruleYAML::PP::Parser::set_rule
66342136.1ms384msYAML::PP::Parser::::cb_send_mapkeyYAML::PP::Parser::cb_send_mapkey
66191127.7ms30.8msYAML::PP::Parser::::cb_mapkeyYAML::PP::Parser::cb_mapkey
6221423127.3ms27.3msYAML::PP::Parser::::eventsYAML::PP::Parser::events
6980014126.8ms26.8msYAML::PP::Parser::::event_stackYAML::PP::Parser::event_stack
548887124.4ms24.4msYAML::PP::Parser::::lexerYAML::PP::Parser::lexer
3593011117.3ms17.3msYAML::PP::Parser::::set_new_nodeYAML::PP::Parser::set_new_node
3584013113.0ms13.0msYAML::PP::Parser::::callbackYAML::PP::Parser::callback
3173615112.9ms12.9msYAML::PP::Parser::::offsetYAML::PP::Parser::offset
272547111.5ms11.5msYAML::PP::Parser::::new_nodeYAML::PP::Parser::new_node
20452111.4ms12.4msYAML::PP::Parser::::cb_take_quotedYAML::PP::Parser::cb_take_quoted
13355217.71ms7.71msYAML::PP::Parser::::ruleYAML::PP::Parser::rule
13355217.44ms7.44msYAML::PP::Parser::::tokensYAML::PP::Parser::tokens
6934216.19ms6.19msYAML::PP::Parser::::levelYAML::PP::Parser::level
15111715.95ms5.95msYAML::PP::Parser::::CORE:matchYAML::PP::Parser::CORE:match (opcode)
331115.89ms13.9msYAML::PP::Parser::::start_flow_sequenceYAML::PP::Parser::start_flow_sequence
1115.31ms8.89msYAML::PP::Parser::::BEGIN@18YAML::PP::Parser::BEGIN@18
666114.44ms39.3msYAML::PP::Parser::::cb_flow_commaYAML::PP::Parser::cb_flow_comma
331113.65ms10.6msYAML::PP::Parser::::end_flow_sequenceYAML::PP::Parser::end_flow_sequence
214113.34ms8.40msYAML::PP::Parser::::start_flow_mappingYAML::PP::Parser::start_flow_mapping
305113.28ms11.3msYAML::PP::Parser::::start_sequenceYAML::PP::Parser::start_sequence
261112.62ms7.11msYAML::PP::Parser::::end_sequenceYAML::PP::Parser::end_sequence
214112.57ms7.75msYAML::PP::Parser::::end_flow_mappingYAML::PP::Parser::end_flow_mapping
331111.99ms29.5msYAML::PP::Parser::::cb_end_flowseqYAML::PP::Parser::cb_end_flowseq
522111.81ms2.03msYAML::PP::Parser::::cb_end_outer_flowYAML::PP::Parser::cb_end_outer_flow
305111.79ms13.2msYAML::PP::Parser::::cb_seqstartYAML::PP::Parser::cb_seqstart
1111.22ms1.32msYAML::PP::Parser::::BEGIN@17YAML::PP::Parser::BEGIN@17
331111.02ms15.0msYAML::PP::Parser::::cb_start_flowseqYAML::PP::Parser::cb_start_flowseq
111967µs1.05msYAML::PP::Parser::::BEGIN@20YAML::PP::Parser::BEGIN@20
21411943µs8.82msYAML::PP::Parser::::cb_end_flowmapYAML::PP::Parser::cb_end_flowmap
21411760µs9.16msYAML::PP::Parser::::cb_start_flowmapYAML::PP::Parser::cb_start_flowmap
29911753µs902µsYAML::PP::Parser::::cb_seqitemYAML::PP::Parser::cb_seqitem
111744µs837µsYAML::PP::Parser::::BEGIN@21YAML::PP::Parser::BEGIN@21
2911211µs1.79msYAML::PP::Parser::::cb_flowkey_plainYAML::PP::Parser::cb_flowkey_plain
151185µs742µsYAML::PP::Parser::::cb_take_quoted_keyYAML::PP::Parser::cb_take_quoted_key
291156µs71µsYAML::PP::Parser::::cb_flow_colonYAML::PP::Parser::cb_flow_colon
11149µs1.04msYAML::PP::Parser::::end_documentYAML::PP::Parser::end_document
11147µs83µsYAML::PP::Loader::::BEGIN@2YAML::PP::Loader::BEGIN@2
11129µs44µsYAML::PP::Parser::::initYAML::PP::Parser::init
11124µs44µsYAML::PP::Parser::::start_documentYAML::PP::Parser::start_document
11118µs24µsYAML::PP::Parser::::start_streamYAML::PP::Parser::start_stream
11117µs5.21sYAML::PP::Parser::::parseYAML::PP::Parser::parse
11114µs29µsYAML::PP::Parser::::newYAML::PP::Parser::new
11111µs35µsYAML::PP::Parser::::cb_send_block_scalarYAML::PP::Parser::cb_send_block_scalar
11110µs15µsYAML::PP::Parser::::end_streamYAML::PP::Parser::end_stream
1118µs89µsYAML::PP::Parser::::BEGIN@19YAML::PP::Parser::BEGIN@19
1117µs12µsYAML::PP::Parser::::set_readerYAML::PP::Parser::set_reader
1116µs43µsYAML::PP::Parser::::BEGIN@11YAML::PP::Parser::BEGIN@11
1116µs43µsYAML::PP::Parser::::BEGIN@8YAML::PP::Parser::BEGIN@8
1116µs19µsYAML::PP::Parser::::BEGIN@97YAML::PP::Parser::BEGIN@97
1115µs103µsYAML::PP::Loader::::BEGIN@3YAML::PP::Loader::BEGIN@3
1115µs20µsYAML::PP::Parser::::BEGIN@22YAML::PP::Parser::BEGIN@22
4415µs5µsYAML::PP::Parser::::__ANON__YAML::PP::Parser::__ANON__ (xsub)
1114µs21µsYAML::PP::Parser::::BEGIN@9YAML::PP::Parser::BEGIN@9
1114µs48µsYAML::PP::Parser::::cb_doc_start_explicitYAML::PP::Parser::cb_doc_start_explicit
1114µs4µsYAML::PP::Parser::::set_eventsYAML::PP::Parser::set_events
1114µs4µsYAML::PP::Parser::::set_receiverYAML::PP::Parser::set_receiver
2213µs3µsYAML::PP::Parser::::set_tagmapYAML::PP::Parser::set_tagmap
2212µs2µsYAML::PP::Parser::::set_yaml_version_directiveYAML::PP::Parser::set_yaml_version_directive
1112µs2µsYAML::PP::Parser::::yaml_versionYAML::PP::Parser::yaml_version
1111µs1µsYAML::PP::Parser::::receiverYAML::PP::Parser::receiver
1111µs1µsYAML::PP::Parser::::set_event_stackYAML::PP::Parser::set_event_stack
1111µs1µsYAML::PP::Parser::::set_offsetYAML::PP::Parser::set_offset
1111µs1µsYAML::PP::Parser::::set_tokensYAML::PP::Parser::set_tokens
1111µs1µsYAML::PP::Parser::::set_yaml_versionYAML::PP::Parser::set_yaml_version
1111µs1µsYAML::PP::Parser::::yaml_version_directiveYAML::PP::Parser::yaml_version_directive
0000s0sYAML::PP::Parser::::__ANON__[:743]YAML::PP::Parser::__ANON__[:743]
0000s0sYAML::PP::Parser::::_colorize_warnYAML::PP::Parser::_colorize_warn
0000s0sYAML::PP::Parser::::_read_tagYAML::PP::Parser::_read_tag
0000s0sYAML::PP::Parser::::_remaining_tokensYAML::PP::Parser::_remaining_tokens
0000s0sYAML::PP::Parser::::alias_eventYAML::PP::Parser::alias_event
0000s0sYAML::PP::Parser::::cb_aliasYAML::PP::Parser::cb_alias
0000s0sYAML::PP::Parser::::cb_anchorYAML::PP::Parser::cb_anchor
0000s0sYAML::PP::Parser::::cb_complexcolonYAML::PP::Parser::cb_complexcolon
0000s0sYAML::PP::Parser::::cb_doc_start_implicitYAML::PP::Parser::cb_doc_start_implicit
0000s0sYAML::PP::Parser::::cb_empty_complexvalueYAML::PP::Parser::cb_empty_complexvalue
0000s0sYAML::PP::Parser::::cb_empty_flow_mapkeyYAML::PP::Parser::cb_empty_flow_mapkey
0000s0sYAML::PP::Parser::::cb_empty_flowmap_key_valueYAML::PP::Parser::cb_empty_flowmap_key_value
0000s0sYAML::PP::Parser::::cb_empty_flowmap_valueYAML::PP::Parser::cb_empty_flowmap_value
0000s0sYAML::PP::Parser::::cb_empty_flowseq_commaYAML::PP::Parser::cb_empty_flowseq_comma
0000s0sYAML::PP::Parser::::cb_empty_flowseq_endYAML::PP::Parser::cb_empty_flowseq_end
0000s0sYAML::PP::Parser::::cb_empty_mapkeyYAML::PP::Parser::cb_empty_mapkey
0000s0sYAML::PP::Parser::::cb_end_doc_start_documentYAML::PP::Parser::cb_end_doc_start_document
0000s0sYAML::PP::Parser::::cb_end_documentYAML::PP::Parser::cb_end_document
0000s0sYAML::PP::Parser::::cb_end_document_emptyYAML::PP::Parser::cb_end_document_empty
0000s0sYAML::PP::Parser::::cb_end_empty_flowmap_key_valueYAML::PP::Parser::cb_end_empty_flowmap_key_value
0000s0sYAML::PP::Parser::::cb_end_flowmap_emptyYAML::PP::Parser::cb_end_flowmap_empty
0000s0sYAML::PP::Parser::::cb_flow_questionYAML::PP::Parser::cb_flow_question
0000s0sYAML::PP::Parser::::cb_flowkey_quotedYAML::PP::Parser::cb_flowkey_quoted
0000s0sYAML::PP::Parser::::cb_insert_empty_implicit_flowseq_mapYAML::PP::Parser::cb_insert_empty_implicit_flowseq_map
0000s0sYAML::PP::Parser::::cb_insert_empty_mapYAML::PP::Parser::cb_insert_empty_map
0000s0sYAML::PP::Parser::::cb_insert_implicit_flowseq_mapYAML::PP::Parser::cb_insert_implicit_flowseq_map
0000s0sYAML::PP::Parser::::cb_insert_map_aliasYAML::PP::Parser::cb_insert_map_alias
0000s0sYAML::PP::Parser::::cb_property_eolYAML::PP::Parser::cb_property_eol
0000s0sYAML::PP::Parser::::cb_questionYAML::PP::Parser::cb_question
0000s0sYAML::PP::Parser::::cb_questionstartYAML::PP::Parser::cb_questionstart
0000s0sYAML::PP::Parser::::cb_quoted_multilineYAML::PP::Parser::cb_quoted_multiline
0000s0sYAML::PP::Parser::::cb_reserved_directiveYAML::PP::Parser::cb_reserved_directive
0000s0sYAML::PP::Parser::::cb_send_aliasYAML::PP::Parser::cb_send_alias
0000s0sYAML::PP::Parser::::cb_send_alias_from_stackYAML::PP::Parser::cb_send_alias_from_stack
0000s0sYAML::PP::Parser::::cb_send_alias_keyYAML::PP::Parser::cb_send_alias_key
0000s0sYAML::PP::Parser::::cb_send_flow_aliasYAML::PP::Parser::cb_send_flow_alias
0000s0sYAML::PP::Parser::::cb_send_plain_multiYAML::PP::Parser::cb_send_plain_multi
0000s0sYAML::PP::Parser::::cb_set_yaml_version_directiveYAML::PP::Parser::cb_set_yaml_version_directive
0000s0sYAML::PP::Parser::::cb_tagYAML::PP::Parser::cb_tag
0000s0sYAML::PP::Parser::::cb_tag_directiveYAML::PP::Parser::cb_tag_directive
0000s0sYAML::PP::Parser::::cloneYAML::PP::Parser::clone
0000s0sYAML::PP::Parser::::debug_eventYAML::PP::Parser::debug_event
0000s0sYAML::PP::Parser::::debug_eventsYAML::PP::Parser::debug_events
0000s0sYAML::PP::Parser::::debug_next_lineYAML::PP::Parser::debug_next_line
0000s0sYAML::PP::Parser::::debug_offsetYAML::PP::Parser::debug_offset
0000s0sYAML::PP::Parser::::debug_rulesYAML::PP::Parser::debug_rules
0000s0sYAML::PP::Parser::::debug_tokensYAML::PP::Parser::debug_tokens
0000s0sYAML::PP::Parser::::debug_yamlYAML::PP::Parser::debug_yaml
1110s0sYAML::PP::Parser::::default_yaml_versionYAML::PP::Parser::default_yaml_version
0000s0sYAML::PP::Parser::::event_to_test_suiteYAML::PP::Parser::event_to_test_suite
0000s0sYAML::PP::Parser::::exceptionYAML::PP::Parser::exception
0000s0sYAML::PP::Parser::::expectedYAML::PP::Parser::expected
0000s0sYAML::PP::Parser::::fetch_inline_propertiesYAML::PP::Parser::fetch_inline_properties
0000s0sYAML::PP::Parser::::gotYAML::PP::Parser::got
0000s0sYAML::PP::Parser::::highlight_yamlYAML::PP::Parser::highlight_yaml
0000s0sYAML::PP::Parser::::infoYAML::PP::Parser::info
0000s0sYAML::PP::Parser::::node_propertiesYAML::PP::Parser::node_properties
0000s0sYAML::PP::Parser::::noteYAML::PP::Parser::note
0000s0sYAML::PP::Parser::::parse_fileYAML::PP::Parser::parse_file
0000s0sYAML::PP::Parser::::parse_stringYAML::PP::Parser::parse_string
0000s0sYAML::PP::Parser::::readerYAML::PP::Parser::reader
0000s0sYAML::PP::Parser::::set_callbackYAML::PP::Parser::set_callback
0000s0sYAML::PP::Parser::::tagmapYAML::PP::Parser::tagmap
0000s0sYAML::PP::Parser::::yaml_to_tokensYAML::PP::Parser::yaml_to_tokens
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# ABSTRACT: YAML Parser
2268µs2119µs
# spent 83µs (47+36) within YAML::PP::Loader::BEGIN@2 which was called: # once (47µs+36µs) by YAML::PP::Loader::BEGIN@8 at line 2
use strict;
# spent 83µs making 1 call to YAML::PP::Loader::BEGIN@2 # spent 36µs making 1 call to strict::import
3249µs2201µs
# spent 103µs (5+98) within YAML::PP::Loader::BEGIN@3 which was called: # once (5µs+98µs) by YAML::PP::Loader::BEGIN@8 at line 3
use warnings;
# spent 103µs making 1 call to YAML::PP::Loader::BEGIN@3 # spent 98µs making 1 call to warnings::import
4package YAML::PP::Parser;
5
613µsour $VERSION = '0.035'; # VERSION
7
8228µs280µs
# spent 43µs (6+37) within YAML::PP::Parser::BEGIN@8 which was called: # once (6µs+37µs) by YAML::PP::Loader::BEGIN@8 at line 8
use constant TRACE => $ENV{YAML_PP_TRACE} ? 1 : 0;
# spent 43µs making 1 call to YAML::PP::Parser::BEGIN@8 # spent 37µs making 1 call to constant::import
9225µs238µs
# spent 21µs (4+17) within YAML::PP::Parser::BEGIN@9 which was called: # once (4µs+17µs) by YAML::PP::Loader::BEGIN@8 at line 9
use constant DEBUG => ($ENV{YAML_PP_DEBUG} || $ENV{YAML_PP_TRACE}) ? 1 : 0;
# spent 21µs making 1 call to YAML::PP::Parser::BEGIN@9 # spent 17µs making 1 call to constant::import
10
1111µs
# spent 43µs (6+37) within YAML::PP::Parser::BEGIN@11 which was called: # once (6µs+37µs) by YAML::PP::Loader::BEGIN@8 at line 16
use YAML::PP::Common qw/
12 YAML_PLAIN_SCALAR_STYLE YAML_SINGLE_QUOTED_SCALAR_STYLE
13 YAML_DOUBLE_QUOTED_SCALAR_STYLE
14 YAML_LITERAL_SCALAR_STYLE YAML_FOLDED_SCALAR_STYLE
15 YAML_FLOW_SEQUENCE_STYLE YAML_FLOW_MAPPING_STYLE
16115µs280µs/;
# spent 43µs making 1 call to YAML::PP::Parser::BEGIN@11 # spent 37µs making 1 call to Exporter::import
172696µs21.32ms
# spent 1.32ms (1.22+97µs) within YAML::PP::Parser::BEGIN@17 which was called: # once (1.22ms+97µs) by YAML::PP::Loader::BEGIN@8 at line 17
use YAML::PP::Render;
# spent 1.32ms making 1 call to YAML::PP::Parser::BEGIN@17 # spent 2µs making 1 call to YAML::PP::Parser::__ANON__
182692µs28.90ms
# spent 8.89ms (5.31+3.59) within YAML::PP::Parser::BEGIN@18 which was called: # once (5.31ms+3.59ms) by YAML::PP::Loader::BEGIN@8 at line 18
use YAML::PP::Lexer;
# spent 8.89ms making 1 call to YAML::PP::Parser::BEGIN@18 # spent 1µs making 1 call to YAML::PP::Parser::__ANON__
19223µs2170µs
# spent 89µs (8+81) within YAML::PP::Parser::BEGIN@19 which was called: # once (8µs+81µs) by YAML::PP::Loader::BEGIN@8 at line 19
use YAML::PP::Grammar qw/ $GRAMMAR /;
# spent 89µs making 1 call to YAML::PP::Parser::BEGIN@19 # spent 81µs making 1 call to Exporter::import
202585µs21.05ms
# spent 1.05ms (967µs+85µs) within YAML::PP::Parser::BEGIN@20 which was called: # once (967µs+85µs) by YAML::PP::Loader::BEGIN@8 at line 20
use YAML::PP::Exception;
# spent 1.05ms making 1 call to YAML::PP::Parser::BEGIN@20 # spent 1µs making 1 call to YAML::PP::Parser::__ANON__
212283µs2838µs
# spent 837µs (744+93) within YAML::PP::Parser::BEGIN@21 which was called: # once (744µs+93µs) by YAML::PP::Loader::BEGIN@8 at line 21
use YAML::PP::Reader;
# spent 837µs making 1 call to YAML::PP::Parser::BEGIN@21 # spent 1µs making 1 call to YAML::PP::Parser::__ANON__
222400µs235µs
# spent 20µs (5+15) within YAML::PP::Parser::BEGIN@22 which was called: # once (5µs+15µs) by YAML::PP::Loader::BEGIN@8 at line 22
use Carp qw/ croak /;
# spent 20µs making 1 call to YAML::PP::Parser::BEGIN@22 # spent 15µs making 1 call to Exporter::import
23
24
25
# spent 29µs (14+15) within YAML::PP::Parser::new which was called: # once (14µs+15µs) by YAML::PP::Loader::new at line 34 of YAML/PP/Loader.pm
sub new {
2611µs my ($class, %args) = @_;
2714µs13µs my $reader = delete $args{reader} || YAML::PP::Reader->new;
# spent 3µs making 1 call to YAML::PP::Reader::new
2810s my $default_yaml_version = delete $args{default_yaml_version};
2914µs112µs my $self = bless {
# spent 12µs making 1 call to YAML::PP::Lexer::new
30 default_yaml_version => $default_yaml_version || '1.2',
31 lexer => YAML::PP::Lexer->new(
32 reader => $reader,
33 ),
34 }, $class;
3510s my $receiver = delete $args{receiver};
3611µs if ($receiver) {
37 $self->set_receiver($receiver);
38 }
3918µs return $self;
40}
41
42sub clone {
43 my ($self) = @_;
44 my $clone = {
45 default_yaml_version => $self->default_yaml_version,
46 lexer => YAML::PP::Lexer->new(),
47 };
48 return bless $clone, ref $self;
49}
50
5113µs
# spent 1µs within YAML::PP::Parser::receiver which was called: # once (1µs+0s) by YAML::PP::Loader::new at line 39 of YAML/PP/Loader.pm
sub receiver { return $_[0]->{receiver} }
52
# spent 4µs within YAML::PP::Parser::set_receiver which was called: # once (4µs+0s) by YAML::PP::Loader::new at line 39 of YAML/PP/Loader.pm
sub set_receiver {
5310s my ($self, $receiver) = @_;
5410s my $callback;
5510s if (ref $receiver eq 'CODE') {
56 $callback = $receiver;
57 }
58 else {
59
# spent 1.12s (85.7ms+1.03) within YAML::PP::Parser::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Parser.pm:62] which was called 35840 times, avg 31µs/call: # 20764 times (47.8ms+709ms) by YAML::PP::Parser::scalar_event at line 723, avg 36µs/call # 6730 times (16.2ms+148ms) by YAML::PP::Parser::remove_nodes at line 475, avg 24µs/call # 6686 times (16.9ms+143ms) by YAML::PP::Parser::start_mapping at line 626, avg 24µs/call # 331 times (949µs+6.22ms) by YAML::PP::Parser::start_flow_sequence at line 551, avg 22µs/call # 331 times (900µs+5.15ms) by YAML::PP::Parser::end_flow_sequence at line 584, avg 18µs/call # 305 times (1.04ms+6.47ms) by YAML::PP::Parser::start_sequence at line 527, avg 25µs/call # 261 times (807µs+3.39ms) by YAML::PP::Parser::end_sequence at line 453, avg 16µs/call # 214 times (672µs+3.96ms) by YAML::PP::Parser::end_flow_mapping at line 599, avg 22µs/call # 214 times (475µs+3.98ms) by YAML::PP::Parser::start_flow_mapping at line 575, avg 21µs/call # once (5µs+19µs) by YAML::PP::Parser::end_document at line 649 # once (7µs+9µs) by YAML::PP::Parser::start_document at line 501 # once (3µs+1000ns) by YAML::PP::Parser::end_stream at line 667 # once (3µs+1000ns) by YAML::PP::Parser::start_stream at line 486
$callback = sub {
60358407.78ms my ($self, $event, $info) = @_;
613584072.9ms358401.03s return $receiver->$event($info);
# spent 709ms making 20764 calls to YAML::PP::Constructor::scalar_event, avg 34µs/call # spent 152ms making 6900 calls to YAML::PP::Constructor::mapping_end_event, avg 22µs/call # spent 147ms making 6900 calls to YAML::PP::Constructor::mapping_start_event, avg 21µs/call # spent 12.7ms making 636 calls to YAML::PP::Constructor::sequence_start_event, avg 20µs/call # spent 9.04ms making 636 calls to YAML::PP::Constructor::sequence_end_event, avg 14µs/call # spent 19µs making 1 call to YAML::PP::Constructor::document_end_event # spent 9µs making 1 call to YAML::PP::Constructor::document_start_event # spent 1µs making 1 call to YAML::PP::Constructor::stream_end_event # spent 1µs making 1 call to YAML::PP::Constructor::stream_start_event
6213µs };
63 }
6411µs $self->{callback} = $callback;
6512µs $self->{receiver} = $receiver;
66}
67sub reader { return $_[0]->lexer->{reader} }
68
# spent 12µs (7+5) within YAML::PP::Parser::set_reader which was called: # once (7µs+5µs) by YAML::PP::Loader::load_file at line 84 of YAML/PP/Loader.pm
sub set_reader {
6911µs my ($self, $reader) = @_;
7015µs25µs $self->lexer->set_reader($reader);
# spent 4µs making 1 call to YAML::PP::Lexer::set_reader # spent 1µs making 1 call to YAML::PP::Parser::lexer
71}
725488861.5ms
# spent 24.4ms within YAML::PP::Parser::lexer which was called 54888 times, avg 445ns/call: # 20764 times (11.6ms+0s) by YAML::PP::Parser::parse_tokens at line 379, avg 557ns/call # 20764 times (7.13ms+0s) by YAML::PP::Parser::parse_tokens at line 381, avg 344ns/call # 13356 times (5.71ms+0s) by YAML::PP::Parser::lex_next_tokens at line 179, avg 427ns/call # once (1µs+0s) by YAML::PP::Parser::set_reader at line 70 # once (1µs+0s) by YAML::PP::Parser::init at line 115 # once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 344 # once (0s+0s) by YAML::PP::Parser::parse at line 151
sub lexer { return $_[0]->{lexer} }
733584037.9ms
# spent 13.0ms within YAML::PP::Parser::callback which was called 35840 times, avg 363ns/call: # 20764 times (7.17ms+0s) by YAML::PP::Parser::scalar_event at line 723, avg 345ns/call # 6730 times (2.78ms+0s) by YAML::PP::Parser::remove_nodes at line 475, avg 413ns/call # 6686 times (2.50ms+0s) by YAML::PP::Parser::start_mapping at line 626, avg 374ns/call # 331 times (107µs+0s) by YAML::PP::Parser::end_flow_sequence at line 584, avg 323ns/call # 331 times (95µs+0s) by YAML::PP::Parser::start_flow_sequence at line 551, avg 287ns/call # 305 times (98µs+0s) by YAML::PP::Parser::start_sequence at line 527, avg 321ns/call # 261 times (85µs+0s) by YAML::PP::Parser::end_sequence at line 453, avg 326ns/call # 214 times (113µs+0s) by YAML::PP::Parser::start_flow_mapping at line 575, avg 528ns/call # 214 times (64µs+0s) by YAML::PP::Parser::end_flow_mapping at line 599, avg 299ns/call # once (1µs+0s) by YAML::PP::Parser::start_document at line 501 # once (0s+0s) by YAML::PP::Parser::end_document at line 649 # once (0s+0s) by YAML::PP::Parser::start_stream at line 486 # once (0s+0s) by YAML::PP::Parser::end_stream at line 667
sub callback { return $_[0]->{callback} }
74sub set_callback { $_[0]->{callback} = $_[1] }
75693411.3ms
# spent 6.19ms within YAML::PP::Parser::level which was called 6934 times, avg 893ns/call: # 6933 times (6.19ms+0s) by YAML::PP::Parser::parse_tokens at line 431, avg 892ns/call # once (3µs+0s) by YAML::PP::Parser::parse_tokens at line 351
sub level { return $#{ $_[0]->{offset} } }
763173636.2ms
# spent 12.9ms within YAML::PP::Parser::offset which was called 31736 times, avg 406ns/call: # 13356 times (5.38ms+0s) by YAML::PP::Parser::lex_next_tokens at line 177, avg 403ns/call # 7238 times (2.49ms+0s) by YAML::PP::Parser::lex_next_tokens at line 239, avg 344ns/call # 6686 times (3.20ms+0s) by YAML::PP::Parser::start_mapping at line 617, avg 478ns/call # 2795 times (1.15ms+0s) by YAML::PP::Parser::remove_nodes at line 459, avg 411ns/call # 331 times (142µs+0s) by YAML::PP::Parser::start_flow_sequence at line 532, avg 429ns/call # 331 times (137µs+0s) by YAML::PP::Parser::end_flow_sequence at line 582, avg 414ns/call # 305 times (124µs+0s) by YAML::PP::Parser::start_sequence at line 513, avg 407ns/call # 261 times (93µs+0s) by YAML::PP::Parser::end_sequence at line 451, avg 356ns/call # 214 times (83µs+0s) by YAML::PP::Parser::start_flow_mapping at line 556, avg 388ns/call # 214 times (77µs+0s) by YAML::PP::Parser::end_flow_mapping at line 597, avg 360ns/call # once (1µs+0s) by YAML::PP::Parser::end_stream at line 666 # once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 342 # once (1µs+0s) by YAML::PP::Parser::start_stream at line 485 # once (0s+0s) by YAML::PP::Parser::start_document at line 494 # once (0s+0s) by YAML::PP::Parser::end_document at line 648
sub offset { return $_[0]->{offset} }
7712µs
# spent 1µs within YAML::PP::Parser::set_offset which was called: # once (1µs+0s) by YAML::PP::Parser::init at line 104
sub set_offset { $_[0]->{offset} = $_[1] }
786221468.4ms
# spent 27.3ms within YAML::PP::Parser::events which was called 62214 times, avg 438ns/call: # 20764 times (10.3ms+0s) by YAML::PP::Parser::scalar_event at line 715, avg 496ns/call # 13356 times (4.89ms+0s) by YAML::PP::Parser::lex_next_tokens at line 178, avg 366ns/call # 7415 times (3.07ms+0s) by YAML::PP::Parser::cb_send_scalar at line 1057, avg 413ns/call # 7238 times (3.17ms+0s) by YAML::PP::Parser::lex_next_tokens at line 231, avg 438ns/call # 6686 times (3.10ms+0s) by YAML::PP::Parser::start_mapping at line 618, avg 464ns/call # 2795 times (1.07ms+0s) by YAML::PP::Parser::remove_nodes at line 460, avg 381ns/call # 666 times (350µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1238, avg 526ns/call # 522 times (213µs+0s) by YAML::PP::Parser::cb_end_outer_flow at line 610, avg 408ns/call # 331 times (143µs+0s) by YAML::PP::Parser::start_flow_sequence at line 543, avg 432ns/call # 331 times (139µs+0s) by YAML::PP::Parser::end_flow_sequence at line 580, avg 420ns/call # 331 times (122µs+0s) by YAML::PP::Parser::start_flow_sequence at line 534, avg 369ns/call # 305 times (118µs+0s) by YAML::PP::Parser::start_sequence at line 514, avg 387ns/call # 305 times (113µs+0s) by YAML::PP::Parser::lex_next_tokens at line 216, avg 370ns/call # 261 times (117µs+0s) by YAML::PP::Parser::lex_next_tokens at line 236, avg 448ns/call # 261 times (109µs+0s) by YAML::PP::Parser::end_sequence at line 449, avg 418ns/call # 214 times (94µs+0s) by YAML::PP::Parser::end_flow_mapping at line 595, avg 439ns/call # 214 times (77µs+0s) by YAML::PP::Parser::start_flow_mapping at line 567, avg 360ns/call # 214 times (74µs+0s) by YAML::PP::Parser::start_flow_mapping at line 558, avg 346ns/call # once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 341 # once (1µs+0s) by YAML::PP::Parser::start_stream at line 484 # once (0s+0s) by YAML::PP::Parser::start_document at line 493 # once (0s+0s) by YAML::PP::Parser::end_document at line 632 # once (0s+0s) by YAML::PP::Parser::end_stream at line 664
sub events { return $_[0]->{events} }
7913µs
# spent 4µs within YAML::PP::Parser::set_events which was called: # once (4µs+0s) by YAML::PP::Parser::init at line 105
sub set_events { $_[0]->{events} = $_[1] }
802725430.5ms
# spent 11.5ms within YAML::PP::Parser::new_node which was called 27254 times, avg 422ns/call: # 13354 times (5.31ms+0s) by YAML::PP::Parser::parse_tokens at line 430, avg 398ns/call # 7238 times (3.28ms+0s) by YAML::PP::Parser::lex_next_tokens at line 209, avg 453ns/call # 6115 times (2.70ms+0s) by YAML::PP::Parser::lex_next_tokens at line 204, avg 442ns/call # 331 times (115µs+0s) by YAML::PP::Parser::start_flow_sequence at line 535, avg 347ns/call # 214 times (82µs+0s) by YAML::PP::Parser::start_flow_mapping at line 559, avg 383ns/call # once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 350 # once (0s+0s) by YAML::PP::Parser::end_document at line 636
sub new_node { return $_[0]->{new_node} }
813593041.3ms
# spent 17.3ms within YAML::PP::Parser::set_new_node which was called 35930 times, avg 482ns/call: # 20764 times (11.7ms+0s) by YAML::PP::Parser::scalar_event at line 724, avg 563ns/call # 6686 times (2.39ms+0s) by YAML::PP::Parser::cb_insert_map at line 1367, avg 358ns/call # 6634 times (2.35ms+0s) by YAML::PP::Parser::cb_send_mapkey at line 1049, avg 354ns/call # 666 times (279µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1239, avg 419ns/call # 331 times (158µs+0s) by YAML::PP::Parser::cb_end_flowseq at line 1233, avg 477ns/call # 305 times (169µs+0s) by YAML::PP::Parser::cb_seqstart at line 1141, avg 554ns/call # 299 times (149µs+0s) by YAML::PP::Parser::cb_seqitem at line 1146, avg 498ns/call # 214 times (122µs+0s) by YAML::PP::Parser::cb_end_flowmap at line 1268, avg 570ns/call # 29 times (15µs+0s) by YAML::PP::Parser::cb_flow_colon at line 1248, avg 517ns/call # once (1µs+0s) by YAML::PP::Parser::init at line 106 # once (0s+0s) by YAML::PP::Parser::start_document at line 508
sub set_new_node { $_[0]->{new_node} = $_[1] }
82sub tagmap { return $_[0]->{tagmap} }
8327µs
# spent 3µs within YAML::PP::Parser::set_tagmap which was called 2 times, avg 2µs/call: # once (2µs+0s) by YAML::PP::Parser::end_document at line 653 # once (1µs+0s) by YAML::PP::Parser::init at line 107
sub set_tagmap { $_[0]->{tagmap} = $_[1] }
841335516.0ms
# spent 7.44ms within YAML::PP::Parser::tokens which was called 13355 times, avg 557ns/call: # 13354 times (7.44ms+0s) by YAML::PP::Parser::lex_next_tokens at line 187, avg 557ns/call # once (0s+0s) by YAML::PP::Parser::parse_tokens at line 343
sub tokens { return $_[0]->{tokens} }
8512µs
# spent 1µs within YAML::PP::Parser::set_tokens which was called: # once (1µs+0s) by YAML::PP::Parser::init at line 110
sub set_tokens { $_[0]->{tokens} = $_[1] }
8669800117ms
# spent 26.8ms within YAML::PP::Parser::event_stack which was called 69800 times, avg 383ns/call: # 20764 times (6.54ms+0s) by YAML::PP::Parser::scalar_event at line 716, avg 315ns/call # 12070 times (5.88ms+0s) by YAML::PP::Parser::cb_start_plain at line 1207, avg 487ns/call # 7415 times (2.87ms+0s) by YAML::PP::Parser::cb_send_scalar at line 1054, avg 387ns/call # 6686 times (2.62ms+0s) by YAML::PP::Parser::cb_insert_map at line 1362, avg 392ns/call # 6686 times (2.03ms+0s) by YAML::PP::Parser::start_mapping at line 620, avg 304ns/call # 6634 times (2.39ms+0s) by YAML::PP::Parser::cb_send_mapkey at line 1047, avg 360ns/call # 6619 times (3.13ms+0s) by YAML::PP::Parser::cb_mapkey at line 1033, avg 473ns/call # 2045 times (1.00ms+0s) by YAML::PP::Parser::cb_take_quoted at line 1152, avg 491ns/call # 331 times (91µs+0s) by YAML::PP::Parser::start_flow_sequence at line 546, avg 275ns/call # 305 times (124µs+0s) by YAML::PP::Parser::start_sequence at line 521, avg 407ns/call # 214 times (73µs+0s) by YAML::PP::Parser::start_flow_mapping at line 570, avg 341ns/call # 29 times (9µs+0s) by YAML::PP::Parser::cb_flowkey_plain at line 1280, avg 310ns/call # once (0s+0s) by YAML::PP::Parser::cb_send_block_scalar at line 1420 # once (0s+0s) by YAML::PP::Parser::cb_send_block_scalar at line 1409
sub event_stack { return $_[0]->{event_stack} }
8712µs
# spent 1µs within YAML::PP::Parser::set_event_stack which was called: # once (1µs+0s) by YAML::PP::Parser::init at line 112
sub set_event_stack { $_[0]->{event_stack} = $_[1] }
8811µs
# spent 0s within YAML::PP::Parser::default_yaml_version which was called: # once (0s+0s) by YAML::PP::Parser::init at line 113
sub default_yaml_version { return $_[0]->{default_yaml_version} }
8912µs
# spent 2µs within YAML::PP::Parser::yaml_version which was called: # once (2µs+0s) by YAML::PP::Parser::end_document at line 653
sub yaml_version { return $_[0]->{yaml_version} }
9012µs
# spent 1µs within YAML::PP::Parser::set_yaml_version which was called: # once (1µs+0s) by YAML::PP::Parser::init at line 113
sub set_yaml_version { $_[0]->{yaml_version} = $_[1] }
9112µs
# spent 1µs within YAML::PP::Parser::yaml_version_directive which was called: # once (1µs+0s) by YAML::PP::Parser::start_document at line 495
sub yaml_version_directive { return $_[0]->{yaml_version_directive} }
9224µs
# spent 2µs within YAML::PP::Parser::set_yaml_version_directive which was called 2 times, avg 1µs/call: # once (1µs+0s) by YAML::PP::Parser::start_document at line 506 # once (1µs+0s) by YAML::PP::Parser::init at line 114
sub set_yaml_version_directive { $_[0]->{yaml_version_directive} = $_[1] }
93
941335516.6ms
# spent 7.71ms within YAML::PP::Parser::rule which was called 13355 times, avg 577ns/call: # 13354 times (7.71ms+0s) by YAML::PP::Parser::parse_tokens at line 437, avg 577ns/call # once (2µs+0s) by YAML::PP::Parser::parse_tokens at line 358
sub rule { return $_[0]->{rule} }
95
# spent 44.5ms within YAML::PP::Parser::set_rule which was called 54556 times, avg 816ns/call: # 46373 times (38.2ms+0s) by YAML::PP::Parser::parse_tokens at line 408, avg 823ns/call # 6933 times (5.38ms+0s) by YAML::PP::Parser::parse_tokens at line 434, avg 776ns/call # 1246 times (978µs+0s) by YAML::PP::Parser::parse_tokens at line 415, avg 785ns/call # once (2µs+0s) by YAML::PP::Parser::init at line 111 # once (1µs+0s) by YAML::PP::Parser::start_document at line 507 # once (0s+0s) by YAML::PP::Parser::end_document at line 659 # once (0s+0s) by YAML::PP::Parser::parse at line 154
sub set_rule {
965455612.0ms my ($self, $name) = @_;
9724.86ms232µs
# spent 19µs (6+13) within YAML::PP::Parser::BEGIN@97 which was called: # once (6µs+13µs) by YAML::PP::Loader::BEGIN@8 at line 97
no warnings 'uninitialized';
# spent 19µs making 1 call to YAML::PP::Parser::BEGIN@97 # spent 13µs making 1 call to warnings::unimport
98 DEBUG and $self->info("set_rule($name)");
995455668.2ms $self->{rule} = $name;
100}
101
102
# spent 44µs (29+15) within YAML::PP::Parser::init which was called: # once (29µs+15µs) by YAML::PP::Parser::parse at line 150
sub init {
10311µs my ($self) = @_;
10412µs11µs $self->set_offset([]);
# spent 1µs making 1 call to YAML::PP::Parser::set_offset
10513µs14µs $self->set_events([]);
# spent 4µs making 1 call to YAML::PP::Parser::set_events
10611µs11µs $self->set_new_node(0);
# spent 1µs making 1 call to YAML::PP::Parser::set_new_node
10711µs11µs $self->set_tagmap({
# spent 1µs making 1 call to YAML::PP::Parser::set_tagmap
108 '!!' => "tag:yaml.org,2002:",
109 });
11011µs11µs $self->set_tokens([]);
# spent 1µs making 1 call to YAML::PP::Parser::set_tokens
11111µs12µs $self->set_rule(undef);
# spent 2µs making 1 call to YAML::PP::Parser::set_rule
11212µs11µs $self->set_event_stack([]);
# spent 1µs making 1 call to YAML::PP::Parser::set_event_stack
11311µs21µs $self->set_yaml_version($self->default_yaml_version);
# spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version # spent 0s making 1 call to YAML::PP::Parser::default_yaml_version
11410s11µs $self->set_yaml_version_directive(undef);
# spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version_directive
11513µs22µs $self->lexer->init;
# spent 1µs making 1 call to YAML::PP::Lexer::init # spent 1µs making 1 call to YAML::PP::Parser::lexer
116}
117
118sub parse_string {
119 my ($self, $yaml) = @_;
120 $self->set_reader(YAML::PP::Reader->new( input => $yaml ));
121 $self->parse();
122}
123
124sub parse_file {
125 my ($self, $file) = @_;
126 $self->set_reader(YAML::PP::Reader::File->new( input => $file ));
127 $self->parse();
128}
129
13018µsmy %nodetypes = (
131 MAPVALUE => 'NODETYPE_COMPLEX',
132 MAP => 'NODETYPE_MAP',
133# IMAP => 'NODETYPE_SEQ',
134 SEQ => 'NODETYPE_SEQ',
135 SEQ0 => 'NODETYPE_SEQ',
136 FLOWMAP => 'NODETYPE_FLOWMAP',
137 FLOWMAPVALUE => 'NODETYPE_FLOWMAPVALUE',
138 FLOWSEQ => 'NODETYPE_FLOWSEQ',
139 FLOWSEQ_NEXT => 'FLOWSEQ_NEXT',
140 DOC => 'FULLNODE',
141 DOC_END => 'DOCUMENT_END',
142 STR => 'STREAM',
143 END_FLOW => 'END_FLOW',
144);
145
146
# spent 5.21s (17µs+5.21) within YAML::PP::Parser::parse which was called: # once (17µs+5.21s) by YAML::PP::Loader::load at line 94 of YAML/PP/Loader.pm
sub parse {
14710s my ($self) = @_;
148 TRACE and warn "=== parse()\n";
149 TRACE and $self->debug_yaml;
15011µs144µs $self->init;
# spent 44µs making 1 call to YAML::PP::Parser::init
15111µs21µs $self->lexer->init;
# spent 1µs making 1 call to YAML::PP::Lexer::init # spent 0s making 1 call to YAML::PP::Parser::lexer
15211µs eval {
15311µs124µs $self->start_stream;
# spent 24µs making 1 call to YAML::PP::Parser::start_stream
15410s10s $self->set_rule( 'STREAM' );
# spent 0s making 1 call to YAML::PP::Parser::set_rule
155
15611µs15.21s $self->parse_tokens();
# spent 5.21s making 1 call to YAML::PP::Parser::parse_tokens
157
15813µs115µs $self->end_stream;
# spent 15µs making 1 call to YAML::PP::Parser::end_stream
159 };
16011µs if (my $error = $@) {
161 if (ref $error) {
162 croak "$error\n ";
163 }
164 croak $error;
165 }
166
167 DEBUG and $self->highlight_yaml;
16813µs TRACE and $self->debug_tokens;
169}
170
171
# spent 1.26s (203ms+1.05) within YAML::PP::Parser::lex_next_tokens which was called 13356 times, avg 94µs/call: # 13355 times (203ms+1.04s) by YAML::PP::Parser::parse_tokens at line 423, avg 93µs/call # once (12µs+13.9ms) by YAML::PP::Parser::parse_tokens at line 346
sub lex_next_tokens {
172133563.11ms my ($self) = @_;
173
174 DEBUG and $self->info("----------------> lex_next_tokens");
175 TRACE and $self->debug_events;
176
177133569.08ms133565.38ms my $indent = $self->offset->[-1];
# spent 5.38ms making 13356 calls to YAML::PP::Parser::offset, avg 403ns/call
178133567.16ms133564.89ms my $event_types = $self->events;
# spent 4.89ms making 13356 calls to YAML::PP::Parser::events, avg 366ns/call
1791335617.8ms26712791ms my $next_tokens = $self->lexer->fetch_next_tokens($indent);
# spent 785ms making 13356 calls to YAML::PP::Lexer::fetch_next_tokens, avg 59µs/call # spent 5.71ms making 13356 calls to YAML::PP::Parser::lexer, avg 427ns/call
180133561.71ms return unless @$next_tokens;
181
182133552.46ms my $next = $next_tokens->[0];
183
184133554.21ms return 1 if ($next->{name} ne 'SPACE');
1851335420.6ms133544.50ms my $flow = $event_types->[-1] =~ m/^FLOW/;
# spent 4.50ms making 13354 calls to YAML::PP::Parser::CORE:match, avg 337ns/call
186133545.21ms my $space = length $next->{value};
187133549.68ms133547.44ms my $tokens = $self->tokens;
# spent 7.44ms making 13354 calls to YAML::PP::Parser::tokens, avg 557ns/call
188
189133544.11ms if (not $space) {
190 shift @$next_tokens;
191 }
192 else {
193133493.70ms push @$tokens, shift @$next_tokens;
194 }
195133541.40ms if ($flow) {
196 if ($space >= $indent) {
197 return 1;
198 }
199 $self->exception("Bad indendation in " . $self->events->[-1]);
200 }
201133542.43ms $next = $next_tokens->[0];
202133543.18ms if ($space > $indent ) {
20361161.20ms return 1 if $indent < 0;
20461154.72ms61152.70ms unless ($self->new_node) {
# spent 2.70ms making 6115 calls to YAML::PP::Parser::new_node, avg 442ns/call
205 $self->exception("Bad indendation in " . $self->events->[-1]);
206 }
20761159.42ms return 1;
208 }
20972386.57ms72383.28ms if ($self->new_node) {
# spent 3.28ms making 7238 calls to YAML::PP::Parser::new_node, avg 453ns/call
210305258µs if ($space < $indent) {
211 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
212 $self->remove_nodes($space);
213 }
214 else {
215 # unindented sequence starts
216305316µs305113µs my $exp = $self->events->[-1];
# spent 113µs making 305 calls to YAML::PP::Parser::events, avg 370ns/call
217305168µs my $seq_start = $next->{name} eq 'DASH';
218305196µs if ( $seq_start and ($exp eq 'MAPVALUE' or $exp eq 'MAP')) {
219 }
220 else {
221 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
222 }
223 }
224 }
225 else {
22669333.91ms2794221ms if ($space < $indent) {
# spent 221ms making 2794 calls to YAML::PP::Parser::remove_nodes, avg 79µs/call
227 $self->remove_nodes($space);
228 }
229 }
230
23172385.91ms72383.17ms my $exp = $self->events->[-1];
# spent 3.17ms making 7238 calls to YAML::PP::Parser::events, avg 438ns/call
232
23372382.61ms if ($exp eq 'SEQ0' and $next->{name} ne 'DASH') {
234 TRACE and $self->info("In unindented sequence");
235261265µs2617.11ms $self->end_sequence;
# spent 7.11ms making 261 calls to YAML::PP::Parser::end_sequence, avg 27µs/call
236261247µs261117µs $exp = $self->events->[-1];
# spent 117µs making 261 calls to YAML::PP::Parser::events, avg 448ns/call
237 }
238
23972385.05ms72382.49ms if ($self->offset->[-1] != $space) {
# spent 2.49ms making 7238 calls to YAML::PP::Parser::offset, avg 344ns/call
240 $self->exception("Expected " . $self->events->[-1]);
241 }
242723811.8ms return 1;
243}
244
24514µsmy %next_event = (
246 MAP => 'MAPVALUE',
247 IMAP => 'IMAPVALUE',
248 MAPVALUE => 'MAP',
249 IMAPVALUE => 'IMAP',
250 SEQ => 'SEQ',
251 SEQ0 => 'SEQ0',
252 DOC => 'DOC_END',
253 STR => 'STR',
254 FLOWSEQ => 'FLOWSEQ_NEXT',
255 FLOWSEQ_NEXT => 'FLOWSEQ',
256 FLOWMAP => 'FLOWMAPVALUE',
257 FLOWMAPVALUE => 'FLOWMAP',
258);
259
26012µsmy %event_to_method = (
261 MAP => 'mapping',
262 IMAP => 'mapping',
263 FLOWMAP => 'mapping',
264 SEQ => 'sequence',
265 SEQ0 => 'sequence',
266 FLOWSEQ => 'sequence',
267 DOC => 'document',
268 STR => 'stream',
269 VAL => 'scalar',
270 ALI => 'alias',
271 MAPVALUE => 'mapping',
272 IMAPVALUE => 'mapping',
273);
274
275#sub process_events {
276# my ($self, $res) = @_;
277#
278# my $event_stack = $self->event_stack;
279# return unless @$event_stack;
280#
281# if (@$event_stack == 1 and $event_stack->[0]->[0] eq 'properties') {
282# return;
283# }
284#
285# my $event_types = $self->events;
286# my $properties;
287# my @send_events;
288# for my $event (@$event_stack) {
289# TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$event], ['event']);
290# my ($type, $info) = @$event;
291# if ($type eq 'properties') {
292# $properties = $info;
293# }
294# elsif ($type eq 'scalar') {
295# $info->{name} = 'scalar_event';
296# $event_types->[-1] = $next_event{ $event_types->[-1] };
297# push @send_events, $info;
298# }
299# elsif ($type eq 'begin') {
300# my $name = $info->{name};
301# $info->{name} = $event_to_method{ $name } . '_start_event';
302# push @{ $event_types }, $name;
303# push @{ $self->offset }, $info->{offset};
304# push @send_events, $info;
305# }
306# elsif ($type eq 'end') {
307# my $name = $info->{name};
308# $info->{name} = $event_to_method{ $name } . '_end_event';
309# $self->$type($name, $info);
310# push @send_events, $info;
311# if (@$event_types) {
312# $event_types->[-1] = $next_event{ $event_types->[-1] };
313# }
314# }
315# elsif ($type eq 'alias') {
316# if ($properties) {
317# $self->exception("Parse error: Alias not allowed in this context");
318# }
319# $info->{name} = 'alias_event';
320# $event_types->[-1] = $next_event{ $event_types->[-1] };
321# push @send_events, $info;
322# }
323# }
324# @$event_stack = ();
325# for my $info (@send_events) {
326# DEBUG and $self->debug_event( $info );
327# $self->callback->($self, $info->{name}, $info);
328# }
329#}
330
33114µsmy %fetch_method = (
332 '"' => 'fetch_quoted',
333 "'" => 'fetch_quoted',
334 '|' => 'fetch_block',
335 '>' => 'fetch_block',
336 '' => 'fetch_plain',
337);
338
339
# spent 5.21s (637ms+4.57) within YAML::PP::Parser::parse_tokens which was called: # once (637ms+4.57s) by YAML::PP::Parser::parse at line 156
sub parse_tokens {
34011µs my ($self) = @_;
34110s11µs my $event_types = $self->events;
# spent 1µs making 1 call to YAML::PP::Parser::events
34211µs11µs my $offsets = $self->offset;
# spent 1µs making 1 call to YAML::PP::Parser::offset
34311µs10s my $tokens = $self->tokens;
# spent 0s making 1 call to YAML::PP::Parser::tokens
34412µs23µs my $next_tokens = $self->lexer->next_tokens;
# spent 2µs making 1 call to YAML::PP::Lexer::next_tokens # spent 1µs making 1 call to YAML::PP::Parser::lexer
345
34611µs113.9ms unless ($self->lex_next_tokens) {
# spent 13.9ms making 1 call to YAML::PP::Parser::lex_next_tokens
347 $self->end_document(1);
348 return 0;
349 }
35012µs11µs unless ($self->new_node) {
# spent 1µs making 1 call to YAML::PP::Parser::new_node
35112µs13µs if ($self->level > 0) {
# spent 3µs making 1 call to YAML::PP::Parser::level
352 my $new_rule = $nodetypes{ $event_types->[-1] }
353 or die "Did not find '$event_types->[-1]'";
354 $self->set_rule( $new_rule );
355 }
356 }
357
35812µs12µs my $rule_name = $self->rule;
# spent 2µs making 1 call to YAML::PP::Parser::rule
359 DEBUG and $self->info("----------------> parse_tokens($rule_name)");
36012µs my $rule = $GRAMMAR->{ $rule_name }
361 or die "Could not find rule $rule_name";
362
363 TRACE and $self->debug_rules($rule);
364 TRACE and $self->debug_yaml;
365 DEBUG and $self->debug_next_line;
366
36717.32ms RULE: while ($rule_name) {
368 DEBUG and $self->info("RULE: $rule_name");
369 TRACE and $self->debug_tokens($next_tokens);
370
37111000610.8ms unless (@$next_tokens) {
372 $self->exception("No more tokens");
373 }
374 TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$next_tokens->[0]], ['next_token']);
37511000626.5ms my $got = $next_tokens->[0]->{name};
37611000612.8ms if ($got eq 'CONTEXT') {
377207643.85ms my $context = shift @$next_tokens;
378207643.61ms my $indent = $offsets->[-1];
3792076423.9ms4152819.5ms $indent++ unless $self->lexer->flowcontext;
# spent 11.6ms making 20764 calls to YAML::PP::Parser::lexer, avg 557ns/call # spent 7.97ms making 20764 calls to YAML::PP::Lexer::flowcontext, avg 384ns/call
380207648.15ms my $method = $fetch_method{ $context->{value} };
3812076427.1ms415281.69s my $partial = $self->lexer->$method($indent, $context->{value});
# spent 1.49s making 18718 calls to YAML::PP::Lexer::fetch_plain, avg 80µs/call # spent 198ms making 2045 calls to YAML::PP::Lexer::fetch_quoted, avg 97µs/call # spent 7.13ms making 20764 calls to YAML::PP::Parser::lexer, avg 344ns/call # spent 272µs making 1 call to YAML::PP::Lexer::fetch_block
3822076421.9ms next RULE;
383 }
3848924228.4ms my $def = $rule->{ $got };
3858924228.3ms if ($def) {
386 push @$tokens, shift @$next_tokens;
387 }
388 elsif ($def = $rule->{DEFAULT}) {
389 $got = 'DEFAULT';
390 }
391 else {
392 $self->expected(
393 expected => [keys %$rule],
394 got => $next_tokens->[0],
395 );
396 }
397
398 DEBUG and $self->got("---got $got");
3998924229.8ms if (my $sub = $def->{match}) {
400 DEBUG and $self->info("CALLBACK $sub");
4014339845.1ms433981.53s $self->$sub(@$tokens ? $tokens->[-1] : ());
# spent 591ms making 6686 calls to YAML::PP::Parser::cb_insert_map, avg 88µs/call # spent 383ms making 6619 calls to YAML::PP::Parser::cb_send_mapkey, avg 58µs/call # spent 343ms making 6417 calls to YAML::PP::Parser::cb_send_scalar, avg 53µs/call # spent 53.8ms making 12070 calls to YAML::PP::Parser::cb_start_plain, avg 4µs/call # spent 39.3ms making 666 calls to YAML::PP::Parser::cb_flow_comma, avg 59µs/call # spent 30.8ms making 6619 calls to YAML::PP::Parser::cb_mapkey, avg 5µs/call # spent 29.5ms making 331 calls to YAML::PP::Parser::cb_end_flowseq, avg 89µs/call # spent 15.0ms making 331 calls to YAML::PP::Parser::cb_start_flowseq, avg 45µs/call # spent 13.2ms making 305 calls to YAML::PP::Parser::cb_seqstart, avg 43µs/call # spent 12.3ms making 2030 calls to YAML::PP::Parser::cb_take_quoted, avg 6µs/call # spent 9.16ms making 214 calls to YAML::PP::Parser::cb_start_flowmap, avg 43µs/call # spent 8.82ms making 214 calls to YAML::PP::Parser::cb_end_flowmap, avg 41µs/call # spent 2.03ms making 522 calls to YAML::PP::Parser::cb_end_outer_flow, avg 4µs/call # spent 1.79ms making 29 calls to YAML::PP::Parser::cb_flowkey_plain, avg 62µs/call # spent 902µs making 299 calls to YAML::PP::Parser::cb_seqitem, avg 3µs/call # spent 742µs making 15 calls to YAML::PP::Parser::cb_take_quoted_key, avg 49µs/call # spent 71µs making 29 calls to YAML::PP::Parser::cb_flow_colon, avg 2µs/call # spent 48µs making 1 call to YAML::PP::Parser::cb_doc_start_explicit # spent 35µs making 1 call to YAML::PP::Parser::cb_send_block_scalar
402 }
4038924214.4ms my $eol = $got eq 'EOL';
4048924219.2ms my $new = $def->{new};
4058924219.3ms if ($new) {
406 DEBUG and $self->got("NEW: $new");
407463736.06ms $rule_name = $new;
4084637329.2ms4637338.2ms $self->set_rule($rule_name);
# spent 38.2ms making 46373 calls to YAML::PP::Parser::set_rule, avg 823ns/call
409 }
410 elsif ($eol) {
411 }
412 elsif ($def->{return}) {
4131246670µs $rule_name = $nodetypes{ $event_types->[-1] }
414 or die "Unexpected event type $event_types->[-1]";
4151246816µs1246978µs $self->set_rule($rule_name);
# spent 978µs making 1246 calls to YAML::PP::Parser::set_rule, avg 785ns/call
416 }
417 else {
4183468914.7ms $rule_name .= " - $got"; # for debugging
419346893.62ms $rule = $def;
420346899.79ms next RULE;
421 }
422545537.39ms if ($eol) {
4231335511.2ms133551.24s unless ($self->lex_next_tokens) {
# spent 1.24s making 13355 calls to YAML::PP::Parser::lex_next_tokens, avg 93µs/call
42410s if ($rule_name eq 'DIRECTIVE') {
425 $self->exception("Directive needs document start");
426 }
42712µs11.04ms $self->end_document(1);
# spent 1.04ms making 1 call to YAML::PP::Parser::end_document
42814µs return 0;
429 }
430133549.15ms133545.31ms unless ($self->new_node) {
# spent 5.31ms making 13354 calls to YAML::PP::Parser::new_node, avg 398ns/call
43169336.68ms69336.19ms if ($self->level > 0) {
# spent 6.19ms making 6933 calls to YAML::PP::Parser::level, avg 892ns/call
43269333.26ms $rule_name = $nodetypes{ $event_types->[-1] }
433 or die "Did not find '$event_types->[-1]'";
43469334.27ms69335.38ms $self->set_rule( $rule_name );
# spent 5.38ms making 6933 calls to YAML::PP::Parser::set_rule, avg 776ns/call
435 }
436 }
4371335411.1ms133547.71ms $rule_name = $self->rule;
# spent 7.71ms making 13354 calls to YAML::PP::Parser::rule, avg 577ns/call
438 }
4395455234.7ms $rule = $GRAMMAR->{ $rule_name }
440 or die "Unexpected rule $rule_name";
441
442 }
443
444 die "Unexpected";
445}
446
447
# spent 7.11ms (2.62+4.49) within YAML::PP::Parser::end_sequence which was called 261 times, avg 27µs/call: # 261 times (2.62ms+4.49ms) by YAML::PP::Parser::lex_next_tokens at line 235, avg 27µs/call
sub end_sequence {
448261109µs my ($self) = @_;
449261184µs261109µs my $event_types = $self->events;
# spent 109µs making 261 calls to YAML::PP::Parser::events, avg 418ns/call
450261116µs pop @{ $event_types };
451261157µs26193µs pop @{ $self->offset };
# spent 93µs making 261 calls to YAML::PP::Parser::offset, avg 356ns/call
452261190µs my $info = { name => 'sequence_end_event' };
453261418µs5224.28ms $self->callback->($self, $info->{name} => $info );
# spent 4.20ms making 261 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 16µs/call # spent 85µs making 261 calls to YAML::PP::Parser::callback, avg 326ns/call
454261688µs $event_types->[-1] = $next_event{ $event_types->[-1] };
455}
456
457
# spent 222ms (52.7+169) within YAML::PP::Parser::remove_nodes which was called 2795 times, avg 79µs/call: # 2794 times (52.7ms+169ms) by YAML::PP::Parser::lex_next_tokens at line 226, avg 79µs/call # once (29µs+935µs) by YAML::PP::Parser::end_document at line 639
sub remove_nodes {
4582795798µs my ($self, $space) = @_;
45927951.95ms27951.15ms my $offset = $self->offset;
# spent 1.15ms making 2795 calls to YAML::PP::Parser::offset, avg 411ns/call
46027951.97ms27951.07ms my $event_types = $self->events;
# spent 1.07ms making 2795 calls to YAML::PP::Parser::events, avg 381ns/call
461
4622795954µs my $exp = $event_types->[-1];
4632795891µs while (@$offset) {
46495252.20ms if ($offset->[ -1 ] <= $space) {
4652795882µs last;
466 }
46767301.16ms if ($exp eq 'MAPVALUE') {
468 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
469 $exp = 'MAP';
470 }
47167303.39ms my $info = { name => $exp };
47267303.69ms $info->{name} = $event_to_method{ $exp } . '_end_event';
47367301.44ms pop @{ $event_types };
47467301.05ms pop @{ $offset };
47567308.11ms13460167ms $self->callback->($self, $info->{name} => $info );
# spent 164ms making 6730 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 24µs/call # spent 2.78ms making 6730 calls to YAML::PP::Parser::callback, avg 413ns/call
47667303.21ms $event_types->[-1] = $next_event{ $event_types->[-1] };
47767305.01ms $exp = $event_types->[-1];
478 }
47927954.01ms return $exp;
480}
481
482
# spent 24µs (18+6) within YAML::PP::Parser::start_stream which was called: # once (18µs+6µs) by YAML::PP::Parser::parse at line 153
sub start_stream {
48311µs my ($self) = @_;
48412µs11µs push @{ $self->events }, 'STR';
# spent 1µs making 1 call to YAML::PP::Parser::events
48512µs11µs push @{ $self->offset }, -1;
# spent 1µs making 1 call to YAML::PP::Parser::offset
48615µs24µs $self->callback->($self, 'stream_start_event', {
# spent 4µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62] # spent 0s making 1 call to YAML::PP::Parser::callback
487 name => 'stream_start_event',
488 });
489}
490
491
# spent 44µs (24+20) within YAML::PP::Parser::start_document which was called: # once (24µs+20µs) by YAML::PP::Parser::cb_doc_start_explicit at line 1441
sub start_document {
49211µs my ($self, $implicit) = @_;
49311µs10s push @{ $self->events }, 'DOC';
# spent 0s making 1 call to YAML::PP::Parser::events
49411µs10s push @{ $self->offset }, -1;
# spent 0s making 1 call to YAML::PP::Parser::offset
49512µs11µs my $directive = $self->yaml_version_directive;
# spent 1µs making 1 call to YAML::PP::Parser::yaml_version_directive
49610s my %directive;
49711µs if ($directive) {
498 my ($major, $minor) = split m/\./, $self->yaml_version;
499 %directive = ( version_directive => { major => $major, minor => $minor } );
500 }
50114µs217µs $self->callback->($self, 'document_start_event', {
# spent 16µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62] # spent 1µs making 1 call to YAML::PP::Parser::callback
502 name => 'document_start_event',
503 implicit => $implicit,
504 %directive,
505 });
50611µs11µs $self->set_yaml_version_directive(undef);
# spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version_directive
50711µs11µs $self->set_rule( 'FULLNODE' );
# spent 1µs making 1 call to YAML::PP::Parser::set_rule
50813µs10s $self->set_new_node(1);
# spent 0s making 1 call to YAML::PP::Parser::set_new_node
509}
510
511
# spent 11.3ms (3.28+7.98) within YAML::PP::Parser::start_sequence which was called 305 times, avg 37µs/call: # 305 times (3.28ms+7.98ms) by YAML::PP::Parser::cb_seqstart at line 1140, avg 37µs/call
sub start_sequence {
512305104µs my ($self, $offset) = @_;
513305182µs305124µs my $offsets = $self->offset;
# spent 124µs making 305 calls to YAML::PP::Parser::offset, avg 407ns/call
514305387µs305118µs if ($offsets->[-1] == $offset) {
# spent 118µs making 305 calls to YAML::PP::Parser::events, avg 387ns/call
515 push @{ $self->events }, 'SEQ0';
516 }
517 else {
518 push @{ $self->events }, 'SEQ';
519 }
520305161µs push @{ $offsets }, $offset;
521305182µs305124µs my $event_stack = $self->event_stack;
# spent 124µs making 305 calls to YAML::PP::Parser::event_stack, avg 407ns/call
522305231µs my $info = { name => 'sequence_start_event' };
52330552µs if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
524 my $properties = pop @$event_stack;
525 $self->node_properties($properties->[1], $info);
526 }
527305969µs6107.61ms $self->callback->($self, 'sequence_start_event', $info);
# spent 7.52ms making 305 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 25µs/call # spent 98µs making 305 calls to YAML::PP::Parser::callback, avg 321ns/call
528}
529
530
# spent 13.9ms (5.89+8.04) within YAML::PP::Parser::start_flow_sequence which was called 331 times, avg 42µs/call: # 331 times (5.89ms+8.04ms) by YAML::PP::Parser::cb_start_flowseq at line 1221, avg 42µs/call
sub start_flow_sequence {
53133193µs my ($self, $offset) = @_;
532331269µs331142µs my $offsets = $self->offset;
# spent 142µs making 331 calls to YAML::PP::Parser::offset, avg 429ns/call
533331181µs my $new_offset = $offsets->[-1];
534331256µs331122µs my $event_types = $self->events;
# spent 122µs making 331 calls to YAML::PP::Parser::events, avg 369ns/call
535331378µs331115µs if ($new_offset < 0) {
# spent 115µs making 331 calls to YAML::PP::Parser::new_node, avg 347ns/call
536 $new_offset = 0;
537 }
538 elsif ($self->new_node) {
539331660µs331166µs if ($event_types->[-1] !~ m/^FLOW/) {
# spent 166µs making 331 calls to YAML::PP::Parser::CORE:match, avg 502ns/call
540 $new_offset++;
541 }
542 }
543331429µs331143µs push @{ $self->events }, 'FLOWSEQ';
# spent 143µs making 331 calls to YAML::PP::Parser::events, avg 432ns/call
544331102µs push @{ $offsets }, $new_offset;
545
546331264µs33191µs my $event_stack = $self->event_stack;
# spent 91µs making 331 calls to YAML::PP::Parser::event_stack, avg 275ns/call
547331407µs my $info = { style => YAML_FLOW_SEQUENCE_STYLE, name => 'sequence_start_event' };
548331135µs if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
549 $self->fetch_inline_properties($event_stack, $info);
550 }
551331970µs6627.26ms $self->callback->($self, 'sequence_start_event', $info);
# spent 7.17ms making 331 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 22µs/call # spent 95µs making 331 calls to YAML::PP::Parser::callback, avg 287ns/call
552}
553
554
# spent 8.40ms (3.34+5.06) within YAML::PP::Parser::start_flow_mapping which was called 214 times, avg 39µs/call: # 214 times (3.34ms+5.06ms) by YAML::PP::Parser::cb_start_flowmap at line 1226, avg 39µs/call
sub start_flow_mapping {
55521475µs my ($self, $offset, $implicit_flowseq_map) = @_;
556214158µs21483µs my $offsets = $self->offset;
# spent 83µs making 214 calls to YAML::PP::Parser::offset, avg 388ns/call
55721497µs my $new_offset = $offsets->[-1];
558214176µs21474µs my $event_types = $self->events;
# spent 74µs making 214 calls to YAML::PP::Parser::events, avg 346ns/call
559214256µs21482µs if ($new_offset < 0) {
# spent 82µs making 214 calls to YAML::PP::Parser::new_node, avg 383ns/call
560 $new_offset = 0;
561 }
562 elsif ($self->new_node) {
563214377µs214105µs if ($event_types->[-1] !~ m/^FLOW/) {
# spent 105µs making 214 calls to YAML::PP::Parser::CORE:match, avg 491ns/call
564 $new_offset++;
565 }
566 }
567214215µs21477µs push @{ $self->events }, $implicit_flowseq_map ? 'IMAP' : 'FLOWMAP';
# spent 77µs making 214 calls to YAML::PP::Parser::events, avg 360ns/call
56821432µs push @{ $offsets }, $new_offset;
569
570214111µs21473µs my $event_stack = $self->event_stack;
# spent 73µs making 214 calls to YAML::PP::Parser::event_stack, avg 341ns/call
571214154µs my $info = { name => 'mapping_start_event', style => YAML_FLOW_MAPPING_STYLE };
57221443µs if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
573 $self->fetch_inline_properties($event_stack, $info);
574 }
575214701µs4284.57ms $self->callback->($self, 'mapping_start_event', $info);
# spent 4.46ms making 214 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 21µs/call # spent 113µs making 214 calls to YAML::PP::Parser::callback, avg 528ns/call
576}
577
578
# spent 10.6ms (3.65+6.91) within YAML::PP::Parser::end_flow_sequence which was called 331 times, avg 32µs/call: # 331 times (3.65ms+6.91ms) by YAML::PP::Parser::cb_end_flowseq at line 1232, avg 32µs/call
sub end_flow_sequence {
579331107µs my ($self) = @_;
580331218µs331139µs my $event_types = $self->events;
# spent 139µs making 331 calls to YAML::PP::Parser::events, avg 420ns/call
581331115µs pop @{ $event_types };
582331312µs331137µs pop @{ $self->offset };
# spent 137µs making 331 calls to YAML::PP::Parser::offset, avg 414ns/call
583331261µs my $info = { name => 'sequence_end_event' };
584331440µs6626.15ms $self->callback->($self, $info->{name}, $info);
# spent 6.05ms making 331 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 18µs/call # spent 107µs making 331 calls to YAML::PP::Parser::callback, avg 323ns/call
5853311.52ms331481µs if ($event_types->[-1] =~ m/^FLOW|^IMAP/) {
# spent 481µs making 331 calls to YAML::PP::Parser::CORE:match, avg 1µs/call
586 $event_types->[-1] = $next_event{ $event_types->[-1] };
587 }
588 else {
589308218µs push @$event_types, 'END_FLOW';
590 }
591}
592
593
# spent 7.75ms (2.57+5.18) within YAML::PP::Parser::end_flow_mapping which was called 214 times, avg 36µs/call: # 214 times (2.57ms+5.18ms) by YAML::PP::Parser::cb_end_flowmap at line 1267, avg 36µs/call
sub end_flow_mapping {
59421456µs my ($self) = @_;
595214196µs21494µs my $event_types = $self->events;
# spent 94µs making 214 calls to YAML::PP::Parser::events, avg 439ns/call
59621487µs pop @{ $event_types };
597214228µs21477µs pop @{ $self->offset };
# spent 77µs making 214 calls to YAML::PP::Parser::offset, avg 360ns/call
598214148µs my $info = { name => 'mapping_end_event' };
599214247µs4284.70ms $self->callback->($self, $info->{name}, $info);
# spent 4.63ms making 214 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 22µs/call # spent 64µs making 214 calls to YAML::PP::Parser::callback, avg 299ns/call
6002141.07ms214312µs if ($event_types->[-1] =~ m/^FLOW|^IMAP/) {
# spent 312µs making 214 calls to YAML::PP::Parser::CORE:match, avg 1µs/call
601 $event_types->[-1] = $next_event{ $event_types->[-1] };
602 }
603 else {
60421496µs push @$event_types, 'END_FLOW';
605 }
606}
607
608
# spent 2.03ms (1.81+213µs) within YAML::PP::Parser::cb_end_outer_flow which was called 522 times, avg 4µs/call: # 522 times (1.81ms+213µs) by YAML::PP::Parser::parse_tokens at line 401, avg 4µs/call
sub cb_end_outer_flow {
609522168µs my ($self) = @_;
610522406µs522213µs my $event_types = $self->events;
# spent 213µs making 522 calls to YAML::PP::Parser::events, avg 408ns/call
611522183µs pop @$event_types;
612522942µs $event_types->[-1] = $next_event{ $event_types->[-1] };
613}
614
615
# spent 227ms (56.0+171) within YAML::PP::Parser::start_mapping which was called 6686 times, avg 34µs/call: # 6686 times (56.0ms+171ms) by YAML::PP::Parser::cb_insert_map at line 1365, avg 34µs/call
sub start_mapping {
61666861.67ms my ($self, $offset) = @_;
61766864.84ms66863.20ms my $offsets = $self->offset;
# spent 3.20ms making 6686 calls to YAML::PP::Parser::offset, avg 478ns/call
61866866.00ms66863.10ms push @{ $self->events }, 'MAP';
# spent 3.10ms making 6686 calls to YAML::PP::Parser::events, avg 464ns/call
61966861.52ms push @{ $offsets }, $offset;
62066863.32ms66862.03ms my $event_stack = $self->event_stack;
# spent 2.03ms making 6686 calls to YAML::PP::Parser::event_stack, avg 304ns/call
62166863.71ms my $info = { name => 'mapping_start_event' };
62266861.38ms if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
623 my $properties = pop @$event_stack;
624 $self->node_properties($properties->[1], $info);
625 }
626668617.2ms13372163ms $self->callback->($self, 'mapping_start_event', $info);
# spent 160ms making 6686 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 24µs/call # spent 2.50ms making 6686 calls to YAML::PP::Parser::callback, avg 374ns/call
627}
628
629
# spent 1.04ms (49µs+992µs) within YAML::PP::Parser::end_document which was called: # once (49µs+992µs) by YAML::PP::Parser::parse_tokens at line 427
sub end_document {
63011µs my ($self, $implicit) = @_;
631
63210s10s my $event_types = $self->events;
# spent 0s making 1 call to YAML::PP::Parser::events
63312µs10s if ($event_types->[-1] =~ m/FLOW/) {
# spent 0s making 1 call to YAML::PP::Parser::CORE:match
634 die "Unexpected end of flow context";
635 }
63611µs10s if ($self->new_node) {
# spent 0s making 1 call to YAML::PP::Parser::new_node
637 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
638 }
63911µs1964µs $self->remove_nodes(-1);
# spent 964µs making 1 call to YAML::PP::Parser::remove_nodes
640
64111µs if ($event_types->[-1] eq 'STR') {
642 return;
643 }
64411µs my $last = pop @{ $event_types };
64511µs if ($last ne 'DOC' and $last ne 'DOC_END') {
646 $self->exception("Unexpected event type $last");
647 }
64812µs10s pop @{ $self->offset };
# spent 0s making 1 call to YAML::PP::Parser::offset
64912µs224µs $self->callback->($self, 'document_end_event', {
# spent 24µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62] # spent 0s making 1 call to YAML::PP::Parser::callback
650 name => 'document_end_event',
651 implicit => $implicit,
652 });
65315µs24µs if ($self->yaml_version eq '1.2') {
# spent 2µs making 1 call to YAML::PP::Parser::set_tagmap # spent 2µs making 1 call to YAML::PP::Parser::yaml_version
654 # In YAML 1.2, directives are only for the following
655 # document. In YAML 1.1, they are global
656 $self->set_tagmap({ '!!' => "tag:yaml.org,2002:" });
657 }
65811µs $event_types->[-1] = $next_event{ $event_types->[-1] };
65912µs10s $self->set_rule('STREAM');
# spent 0s making 1 call to YAML::PP::Parser::set_rule
660}
661
662
# spent 15µs (10+5) within YAML::PP::Parser::end_stream which was called: # once (10µs+5µs) by YAML::PP::Parser::parse at line 158
sub end_stream {
66310s my ($self) = @_;
66411µs10s my $last = pop @{ $self->events };
# spent 0s making 1 call to YAML::PP::Parser::events
66511µs $self->exception("Unexpected event type $last") unless $last eq 'STR';
66610s11µs pop @{ $self->offset };
# spent 1µs making 1 call to YAML::PP::Parser::offset
66713µs24µs $self->callback->($self, 'stream_end_event', {
# spent 4µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62] # spent 0s making 1 call to YAML::PP::Parser::callback
668 name => 'stream_end_event',
669 });
670}
671
672sub fetch_inline_properties {
673 my ($self, $stack, $info) = @_;
674 my $properties = $stack->[-1];
675
676 $properties = $properties->[1];
677 my $property_offset;
678 if ($properties) {
679 for my $p (@{ $properties->{inline} }) {
680 my $type = $p->{type};
681 if (exists $info->{ $type }) {
682 $self->exception("A node can only have one $type");
683 }
684 $info->{ $type } = $p->{value};
685 unless (defined $property_offset) {
686 $property_offset = $p->{offset};
687 $info->{offset} = $p->{offset};
688 }
689 }
690 delete $properties->{inline};
691 undef $properties unless $properties->{newline};
692 }
693
694 unless ($properties) {
695 pop @$stack;
696 }
697}
698
699sub node_properties {
700 my ($self, $properties, $info) = @_;
701 if ($properties) {
702 for my $p (@{ $properties->{newline} }) {
703 my $type = $p->{type};
704 if (exists $info->{ $type }) {
705 $self->exception("A node can only have one $type");
706 }
707 $info->{ $type } = $p->{value};
708 }
709 undef $properties;
710 }
711}
712
713
# spent 994ms (202+793) within YAML::PP::Parser::scalar_event which was called 20764 times, avg 48µs/call: # 7415 times (98.2ms+244ms) by YAML::PP::Parser::cb_send_scalar at line 1056, avg 46µs/call # 6686 times (52.5ms+255ms) by YAML::PP::Parser::cb_insert_map at line 1366, avg 46µs/call # 6634 times (50.8ms+292ms) by YAML::PP::Parser::cb_send_mapkey at line 1048, avg 52µs/call # 29 times (232µs+1.33ms) by YAML::PP::Parser::cb_flowkey_plain at line 1289, avg 54µs/call
sub scalar_event {
714207643.24ms my ($self, $info) = @_;
7152076412.7ms2076410.3ms my $event_types = $self->events;
# spent 10.3ms making 20764 calls to YAML::PP::Parser::events, avg 496ns/call
7162076410.4ms207646.54ms my $event_stack = $self->event_stack;
# spent 6.54ms making 20764 calls to YAML::PP::Parser::event_stack, avg 315ns/call
717207643.55ms if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
718 my $properties = pop @$event_stack;
719 $properties = $self->node_properties($properties->[1], $info);
720 }
721
722207645.87ms $info->{name} = 'scalar_event';
7232076423.2ms41528764ms $self->callback->($self, 'scalar_event', $info);
# spent 757ms making 20764 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 36µs/call # spent 7.17ms making 20764 calls to YAML::PP::Parser::callback, avg 345ns/call
7242076413.5ms2076411.7ms $self->set_new_node(0);
# spent 11.7ms making 20764 calls to YAML::PP::Parser::set_new_node, avg 563ns/call
7252076436.8ms $event_types->[-1] = $next_event{ $event_types->[-1] };
726}
727
728sub alias_event {
729 my ($self, $info) = @_;
730 my $event_stack = $self->event_stack;
731 if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') {
732 $self->exception("Parse error: Alias not allowed in this context");
733 }
734 my $event_types = $self->events;
735 $info->{name} = 'alias_event';
736 $self->callback->($self, 'alias_event', $info);
737 $self->set_new_node(0);
738 $event_types->[-1] = $next_event{ $event_types->[-1] };
739}
740
741sub yaml_to_tokens {
742 my ($class, $type, $input) = @_;
743 my $yp = YAML::PP::Parser->new( receiver => sub {} );
744 my @docs = eval {
745 $type eq 'string' ? $yp->parse_string($input) : $yp->parse_file($input);
746 };
747 my $error = $@;
748
749 my $tokens = $yp->tokens;
750 if ($error) {
751 my $remaining_tokens = $yp->_remaining_tokens;
752 push @$tokens, map { +{ %$_, name => 'ERROR' } } @$remaining_tokens;
753 }
754 return $error, $tokens;
755}
756
757sub _remaining_tokens {
758 my ($self) = @_;
759 my @tokens;
760 my $next = $self->lexer->next_tokens;
761 push @tokens, @$next;
762 my $next_line = $self->lexer->next_line;
763 my $remaining = '';
764 if ($next_line) {
765 if ($self->lexer->offset > 0) {
766 $remaining = $next_line->[1] . $next_line->[2];
767 }
768 else {
769 $remaining = join '', @$next_line;
770 }
771 }
772 $remaining .= $self->reader->read;
773 $remaining = '' unless defined $remaining;
774 push @tokens, { name => "ERROR", value => $remaining };
775 return \@tokens;
776}
777
778# deprecated
779sub event_to_test_suite {
780 # uncoverable subroutine
781 my ($self, $event) = @_; # uncoverable statement
782 if (ref $event eq 'ARRAY') { # uncoverable statement
783 return YAML::PP::Common::event_to_test_suite($event->[1]); # uncoverable statement
784 }
785 return YAML::PP::Common::event_to_test_suite($event); # uncoverable statement
786}
787
788sub debug_events {
789 # uncoverable subroutine
790 my ($self) = @_; # uncoverable statement
791 $self->note("EVENTS: (" # uncoverable statement
792 . join (' | ', @{ $_[0]->events }) . ')' # uncoverable statement
793 );
794 $self->debug_offset; # uncoverable statement
795}
796
797sub debug_offset {
798 # uncoverable subroutine
799 my ($self) = @_; # uncoverable statement
800 $self->note(
801 qq{OFFSET: (}
802 # uncoverable statement count:1
803 # uncoverable statement count:2
804 # uncoverable statement count:3
805 . join (' | ', map { defined $_ ? sprintf "%-3d", $_ : '?' } @{ $_[0]->offset })
806 # uncoverable statement
807 . qq/) level=@{[ $_[0]->level ]}]}/
808 );
809}
810
811sub debug_yaml {
812 # uncoverable subroutine
813 my ($self) = @_; # uncoverable statement
814 my $line = $self->lexer->line; # uncoverable statement
815 $self->note("LINE NUMBER: $line"); # uncoverable statement
816 my $next_tokens = $self->lexer->next_tokens; # uncoverable statement
817 if (@$next_tokens) { # uncoverable statement
818 $self->debug_tokens($next_tokens); # uncoverable statement
819 }
820}
821
822sub debug_next_line {
823 my ($self) = @_;
824 my $next_line = $self->lexer->next_line || [];
825 my $line = $next_line->[0];
826 $line = '' unless defined $line;
827 $line =~ s/( +)$/'·' x length $1/e;
828 $line =~ s/\t/▸/g;
829 $self->note("NEXT LINE: >>$line<<");
830}
831
832sub note {
833 my ($self, $msg) = @_;
834 $self->_colorize_warn(["yellow"], "============ $msg");
835}
836
837sub info {
838 my ($self, $msg) = @_;
839 $self->_colorize_warn(["cyan"], "============ $msg");
840}
841
842sub got {
843 my ($self, $msg) = @_;
844 $self->_colorize_warn(["green"], "============ $msg");
845}
846
847sub _colorize_warn {
848 # uncoverable subroutine
849 my ($self, $colors, $text) = @_; # uncoverable statement
850 require Term::ANSIColor; # uncoverable statement
851 warn Term::ANSIColor::colored($colors, $text), "\n"; # uncoverable statement
852}
853
854sub debug_event {
855 # uncoverable subroutine
856 my ($self, $event) = @_; # uncoverable statement
857 my $str = YAML::PP::Common::event_to_test_suite($event); # uncoverable statement
858 require Term::ANSIColor; # uncoverable statement
859 warn Term::ANSIColor::colored(["magenta"], "============ $str"), "\n"; # uncoverable statement
860}
861
862sub debug_rules {
863 # uncoverable subroutine
864 my ($self, $rules) = @_; # uncoverable statement
865 local $Data::Dumper::Maxdepth = 2; # uncoverable statement
866 $self->note("RULES:"); # uncoverable statement
867 for my $rule ($rules) { # uncoverable statement
868 if (ref $rule eq 'ARRAY') { # uncoverable statement
869 my $first = $rule->[0]; # uncoverable statement
870 if (ref $first eq 'SCALAR') { # uncoverable statement
871 $self->info("-> $$first"); # uncoverable statement
872 }
873 else { # uncoverable statement
874 if (ref $first eq 'ARRAY') { # uncoverable statement
875 $first = $first->[0]; # uncoverable statement
876 }
877 $self->info("TYPE $first"); # uncoverable statement
878 }
879 }
880 else { # uncoverable statement
881 eval { # uncoverable statement
882 my @keys = sort keys %$rule; # uncoverable statement
883 $self->info("@keys"); # uncoverable statement
884 };
885 }
886 }
887}
888
889sub debug_tokens {
890 # uncoverable subroutine
891 my ($self, $tokens) = @_; # uncoverable statement
892 $tokens ||= $self->tokens; # uncoverable statement
893 require Term::ANSIColor; # uncoverable statement
894 for my $token (@$tokens) { # uncoverable statement
895 my $type = Term::ANSIColor::colored(["green"], # uncoverable statement
896 sprintf "%-22s L %2d C %2d ", # uncoverable statement
897 $token->{name}, $token->{line}, $token->{column} + 1 # uncoverable statement
898 );
899 local $Data::Dumper::Useqq = 1; # uncoverable statement
900 local $Data::Dumper::Terse = 1; # uncoverable statement
901 require Data::Dumper; # uncoverable statement
902 my $str = Data::Dumper->Dump([$token->{value}], ['str']); # uncoverable statement
903 chomp $str; # uncoverable statement
904 $str =~ s/(^.|.$)/Term::ANSIColor::colored(['blue'], $1)/ge; # uncoverable statement
905 warn "$type$str\n"; # uncoverable statement
906 }
907
908}
909
910sub highlight_yaml {
911 my ($self) = @_;
912 require YAML::PP::Highlight;
913 my $tokens = $self->tokens;
914 my $highlighted = YAML::PP::Highlight->ansicolored($tokens);
915 warn $highlighted;
916}
917
918sub exception {
919 my ($self, $msg, %args) = @_;
920 my $next = $self->lexer->next_tokens;
921 my $line = @$next ? $next->[0]->{line} : $self->lexer->line;
922 my $offset = @$next ? $next->[0]->{column} : $self->lexer->offset;
923 $offset++;
924 my $next_line = $self->lexer->next_line;
925 my $remaining = '';
926 if ($next_line) {
927 if ($self->lexer->offset > 0) {
928 $remaining = $next_line->[1] . $next_line->[2];
929 }
930 else {
931 $remaining = join '', @$next_line;
932 }
933 }
934 my $caller = $args{caller} || [ caller(0) ];
935 my $e = YAML::PP::Exception->new(
936 got => $args{got},
937 expected => $args{expected},
938 line => $line,
939 column => $offset,
940 msg => $msg,
941 next => $next,
942 where => $caller->[1] . ' line ' . $caller->[2],
943 yaml => $remaining,
944 );
945 croak $e;
946}
947
948sub expected {
949 my ($self, %args) = @_;
950 my $expected = $args{expected};
951 @$expected = sort grep { m/^[A-Z_]+$/ } @$expected;
952 my $got = $args{got}->{name};
953 my @caller = caller(0);
954 $self->exception("Expected (@$expected), but got $got",
955 caller => \@caller,
956 expected => $expected,
957 got => $args{got},
958 );
959}
960
961sub cb_tag {
962 my ($self, $token) = @_;
963 my $stack = $self->event_stack;
964 if (! @$stack or $stack->[-1]->[0] ne 'properties') {
965 push @$stack, [ properties => {} ];
966 }
967 my $last = $stack->[-1]->[1];
968 my $tag = $self->_read_tag($token->{value}, $self->tagmap);
969 $last->{inline} ||= [];
970 push @{ $last->{inline} }, {
971 type => 'tag',
972 value => $tag,
973 offset => $token->{column},
974 };
975}
976
977sub _read_tag {
978 my ($self, $tag, $map) = @_;
979 if ($tag eq '!') {
980 return "!";
981 }
982 elsif ($tag =~ m/^!<(.*)>/) {
983 return $1;
984 }
985 elsif ($tag =~ m/^(![^!]*!|!)(.+)/) {
986 my $alias = $1;
987 my $name = $2;
988 $name =~ s/%([0-9a-fA-F]{2})/chr hex $1/eg;
989 if (exists $map->{ $alias }) {
990 $tag = $map->{ $alias }. $name;
991 }
992 else {
993 if ($alias ne '!' and $alias ne '!!') {
994 die "Found undefined tag handle '$alias'";
995 }
996 $tag = "!$name";
997 }
998 }
999 else {
1000 die "Invalid tag";
1001 }
1002 return $tag;
1003}
1004
1005sub cb_anchor {
1006 my ($self, $token) = @_;
1007 my $anchor = $token->{value};
1008 $anchor = substr($anchor, 1);
1009 my $stack = $self->event_stack;
1010 if (! @$stack or $stack->[-1]->[0] ne 'properties') {
1011 push @$stack, [ properties => {} ];
1012 }
1013 my $last = $stack->[-1]->[1];
1014 $last->{inline} ||= [];
1015 push @{ $last->{inline} }, {
1016 type => 'anchor',
1017 value => $anchor,
1018 offset => $token->{column},
1019 };
1020}
1021
1022sub cb_property_eol {
1023 my ($self, $res) = @_;
1024 my $stack = $self->event_stack;
1025 my $last = $stack->[-1]->[1];
1026 my $inline = delete $last->{inline} or return;
1027 my $newline = $last->{newline} ||= [];
1028 push @$newline, @$inline;
1029}
1030
1031
# spent 30.8ms (27.7+3.13) within YAML::PP::Parser::cb_mapkey which was called 6619 times, avg 5µs/call: # 6619 times (27.7ms+3.13ms) by YAML::PP::Parser::parse_tokens at line 401, avg 5µs/call
sub cb_mapkey {
103266191.21ms my ($self, $token) = @_;
103366194.62ms66193.13ms my $stack = $self->event_stack;
# spent 3.13ms making 6619 calls to YAML::PP::Parser::event_stack, avg 473ns/call
1034 my $info = {
1035 style => YAML_PLAIN_SCALAR_STYLE,
1036 value => $token->{value},
1037 offset => $token->{column},
103866197.88ms };
103966191.72ms if (@$stack and $stack->[-1]->[0] eq 'properties') {
1040 $self->fetch_inline_properties($stack, $info);
1041 }
1042661912.3ms push @{ $stack }, [ scalar => $info ];
1043}
1044
1045
# spent 384ms (36.1+348) within YAML::PP::Parser::cb_send_mapkey which was called 6634 times, avg 58µs/call: # 6619 times (36.0ms+347ms) by YAML::PP::Parser::parse_tokens at line 401, avg 58µs/call # 15 times (91µs+476µs) by YAML::PP::Parser::cb_take_quoted_key at line 1187, avg 38µs/call
sub cb_send_mapkey {
10466634842µs my ($self, $res) = @_;
104766344.85ms66342.39ms my $last = pop @{ $self->event_stack };
# spent 2.39ms making 6634 calls to YAML::PP::Parser::event_stack, avg 360ns/call
104866344.85ms6634343ms $self->scalar_event($last->[1]);
# spent 343ms making 6634 calls to YAML::PP::Parser::scalar_event, avg 52µs/call
1049663415.9ms66342.35ms $self->set_new_node(1);
# spent 2.35ms making 6634 calls to YAML::PP::Parser::set_new_node, avg 354ns/call
1050}
1051
1052
# spent 393ms (45.2+348) within YAML::PP::Parser::cb_send_scalar which was called 7415 times, avg 53µs/call: # 6417 times (39.5ms+303ms) by YAML::PP::Parser::parse_tokens at line 401, avg 53µs/call # 666 times (3.67ms+30.2ms) by YAML::PP::Parser::cb_flow_comma at line 1241, avg 51µs/call # 331 times (2.03ms+14.7ms) by YAML::PP::Parser::cb_end_flowseq at line 1231, avg 51µs/call # once (3µs+21µs) by YAML::PP::Parser::cb_send_block_scalar at line 1421
sub cb_send_scalar {
105374151.50ms my ($self, $res) = @_;
105474155.62ms74152.87ms my $last = pop @{ $self->event_stack };
# spent 2.87ms making 7415 calls to YAML::PP::Parser::event_stack, avg 387ns/call
105574151.09ms return unless $last;
105674154.77ms7415342ms $self->scalar_event($last->[1]);
# spent 342ms making 7415 calls to YAML::PP::Parser::scalar_event, avg 46µs/call
105774154.35ms74153.07ms my $e = $self->events;
# spent 3.07ms making 7415 calls to YAML::PP::Parser::events, avg 413ns/call
1058741516.8ms if ($e->[-1] eq 'IMAP') {
1059 $self->end_flow_mapping;
1060 }
1061}
1062
1063sub cb_empty_mapkey {
1064 my ($self, $token) = @_;
1065 my $stack = $self->event_stack;
1066 my $info = {
1067 style => YAML_PLAIN_SCALAR_STYLE,
1068 value => '',
1069 offset => $token->{column},
1070 };
1071 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1072 $self->fetch_inline_properties($stack, $info);
1073 }
1074 $self->scalar_event($info);
1075 $self->set_new_node(1);
1076}
1077
1078sub cb_send_flow_alias {
1079 my ($self, $token) = @_;
1080 my $alias = substr($token->{value}, 1);
1081 $self->alias_event({ value => $alias });
1082}
1083
1084sub cb_send_alias {
1085 my ($self, $token) = @_;
1086 my $alias = substr($token->{value}, 1);
1087 $self->alias_event({ value => $alias });
1088}
1089
1090sub cb_send_alias_key {
1091 my ($self, $token) = @_;
1092 my $alias = substr($token->{value}, 1);
1093 $self->alias_event({ value => $alias });
1094 $self->set_new_node(1);
1095}
1096
1097sub cb_send_alias_from_stack {
1098 my ($self, $token) = @_;
1099 my $last = pop @{ $self->event_stack };
1100 $self->alias_event($last->[1]);
1101}
1102
1103sub cb_alias {
1104 my ($self, $token) = @_;
1105 my $alias = substr($token->{value}, 1);
1106 push @{ $self->event_stack }, [ alias => {
1107 value => $alias,
1108 offset => $token->{column},
1109 }];
1110}
1111
1112sub cb_question {
1113 my ($self, $res) = @_;
1114 $self->set_new_node(1);
1115}
1116
1117sub cb_flow_question {
1118 my ($self, $res) = @_;
1119 $self->set_new_node(2);
1120}
1121
1122sub cb_empty_complexvalue {
1123 my ($self, $res) = @_;
1124 $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' });
1125}
1126
1127sub cb_questionstart {
1128 my ($self, $token) = @_;
1129 $self->start_mapping($token->{column});
1130}
1131
1132sub cb_complexcolon {
1133 my ($self, $res) = @_;
1134 $self->set_new_node(1);
1135}
1136
1137
# spent 13.2ms (1.79+11.4) within YAML::PP::Parser::cb_seqstart which was called 305 times, avg 43µs/call: # 305 times (1.79ms+11.4ms) by YAML::PP::Parser::parse_tokens at line 401, avg 43µs/call
sub cb_seqstart {
1138305117µs my ($self, $token) = @_;
1139305123µs my $column = $token->{column};
1140305468µs30511.3ms $self->start_sequence($column);
# spent 11.3ms making 305 calls to YAML::PP::Parser::start_sequence, avg 37µs/call
1141305719µs305169µs $self->set_new_node(1);
# spent 169µs making 305 calls to YAML::PP::Parser::set_new_node, avg 554ns/call
1142}
1143
1144
# spent 902µs (753+149) within YAML::PP::Parser::cb_seqitem which was called 299 times, avg 3µs/call: # 299 times (753µs+149µs) by YAML::PP::Parser::parse_tokens at line 401, avg 3µs/call
sub cb_seqitem {
114529983µs my ($self, $res) = @_;
1146299644µs299149µs $self->set_new_node(1);
# spent 149µs making 299 calls to YAML::PP::Parser::set_new_node, avg 498ns/call
1147}
1148
1149
# spent 12.4ms (11.4+1.00) within YAML::PP::Parser::cb_take_quoted which was called 2045 times, avg 6µs/call: # 2030 times (11.3ms+991µs) by YAML::PP::Parser::parse_tokens at line 401, avg 6µs/call # 15 times (77µs+13µs) by YAML::PP::Parser::cb_take_quoted_key at line 1186, avg 6µs/call
sub cb_take_quoted {
11502045618µs my ($self, $token) = @_;
11512045468µs my $subtokens = $token->{subtokens};
115220451.85ms20451.00ms my $stack = $self->event_stack;
# spent 1.00ms making 2045 calls to YAML::PP::Parser::event_stack, avg 491ns/call
1153 my $info = {
1154 style => $subtokens->[0]->{value} eq '"'
1155 ? YAML_DOUBLE_QUOTED_SCALAR_STYLE
1156 : YAML_SINGLE_QUOTED_SCALAR_STYLE,
1157 value => $token->{value},
1158 offset => $token->{column},
115920453.39ms };
11602045529µs if (@$stack and $stack->[-1]->[0] eq 'properties') {
1161 $self->fetch_inline_properties($stack, $info);
1162 }
116320453.76ms push @{ $stack }, [ scalar => $info ];
1164}
1165
1166sub cb_quoted_multiline {
1167 my ($self, $token) = @_;
1168 my $subtokens = $token->{subtokens};
1169 my $stack = $self->event_stack;
1170 my $info = {
1171 style => $subtokens->[0]->{value} eq '"'
1172 ? YAML_DOUBLE_QUOTED_SCALAR_STYLE
1173 : YAML_SINGLE_QUOTED_SCALAR_STYLE,
1174 value => $token->{value},
1175 offset => $token->{column},
1176 };
1177 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1178 $self->fetch_inline_properties($stack, $info);
1179 }
1180 push @{ $stack }, [ scalar => $info ];
1181 $self->cb_send_scalar;
1182}
1183
1184
# spent 742µs (85+657) within YAML::PP::Parser::cb_take_quoted_key which was called 15 times, avg 49µs/call: # 15 times (85µs+657µs) by YAML::PP::Parser::parse_tokens at line 401, avg 49µs/call
sub cb_take_quoted_key {
1185154µs my ($self, $token) = @_;
11861521µs1590µs $self->cb_take_quoted($token);
# spent 90µs making 15 calls to YAML::PP::Parser::cb_take_quoted, avg 6µs/call
11871538µs15567µs $self->cb_send_mapkey;
# spent 567µs making 15 calls to YAML::PP::Parser::cb_send_mapkey, avg 38µs/call
1188}
1189
1190sub cb_send_plain_multi {
1191 my ($self, $token) = @_;
1192 my $stack = $self->event_stack;
1193 my $info = {
1194 style => YAML_PLAIN_SCALAR_STYLE,
1195 value => $token->{value},
1196 offset => $token->{column},
1197 };
1198 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1199 $self->fetch_inline_properties($stack, $info);
1200 }
1201 push @{ $stack }, [ scalar => $info ];
1202 $self->cb_send_scalar;
1203}
1204
1205
# spent 53.8ms (47.9+5.87) within YAML::PP::Parser::cb_start_plain which was called 12070 times, avg 4µs/call: # 12070 times (47.9ms+5.87ms) by YAML::PP::Parser::parse_tokens at line 401, avg 4µs/call
sub cb_start_plain {
1206120701.87ms my ($self, $token) = @_;
1207120708.53ms120705.88ms my $stack = $self->event_stack;
# spent 5.88ms making 12070 calls to YAML::PP::Parser::event_stack, avg 487ns/call
1208 my $info = {
1209 style => YAML_PLAIN_SCALAR_STYLE,
1210 value => $token->{value},
1211 offset => $token->{column},
12121207014.1ms };
1213120702.66ms if (@$stack and $stack->[-1]->[0] eq 'properties') {
1214 $self->fetch_inline_properties($stack, $info);
1215 }
12161207018.5ms push @{ $stack }, [ scalar => $info ];
1217}
1218
1219
# spent 15.0ms (1.02+13.9) within YAML::PP::Parser::cb_start_flowseq which was called 331 times, avg 45µs/call: # 331 times (1.02ms+13.9ms) by YAML::PP::Parser::parse_tokens at line 401, avg 45µs/call
sub cb_start_flowseq {
1220331104µs my ($self, $token) = @_;
1221331960µs33113.9ms $self->start_flow_sequence($token->{column});
# spent 13.9ms making 331 calls to YAML::PP::Parser::start_flow_sequence, avg 42µs/call
1222}
1223
1224
# spent 9.16ms (760µs+8.40) within YAML::PP::Parser::cb_start_flowmap which was called 214 times, avg 43µs/call: # 214 times (760µs+8.40ms) by YAML::PP::Parser::parse_tokens at line 401, avg 43µs/call
sub cb_start_flowmap {
122521499µs my ($self, $token) = @_;
1226214565µs2148.40ms $self->start_flow_mapping($token->{column});
# spent 8.40ms making 214 calls to YAML::PP::Parser::start_flow_mapping, avg 39µs/call
1227}
1228
1229
# spent 29.5ms (1.99+27.5) within YAML::PP::Parser::cb_end_flowseq which was called 331 times, avg 89µs/call: # 331 times (1.99ms+27.5ms) by YAML::PP::Parser::parse_tokens at line 401, avg 89µs/call
sub cb_end_flowseq {
1230331100µs my ($self, $res) = @_;
1231331269µs33116.8ms $self->cb_send_scalar;
# spent 16.8ms making 331 calls to YAML::PP::Parser::cb_send_scalar, avg 51µs/call
1232331481µs33110.6ms $self->end_flow_sequence;
# spent 10.6ms making 331 calls to YAML::PP::Parser::end_flow_sequence, avg 32µs/call
1233331626µs331158µs $self->set_new_node(0);
# spent 158µs making 331 calls to YAML::PP::Parser::set_new_node, avg 477ns/call
1234}
1235
1236
# spent 39.3ms (4.44+34.9) within YAML::PP::Parser::cb_flow_comma which was called 666 times, avg 59µs/call: # 666 times (4.44ms+34.9ms) by YAML::PP::Parser::parse_tokens at line 401, avg 59µs/call
sub cb_flow_comma {
1237666134µs my ($self) = @_;
1238666435µs666350µs my $event_types = $self->events;
# spent 350µs making 666 calls to YAML::PP::Parser::events, avg 526ns/call
1239666412µs666279µs $self->set_new_node(0);
# spent 279µs making 666 calls to YAML::PP::Parser::set_new_node, avg 419ns/call
12406662.49ms666387µs if ($event_types->[-1] =~ m/^FLOWSEQ/) {
# spent 387µs making 666 calls to YAML::PP::Parser::CORE:match, avg 581ns/call
1241666386µs66633.8ms $self->cb_send_scalar;
# spent 33.8ms making 666 calls to YAML::PP::Parser::cb_send_scalar, avg 51µs/call
1242666311µs $event_types->[-1] = $next_event{ $event_types->[-1] };
1243 }
1244}
1245
1246
# spent 71µs (56+15) within YAML::PP::Parser::cb_flow_colon which was called 29 times, avg 2µs/call: # 29 times (56µs+15µs) by YAML::PP::Parser::parse_tokens at line 401, avg 2µs/call
sub cb_flow_colon {
1247296µs my ($self) = @_;
12482956µs2915µs $self->set_new_node(1);
# spent 15µs making 29 calls to YAML::PP::Parser::set_new_node, avg 517ns/call
1249}
1250
1251sub cb_empty_flow_mapkey {
1252 my ($self, $token) = @_;
1253 my $stack = $self->event_stack;
1254 my $info = {
1255 style => YAML_PLAIN_SCALAR_STYLE,
1256 value => '',
1257 offset => $token->{column},
1258 };
1259 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1260 $self->fetch_inline_properties($stack, $info);
1261 }
1262 $self->scalar_event($info);
1263}
1264
1265
# spent 8.82ms (943µs+7.87) within YAML::PP::Parser::cb_end_flowmap which was called 214 times, avg 41µs/call: # 214 times (943µs+7.87ms) by YAML::PP::Parser::parse_tokens at line 401, avg 41µs/call
sub cb_end_flowmap {
126621459µs my ($self, $res) = @_;
1267214291µs2147.75ms $self->end_flow_mapping;
# spent 7.75ms making 214 calls to YAML::PP::Parser::end_flow_mapping, avg 36µs/call
1268214371µs214122µs $self->set_new_node(0);
# spent 122µs making 214 calls to YAML::PP::Parser::set_new_node, avg 570ns/call
1269}
1270
1271sub cb_end_flowmap_empty {
1272 my ($self, $res) = @_;
1273 $self->cb_empty_flowmap_value;
1274 $self->end_flow_mapping;
1275 $self->set_new_node(0);
1276}
1277
1278
# spent 1.79ms (211µs+1.58) within YAML::PP::Parser::cb_flowkey_plain which was called 29 times, avg 62µs/call: # 29 times (211µs+1.58ms) by YAML::PP::Parser::parse_tokens at line 401, avg 62µs/call
sub cb_flowkey_plain {
1279295µs my ($self, $token) = @_;
12802923µs299µs my $stack = $self->event_stack;
# spent 9µs making 29 calls to YAML::PP::Parser::event_stack, avg 310ns/call
1281 my $info = {
1282 style => YAML_PLAIN_SCALAR_STYLE,
1283 value => $token->{value},
1284 offset => $token->{column},
12852966µs };
1286295µs if (@$stack and $stack->[-1]->[0] eq 'properties') {
1287 $self->fetch_inline_properties($stack, $info);
1288 }
12892994µs291.57ms $self->scalar_event($info);
# spent 1.57ms making 29 calls to YAML::PP::Parser::scalar_event, avg 54µs/call
1290}
1291
1292sub cb_flowkey_quoted {
1293 my ($self, $token) = @_;
1294 my $stack = $self->event_stack;
1295 my $subtokens = $token->{subtokens};
1296 my $info = {
1297 style => $subtokens->[0]->{value} eq '"'
1298 ? YAML_DOUBLE_QUOTED_SCALAR_STYLE
1299 : YAML_SINGLE_QUOTED_SCALAR_STYLE,
1300 value => $token->{value},
1301 offset => $token->{column},
1302 };
1303 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1304 $self->fetch_inline_properties($stack, $info);
1305 }
1306 $self->scalar_event($info);
1307}
1308
1309sub cb_empty_flowmap_key_value {
1310 my ($self, $token) = @_;
1311 $self->cb_empty_flow_mapkey($token);
1312 $self->cb_empty_flowmap_value;
1313 $self->cb_flow_comma;
1314}
1315
1316sub cb_end_empty_flowmap_key_value {
1317 my ($self, $token) = @_;
1318 $self->cb_empty_flow_mapkey($token);
1319 $self->cb_empty_flowmap_value;
1320 $self->cb_flow_comma;
1321 $self->cb_end_flowmap;
1322}
1323
1324sub cb_empty_flowmap_value {
1325 my ($self, $token) = @_;
1326 my $stack = $self->event_stack;
1327 my $info = {
1328 style => YAML_PLAIN_SCALAR_STYLE,
1329 value => '',
1330 offset => $token->{column},
1331 };
1332 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1333 $self->fetch_inline_properties($stack, $info);
1334 }
1335 $self->scalar_event($info);
1336}
1337
1338sub cb_empty_flowseq_comma {
1339 my ($self, $token) = @_;
1340 $self->cb_empty_flowmap_value($token);
1341 $self->cb_flow_comma;
1342}
1343
1344sub cb_empty_flowseq_end {
1345 my ($self, $token) = @_;
1346 $self->cb_empty_flowmap_value($token);
1347 $self->cb_end_flowseq;
1348}
1349
1350sub cb_insert_map_alias {
1351 my ($self, $res) = @_;
1352 my $stack = $self->event_stack;
1353 my $scalar = pop @$stack;
1354 my $info = $scalar->[1];
1355 $self->start_mapping($info->{offset});
1356 $self->alias_event($info);
1357 $self->set_new_node(1);
1358}
1359
1360
# spent 591ms (51.1+539) within YAML::PP::Parser::cb_insert_map which was called 6686 times, avg 88µs/call: # 6686 times (51.1ms+539ms) by YAML::PP::Parser::parse_tokens at line 401, avg 88µs/call
sub cb_insert_map {
136166861.42ms my ($self, $res) = @_;
136266863.77ms66862.62ms my $stack = $self->event_stack;
# spent 2.62ms making 6686 calls to YAML::PP::Parser::event_stack, avg 392ns/call
136366861.74ms my $scalar = pop @$stack;
136466861.36ms my $info = $scalar->[1];
136566866.91ms6686227ms $self->start_mapping($info->{offset});
# spent 227ms making 6686 calls to YAML::PP::Parser::start_mapping, avg 34µs/call
136666865.10ms6686307ms $self->scalar_event($info);
# spent 307ms making 6686 calls to YAML::PP::Parser::scalar_event, avg 46µs/call
1367668617.5ms66862.39ms $self->set_new_node(1);
# spent 2.39ms making 6686 calls to YAML::PP::Parser::set_new_node, avg 358ns/call
1368}
1369
1370sub cb_insert_implicit_flowseq_map {
1371 my ($self, $res) = @_;
1372 my $stack = $self->event_stack;
1373 my $scalar = pop @$stack;
1374 my $info = $scalar->[1];
1375 $self->start_flow_mapping($info->{offset}, 1);
1376 $self->scalar_event($info);
1377 $self->set_new_node(1);
1378}
1379
1380sub cb_insert_empty_implicit_flowseq_map {
1381 my ($self, $res) = @_;
1382 my $stack = $self->event_stack;
1383 my $scalar = pop @$stack;
1384 my $info = $scalar->[1];
1385 $self->start_flow_mapping($info->{offset}, 1);
1386 $self->cb_empty_flowmap_value;
1387 $self->set_new_node(2);
1388}
1389
1390sub cb_insert_empty_map {
1391 my ($self, $token) = @_;
1392 my $stack = $self->event_stack;
1393 my $info = {
1394 style => YAML_PLAIN_SCALAR_STYLE,
1395 value => '',
1396 offset => $token->{column},
1397 };
1398 if (@$stack and $stack->[-1]->[0] eq 'properties') {
1399 $self->fetch_inline_properties($stack, $info);
1400 }
1401 $self->start_mapping($info->{offset});
1402 $self->scalar_event($info);
1403 $self->set_new_node(1);
1404}
1405
1406
# spent 35µs (11+24) within YAML::PP::Parser::cb_send_block_scalar which was called: # once (11µs+24µs) by YAML::PP::Parser::parse_tokens at line 401
sub cb_send_block_scalar {
140710s my ($self, $token) = @_;
140810s my $type = $token->{subtokens}->[0]->{value};
140911µs10s my $stack = $self->event_stack;
# spent 0s making 1 call to YAML::PP::Parser::event_stack
1410 my $info = {
1411 style => $type eq '|'
1412 ? YAML_LITERAL_SCALAR_STYLE
1413 : YAML_FOLDED_SCALAR_STYLE,
1414 value => $token->{value},
1415 offset => $token->{column},
141611µs };
141710s if (@$stack and $stack->[-1]->[0] eq 'properties') {
1418 $self->fetch_inline_properties($stack, $info);
1419 }
142012µs10s push @{ $self->event_stack }, [ scalar => $info ];
# spent 0s making 1 call to YAML::PP::Parser::event_stack
142113µs124µs $self->cb_send_scalar;
# spent 24µs making 1 call to YAML::PP::Parser::cb_send_scalar
1422}
1423
1424sub cb_end_document {
1425 my ($self, $token) = @_;
1426 $self->end_document(0);
1427}
1428
1429sub cb_end_document_empty {
1430 my ($self, $token) = @_;
1431 $self->end_document(0);
1432}
1433
1434sub cb_doc_start_implicit {
1435 my ($self, $token) = @_;
1436 $self->start_document(1);
1437}
1438
1439
# spent 48µs (4+44) within YAML::PP::Parser::cb_doc_start_explicit which was called: # once (4µs+44µs) by YAML::PP::Parser::parse_tokens at line 401
sub cb_doc_start_explicit {
144010s my ($self, $token) = @_;
144113µs144µs $self->start_document(0);
# spent 44µs making 1 call to YAML::PP::Parser::start_document
1442}
1443
1444sub cb_end_doc_start_document {
1445 my ($self, $token) = @_;
1446 $self->end_document(1);
1447 $self->start_document(0);
1448}
1449
1450sub cb_tag_directive {
1451 my ($self, $token) = @_;
1452 my ($name, $tag_alias, $tag_url) = split ' ', $token->{value};
1453 $self->tagmap->{ $tag_alias } = $tag_url;
1454}
1455
1456sub cb_reserved_directive {
1457}
1458
1459sub cb_set_yaml_version_directive {
1460 my ($self, $token) = @_;
1461 if ($self->yaml_version_directive) {
1462 croak "Found duplicate YAML directive";
1463 }
1464 my ($version) = $token->{value} =~ m/^%YAML[ \t]+(1\.[12])/;
1465 $self->set_yaml_version($version || '1.2');
1466 $self->set_yaml_version_directive(1);
1467}
1468
1469116µs1;
 
# spent 5.95ms within YAML::PP::Parser::CORE:match which was called 15111 times, avg 394ns/call: # 13354 times (4.50ms+0s) by YAML::PP::Parser::lex_next_tokens at line 185, avg 337ns/call # 666 times (387µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1240, avg 581ns/call # 331 times (481µs+0s) by YAML::PP::Parser::end_flow_sequence at line 585, avg 1µs/call # 331 times (166µs+0s) by YAML::PP::Parser::start_flow_sequence at line 539, avg 502ns/call # 214 times (312µs+0s) by YAML::PP::Parser::end_flow_mapping at line 600, avg 1µs/call # 214 times (105µs+0s) by YAML::PP::Parser::start_flow_mapping at line 563, avg 491ns/call # once (0s+0s) by YAML::PP::Parser::end_document at line 633
sub YAML::PP::Parser::CORE:match; # opcode
# spent 5µs within YAML::PP::Parser::__ANON__ which was called 4 times, avg 1µs/call: # once (2µs+0s) by YAML::PP::Parser::BEGIN@17 at line 17 # once (1µs+0s) by YAML::PP::Parser::BEGIN@18 at line 18 # once (1µs+0s) by YAML::PP::Parser::BEGIN@20 at line 20 # once (1µs+0s) by YAML::PP::Parser::BEGIN@21 at line 21
sub YAML::PP::Parser::__ANON__; # xsub