Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Parser.pm |
Statements | Executed 2774199 statements in 2.21s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 922ms | 6.98s | parse_tokens | YAML::PP::Parser::
13451 | 2 | 1 | 269ms | 1.65s | lex_next_tokens | YAML::PP::Parser::
20941 | 4 | 1 | 219ms | 1.29s | scalar_event | YAML::PP::Parser::
36113 | 13 | 1 | 114ms | 1.49s | __ANON__[:62] | YAML::PP::Parser::
6725 | 1 | 1 | 75.9ms | 299ms | start_mapping | YAML::PP::Parser::
2816 | 2 | 1 | 74.4ms | 295ms | remove_nodes | YAML::PP::Parser::
6725 | 1 | 1 | 68.0ms | 822ms | cb_insert_map | YAML::PP::Parser::
12180 | 1 | 1 | 65.8ms | 72.8ms | cb_start_plain | YAML::PP::Parser::
7497 | 4 | 1 | 64.4ms | 472ms | cb_send_scalar | YAML::PP::Parser::
55080 | 7 | 1 | 53.4ms | 53.4ms | set_rule | YAML::PP::Parser::
6690 | 2 | 1 | 48.5ms | 489ms | cb_send_mapkey | YAML::PP::Parser::
6675 | 1 | 1 | 38.7ms | 42.5ms | cb_mapkey | YAML::PP::Parser::
70379 | 14 | 1 | 32.7ms | 32.7ms | event_stack | YAML::PP::Parser::
62745 | 23 | 1 | 30.6ms | 30.6ms | events | YAML::PP::Parser::
55337 | 7 | 1 | 26.9ms | 26.9ms | lexer | YAML::PP::Parser::
36237 | 11 | 1 | 22.8ms | 22.8ms | set_new_node | YAML::PP::Parser::
36113 | 13 | 1 | 18.1ms | 18.1ms | callback | YAML::PP::Parser::
1 | 1 | 1 | 17.9ms | 22.2ms | BEGIN@18 | YAML::PP::Parser::
31969 | 15 | 1 | 17.9ms | 17.9ms | offset | YAML::PP::Parser::
2056 | 2 | 1 | 15.7ms | 16.8ms | cb_take_quoted | YAML::PP::Parser::
27450 | 7 | 1 | 14.2ms | 14.2ms | new_node | YAML::PP::Parser::
13450 | 2 | 1 | 10.5ms | 10.5ms | rule | YAML::PP::Parser::
13450 | 2 | 1 | 10.1ms | 10.1ms | tokens | YAML::PP::Parser::
6993 | 2 | 1 | 9.30ms | 9.30ms | level | YAML::PP::Parser::
337 | 1 | 1 | 7.56ms | 18.4ms | start_flow_sequence | YAML::PP::Parser::
15241 | 7 | 1 | 7.08ms | 7.08ms | CORE:match (opcode) | YAML::PP::Parser::
689 | 1 | 1 | 6.43ms | 59.3ms | cb_flow_comma | YAML::PP::Parser::
337 | 1 | 1 | 5.20ms | 15.0ms | end_flow_sequence | YAML::PP::Parser::
308 | 1 | 1 | 4.89ms | 15.2ms | start_sequence | YAML::PP::Parser::
214 | 1 | 1 | 4.70ms | 11.5ms | start_flow_mapping | YAML::PP::Parser::
262 | 1 | 1 | 3.62ms | 9.87ms | end_sequence | YAML::PP::Parser::
1 | 1 | 1 | 3.54ms | 3.70ms | BEGIN@20 | YAML::PP::Parser::
337 | 1 | 1 | 3.47ms | 42.6ms | cb_end_flowseq | YAML::PP::Parser::
214 | 1 | 1 | 3.25ms | 10.7ms | end_flow_mapping | YAML::PP::Parser::
528 | 1 | 1 | 2.49ms | 2.73ms | cb_end_outer_flow | YAML::PP::Parser::
308 | 1 | 1 | 2.39ms | 17.8ms | cb_seqstart | YAML::PP::Parser::
337 | 1 | 1 | 1.44ms | 19.9ms | cb_start_flowseq | YAML::PP::Parser::
214 | 1 | 1 | 1.33ms | 12.2ms | cb_end_flowmap | YAML::PP::Parser::
302 | 1 | 1 | 1.26ms | 1.44ms | cb_seqitem | YAML::PP::Parser::
1 | 1 | 1 | 1.12ms | 1.32ms | BEGIN@21 | YAML::PP::Parser::
1 | 1 | 1 | 921µs | 1.00ms | BEGIN@17 | YAML::PP::Parser::
214 | 1 | 1 | 762µs | 12.3ms | cb_start_flowmap | YAML::PP::Parser::
29 | 1 | 1 | 325µs | 2.72ms | cb_flowkey_plain | YAML::PP::Parser::
29 | 1 | 1 | 190µs | 202µs | cb_flow_colon | YAML::PP::Parser::
15 | 1 | 1 | 107µs | 1.18ms | cb_take_quoted_key | YAML::PP::Parser::
1 | 1 | 1 | 65µs | 453µs | BEGIN@19 | YAML::PP::Parser::
1 | 1 | 1 | 50µs | 1.76ms | end_document | YAML::PP::Parser::
1 | 1 | 1 | 44µs | 61µs | init | YAML::PP::Parser::
1 | 1 | 1 | 35µs | 119µs | start_document | YAML::PP::Parser::
1 | 1 | 1 | 25µs | 6.98s | parse | YAML::PP::Parser::
1 | 1 | 1 | 21µs | 27µs | end_stream | YAML::PP::Parser::
1 | 1 | 1 | 21µs | 52µs | new | YAML::PP::Parser::
1 | 1 | 1 | 21µs | 21µs | set_receiver | YAML::PP::Parser::
1 | 1 | 1 | 19µs | 21µs | BEGIN@2 | YAML::PP::Loader::
1 | 1 | 1 | 15µs | 47µs | BEGIN@97 | YAML::PP::Parser::
1 | 1 | 1 | 11µs | 35µs | cb_send_block_scalar | YAML::PP::Parser::
1 | 1 | 1 | 11µs | 17µs | start_stream | YAML::PP::Parser::
1 | 1 | 1 | 10µs | 44µs | BEGIN@22 | YAML::PP::Parser::
1 | 1 | 1 | 10µs | 13µs | set_reader | YAML::PP::Parser::
3 | 3 | 1 | 8µs | 8µs | __ANON__ (xsub) | YAML::PP::Loader::
4 | 4 | 1 | 7µs | 7µs | __ANON__ (xsub) | YAML::PP::Parser::
1 | 1 | 1 | 6µs | 32µs | BEGIN@3 | YAML::PP::Loader::
1 | 1 | 1 | 5µs | 41µs | BEGIN@8 | YAML::PP::Parser::
1 | 1 | 1 | 5µs | 124µs | cb_doc_start_explicit | YAML::PP::Parser::
1 | 1 | 1 | 4µs | 36µs | BEGIN@11 | YAML::PP::Parser::
1 | 1 | 1 | 4µs | 4µs | receiver | YAML::PP::Parser::
1 | 1 | 1 | 3µs | 18µs | BEGIN@9 | YAML::PP::Parser::
2 | 2 | 1 | 3µs | 3µs | set_tagmap | YAML::PP::Parser::
1 | 1 | 1 | 2µs | 2µs | set_events | YAML::PP::Parser::
1 | 1 | 1 | 2µs | 2µs | set_offset | YAML::PP::Parser::
1 | 1 | 1 | 2µs | 2µs | set_tokens | YAML::PP::Parser::
1 | 1 | 1 | 2µs | 2µs | yaml_version | YAML::PP::Parser::
1 | 1 | 1 | 2µs | 2µs | yaml_version_directive | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | default_yaml_version | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | set_event_stack | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | set_yaml_version | YAML::PP::Parser::
2 | 2 | 1 | 1µs | 1µs | set_yaml_version_directive | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | __ANON__[:743] | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | _colorize_warn | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | _read_tag | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | _remaining_tokens | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | alias_event | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_alias | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_anchor | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_complexcolon | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_doc_start_implicit | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_empty_complexvalue | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_empty_flow_mapkey | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_empty_flowmap_key_value | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_empty_flowmap_value | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_empty_flowseq_comma | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_empty_flowseq_end | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_empty_mapkey | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_end_doc_start_document | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_end_document | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_end_document_empty | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_end_empty_flowmap_key_value | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_end_flowmap_empty | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_flow_question | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_flowkey_quoted | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_insert_empty_implicit_flowseq_map | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_insert_empty_map | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_insert_implicit_flowseq_map | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_insert_map_alias | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_property_eol | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_question | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_questionstart | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_quoted_multiline | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_reserved_directive | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_send_alias | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_send_alias_from_stack | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_send_alias_key | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_send_flow_alias | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_send_plain_multi | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_set_yaml_version_directive | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_tag | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | cb_tag_directive | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | clone | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | debug_event | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | debug_events | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | debug_next_line | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | debug_offset | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | debug_rules | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | debug_tokens | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | debug_yaml | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | event_to_test_suite | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | exception | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | expected | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | fetch_inline_properties | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | got | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | highlight_yaml | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | info | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | node_properties | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | note | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | parse_file | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | parse_string | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | reader | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | set_callback | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | tagmap | YAML::PP::Parser::
0 | 0 | 0 | 0s | 0s | yaml_to_tokens | YAML::PP::Parser::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | # ABSTRACT: YAML Parser | ||||
2 | 2 | 20µs | 2 | 23µs | # spent 21µs (19+2) within YAML::PP::Loader::BEGIN@2 which was called:
# once (19µs+2µs) by YAML::PP::Loader::BEGIN@8 at line 2 # spent 21µs making 1 call to YAML::PP::Loader::BEGIN@2
# spent 2µs making 1 call to strict::import |
3 | 2 | 33µs | 2 | 58µs | # spent 32µs (6+26) within YAML::PP::Loader::BEGIN@3 which was called:
# once (6µs+26µs) by YAML::PP::Loader::BEGIN@8 at line 3 # spent 32µs making 1 call to YAML::PP::Loader::BEGIN@3
# spent 26µs making 1 call to warnings::import |
4 | package YAML::PP::Parser; | ||||
5 | |||||
6 | 1 | 4µs | our $VERSION = '0.035'; # VERSION | ||
7 | |||||
8 | 2 | 27µs | 2 | 77µs | # spent 41µs (5+36) within YAML::PP::Parser::BEGIN@8 which was called:
# once (5µs+36µs) by YAML::PP::Loader::BEGIN@8 at line 8 # spent 41µs making 1 call to YAML::PP::Parser::BEGIN@8
# spent 36µs making 1 call to constant::import |
9 | 2 | 24µs | 2 | 33µs | # spent 18µs (3+15) within YAML::PP::Parser::BEGIN@9 which was called:
# once (3µs+15µs) by YAML::PP::Loader::BEGIN@8 at line 9 # spent 18µs making 1 call to YAML::PP::Parser::BEGIN@9
# spent 15µs making 1 call to constant::import |
10 | |||||
11 | 1 | 0s | # spent 36µs (4+32) within YAML::PP::Parser::BEGIN@11 which was called:
# once (4µs+32µs) by YAML::PP::Loader::BEGIN@8 at line 16 | ||
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 | ||||
16 | 1 | 17µs | 2 | 68µs | /; # spent 36µs making 1 call to YAML::PP::Parser::BEGIN@11
# spent 32µs making 1 call to Exporter::import |
17 | 2 | 442µs | 2 | 1.00ms | # spent 1.00ms (921µs+83µs) within YAML::PP::Parser::BEGIN@17 which was called:
# once (921µs+83µs) by YAML::PP::Loader::BEGIN@8 at line 17 # spent 1.00ms making 1 call to YAML::PP::Parser::BEGIN@17
# spent 1µs making 1 call to YAML::PP::Parser::__ANON__ |
18 | 2 | 520µs | 2 | 22.2ms | # spent 22.2ms (17.9+4.26) within YAML::PP::Parser::BEGIN@18 which was called:
# once (17.9ms+4.26ms) by YAML::PP::Loader::BEGIN@8 at line 18 # spent 22.2ms making 1 call to YAML::PP::Parser::BEGIN@18
# spent 2µs making 1 call to YAML::PP::Parser::__ANON__ |
19 | 2 | 97µs | 2 | 841µs | # spent 453µs (65+388) within YAML::PP::Parser::BEGIN@19 which was called:
# once (65µs+388µs) by YAML::PP::Loader::BEGIN@8 at line 19 # spent 453µs making 1 call to YAML::PP::Parser::BEGIN@19
# spent 388µs making 1 call to Exporter::import |
20 | 2 | 2.59ms | 2 | 3.70ms | # spent 3.70ms (3.54+155µs) within YAML::PP::Parser::BEGIN@20 which was called:
# once (3.54ms+155µs) by YAML::PP::Loader::BEGIN@8 at line 20 # spent 3.70ms making 1 call to YAML::PP::Parser::BEGIN@20
# spent 2µs making 1 call to YAML::PP::Parser::__ANON__ |
21 | 2 | 437µs | 2 | 1.32ms | # spent 1.32ms (1.12+204µs) within YAML::PP::Parser::BEGIN@21 which was called:
# once (1.12ms+204µs) by YAML::PP::Loader::BEGIN@8 at line 21 # spent 1.32ms making 1 call to YAML::PP::Parser::BEGIN@21
# spent 2µs making 1 call to YAML::PP::Parser::__ANON__ |
22 | 2 | 737µs | 2 | 78µs | # spent 44µs (10+34) within YAML::PP::Parser::BEGIN@22 which was called:
# once (10µs+34µs) by YAML::PP::Loader::BEGIN@8 at line 22 # spent 44µs making 1 call to YAML::PP::Parser::BEGIN@22
# spent 34µs making 1 call to Exporter::import |
23 | |||||
24 | |||||
25 | # spent 52µs (21+31) within YAML::PP::Parser::new which was called:
# once (21µs+31µs) by YAML::PP::Loader::new at line 34 of YAML/PP/Loader.pm | ||||
26 | 1 | 3µs | my ($class, %args) = @_; | ||
27 | 1 | 4µs | 1 | 5µs | my $reader = delete $args{reader} || YAML::PP::Reader->new; # spent 5µs making 1 call to YAML::PP::Reader::new |
28 | 1 | 1µs | my $default_yaml_version = delete $args{default_yaml_version}; | ||
29 | 1 | 5µs | 1 | 26µs | my $self = bless { # spent 26µ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; | ||||
35 | 1 | 1µs | my $receiver = delete $args{receiver}; | ||
36 | 1 | 0s | if ($receiver) { | ||
37 | $self->set_receiver($receiver); | ||||
38 | } | ||||
39 | 1 | 3µs | return $self; | ||
40 | } | ||||
41 | |||||
42 | sub 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 | |||||
51 | 1 | 9µs | # spent 4µs within YAML::PP::Parser::receiver which was called:
# once (4µs+0s) by YAML::PP::Loader::new at line 39 of YAML/PP/Loader.pm | ||
52 | # spent 21µs within YAML::PP::Parser::set_receiver which was called:
# once (21µs+0s) by YAML::PP::Loader::new at line 39 of YAML/PP/Loader.pm | ||||
53 | 1 | 0s | my ($self, $receiver) = @_; | ||
54 | 1 | 1µs | my $callback; | ||
55 | 1 | 2µs | if (ref $receiver eq 'CODE') { | ||
56 | $callback = $receiver; | ||||
57 | } | ||||
58 | else { | ||||
59 | # spent 1.49s (114ms+1.38) within YAML::PP::Parser::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Parser.pm:62] which was called 36113 times, avg 41µs/call:
# 20941 times (63.0ms+958ms) by YAML::PP::Parser::scalar_event at line 723, avg 49µs/call
# 6771 times (21.7ms+193ms) by YAML::PP::Parser::remove_nodes at line 475, avg 32µs/call
# 6725 times (23.4ms+186ms) by YAML::PP::Parser::start_mapping at line 626, avg 31µs/call
# 337 times (1.25ms+8.54ms) by YAML::PP::Parser::start_flow_sequence at line 551, avg 29µs/call
# 337 times (1.33ms+7.44ms) by YAML::PP::Parser::end_flow_sequence at line 584, avg 26µs/call
# 308 times (1.27ms+8.52ms) by YAML::PP::Parser::start_sequence at line 527, avg 32µs/call
# 262 times (1.02ms+4.86ms) by YAML::PP::Parser::end_sequence at line 453, avg 22µs/call
# 214 times (650µs+5.99ms) by YAML::PP::Parser::end_flow_mapping at line 599, avg 31µs/call
# 214 times (707µs+5.43ms) by YAML::PP::Parser::start_flow_mapping at line 575, avg 29µs/call
# once (11µs+63µs) by YAML::PP::Parser::start_document at line 501
# once (4µs+29µs) by YAML::PP::Parser::end_document at line 649
# once (4µs+1µs) by YAML::PP::Parser::end_stream at line 667
# once (3µs+1000ns) by YAML::PP::Parser::start_stream at line 486 | ||||
60 | 36113 | 10.2ms | my ($self, $event, $info) = @_; | ||
61 | 36113 | 103ms | 36113 | 1.38s | return $receiver->$event($info); # spent 958ms making 20941 calls to YAML::PP::Constructor::scalar_event, avg 46µs/call
# spent 198ms making 6939 calls to YAML::PP::Constructor::mapping_end_event, avg 29µs/call
# spent 191ms making 6939 calls to YAML::PP::Constructor::mapping_start_event, avg 28µs/call
# spent 17.1ms making 645 calls to YAML::PP::Constructor::sequence_start_event, avg 26µs/call
# spent 13.0ms making 645 calls to YAML::PP::Constructor::sequence_end_event, avg 20µs/call
# spent 63µs making 1 call to YAML::PP::Constructor::document_start_event
# spent 29µs making 1 call to YAML::PP::Constructor::document_end_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 |
62 | 1 | 8µs | }; | ||
63 | } | ||||
64 | 1 | 0s | $self->{callback} = $callback; | ||
65 | 1 | 15µs | $self->{receiver} = $receiver; | ||
66 | } | ||||
67 | sub reader { return $_[0]->lexer->{reader} } | ||||
68 | # spent 13µs (10+3) within YAML::PP::Parser::set_reader which was called:
# once (10µs+3µs) by YAML::PP::Loader::load_file at line 84 of YAML/PP/Loader.pm | ||||
69 | 1 | 0s | my ($self, $reader) = @_; | ||
70 | 1 | 5µs | 2 | 3µs | $self->lexer->set_reader($reader); # spent 3µs making 1 call to YAML::PP::Lexer::set_reader
# spent 0s making 1 call to YAML::PP::Parser::lexer |
71 | } | ||||
72 | 55337 | 77.7ms | # spent 26.9ms within YAML::PP::Parser::lexer which was called 55337 times, avg 486ns/call:
# 20941 times (12.2ms+0s) by YAML::PP::Parser::parse_tokens at line 379, avg 583ns/call
# 20941 times (8.08ms+0s) by YAML::PP::Parser::parse_tokens at line 381, avg 386ns/call
# 13451 times (6.59ms+0s) by YAML::PP::Parser::lex_next_tokens at line 179, avg 490ns/call
# once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 344
# once (0s+0s) by YAML::PP::Parser::set_reader at line 70
# once (0s+0s) by YAML::PP::Parser::parse at line 151
# once (0s+0s) by YAML::PP::Parser::init at line 115 | ||
73 | 36113 | 46.7ms | # spent 18.1ms within YAML::PP::Parser::callback which was called 36113 times, avg 500ns/call:
# 20941 times (10.1ms+0s) by YAML::PP::Parser::scalar_event at line 723, avg 483ns/call
# 6771 times (3.78ms+0s) by YAML::PP::Parser::remove_nodes at line 475, avg 559ns/call
# 6725 times (3.45ms+0s) by YAML::PP::Parser::start_mapping at line 626, avg 513ns/call
# 337 times (136µs+0s) by YAML::PP::Parser::end_flow_sequence at line 584, avg 404ns/call
# 337 times (120µs+0s) by YAML::PP::Parser::start_flow_sequence at line 551, avg 356ns/call
# 308 times (151µs+0s) by YAML::PP::Parser::start_sequence at line 527, avg 490ns/call
# 262 times (120µs+0s) by YAML::PP::Parser::end_sequence at line 453, avg 458ns/call
# 214 times (99µs+0s) by YAML::PP::Parser::end_flow_mapping at line 599, avg 463ns/call
# 214 times (95µs+0s) by YAML::PP::Parser::start_flow_mapping at line 575, avg 444ns/call
# once (2µs+0s) by YAML::PP::Parser::start_document at line 501
# once (1µs+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 | ||
74 | sub set_callback { $_[0]->{callback} = $_[1] } | ||||
75 | 6993 | 16.1ms | sub level { return $#{ $_[0]->{offset} } } | ||
76 | 31969 | 46.8ms | # spent 17.9ms within YAML::PP::Parser::offset which was called 31969 times, avg 560ns/call:
# 13451 times (7.51ms+0s) by YAML::PP::Parser::lex_next_tokens at line 177, avg 558ns/call
# 7300 times (3.43ms+0s) by YAML::PP::Parser::lex_next_tokens at line 239, avg 470ns/call
# 6725 times (4.49ms+0s) by YAML::PP::Parser::start_mapping at line 617, avg 668ns/call
# 2816 times (1.58ms+0s) by YAML::PP::Parser::remove_nodes at line 459, avg 561ns/call
# 337 times (189µs+0s) by YAML::PP::Parser::end_flow_sequence at line 582, avg 561ns/call
# 337 times (179µs+0s) by YAML::PP::Parser::start_flow_sequence at line 532, avg 531ns/call
# 308 times (152µs+0s) by YAML::PP::Parser::start_sequence at line 513, avg 494ns/call
# 262 times (134µs+0s) by YAML::PP::Parser::end_sequence at line 451, avg 511ns/call
# 214 times (123µs+0s) by YAML::PP::Parser::start_flow_mapping at line 556, avg 575ns/call
# 214 times (96µs+0s) by YAML::PP::Parser::end_flow_mapping at line 597, avg 449ns/call
# once (1µs+0s) by YAML::PP::Parser::end_stream at line 666
# once (1µs+0s) by YAML::PP::Parser::end_document at line 648
# 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 | ||
77 | 1 | 3µs | # spent 2µs within YAML::PP::Parser::set_offset which was called:
# once (2µs+0s) by YAML::PP::Parser::init at line 104 | ||
78 | 62745 | 90.3ms | # spent 30.6ms within YAML::PP::Parser::events which was called 62745 times, avg 488ns/call:
# 20941 times (11.4ms+0s) by YAML::PP::Parser::scalar_event at line 715, avg 545ns/call
# 13451 times (5.22ms+0s) by YAML::PP::Parser::lex_next_tokens at line 178, avg 388ns/call
# 7497 times (3.60ms+0s) by YAML::PP::Parser::cb_send_scalar at line 1057, avg 480ns/call
# 7300 times (3.95ms+0s) by YAML::PP::Parser::lex_next_tokens at line 231, avg 541ns/call
# 6725 times (3.33ms+0s) by YAML::PP::Parser::start_mapping at line 618, avg 495ns/call
# 2816 times (1.12ms+0s) by YAML::PP::Parser::remove_nodes at line 460, avg 397ns/call
# 689 times (500µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1238, avg 726ns/call
# 528 times (236µs+0s) by YAML::PP::Parser::cb_end_outer_flow at line 610, avg 447ns/call
# 337 times (146µs+0s) by YAML::PP::Parser::start_flow_sequence at line 534, avg 433ns/call
# 337 times (131µs+0s) by YAML::PP::Parser::end_flow_sequence at line 580, avg 389ns/call
# 337 times (117µs+0s) by YAML::PP::Parser::start_flow_sequence at line 543, avg 347ns/call
# 308 times (182µs+0s) by YAML::PP::Parser::lex_next_tokens at line 216, avg 591ns/call
# 308 times (120µs+0s) by YAML::PP::Parser::start_sequence at line 514, avg 390ns/call
# 262 times (124µs+0s) by YAML::PP::Parser::lex_next_tokens at line 236, avg 473ns/call
# 262 times (113µs+0s) by YAML::PP::Parser::end_sequence at line 449, avg 431ns/call
# 214 times (197µs+0s) by YAML::PP::Parser::end_flow_mapping at line 595, avg 921ns/call
# 214 times (86µs+0s) by YAML::PP::Parser::start_flow_mapping at line 567, avg 402ns/call
# 214 times (69µs+0s) by YAML::PP::Parser::start_flow_mapping at line 558, avg 322ns/call
# once (3µs+0s) by YAML::PP::Parser::parse_tokens at line 341
# once (1µs+0s) by YAML::PP::Parser::start_document at line 493
# once (1µs+0s) by YAML::PP::Parser::start_stream at line 484
# once (0s+0s) by YAML::PP::Parser::end_document at line 632
# once (0s+0s) by YAML::PP::Parser::end_stream at line 664 | ||
79 | 1 | 2µs | # spent 2µs within YAML::PP::Parser::set_events which was called:
# once (2µs+0s) by YAML::PP::Parser::init at line 105 | ||
80 | 27450 | 38.3ms | # spent 14.2ms within YAML::PP::Parser::new_node which was called 27450 times, avg 519ns/call:
# 13449 times (6.48ms+0s) by YAML::PP::Parser::parse_tokens at line 430, avg 482ns/call
# 7300 times (4.18ms+0s) by YAML::PP::Parser::lex_next_tokens at line 209, avg 572ns/call
# 6148 times (3.34ms+0s) by YAML::PP::Parser::lex_next_tokens at line 204, avg 544ns/call
# 337 times (140µs+0s) by YAML::PP::Parser::start_flow_sequence at line 535, avg 415ns/call
# 214 times (90µs+0s) by YAML::PP::Parser::start_flow_mapping at line 559, avg 421ns/call
# once (2µs+0s) by YAML::PP::Parser::parse_tokens at line 350
# once (1µs+0s) by YAML::PP::Parser::end_document at line 636 | ||
81 | 36237 | 55.5ms | # spent 22.8ms within YAML::PP::Parser::set_new_node which was called 36237 times, avg 630ns/call:
# 20941 times (15.6ms+0s) by YAML::PP::Parser::scalar_event at line 724, avg 743ns/call
# 6725 times (3.08ms+0s) by YAML::PP::Parser::cb_insert_map at line 1367, avg 458ns/call
# 6690 times (2.99ms+0s) by YAML::PP::Parser::cb_send_mapkey at line 1049, avg 447ns/call
# 689 times (430µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1239, avg 624ns/call
# 337 times (220µs+0s) by YAML::PP::Parser::cb_end_flowseq at line 1233, avg 653ns/call
# 308 times (197µs+0s) by YAML::PP::Parser::cb_seqstart at line 1141, avg 640ns/call
# 302 times (184µs+0s) by YAML::PP::Parser::cb_seqitem at line 1146, avg 609ns/call
# 214 times (148µs+0s) by YAML::PP::Parser::cb_end_flowmap at line 1268, avg 692ns/call
# 29 times (12µs+0s) by YAML::PP::Parser::cb_flow_colon at line 1248, avg 414ns/call
# once (2µs+0s) by YAML::PP::Parser::start_document at line 508
# once (1µs+0s) by YAML::PP::Parser::init at line 106 | ||
82 | sub tagmap { return $_[0]->{tagmap} } | ||||
83 | 2 | 6µs | sub set_tagmap { $_[0]->{tagmap} = $_[1] } | ||
84 | 13450 | 21.4ms | sub tokens { return $_[0]->{tokens} } | ||
85 | 1 | 2µs | # spent 2µs within YAML::PP::Parser::set_tokens which was called:
# once (2µs+0s) by YAML::PP::Parser::init at line 110 | ||
86 | 70379 | 106ms | # spent 32.7ms within YAML::PP::Parser::event_stack which was called 70379 times, avg 465ns/call:
# 20941 times (8.20ms+0s) by YAML::PP::Parser::scalar_event at line 716, avg 392ns/call
# 12180 times (7.03ms+0s) by YAML::PP::Parser::cb_start_plain at line 1207, avg 577ns/call
# 7497 times (3.65ms+0s) by YAML::PP::Parser::cb_send_scalar at line 1054, avg 487ns/call
# 6725 times (3.05ms+0s) by YAML::PP::Parser::cb_insert_map at line 1362, avg 454ns/call
# 6725 times (2.52ms+0s) by YAML::PP::Parser::start_mapping at line 620, avg 374ns/call
# 6690 times (3.01ms+0s) by YAML::PP::Parser::cb_send_mapkey at line 1047, avg 451ns/call
# 6675 times (3.74ms+0s) by YAML::PP::Parser::cb_mapkey at line 1033, avg 561ns/call
# 2056 times (1.12ms+0s) by YAML::PP::Parser::cb_take_quoted at line 1152, avg 544ns/call
# 337 times (135µs+0s) by YAML::PP::Parser::start_flow_sequence at line 546, avg 401ns/call
# 308 times (136µs+0s) by YAML::PP::Parser::start_sequence at line 521, avg 442ns/call
# 214 times (93µs+0s) by YAML::PP::Parser::start_flow_mapping at line 570, avg 435ns/call
# 29 times (24µs+0s) by YAML::PP::Parser::cb_flowkey_plain at line 1280, avg 828ns/call
# once (1µs+0s) by YAML::PP::Parser::cb_send_block_scalar at line 1409
# once (0s+0s) by YAML::PP::Parser::cb_send_block_scalar at line 1420 | ||
87 | 1 | 2µ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 | ||
88 | 1 | 2µs | # spent 1µs within YAML::PP::Parser::default_yaml_version which was called:
# once (1µs+0s) by YAML::PP::Parser::init at line 113 | ||
89 | 1 | 3µ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 | ||
90 | 1 | 2µ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 | ||
91 | 1 | 3µs | # spent 2µs within YAML::PP::Parser::yaml_version_directive which was called:
# once (2µs+0s) by YAML::PP::Parser::start_document at line 495 | ||
92 | 2 | 5µs | sub set_yaml_version_directive { $_[0]->{yaml_version_directive} = $_[1] } | ||
93 | |||||
94 | 13450 | 21.1ms | sub rule { return $_[0]->{rule} } | ||
95 | # spent 53.4ms within YAML::PP::Parser::set_rule which was called 55080 times, avg 969ns/call:
# 46809 times (45.4ms+0s) by YAML::PP::Parser::parse_tokens at line 408, avg 970ns/call
# 6992 times (6.89ms+0s) by YAML::PP::Parser::parse_tokens at line 434, avg 986ns/call
# 1275 times (1.09ms+0s) by YAML::PP::Parser::parse_tokens at line 415, avg 854ns/call
# once (2µs+0s) by YAML::PP::Parser::init at line 111
# once (2µs+0s) by YAML::PP::Parser::start_document at line 507
# once (1µs+0s) by YAML::PP::Parser::end_document at line 659
# once (1µs+0s) by YAML::PP::Parser::parse at line 154 | ||||
96 | 55080 | 16.0ms | my ($self, $name) = @_; | ||
97 | 2 | 9.01ms | 2 | 79µs | # spent 47µs (15+32) within YAML::PP::Parser::BEGIN@97 which was called:
# once (15µs+32µs) by YAML::PP::Loader::BEGIN@8 at line 97 # spent 47µs making 1 call to YAML::PP::Parser::BEGIN@97
# spent 32µs making 1 call to warnings::unimport |
98 | DEBUG and $self->info("set_rule($name)"); | ||||
99 | 55080 | 110ms | $self->{rule} = $name; | ||
100 | } | ||||
101 | |||||
102 | # spent 61µs (44+17) within YAML::PP::Parser::init which was called:
# once (44µs+17µs) by YAML::PP::Parser::parse at line 150 | ||||
103 | 1 | 0s | my ($self) = @_; | ||
104 | 1 | 1µs | 1 | 2µs | $self->set_offset([]); # spent 2µs making 1 call to YAML::PP::Parser::set_offset |
105 | 1 | 14µs | 1 | 2µs | $self->set_events([]); # spent 2µs making 1 call to YAML::PP::Parser::set_events |
106 | 1 | 2µs | 1 | 1µs | $self->set_new_node(0); # spent 1µs making 1 call to YAML::PP::Parser::set_new_node |
107 | 1 | 1µs | 1 | 1µs | $self->set_tagmap({ # spent 1µs making 1 call to YAML::PP::Parser::set_tagmap |
108 | '!!' => "tag:yaml.org,2002:", | ||||
109 | }); | ||||
110 | 1 | 2µs | 1 | 2µs | $self->set_tokens([]); # spent 2µs making 1 call to YAML::PP::Parser::set_tokens |
111 | 1 | 3µs | 1 | 2µs | $self->set_rule(undef); # spent 2µs making 1 call to YAML::PP::Parser::set_rule |
112 | 1 | 1µs | 1 | 1µs | $self->set_event_stack([]); # spent 1µs making 1 call to YAML::PP::Parser::set_event_stack |
113 | 1 | 3µs | 2 | 2µs | $self->set_yaml_version($self->default_yaml_version); # spent 1µs making 1 call to YAML::PP::Parser::default_yaml_version
# spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version |
114 | 1 | 1µs | 1 | 0s | $self->set_yaml_version_directive(undef); # spent 0s making 1 call to YAML::PP::Parser::set_yaml_version_directive |
115 | 1 | 4µs | 2 | 4µs | $self->lexer->init; # spent 4µs making 1 call to YAML::PP::Lexer::init
# spent 0s making 1 call to YAML::PP::Parser::lexer |
116 | } | ||||
117 | |||||
118 | sub parse_string { | ||||
119 | my ($self, $yaml) = @_; | ||||
120 | $self->set_reader(YAML::PP::Reader->new( input => $yaml )); | ||||
121 | $self->parse(); | ||||
122 | } | ||||
123 | |||||
124 | sub parse_file { | ||||
125 | my ($self, $file) = @_; | ||||
126 | $self->set_reader(YAML::PP::Reader::File->new( input => $file )); | ||||
127 | $self->parse(); | ||||
128 | } | ||||
129 | |||||
130 | 1 | 13µs | my %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 6.98s (25µs+6.98) within YAML::PP::Parser::parse which was called:
# once (25µs+6.98s) by YAML::PP::Loader::load at line 94 of YAML/PP/Loader.pm | ||||
147 | 1 | 0s | my ($self) = @_; | ||
148 | TRACE and warn "=== parse()\n"; | ||||
149 | TRACE and $self->debug_yaml; | ||||
150 | 1 | 2µs | 1 | 61µs | $self->init; # spent 61µs making 1 call to YAML::PP::Parser::init |
151 | 1 | 2µs | 2 | 1µ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 |
152 | 1 | 1µs | eval { | ||
153 | 1 | 1µs | 1 | 17µs | $self->start_stream; # spent 17µs making 1 call to YAML::PP::Parser::start_stream |
154 | 1 | 1µs | 1 | 1µs | $self->set_rule( 'STREAM' ); # spent 1µs making 1 call to YAML::PP::Parser::set_rule |
155 | |||||
156 | 1 | 2µs | 1 | 6.98s | $self->parse_tokens(); # spent 6.98s making 1 call to YAML::PP::Parser::parse_tokens |
157 | |||||
158 | 1 | 3µs | 1 | 27µs | $self->end_stream; # spent 27µs making 1 call to YAML::PP::Parser::end_stream |
159 | }; | ||||
160 | 1 | 1µs | if (my $error = $@) { | ||
161 | if (ref $error) { | ||||
162 | croak "$error\n "; | ||||
163 | } | ||||
164 | croak $error; | ||||
165 | } | ||||
166 | |||||
167 | DEBUG and $self->highlight_yaml; | ||||
168 | 1 | 4µs | TRACE and $self->debug_tokens; | ||
169 | } | ||||
170 | |||||
171 | sub lex_next_tokens { | ||||
172 | 13451 | 3.48ms | my ($self) = @_; | ||
173 | |||||
174 | DEBUG and $self->info("----------------> lex_next_tokens"); | ||||
175 | TRACE and $self->debug_events; | ||||
176 | |||||
177 | 13451 | 13.3ms | 13451 | 7.51ms | my $indent = $self->offset->[-1]; # spent 7.51ms making 13451 calls to YAML::PP::Parser::offset, avg 558ns/call |
178 | 13451 | 8.99ms | 13451 | 5.22ms | my $event_types = $self->events; # spent 5.22ms making 13451 calls to YAML::PP::Parser::events, avg 388ns/call |
179 | 13451 | 23.8ms | 26902 | 1.03s | my $next_tokens = $self->lexer->fetch_next_tokens($indent); # spent 1.03s making 13451 calls to YAML::PP::Lexer::fetch_next_tokens, avg 76µs/call
# spent 6.59ms making 13451 calls to YAML::PP::Parser::lexer, avg 490ns/call |
180 | 13451 | 2.15ms | return unless @$next_tokens; | ||
181 | |||||
182 | 13450 | 4.95ms | my $next = $next_tokens->[0]; | ||
183 | |||||
184 | 13450 | 5.47ms | return 1 if ($next->{name} ne 'SPACE'); | ||
185 | 13449 | 25.6ms | 13449 | 5.17ms | my $flow = $event_types->[-1] =~ m/^FLOW/; # spent 5.17ms making 13449 calls to YAML::PP::Parser::CORE:match, avg 384ns/call |
186 | 13449 | 7.40ms | my $space = length $next->{value}; | ||
187 | 13449 | 12.6ms | 13449 | 10.1ms | my $tokens = $self->tokens; # spent 10.1ms making 13449 calls to YAML::PP::Parser::tokens, avg 754ns/call |
188 | |||||
189 | 13449 | 5.96ms | if (not $space) { | ||
190 | shift @$next_tokens; | ||||
191 | } | ||||
192 | else { | ||||
193 | 13444 | 4.68ms | push @$tokens, shift @$next_tokens; | ||
194 | } | ||||
195 | 13449 | 2.23ms | if ($flow) { | ||
196 | if ($space >= $indent) { | ||||
197 | return 1; | ||||
198 | } | ||||
199 | $self->exception("Bad indendation in " . $self->events->[-1]); | ||||
200 | } | ||||
201 | 13449 | 3.94ms | $next = $next_tokens->[0]; | ||
202 | 13449 | 4.30ms | if ($space > $indent ) { | ||
203 | 6149 | 1.32ms | return 1 if $indent < 0; | ||
204 | 6148 | 4.82ms | 6148 | 3.34ms | unless ($self->new_node) { # spent 3.34ms making 6148 calls to YAML::PP::Parser::new_node, avg 544ns/call |
205 | $self->exception("Bad indendation in " . $self->events->[-1]); | ||||
206 | } | ||||
207 | 6148 | 12.9ms | return 1; | ||
208 | } | ||||
209 | 7300 | 8.92ms | 7300 | 4.18ms | if ($self->new_node) { # spent 4.18ms making 7300 calls to YAML::PP::Parser::new_node, avg 572ns/call |
210 | 308 | 305µ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 | ||||
216 | 308 | 615µs | 308 | 182µs | my $exp = $self->events->[-1]; # spent 182µs making 308 calls to YAML::PP::Parser::events, avg 591ns/call |
217 | 308 | 211µs | my $seq_start = $next->{name} eq 'DASH'; | ||
218 | 308 | 363µ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 { | ||||
226 | 6992 | 6.17ms | 2815 | 294ms | if ($space < $indent) { # spent 294ms making 2815 calls to YAML::PP::Parser::remove_nodes, avg 104µs/call |
227 | $self->remove_nodes($space); | ||||
228 | } | ||||
229 | } | ||||
230 | |||||
231 | 7300 | 8.30ms | 7300 | 3.95ms | my $exp = $self->events->[-1]; # spent 3.95ms making 7300 calls to YAML::PP::Parser::events, avg 541ns/call |
232 | |||||
233 | 7300 | 2.88ms | if ($exp eq 'SEQ0' and $next->{name} ne 'DASH') { | ||
234 | TRACE and $self->info("In unindented sequence"); | ||||
235 | 262 | 414µs | 262 | 9.87ms | $self->end_sequence; # spent 9.87ms making 262 calls to YAML::PP::Parser::end_sequence, avg 38µs/call |
236 | 262 | 296µs | 262 | 124µs | $exp = $self->events->[-1]; # spent 124µs making 262 calls to YAML::PP::Parser::events, avg 473ns/call |
237 | } | ||||
238 | |||||
239 | 7300 | 8.30ms | 7300 | 3.43ms | if ($self->offset->[-1] != $space) { # spent 3.43ms making 7300 calls to YAML::PP::Parser::offset, avg 470ns/call |
240 | $self->exception("Expected " . $self->events->[-1]); | ||||
241 | } | ||||
242 | 7300 | 16.5ms | return 1; | ||
243 | } | ||||
244 | |||||
245 | 1 | 12µs | my %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 | |||||
260 | 1 | 15µs | my %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 | |||||
331 | 1 | 3µs | my %fetch_method = ( | ||
332 | '"' => 'fetch_quoted', | ||||
333 | "'" => 'fetch_quoted', | ||||
334 | '|' => 'fetch_block', | ||||
335 | '>' => 'fetch_block', | ||||
336 | '' => 'fetch_plain', | ||||
337 | ); | ||||
338 | |||||
339 | # spent 6.98s (922ms+6.06) within YAML::PP::Parser::parse_tokens which was called:
# once (922ms+6.06s) by YAML::PP::Parser::parse at line 156 | ||||
340 | 1 | 8µs | my ($self) = @_; | ||
341 | 1 | 4µs | 1 | 3µs | my $event_types = $self->events; # spent 3µs making 1 call to YAML::PP::Parser::events |
342 | 1 | 1µs | 1 | 1µs | my $offsets = $self->offset; # spent 1µs making 1 call to YAML::PP::Parser::offset |
343 | 1 | 2µs | 1 | 1µs | my $tokens = $self->tokens; # spent 1µs making 1 call to YAML::PP::Parser::tokens |
344 | 1 | 3µs | 2 | 4µs | my $next_tokens = $self->lexer->next_tokens; # spent 3µs making 1 call to YAML::PP::Lexer::next_tokens
# spent 1µs making 1 call to YAML::PP::Parser::lexer |
345 | |||||
346 | 1 | 2µs | 1 | 3.85ms | unless ($self->lex_next_tokens) { # spent 3.85ms making 1 call to YAML::PP::Parser::lex_next_tokens |
347 | $self->end_document(1); | ||||
348 | return 0; | ||||
349 | } | ||||
350 | 1 | 3µs | 1 | 2µs | unless ($self->new_node) { # spent 2µs making 1 call to YAML::PP::Parser::new_node |
351 | 1 | 3µs | 1 | 2µs | if ($self->level > 0) { # spent 2µ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 | |||||
358 | 1 | 2µs | 1 | 1µs | my $rule_name = $self->rule; # spent 1µs making 1 call to YAML::PP::Parser::rule |
359 | DEBUG and $self->info("----------------> parse_tokens($rule_name)"); | ||||
360 | 1 | 2µ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 | |||||
367 | 1 | 9.75ms | RULE: while ($rule_name) { | ||
368 | DEBUG and $self->info("RULE: $rule_name"); | ||||
369 | TRACE and $self->debug_tokens($next_tokens); | ||||
370 | |||||
371 | 110985 | 14.1ms | unless (@$next_tokens) { | ||
372 | $self->exception("No more tokens"); | ||||
373 | } | ||||
374 | TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$next_tokens->[0]], ['next_token']); | ||||
375 | 110985 | 33.1ms | my $got = $next_tokens->[0]->{name}; | ||
376 | 110985 | 16.8ms | if ($got eq 'CONTEXT') { | ||
377 | 20941 | 4.80ms | my $context = shift @$next_tokens; | ||
378 | 20941 | 4.74ms | my $indent = $offsets->[-1]; | ||
379 | 20941 | 31.7ms | 41882 | 22.2ms | $indent++ unless $self->lexer->flowcontext; # spent 12.2ms making 20941 calls to YAML::PP::Parser::lexer, avg 583ns/call
# spent 10.0ms making 20941 calls to YAML::PP::Lexer::flowcontext, avg 478ns/call |
380 | 20941 | 12.2ms | my $method = $fetch_method{ $context->{value} }; | ||
381 | 20941 | 36.5ms | 41882 | 2.30s | my $partial = $self->lexer->$method($indent, $context->{value}); # spent 1.93s making 18884 calls to YAML::PP::Lexer::fetch_plain, avg 102µs/call
# spent 357ms making 2056 calls to YAML::PP::Lexer::fetch_quoted, avg 174µs/call
# spent 8.08ms making 20941 calls to YAML::PP::Parser::lexer, avg 386ns/call
# spent 320µs making 1 call to YAML::PP::Lexer::fetch_block |
382 | 20941 | 29.0ms | next RULE; | ||
383 | } | ||||
384 | 90044 | 42.8ms | my $def = $rule->{ $got }; | ||
385 | 90044 | 36.9ms | 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"); | ||||
399 | 90044 | 40.2ms | if (my $sub = $def->{match}) { | ||
400 | DEBUG and $self->info("CALLBACK $sub"); | ||||
401 | 43770 | 62.4ms | 43770 | 2.01s | $self->$sub(@$tokens ? $tokens->[-1] : ()); # spent 822ms making 6725 calls to YAML::PP::Parser::cb_insert_map, avg 122µs/call
# spent 488ms making 6675 calls to YAML::PP::Parser::cb_send_mapkey, avg 73µs/call
# spent 397ms making 6470 calls to YAML::PP::Parser::cb_send_scalar, avg 61µs/call
# spent 72.8ms making 12180 calls to YAML::PP::Parser::cb_start_plain, avg 6µs/call
# spent 59.3ms making 689 calls to YAML::PP::Parser::cb_flow_comma, avg 86µs/call
# spent 42.6ms making 337 calls to YAML::PP::Parser::cb_end_flowseq, avg 126µs/call
# spent 42.5ms making 6675 calls to YAML::PP::Parser::cb_mapkey, avg 6µs/call
# spent 19.9ms making 337 calls to YAML::PP::Parser::cb_start_flowseq, avg 59µs/call
# spent 17.8ms making 308 calls to YAML::PP::Parser::cb_seqstart, avg 58µs/call
# spent 16.7ms making 2041 calls to YAML::PP::Parser::cb_take_quoted, avg 8µs/call
# spent 12.3ms making 214 calls to YAML::PP::Parser::cb_start_flowmap, avg 57µs/call
# spent 12.2ms making 214 calls to YAML::PP::Parser::cb_end_flowmap, avg 57µs/call
# spent 2.73ms making 528 calls to YAML::PP::Parser::cb_end_outer_flow, avg 5µs/call
# spent 2.72ms making 29 calls to YAML::PP::Parser::cb_flowkey_plain, avg 94µs/call
# spent 1.44ms making 302 calls to YAML::PP::Parser::cb_seqitem, avg 5µs/call
# spent 1.18ms making 15 calls to YAML::PP::Parser::cb_take_quoted_key, avg 78µs/call
# spent 202µs making 29 calls to YAML::PP::Parser::cb_flow_colon, avg 7µs/call
# spent 124µ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 | } | ||||
403 | 90044 | 19.5ms | my $eol = $got eq 'EOL'; | ||
404 | 90044 | 24.8ms | my $new = $def->{new}; | ||
405 | 90044 | 25.2ms | if ($new) { | ||
406 | DEBUG and $self->got("NEW: $new"); | ||||
407 | 46809 | 8.48ms | $rule_name = $new; | ||
408 | 46809 | 36.4ms | 46809 | 45.4ms | $self->set_rule($rule_name); # spent 45.4ms making 46809 calls to YAML::PP::Parser::set_rule, avg 970ns/call |
409 | } | ||||
410 | elsif ($eol) { | ||||
411 | } | ||||
412 | elsif ($def->{return}) { | ||||
413 | 1275 | 1.03ms | $rule_name = $nodetypes{ $event_types->[-1] } | ||
414 | or die "Unexpected event type $event_types->[-1]"; | ||||
415 | 1275 | 989µs | 1275 | 1.09ms | $self->set_rule($rule_name); # spent 1.09ms making 1275 calls to YAML::PP::Parser::set_rule, avg 854ns/call |
416 | } | ||||
417 | else { | ||||
418 | 34967 | 20.0ms | $rule_name .= " - $got"; # for debugging | ||
419 | 34967 | 4.60ms | $rule = $def; | ||
420 | 34967 | 13.2ms | next RULE; | ||
421 | } | ||||
422 | 55077 | 9.11ms | if ($eol) { | ||
423 | 13450 | 14.5ms | 13450 | 1.65s | unless ($self->lex_next_tokens) { # spent 1.65s making 13450 calls to YAML::PP::Parser::lex_next_tokens, avg 122µs/call |
424 | 1 | 1µs | if ($rule_name eq 'DIRECTIVE') { | ||
425 | $self->exception("Directive needs document start"); | ||||
426 | } | ||||
427 | 1 | 2µs | 1 | 1.76ms | $self->end_document(1); # spent 1.76ms making 1 call to YAML::PP::Parser::end_document |
428 | 1 | 5µs | return 0; | ||
429 | } | ||||
430 | 13449 | 11.9ms | 13449 | 6.48ms | unless ($self->new_node) { # spent 6.48ms making 13449 calls to YAML::PP::Parser::new_node, avg 482ns/call |
431 | 6992 | 10.7ms | 6992 | 9.30ms | if ($self->level > 0) { # spent 9.30ms making 6992 calls to YAML::PP::Parser::level, avg 1µs/call |
432 | 6992 | 5.61ms | $rule_name = $nodetypes{ $event_types->[-1] } | ||
433 | or die "Did not find '$event_types->[-1]'"; | ||||
434 | 6992 | 5.41ms | 6992 | 6.89ms | $self->set_rule( $rule_name ); # spent 6.89ms making 6992 calls to YAML::PP::Parser::set_rule, avg 986ns/call |
435 | } | ||||
436 | } | ||||
437 | 13449 | 15.3ms | 13449 | 10.5ms | $rule_name = $self->rule; # spent 10.5ms making 13449 calls to YAML::PP::Parser::rule, avg 783ns/call |
438 | } | ||||
439 | 55076 | 89.3ms | $rule = $GRAMMAR->{ $rule_name } | ||
440 | or die "Unexpected rule $rule_name"; | ||||
441 | |||||
442 | } | ||||
443 | |||||
444 | die "Unexpected"; | ||||
445 | } | ||||
446 | |||||
447 | # spent 9.87ms (3.62+6.25) within YAML::PP::Parser::end_sequence which was called 262 times, avg 38µs/call:
# 262 times (3.62ms+6.25ms) by YAML::PP::Parser::lex_next_tokens at line 235, avg 38µs/call | ||||
448 | 262 | 124µs | my ($self) = @_; | ||
449 | 262 | 214µs | 262 | 113µs | my $event_types = $self->events; # spent 113µs making 262 calls to YAML::PP::Parser::events, avg 431ns/call |
450 | 262 | 109µs | pop @{ $event_types }; | ||
451 | 262 | 338µs | 262 | 134µs | pop @{ $self->offset }; # spent 134µs making 262 calls to YAML::PP::Parser::offset, avg 511ns/call |
452 | 262 | 229µs | my $info = { name => 'sequence_end_event' }; | ||
453 | 262 | 501µs | 524 | 6.00ms | $self->callback->($self, $info->{name} => $info ); # spent 5.88ms making 262 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 22µs/call
# spent 120µs making 262 calls to YAML::PP::Parser::callback, avg 458ns/call |
454 | 262 | 952µs | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
455 | } | ||||
456 | |||||
457 | sub remove_nodes { | ||||
458 | 2816 | 1.25ms | my ($self, $space) = @_; | ||
459 | 2816 | 3.16ms | 2816 | 1.58ms | my $offset = $self->offset; # spent 1.58ms making 2816 calls to YAML::PP::Parser::offset, avg 561ns/call |
460 | 2816 | 2.78ms | 2816 | 1.12ms | my $event_types = $self->events; # spent 1.12ms making 2816 calls to YAML::PP::Parser::events, avg 397ns/call |
461 | |||||
462 | 2816 | 1.38ms | my $exp = $event_types->[-1]; | ||
463 | 2816 | 1.07ms | while (@$offset) { | ||
464 | 9587 | 3.24ms | if ($offset->[ -1 ] <= $space) { | ||
465 | 2816 | 1.36ms | last; | ||
466 | } | ||||
467 | 6771 | 1.70ms | if ($exp eq 'MAPVALUE') { | ||
468 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | ||||
469 | $exp = 'MAP'; | ||||
470 | } | ||||
471 | 6771 | 4.32ms | my $info = { name => $exp }; | ||
472 | 6771 | 5.10ms | $info->{name} = $event_to_method{ $exp } . '_end_event'; | ||
473 | 6771 | 2.04ms | pop @{ $event_types }; | ||
474 | 6771 | 1.18ms | pop @{ $offset }; | ||
475 | 6771 | 10.7ms | 13542 | 218ms | $self->callback->($self, $info->{name} => $info ); # spent 214ms making 6771 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 32µs/call
# spent 3.78ms making 6771 calls to YAML::PP::Parser::callback, avg 559ns/call |
476 | 6771 | 4.84ms | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
477 | 6771 | 6.49ms | $exp = $event_types->[-1]; | ||
478 | } | ||||
479 | 2816 | 6.51ms | return $exp; | ||
480 | } | ||||
481 | |||||
482 | # spent 17µs (11+6) within YAML::PP::Parser::start_stream which was called:
# once (11µs+6µs) by YAML::PP::Parser::parse at line 153 | ||||
483 | 1 | 1µs | my ($self) = @_; | ||
484 | 1 | 1µs | 1 | 1µs | push @{ $self->events }, 'STR'; # spent 1µs making 1 call to YAML::PP::Parser::events |
485 | 1 | 3µs | 1 | 1µs | push @{ $self->offset }, -1; # spent 1µs making 1 call to YAML::PP::Parser::offset |
486 | 1 | 4µs | 2 | 4µ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 119µs (35+84) within YAML::PP::Parser::start_document which was called:
# once (35µs+84µs) by YAML::PP::Parser::cb_doc_start_explicit at line 1441 | ||||
492 | 1 | 0s | my ($self, $implicit) = @_; | ||
493 | 1 | 3µs | 1 | 1µs | push @{ $self->events }, 'DOC'; # spent 1µs making 1 call to YAML::PP::Parser::events |
494 | 1 | 2µs | 1 | 0s | push @{ $self->offset }, -1; # spent 0s making 1 call to YAML::PP::Parser::offset |
495 | 1 | 2µs | 1 | 2µs | my $directive = $self->yaml_version_directive; # spent 2µs making 1 call to YAML::PP::Parser::yaml_version_directive |
496 | 1 | 1µs | my %directive; | ||
497 | 1 | 0s | if ($directive) { | ||
498 | my ($major, $minor) = split m/\./, $self->yaml_version; | ||||
499 | %directive = ( version_directive => { major => $major, minor => $minor } ); | ||||
500 | } | ||||
501 | 1 | 10µs | 2 | 76µs | $self->callback->($self, 'document_start_event', { # spent 74µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62]
# spent 2µs making 1 call to YAML::PP::Parser::callback |
502 | name => 'document_start_event', | ||||
503 | implicit => $implicit, | ||||
504 | %directive, | ||||
505 | }); | ||||
506 | 1 | 2µs | 1 | 1µs | $self->set_yaml_version_directive(undef); # spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version_directive |
507 | 1 | 1µs | 1 | 2µs | $self->set_rule( 'FULLNODE' ); # spent 2µs making 1 call to YAML::PP::Parser::set_rule |
508 | 1 | 6µs | 1 | 2µs | $self->set_new_node(1); # spent 2µs making 1 call to YAML::PP::Parser::set_new_node |
509 | } | ||||
510 | |||||
511 | # spent 15.2ms (4.89+10.3) within YAML::PP::Parser::start_sequence which was called 308 times, avg 49µs/call:
# 308 times (4.89ms+10.3ms) by YAML::PP::Parser::cb_seqstart at line 1140, avg 49µs/call | ||||
512 | 308 | 139µs | my ($self, $offset) = @_; | ||
513 | 308 | 271µs | 308 | 152µs | my $offsets = $self->offset; # spent 152µs making 308 calls to YAML::PP::Parser::offset, avg 494ns/call |
514 | 308 | 563µs | 308 | 120µs | if ($offsets->[-1] == $offset) { # spent 120µs making 308 calls to YAML::PP::Parser::events, avg 390ns/call |
515 | push @{ $self->events }, 'SEQ0'; | ||||
516 | } | ||||
517 | else { | ||||
518 | push @{ $self->events }, 'SEQ'; | ||||
519 | } | ||||
520 | 308 | 138µs | push @{ $offsets }, $offset; | ||
521 | 308 | 350µs | 308 | 136µs | my $event_stack = $self->event_stack; # spent 136µs making 308 calls to YAML::PP::Parser::event_stack, avg 442ns/call |
522 | 308 | 330µs | my $info = { name => 'sequence_start_event' }; | ||
523 | 308 | 130µ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 | } | ||||
527 | 308 | 1.24ms | 616 | 9.94ms | $self->callback->($self, 'sequence_start_event', $info); # spent 9.79ms making 308 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 32µs/call
# spent 151µs making 308 calls to YAML::PP::Parser::callback, avg 490ns/call |
528 | } | ||||
529 | |||||
530 | # spent 18.4ms (7.56+10.8) within YAML::PP::Parser::start_flow_sequence which was called 337 times, avg 55µs/call:
# 337 times (7.56ms+10.8ms) by YAML::PP::Parser::cb_start_flowseq at line 1221, avg 55µs/call | ||||
531 | 337 | 151µs | my ($self, $offset) = @_; | ||
532 | 337 | 362µs | 337 | 179µs | my $offsets = $self->offset; # spent 179µs making 337 calls to YAML::PP::Parser::offset, avg 531ns/call |
533 | 337 | 183µs | my $new_offset = $offsets->[-1]; | ||
534 | 337 | 360µs | 337 | 146µs | my $event_types = $self->events; # spent 146µs making 337 calls to YAML::PP::Parser::events, avg 433ns/call |
535 | 337 | 571µs | 337 | 140µs | if ($new_offset < 0) { # spent 140µs making 337 calls to YAML::PP::Parser::new_node, avg 415ns/call |
536 | $new_offset = 0; | ||||
537 | } | ||||
538 | elsif ($self->new_node) { | ||||
539 | 337 | 901µs | 337 | 218µs | if ($event_types->[-1] !~ m/^FLOW/) { # spent 218µs making 337 calls to YAML::PP::Parser::CORE:match, avg 647ns/call |
540 | $new_offset++; | ||||
541 | } | ||||
542 | } | ||||
543 | 337 | 397µs | 337 | 117µs | push @{ $self->events }, 'FLOWSEQ'; # spent 117µs making 337 calls to YAML::PP::Parser::events, avg 347ns/call |
544 | 337 | 144µs | push @{ $offsets }, $new_offset; | ||
545 | |||||
546 | 337 | 340µs | 337 | 135µs | my $event_stack = $self->event_stack; # spent 135µs making 337 calls to YAML::PP::Parser::event_stack, avg 401ns/call |
547 | 337 | 395µs | my $info = { style => YAML_FLOW_SEQUENCE_STYLE, name => 'sequence_start_event' }; | ||
548 | 337 | 102µs | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||
549 | $self->fetch_inline_properties($event_stack, $info); | ||||
550 | } | ||||
551 | 337 | 1.30ms | 674 | 9.91ms | $self->callback->($self, 'sequence_start_event', $info); # spent 9.79ms making 337 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 29µs/call
# spent 120µs making 337 calls to YAML::PP::Parser::callback, avg 356ns/call |
552 | } | ||||
553 | |||||
554 | # spent 11.5ms (4.70+6.83) within YAML::PP::Parser::start_flow_mapping which was called 214 times, avg 54µs/call:
# 214 times (4.70ms+6.83ms) by YAML::PP::Parser::cb_start_flowmap at line 1226, avg 54µs/call | ||||
555 | 214 | 87µs | my ($self, $offset, $implicit_flowseq_map) = @_; | ||
556 | 214 | 193µs | 214 | 123µs | my $offsets = $self->offset; # spent 123µs making 214 calls to YAML::PP::Parser::offset, avg 575ns/call |
557 | 214 | 74µs | my $new_offset = $offsets->[-1]; | ||
558 | 214 | 205µs | 214 | 69µs | my $event_types = $self->events; # spent 69µs making 214 calls to YAML::PP::Parser::events, avg 322ns/call |
559 | 214 | 302µs | 214 | 90µs | if ($new_offset < 0) { # spent 90µs making 214 calls to YAML::PP::Parser::new_node, avg 421ns/call |
560 | $new_offset = 0; | ||||
561 | } | ||||
562 | elsif ($self->new_node) { | ||||
563 | 214 | 500µs | 214 | 133µs | if ($event_types->[-1] !~ m/^FLOW/) { # spent 133µs making 214 calls to YAML::PP::Parser::CORE:match, avg 621ns/call |
564 | $new_offset++; | ||||
565 | } | ||||
566 | } | ||||
567 | 214 | 422µs | 214 | 86µs | push @{ $self->events }, $implicit_flowseq_map ? 'IMAP' : 'FLOWMAP'; # spent 86µs making 214 calls to YAML::PP::Parser::events, avg 402ns/call |
568 | 214 | 82µs | push @{ $offsets }, $new_offset; | ||
569 | |||||
570 | 214 | 229µs | 214 | 93µs | my $event_stack = $self->event_stack; # spent 93µs making 214 calls to YAML::PP::Parser::event_stack, avg 435ns/call |
571 | 214 | 315µs | my $info = { name => 'mapping_start_event', style => YAML_FLOW_MAPPING_STYLE }; | ||
572 | 214 | 64µs | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||
573 | $self->fetch_inline_properties($event_stack, $info); | ||||
574 | } | ||||
575 | 214 | 812µs | 428 | 6.23ms | $self->callback->($self, 'mapping_start_event', $info); # spent 6.14ms making 214 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 29µs/call
# spent 95µs making 214 calls to YAML::PP::Parser::callback, avg 444ns/call |
576 | } | ||||
577 | |||||
578 | # spent 15.0ms (5.20+9.85) within YAML::PP::Parser::end_flow_sequence which was called 337 times, avg 45µs/call:
# 337 times (5.20ms+9.85ms) by YAML::PP::Parser::cb_end_flowseq at line 1232, avg 45µs/call | ||||
579 | 337 | 182µs | my ($self) = @_; | ||
580 | 337 | 523µs | 337 | 131µs | my $event_types = $self->events; # spent 131µs making 337 calls to YAML::PP::Parser::events, avg 389ns/call |
581 | 337 | 179µs | pop @{ $event_types }; | ||
582 | 337 | 423µs | 337 | 189µs | pop @{ $self->offset }; # spent 189µs making 337 calls to YAML::PP::Parser::offset, avg 561ns/call |
583 | 337 | 266µs | my $info = { name => 'sequence_end_event' }; | ||
584 | 337 | 737µs | 674 | 8.91ms | $self->callback->($self, $info->{name}, $info); # spent 8.78ms making 337 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 26µs/call
# spent 136µs making 337 calls to YAML::PP::Parser::callback, avg 404ns/call |
585 | 337 | 2.70ms | 337 | 612µs | if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { # spent 612µs making 337 calls to YAML::PP::Parser::CORE:match, avg 2µs/call |
586 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||||
587 | } | ||||
588 | else { | ||||
589 | 314 | 139µs | push @$event_types, 'END_FLOW'; | ||
590 | } | ||||
591 | } | ||||
592 | |||||
593 | # spent 10.7ms (3.25+7.47) within YAML::PP::Parser::end_flow_mapping which was called 214 times, avg 50µs/call:
# 214 times (3.25ms+7.47ms) by YAML::PP::Parser::cb_end_flowmap at line 1267, avg 50µs/call | ||||
594 | 214 | 133µs | my ($self) = @_; | ||
595 | 214 | 270µs | 214 | 197µs | my $event_types = $self->events; # spent 197µs making 214 calls to YAML::PP::Parser::events, avg 921ns/call |
596 | 214 | 102µs | pop @{ $event_types }; | ||
597 | 214 | 245µs | 214 | 96µs | pop @{ $self->offset }; # spent 96µs making 214 calls to YAML::PP::Parser::offset, avg 449ns/call |
598 | 214 | 170µs | my $info = { name => 'mapping_end_event' }; | ||
599 | 214 | 333µs | 428 | 6.73ms | $self->callback->($self, $info->{name}, $info); # spent 6.64ms making 214 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 31µs/call
# spent 99µs making 214 calls to YAML::PP::Parser::callback, avg 463ns/call |
600 | 214 | 1.64ms | 214 | 443µs | if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { # spent 443µs making 214 calls to YAML::PP::Parser::CORE:match, avg 2µs/call |
601 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||||
602 | } | ||||
603 | else { | ||||
604 | 214 | 120µs | push @$event_types, 'END_FLOW'; | ||
605 | } | ||||
606 | } | ||||
607 | |||||
608 | # spent 2.73ms (2.49+236µs) within YAML::PP::Parser::cb_end_outer_flow which was called 528 times, avg 5µs/call:
# 528 times (2.49ms+236µs) by YAML::PP::Parser::parse_tokens at line 401, avg 5µs/call | ||||
609 | 528 | 279µs | my ($self) = @_; | ||
610 | 528 | 479µs | 528 | 236µs | my $event_types = $self->events; # spent 236µs making 528 calls to YAML::PP::Parser::events, avg 447ns/call |
611 | 528 | 334µs | pop @$event_types; | ||
612 | 528 | 1.34ms | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
613 | } | ||||
614 | |||||
615 | # spent 299ms (75.9+223) within YAML::PP::Parser::start_mapping which was called 6725 times, avg 44µs/call:
# 6725 times (75.9ms+223ms) by YAML::PP::Parser::cb_insert_map at line 1365, avg 44µs/call | ||||
616 | 6725 | 2.03ms | my ($self, $offset) = @_; | ||
617 | 6725 | 7.11ms | 6725 | 4.49ms | my $offsets = $self->offset; # spent 4.49ms making 6725 calls to YAML::PP::Parser::offset, avg 668ns/call |
618 | 6725 | 7.66ms | 6725 | 3.33ms | push @{ $self->events }, 'MAP'; # spent 3.33ms making 6725 calls to YAML::PP::Parser::events, avg 495ns/call |
619 | 6725 | 2.39ms | push @{ $offsets }, $offset; | ||
620 | 6725 | 4.17ms | 6725 | 2.52ms | my $event_stack = $self->event_stack; # spent 2.52ms making 6725 calls to YAML::PP::Parser::event_stack, avg 374ns/call |
621 | 6725 | 5.90ms | my $info = { name => 'mapping_start_event' }; | ||
622 | 6725 | 1.43ms | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||
623 | my $properties = pop @$event_stack; | ||||
624 | $self->node_properties($properties->[1], $info); | ||||
625 | } | ||||
626 | 6725 | 21.7ms | 13450 | 213ms | $self->callback->($self, 'mapping_start_event', $info); # spent 209ms making 6725 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 31µs/call
# spent 3.45ms making 6725 calls to YAML::PP::Parser::callback, avg 513ns/call |
627 | } | ||||
628 | |||||
629 | # spent 1.76ms (50µs+1.71) within YAML::PP::Parser::end_document which was called:
# once (50µs+1.71ms) by YAML::PP::Parser::parse_tokens at line 427 | ||||
630 | 1 | 0s | my ($self, $implicit) = @_; | ||
631 | |||||
632 | 1 | 1µs | 1 | 0s | my $event_types = $self->events; # spent 0s making 1 call to YAML::PP::Parser::events |
633 | 1 | 5µs | 1 | 1µs | if ($event_types->[-1] =~ m/FLOW/) { # spent 1µs making 1 call to YAML::PP::Parser::CORE:match |
634 | die "Unexpected end of flow context"; | ||||
635 | } | ||||
636 | 1 | 1µs | 1 | 1µs | if ($self->new_node) { # spent 1µs making 1 call to YAML::PP::Parser::new_node |
637 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | ||||
638 | } | ||||
639 | 1 | 2µs | 1 | 1.67ms | $self->remove_nodes(-1); # spent 1.67ms making 1 call to YAML::PP::Parser::remove_nodes |
640 | |||||
641 | 1 | 1µs | if ($event_types->[-1] eq 'STR') { | ||
642 | return; | ||||
643 | } | ||||
644 | 1 | 0s | my $last = pop @{ $event_types }; | ||
645 | 1 | 0s | if ($last ne 'DOC' and $last ne 'DOC_END') { | ||
646 | $self->exception("Unexpected event type $last"); | ||||
647 | } | ||||
648 | 1 | 2µs | 1 | 1µs | pop @{ $self->offset }; # spent 1µs making 1 call to YAML::PP::Parser::offset |
649 | 1 | 4µs | 2 | 34µs | $self->callback->($self, 'document_end_event', { # spent 33µ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 |
650 | name => 'document_end_event', | ||||
651 | implicit => $implicit, | ||||
652 | }); | ||||
653 | 1 | 5µs | 2 | 4µ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 | } | ||||
658 | 1 | 1µs | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
659 | 1 | 6µs | 1 | 1µs | $self->set_rule('STREAM'); # spent 1µs making 1 call to YAML::PP::Parser::set_rule |
660 | } | ||||
661 | |||||
662 | # spent 27µs (21+6) within YAML::PP::Parser::end_stream which was called:
# once (21µs+6µs) by YAML::PP::Parser::parse at line 158 | ||||
663 | 1 | 0s | my ($self) = @_; | ||
664 | 1 | 2µs | 1 | 0s | my $last = pop @{ $self->events }; # spent 0s making 1 call to YAML::PP::Parser::events |
665 | 1 | 1µs | $self->exception("Unexpected event type $last") unless $last eq 'STR'; | ||
666 | 1 | 2µs | 1 | 1µs | pop @{ $self->offset }; # spent 1µs making 1 call to YAML::PP::Parser::offset |
667 | 1 | 6µs | 2 | 5µs | $self->callback->($self, 'stream_end_event', { # spent 5µ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 | |||||
672 | sub 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 | |||||
699 | sub 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 1.29s (219ms+1.07) within YAML::PP::Parser::scalar_event which was called 20941 times, avg 61µs/call:
# 7497 times (75.9ms+324ms) by YAML::PP::Parser::cb_send_scalar at line 1056, avg 53µs/call
# 6725 times (70.1ms+378ms) by YAML::PP::Parser::cb_insert_map at line 1366, avg 67µs/call
# 6690 times (72.3ms+362ms) by YAML::PP::Parser::cb_send_mapkey at line 1048, avg 65µs/call
# 29 times (367µs+2.00ms) by YAML::PP::Parser::cb_flowkey_plain at line 1289, avg 82µs/call | ||||
714 | 20941 | 4.29ms | my ($self, $info) = @_; | ||
715 | 20941 | 16.9ms | 20941 | 11.4ms | my $event_types = $self->events; # spent 11.4ms making 20941 calls to YAML::PP::Parser::events, avg 545ns/call |
716 | 20941 | 12.1ms | 20941 | 8.20ms | my $event_stack = $self->event_stack; # spent 8.20ms making 20941 calls to YAML::PP::Parser::event_stack, avg 392ns/call |
717 | 20941 | 3.97ms | 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 | |||||
722 | 20941 | 8.97ms | $info->{name} = 'scalar_event'; | ||
723 | 20941 | 30.1ms | 41882 | 1.03s | $self->callback->($self, 'scalar_event', $info); # spent 1.02s making 20941 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 49µs/call
# spent 10.1ms making 20941 calls to YAML::PP::Parser::callback, avg 483ns/call |
724 | 20941 | 19.4ms | 20941 | 15.6ms | $self->set_new_node(0); # spent 15.6ms making 20941 calls to YAML::PP::Parser::set_new_node, avg 743ns/call |
725 | 20941 | 50.3ms | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
726 | } | ||||
727 | |||||
728 | sub 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 | |||||
741 | sub 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 | |||||
757 | sub _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 | ||||
779 | sub 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 | |||||
788 | sub 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 | |||||
797 | sub 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 | |||||
811 | sub 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 | |||||
822 | sub 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 | |||||
832 | sub note { | ||||
833 | my ($self, $msg) = @_; | ||||
834 | $self->_colorize_warn(["yellow"], "============ $msg"); | ||||
835 | } | ||||
836 | |||||
837 | sub info { | ||||
838 | my ($self, $msg) = @_; | ||||
839 | $self->_colorize_warn(["cyan"], "============ $msg"); | ||||
840 | } | ||||
841 | |||||
842 | sub got { | ||||
843 | my ($self, $msg) = @_; | ||||
844 | $self->_colorize_warn(["green"], "============ $msg"); | ||||
845 | } | ||||
846 | |||||
847 | sub _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 | |||||
854 | sub 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 | |||||
862 | sub 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 | |||||
889 | sub 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 | |||||
910 | sub 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 | |||||
918 | sub 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 | |||||
948 | sub 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 | |||||
961 | sub 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 | |||||
977 | sub _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 | |||||
1005 | sub 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 | |||||
1022 | sub 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 42.5ms (38.7+3.74) within YAML::PP::Parser::cb_mapkey which was called 6675 times, avg 6µs/call:
# 6675 times (38.7ms+3.74ms) by YAML::PP::Parser::parse_tokens at line 401, avg 6µs/call | ||||
1032 | 6675 | 2.08ms | my ($self, $token) = @_; | ||
1033 | 6675 | 5.75ms | 6675 | 3.74ms | my $stack = $self->event_stack; # spent 3.74ms making 6675 calls to YAML::PP::Parser::event_stack, avg 561ns/call |
1034 | my $info = { | ||||
1035 | style => YAML_PLAIN_SCALAR_STYLE, | ||||
1036 | value => $token->{value}, | ||||
1037 | offset => $token->{column}, | ||||
1038 | 6675 | 10.6ms | }; | ||
1039 | 6675 | 2.25ms | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1040 | $self->fetch_inline_properties($stack, $info); | ||||
1041 | } | ||||
1042 | 6675 | 15.3ms | push @{ $stack }, [ scalar => $info ]; | ||
1043 | } | ||||
1044 | |||||
1045 | sub cb_send_mapkey { | ||||
1046 | 6690 | 1.42ms | my ($self, $res) = @_; | ||
1047 | 6690 | 7.00ms | 6690 | 3.01ms | my $last = pop @{ $self->event_stack }; # spent 3.01ms making 6690 calls to YAML::PP::Parser::event_stack, avg 451ns/call |
1048 | 6690 | 6.86ms | 6690 | 434ms | $self->scalar_event($last->[1]); # spent 434ms making 6690 calls to YAML::PP::Parser::scalar_event, avg 65µs/call |
1049 | 6690 | 20.8ms | 6690 | 2.99ms | $self->set_new_node(1); # spent 2.99ms making 6690 calls to YAML::PP::Parser::set_new_node, avg 447ns/call |
1050 | } | ||||
1051 | |||||
1052 | # spent 472ms (64.4+408) within YAML::PP::Parser::cb_send_scalar which was called 7497 times, avg 63µs/call:
# 6470 times (54.4ms+342ms) by YAML::PP::Parser::parse_tokens at line 401, avg 61µs/call
# 689 times (7.07ms+44.4ms) by YAML::PP::Parser::cb_flow_comma at line 1241, avg 75µs/call
# 337 times (2.89ms+21.0ms) by YAML::PP::Parser::cb_end_flowseq at line 1231, avg 71µs/call
# once (6µs+17µs) by YAML::PP::Parser::cb_send_block_scalar at line 1421 | ||||
1053 | 7497 | 2.28ms | my ($self, $res) = @_; | ||
1054 | 7497 | 7.61ms | 7497 | 3.65ms | my $last = pop @{ $self->event_stack }; # spent 3.65ms making 7497 calls to YAML::PP::Parser::event_stack, avg 487ns/call |
1055 | 7497 | 1.27ms | return unless $last; | ||
1056 | 7497 | 6.93ms | 7497 | 400ms | $self->scalar_event($last->[1]); # spent 400ms making 7497 calls to YAML::PP::Parser::scalar_event, avg 53µs/call |
1057 | 7497 | 6.36ms | 7497 | 3.60ms | my $e = $self->events; # spent 3.60ms making 7497 calls to YAML::PP::Parser::events, avg 480ns/call |
1058 | 7497 | 23.4ms | if ($e->[-1] eq 'IMAP') { | ||
1059 | $self->end_flow_mapping; | ||||
1060 | } | ||||
1061 | } | ||||
1062 | |||||
1063 | sub 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 | |||||
1078 | sub cb_send_flow_alias { | ||||
1079 | my ($self, $token) = @_; | ||||
1080 | my $alias = substr($token->{value}, 1); | ||||
1081 | $self->alias_event({ value => $alias }); | ||||
1082 | } | ||||
1083 | |||||
1084 | sub cb_send_alias { | ||||
1085 | my ($self, $token) = @_; | ||||
1086 | my $alias = substr($token->{value}, 1); | ||||
1087 | $self->alias_event({ value => $alias }); | ||||
1088 | } | ||||
1089 | |||||
1090 | sub 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 | |||||
1097 | sub cb_send_alias_from_stack { | ||||
1098 | my ($self, $token) = @_; | ||||
1099 | my $last = pop @{ $self->event_stack }; | ||||
1100 | $self->alias_event($last->[1]); | ||||
1101 | } | ||||
1102 | |||||
1103 | sub 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 | |||||
1112 | sub cb_question { | ||||
1113 | my ($self, $res) = @_; | ||||
1114 | $self->set_new_node(1); | ||||
1115 | } | ||||
1116 | |||||
1117 | sub cb_flow_question { | ||||
1118 | my ($self, $res) = @_; | ||||
1119 | $self->set_new_node(2); | ||||
1120 | } | ||||
1121 | |||||
1122 | sub cb_empty_complexvalue { | ||||
1123 | my ($self, $res) = @_; | ||||
1124 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | ||||
1125 | } | ||||
1126 | |||||
1127 | sub cb_questionstart { | ||||
1128 | my ($self, $token) = @_; | ||||
1129 | $self->start_mapping($token->{column}); | ||||
1130 | } | ||||
1131 | |||||
1132 | sub cb_complexcolon { | ||||
1133 | my ($self, $res) = @_; | ||||
1134 | $self->set_new_node(1); | ||||
1135 | } | ||||
1136 | |||||
1137 | # spent 17.8ms (2.39+15.4) within YAML::PP::Parser::cb_seqstart which was called 308 times, avg 58µs/call:
# 308 times (2.39ms+15.4ms) by YAML::PP::Parser::parse_tokens at line 401, avg 58µs/call | ||||
1138 | 308 | 200µs | my ($self, $token) = @_; | ||
1139 | 308 | 175µs | my $column = $token->{column}; | ||
1140 | 308 | 604µs | 308 | 15.2ms | $self->start_sequence($column); # spent 15.2ms making 308 calls to YAML::PP::Parser::start_sequence, avg 49µs/call |
1141 | 308 | 1.00ms | 308 | 197µs | $self->set_new_node(1); # spent 197µs making 308 calls to YAML::PP::Parser::set_new_node, avg 640ns/call |
1142 | } | ||||
1143 | |||||
1144 | # spent 1.44ms (1.26+184µs) within YAML::PP::Parser::cb_seqitem which was called 302 times, avg 5µs/call:
# 302 times (1.26ms+184µs) by YAML::PP::Parser::parse_tokens at line 401, avg 5µs/call | ||||
1145 | 302 | 123µs | my ($self, $res) = @_; | ||
1146 | 302 | 964µs | 302 | 184µs | $self->set_new_node(1); # spent 184µs making 302 calls to YAML::PP::Parser::set_new_node, avg 609ns/call |
1147 | } | ||||
1148 | |||||
1149 | sub cb_take_quoted { | ||||
1150 | 2056 | 806µs | my ($self, $token) = @_; | ||
1151 | 2056 | 791µs | my $subtokens = $token->{subtokens}; | ||
1152 | 2056 | 2.41ms | 2056 | 1.12ms | my $stack = $self->event_stack; # spent 1.12ms making 2056 calls to YAML::PP::Parser::event_stack, avg 544ns/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}, | ||||
1159 | 2056 | 5.00ms | }; | ||
1160 | 2056 | 625µs | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1161 | $self->fetch_inline_properties($stack, $info); | ||||
1162 | } | ||||
1163 | 2056 | 4.92ms | push @{ $stack }, [ scalar => $info ]; | ||
1164 | } | ||||
1165 | |||||
1166 | sub 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 1.18ms (107µs+1.07) within YAML::PP::Parser::cb_take_quoted_key which was called 15 times, avg 78µs/call:
# 15 times (107µs+1.07ms) by YAML::PP::Parser::parse_tokens at line 401, avg 78µs/call | ||||
1185 | 15 | 4µs | my ($self, $token) = @_; | ||
1186 | 15 | 28µs | 15 | 136µs | $self->cb_take_quoted($token); # spent 136µs making 15 calls to YAML::PP::Parser::cb_take_quoted, avg 9µs/call |
1187 | 15 | 47µs | 15 | 932µs | $self->cb_send_mapkey; # spent 932µs making 15 calls to YAML::PP::Parser::cb_send_mapkey, avg 62µs/call |
1188 | } | ||||
1189 | |||||
1190 | sub 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 72.8ms (65.8+7.03) within YAML::PP::Parser::cb_start_plain which was called 12180 times, avg 6µs/call:
# 12180 times (65.8ms+7.03ms) by YAML::PP::Parser::parse_tokens at line 401, avg 6µs/call | ||||
1206 | 12180 | 3.37ms | my ($self, $token) = @_; | ||
1207 | 12180 | 10.5ms | 12180 | 7.03ms | my $stack = $self->event_stack; # spent 7.03ms making 12180 calls to YAML::PP::Parser::event_stack, avg 577ns/call |
1208 | my $info = { | ||||
1209 | style => YAML_PLAIN_SCALAR_STYLE, | ||||
1210 | value => $token->{value}, | ||||
1211 | offset => $token->{column}, | ||||
1212 | 12180 | 19.3ms | }; | ||
1213 | 12180 | 2.44ms | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1214 | $self->fetch_inline_properties($stack, $info); | ||||
1215 | } | ||||
1216 | 12180 | 25.7ms | push @{ $stack }, [ scalar => $info ]; | ||
1217 | } | ||||
1218 | |||||
1219 | # spent 19.9ms (1.44+18.4) within YAML::PP::Parser::cb_start_flowseq which was called 337 times, avg 59µs/call:
# 337 times (1.44ms+18.4ms) by YAML::PP::Parser::parse_tokens at line 401, avg 59µs/call | ||||
1220 | 337 | 191µs | my ($self, $token) = @_; | ||
1221 | 337 | 1.28ms | 337 | 18.4ms | $self->start_flow_sequence($token->{column}); # spent 18.4ms making 337 calls to YAML::PP::Parser::start_flow_sequence, avg 55µs/call |
1222 | } | ||||
1223 | |||||
1224 | # spent 12.3ms (762µs+11.5) within YAML::PP::Parser::cb_start_flowmap which was called 214 times, avg 57µs/call:
# 214 times (762µs+11.5ms) by YAML::PP::Parser::parse_tokens at line 401, avg 57µs/call | ||||
1225 | 214 | 96µs | my ($self, $token) = @_; | ||
1226 | 214 | 658µs | 214 | 11.5ms | $self->start_flow_mapping($token->{column}); # spent 11.5ms making 214 calls to YAML::PP::Parser::start_flow_mapping, avg 54µs/call |
1227 | } | ||||
1228 | |||||
1229 | # spent 42.6ms (3.47+39.1) within YAML::PP::Parser::cb_end_flowseq which was called 337 times, avg 126µs/call:
# 337 times (3.47ms+39.1ms) by YAML::PP::Parser::parse_tokens at line 401, avg 126µs/call | ||||
1230 | 337 | 158µs | my ($self, $res) = @_; | ||
1231 | 337 | 456µs | 337 | 23.8ms | $self->cb_send_scalar; # spent 23.8ms making 337 calls to YAML::PP::Parser::cb_send_scalar, avg 71µs/call |
1232 | 337 | 812µs | 337 | 15.0ms | $self->end_flow_sequence; # spent 15.0ms making 337 calls to YAML::PP::Parser::end_flow_sequence, avg 45µs/call |
1233 | 337 | 914µs | 337 | 220µs | $self->set_new_node(0); # spent 220µs making 337 calls to YAML::PP::Parser::set_new_node, avg 653ns/call |
1234 | } | ||||
1235 | |||||
1236 | # spent 59.3ms (6.43+52.9) within YAML::PP::Parser::cb_flow_comma which was called 689 times, avg 86µs/call:
# 689 times (6.43ms+52.9ms) by YAML::PP::Parser::parse_tokens at line 401, avg 86µs/call | ||||
1237 | 689 | 191µs | my ($self) = @_; | ||
1238 | 689 | 735µs | 689 | 500µs | my $event_types = $self->events; # spent 500µs making 689 calls to YAML::PP::Parser::events, avg 726ns/call |
1239 | 689 | 643µs | 689 | 430µs | $self->set_new_node(0); # spent 430µs making 689 calls to YAML::PP::Parser::set_new_node, avg 624ns/call |
1240 | 689 | 2.77ms | 689 | 512µs | if ($event_types->[-1] =~ m/^FLOWSEQ/) { # spent 512µs making 689 calls to YAML::PP::Parser::CORE:match, avg 743ns/call |
1241 | 689 | 723µs | 689 | 51.4ms | $self->cb_send_scalar; # spent 51.4ms making 689 calls to YAML::PP::Parser::cb_send_scalar, avg 75µs/call |
1242 | 689 | 431µs | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
1243 | } | ||||
1244 | } | ||||
1245 | |||||
1246 | # spent 202µs (190+12) within YAML::PP::Parser::cb_flow_colon which was called 29 times, avg 7µs/call:
# 29 times (190µs+12µs) by YAML::PP::Parser::parse_tokens at line 401, avg 7µs/call | ||||
1247 | 29 | 10µs | my ($self) = @_; | ||
1248 | 29 | 72µs | 29 | 12µs | $self->set_new_node(1); # spent 12µs making 29 calls to YAML::PP::Parser::set_new_node, avg 414ns/call |
1249 | } | ||||
1250 | |||||
1251 | sub 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 12.2ms (1.33+10.9) within YAML::PP::Parser::cb_end_flowmap which was called 214 times, avg 57µs/call:
# 214 times (1.33ms+10.9ms) by YAML::PP::Parser::parse_tokens at line 401, avg 57µs/call | ||||
1266 | 214 | 89µs | my ($self, $res) = @_; | ||
1267 | 214 | 415µs | 214 | 10.7ms | $self->end_flow_mapping; # spent 10.7ms making 214 calls to YAML::PP::Parser::end_flow_mapping, avg 50µs/call |
1268 | 214 | 604µs | 214 | 148µs | $self->set_new_node(0); # spent 148µs making 214 calls to YAML::PP::Parser::set_new_node, avg 692ns/call |
1269 | } | ||||
1270 | |||||
1271 | sub 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 2.72ms (325µs+2.39) within YAML::PP::Parser::cb_flowkey_plain which was called 29 times, avg 94µs/call:
# 29 times (325µs+2.39ms) by YAML::PP::Parser::parse_tokens at line 401, avg 94µs/call | ||||
1279 | 29 | 57µs | my ($self, $token) = @_; | ||
1280 | 29 | 38µs | 29 | 24µs | my $stack = $self->event_stack; # spent 24µs making 29 calls to YAML::PP::Parser::event_stack, avg 828ns/call |
1281 | my $info = { | ||||
1282 | style => YAML_PLAIN_SCALAR_STYLE, | ||||
1283 | value => $token->{value}, | ||||
1284 | offset => $token->{column}, | ||||
1285 | 29 | 61µs | }; | ||
1286 | 29 | 9µs | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1287 | $self->fetch_inline_properties($stack, $info); | ||||
1288 | } | ||||
1289 | 29 | 107µs | 29 | 2.37ms | $self->scalar_event($info); # spent 2.37ms making 29 calls to YAML::PP::Parser::scalar_event, avg 82µs/call |
1290 | } | ||||
1291 | |||||
1292 | sub 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 | |||||
1309 | sub 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 | |||||
1316 | sub 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 | |||||
1324 | sub 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 | |||||
1338 | sub cb_empty_flowseq_comma { | ||||
1339 | my ($self, $token) = @_; | ||||
1340 | $self->cb_empty_flowmap_value($token); | ||||
1341 | $self->cb_flow_comma; | ||||
1342 | } | ||||
1343 | |||||
1344 | sub cb_empty_flowseq_end { | ||||
1345 | my ($self, $token) = @_; | ||||
1346 | $self->cb_empty_flowmap_value($token); | ||||
1347 | $self->cb_end_flowseq; | ||||
1348 | } | ||||
1349 | |||||
1350 | sub 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 822ms (68.0+753) within YAML::PP::Parser::cb_insert_map which was called 6725 times, avg 122µs/call:
# 6725 times (68.0ms+753ms) by YAML::PP::Parser::parse_tokens at line 401, avg 122µs/call | ||||
1361 | 6725 | 1.75ms | my ($self, $res) = @_; | ||
1362 | 6725 | 5.28ms | 6725 | 3.05ms | my $stack = $self->event_stack; # spent 3.05ms making 6725 calls to YAML::PP::Parser::event_stack, avg 454ns/call |
1363 | 6725 | 2.65ms | my $scalar = pop @$stack; | ||
1364 | 6725 | 1.54ms | my $info = $scalar->[1]; | ||
1365 | 6725 | 9.07ms | 6725 | 299ms | $self->start_mapping($info->{offset}); # spent 299ms making 6725 calls to YAML::PP::Parser::start_mapping, avg 44µs/call |
1366 | 6725 | 6.85ms | 6725 | 448ms | $self->scalar_event($info); # spent 448ms making 6725 calls to YAML::PP::Parser::scalar_event, avg 67µs/call |
1367 | 6725 | 22.9ms | 6725 | 3.08ms | $self->set_new_node(1); # spent 3.08ms making 6725 calls to YAML::PP::Parser::set_new_node, avg 458ns/call |
1368 | } | ||||
1369 | |||||
1370 | sub 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 | |||||
1380 | sub 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 | |||||
1390 | sub 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 | ||||
1407 | 1 | 0s | my ($self, $token) = @_; | ||
1408 | 1 | 1µs | my $type = $token->{subtokens}->[0]->{value}; | ||
1409 | 1 | 1µs | 1 | 1µs | my $stack = $self->event_stack; # spent 1µs 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}, | ||||
1416 | 1 | 3µs | }; | ||
1417 | 1 | 0s | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1418 | $self->fetch_inline_properties($stack, $info); | ||||
1419 | } | ||||
1420 | 1 | 1µs | 1 | 0s | push @{ $self->event_stack }, [ scalar => $info ]; # spent 0s making 1 call to YAML::PP::Parser::event_stack |
1421 | 1 | 4µs | 1 | 23µs | $self->cb_send_scalar; # spent 23µs making 1 call to YAML::PP::Parser::cb_send_scalar |
1422 | } | ||||
1423 | |||||
1424 | sub cb_end_document { | ||||
1425 | my ($self, $token) = @_; | ||||
1426 | $self->end_document(0); | ||||
1427 | } | ||||
1428 | |||||
1429 | sub cb_end_document_empty { | ||||
1430 | my ($self, $token) = @_; | ||||
1431 | $self->end_document(0); | ||||
1432 | } | ||||
1433 | |||||
1434 | sub cb_doc_start_implicit { | ||||
1435 | my ($self, $token) = @_; | ||||
1436 | $self->start_document(1); | ||||
1437 | } | ||||
1438 | |||||
1439 | # spent 124µs (5+119) within YAML::PP::Parser::cb_doc_start_explicit which was called:
# once (5µs+119µs) by YAML::PP::Parser::parse_tokens at line 401 | ||||
1440 | 1 | 0s | my ($self, $token) = @_; | ||
1441 | 1 | 6µs | 1 | 119µs | $self->start_document(0); # spent 119µs making 1 call to YAML::PP::Parser::start_document |
1442 | } | ||||
1443 | |||||
1444 | sub cb_end_doc_start_document { | ||||
1445 | my ($self, $token) = @_; | ||||
1446 | $self->end_document(1); | ||||
1447 | $self->start_document(0); | ||||
1448 | } | ||||
1449 | |||||
1450 | sub 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 | |||||
1456 | sub cb_reserved_directive { | ||||
1457 | } | ||||
1458 | |||||
1459 | sub 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 | |||||
1469 | 1 | 27µs | 1; | ||
# spent 8µs within YAML::PP::Loader::__ANON__ which was called 3 times, avg 3µs/call:
# once (4µs+0s) by YAML::PP::Loader::BEGIN@9 at line 9 of YAML/PP/Loader.pm
# once (3µs+0s) by YAML::PP::Loader::BEGIN@8 at line 8 of YAML/PP/Loader.pm
# once (1µs+0s) by YAML::PP::Loader::BEGIN@10 at line 10 of YAML/PP/Loader.pm | |||||
# spent 7.08ms within YAML::PP::Parser::CORE:match which was called 15241 times, avg 465ns/call:
# 13449 times (5.17ms+0s) by YAML::PP::Parser::lex_next_tokens at line 185, avg 384ns/call
# 689 times (512µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1240, avg 743ns/call
# 337 times (612µs+0s) by YAML::PP::Parser::end_flow_sequence at line 585, avg 2µs/call
# 337 times (218µs+0s) by YAML::PP::Parser::start_flow_sequence at line 539, avg 647ns/call
# 214 times (443µs+0s) by YAML::PP::Parser::end_flow_mapping at line 600, avg 2µs/call
# 214 times (133µs+0s) by YAML::PP::Parser::start_flow_mapping at line 563, avg 621ns/call
# once (1µs+0s) by YAML::PP::Parser::end_document at line 633 | |||||
# spent 7µs within YAML::PP::Parser::__ANON__ which was called 4 times, avg 2µs/call:
# once (2µs+0s) by YAML::PP::Parser::BEGIN@20 at line 20
# once (2µs+0s) by YAML::PP::Parser::BEGIN@18 at line 18
# once (2µs+0s) by YAML::PP::Parser::BEGIN@21 at line 21
# once (1µs+0s) by YAML::PP::Parser::BEGIN@17 at line 17 |