Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Parser.pm |
Statements | Executed 2750907 statements in 1.64s |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 637ms | 5.21s | parse_tokens | YAML::PP::Parser::
13356 | 2 | 1 | 203ms | 1.26s | lex_next_tokens | YAML::PP::Parser::
20764 | 4 | 1 | 202ms | 994ms | scalar_event | YAML::PP::Parser::
35840 | 13 | 1 | 85.7ms | 1.12s | __ANON__[:62] | YAML::PP::Parser::
6686 | 1 | 1 | 56.0ms | 227ms | start_mapping | YAML::PP::Parser::
2795 | 2 | 1 | 52.7ms | 222ms | remove_nodes | YAML::PP::Parser::
6686 | 1 | 1 | 51.1ms | 591ms | cb_insert_map | YAML::PP::Parser::
12070 | 1 | 1 | 47.9ms | 53.8ms | cb_start_plain | YAML::PP::Parser::
7415 | 4 | 1 | 45.2ms | 393ms | cb_send_scalar | YAML::PP::Parser::
54556 | 7 | 1 | 44.5ms | 44.5ms | set_rule | YAML::PP::Parser::
6634 | 2 | 1 | 36.1ms | 384ms | cb_send_mapkey | YAML::PP::Parser::
6619 | 1 | 1 | 27.7ms | 30.8ms | cb_mapkey | YAML::PP::Parser::
62214 | 23 | 1 | 27.3ms | 27.3ms | events | YAML::PP::Parser::
69800 | 14 | 1 | 26.8ms | 26.8ms | event_stack | YAML::PP::Parser::
54888 | 7 | 1 | 24.4ms | 24.4ms | lexer | YAML::PP::Parser::
35930 | 11 | 1 | 17.3ms | 17.3ms | set_new_node | YAML::PP::Parser::
35840 | 13 | 1 | 13.0ms | 13.0ms | callback | YAML::PP::Parser::
31736 | 15 | 1 | 12.9ms | 12.9ms | offset | YAML::PP::Parser::
27254 | 7 | 1 | 11.5ms | 11.5ms | new_node | YAML::PP::Parser::
2045 | 2 | 1 | 11.4ms | 12.4ms | cb_take_quoted | YAML::PP::Parser::
13355 | 2 | 1 | 7.71ms | 7.71ms | rule | YAML::PP::Parser::
13355 | 2 | 1 | 7.44ms | 7.44ms | tokens | YAML::PP::Parser::
6934 | 2 | 1 | 6.19ms | 6.19ms | level | YAML::PP::Parser::
15111 | 7 | 1 | 5.95ms | 5.95ms | CORE:match (opcode) | YAML::PP::Parser::
331 | 1 | 1 | 5.89ms | 13.9ms | start_flow_sequence | YAML::PP::Parser::
1 | 1 | 1 | 5.31ms | 8.89ms | BEGIN@18 | YAML::PP::Parser::
666 | 1 | 1 | 4.44ms | 39.3ms | cb_flow_comma | YAML::PP::Parser::
331 | 1 | 1 | 3.65ms | 10.6ms | end_flow_sequence | YAML::PP::Parser::
214 | 1 | 1 | 3.34ms | 8.40ms | start_flow_mapping | YAML::PP::Parser::
305 | 1 | 1 | 3.28ms | 11.3ms | start_sequence | YAML::PP::Parser::
261 | 1 | 1 | 2.62ms | 7.11ms | end_sequence | YAML::PP::Parser::
214 | 1 | 1 | 2.57ms | 7.75ms | end_flow_mapping | YAML::PP::Parser::
331 | 1 | 1 | 1.99ms | 29.5ms | cb_end_flowseq | YAML::PP::Parser::
522 | 1 | 1 | 1.81ms | 2.03ms | cb_end_outer_flow | YAML::PP::Parser::
305 | 1 | 1 | 1.79ms | 13.2ms | cb_seqstart | YAML::PP::Parser::
1 | 1 | 1 | 1.22ms | 1.32ms | BEGIN@17 | YAML::PP::Parser::
331 | 1 | 1 | 1.02ms | 15.0ms | cb_start_flowseq | YAML::PP::Parser::
1 | 1 | 1 | 967µs | 1.05ms | BEGIN@20 | YAML::PP::Parser::
214 | 1 | 1 | 943µs | 8.82ms | cb_end_flowmap | YAML::PP::Parser::
214 | 1 | 1 | 760µs | 9.16ms | cb_start_flowmap | YAML::PP::Parser::
299 | 1 | 1 | 753µs | 902µs | cb_seqitem | YAML::PP::Parser::
1 | 1 | 1 | 744µs | 837µs | BEGIN@21 | YAML::PP::Parser::
29 | 1 | 1 | 211µs | 1.79ms | cb_flowkey_plain | YAML::PP::Parser::
15 | 1 | 1 | 85µs | 742µs | cb_take_quoted_key | YAML::PP::Parser::
29 | 1 | 1 | 56µs | 71µs | cb_flow_colon | YAML::PP::Parser::
1 | 1 | 1 | 49µs | 1.04ms | end_document | YAML::PP::Parser::
1 | 1 | 1 | 47µs | 83µs | BEGIN@2 | YAML::PP::Loader::
1 | 1 | 1 | 29µs | 44µs | init | YAML::PP::Parser::
1 | 1 | 1 | 24µs | 44µs | start_document | YAML::PP::Parser::
1 | 1 | 1 | 18µs | 24µs | start_stream | YAML::PP::Parser::
1 | 1 | 1 | 17µs | 5.21s | parse | YAML::PP::Parser::
1 | 1 | 1 | 14µs | 29µs | new | YAML::PP::Parser::
1 | 1 | 1 | 11µs | 35µs | cb_send_block_scalar | YAML::PP::Parser::
1 | 1 | 1 | 10µs | 15µs | end_stream | YAML::PP::Parser::
1 | 1 | 1 | 8µs | 89µs | BEGIN@19 | YAML::PP::Parser::
1 | 1 | 1 | 7µs | 12µs | set_reader | YAML::PP::Parser::
1 | 1 | 1 | 6µs | 43µs | BEGIN@11 | YAML::PP::Parser::
1 | 1 | 1 | 6µs | 43µs | BEGIN@8 | YAML::PP::Parser::
1 | 1 | 1 | 6µs | 19µs | BEGIN@97 | YAML::PP::Parser::
1 | 1 | 1 | 5µs | 103µs | BEGIN@3 | YAML::PP::Loader::
1 | 1 | 1 | 5µs | 20µs | BEGIN@22 | YAML::PP::Parser::
4 | 4 | 1 | 5µs | 5µs | __ANON__ (xsub) | YAML::PP::Parser::
1 | 1 | 1 | 4µs | 21µs | BEGIN@9 | YAML::PP::Parser::
1 | 1 | 1 | 4µs | 48µs | cb_doc_start_explicit | YAML::PP::Parser::
1 | 1 | 1 | 4µs | 4µs | set_events | YAML::PP::Parser::
1 | 1 | 1 | 4µs | 4µs | set_receiver | YAML::PP::Parser::
2 | 2 | 1 | 3µs | 3µs | set_tagmap | YAML::PP::Parser::
2 | 2 | 1 | 2µs | 2µs | set_yaml_version_directive | YAML::PP::Parser::
1 | 1 | 1 | 2µs | 2µs | yaml_version | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | receiver | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | set_event_stack | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | set_offset | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | set_tokens | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | set_yaml_version | YAML::PP::Parser::
1 | 1 | 1 | 1µs | 1µs | 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::
1 | 1 | 1 | 0s | 0s | default_yaml_version | 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 | 68µs | 2 | 119µs | # spent 83µs (47+36) within YAML::PP::Loader::BEGIN@2 which was called:
# once (47µs+36µs) by YAML::PP::Loader::BEGIN@8 at line 2 # spent 83µs making 1 call to YAML::PP::Loader::BEGIN@2
# spent 36µs making 1 call to strict::import |
3 | 2 | 49µs | 2 | 201µs | # spent 103µs (5+98) within YAML::PP::Loader::BEGIN@3 which was called:
# once (5µs+98µs) by YAML::PP::Loader::BEGIN@8 at line 3 # spent 103µs making 1 call to YAML::PP::Loader::BEGIN@3
# spent 98µs making 1 call to warnings::import |
4 | package YAML::PP::Parser; | ||||
5 | |||||
6 | 1 | 3µs | our $VERSION = '0.035'; # VERSION | ||
7 | |||||
8 | 2 | 28µs | 2 | 80µs | # spent 43µs (6+37) within YAML::PP::Parser::BEGIN@8 which was called:
# once (6µs+37µs) by YAML::PP::Loader::BEGIN@8 at line 8 # spent 43µs making 1 call to YAML::PP::Parser::BEGIN@8
# spent 37µs making 1 call to constant::import |
9 | 2 | 25µs | 2 | 38µs | # spent 21µs (4+17) within YAML::PP::Parser::BEGIN@9 which was called:
# once (4µs+17µs) by YAML::PP::Loader::BEGIN@8 at line 9 # spent 21µs making 1 call to YAML::PP::Parser::BEGIN@9
# spent 17µs making 1 call to constant::import |
10 | |||||
11 | 1 | 1µs | # spent 43µs (6+37) within YAML::PP::Parser::BEGIN@11 which was called:
# once (6µs+37µs) by YAML::PP::Loader::BEGIN@8 at line 16 | ||
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 | 15µs | 2 | 80µs | /; # spent 43µs making 1 call to YAML::PP::Parser::BEGIN@11
# spent 37µs making 1 call to Exporter::import |
17 | 2 | 696µs | 2 | 1.32ms | # spent 1.32ms (1.22+97µs) within YAML::PP::Parser::BEGIN@17 which was called:
# once (1.22ms+97µs) by YAML::PP::Loader::BEGIN@8 at line 17 # spent 1.32ms making 1 call to YAML::PP::Parser::BEGIN@17
# spent 2µs making 1 call to YAML::PP::Parser::__ANON__ |
18 | 2 | 692µs | 2 | 8.90ms | # spent 8.89ms (5.31+3.59) within YAML::PP::Parser::BEGIN@18 which was called:
# once (5.31ms+3.59ms) by YAML::PP::Loader::BEGIN@8 at line 18 # spent 8.89ms making 1 call to YAML::PP::Parser::BEGIN@18
# spent 1µs making 1 call to YAML::PP::Parser::__ANON__ |
19 | 2 | 23µs | 2 | 170µs | # spent 89µs (8+81) within YAML::PP::Parser::BEGIN@19 which was called:
# once (8µs+81µs) by YAML::PP::Loader::BEGIN@8 at line 19 # spent 89µs making 1 call to YAML::PP::Parser::BEGIN@19
# spent 81µs making 1 call to Exporter::import |
20 | 2 | 585µs | 2 | 1.05ms | # spent 1.05ms (967µs+85µs) within YAML::PP::Parser::BEGIN@20 which was called:
# once (967µs+85µs) by YAML::PP::Loader::BEGIN@8 at line 20 # spent 1.05ms making 1 call to YAML::PP::Parser::BEGIN@20
# spent 1µs making 1 call to YAML::PP::Parser::__ANON__ |
21 | 2 | 283µs | 2 | 838µs | # spent 837µs (744+93) within YAML::PP::Parser::BEGIN@21 which was called:
# once (744µs+93µs) by YAML::PP::Loader::BEGIN@8 at line 21 # spent 837µs making 1 call to YAML::PP::Parser::BEGIN@21
# spent 1µs making 1 call to YAML::PP::Parser::__ANON__ |
22 | 2 | 400µs | 2 | 35µs | # spent 20µs (5+15) within YAML::PP::Parser::BEGIN@22 which was called:
# once (5µs+15µs) by YAML::PP::Loader::BEGIN@8 at line 22 # spent 20µs making 1 call to YAML::PP::Parser::BEGIN@22
# spent 15µs making 1 call to Exporter::import |
23 | |||||
24 | |||||
25 | # spent 29µs (14+15) within YAML::PP::Parser::new which was called:
# once (14µs+15µs) by YAML::PP::Loader::new at line 34 of YAML/PP/Loader.pm | ||||
26 | 1 | 1µs | my ($class, %args) = @_; | ||
27 | 1 | 4µs | 1 | 3µs | my $reader = delete $args{reader} || YAML::PP::Reader->new; # spent 3µs making 1 call to YAML::PP::Reader::new |
28 | 1 | 0s | my $default_yaml_version = delete $args{default_yaml_version}; | ||
29 | 1 | 4µs | 1 | 12µs | my $self = bless { # spent 12µs making 1 call to YAML::PP::Lexer::new |
30 | default_yaml_version => $default_yaml_version || '1.2', | ||||
31 | lexer => YAML::PP::Lexer->new( | ||||
32 | reader => $reader, | ||||
33 | ), | ||||
34 | }, $class; | ||||
35 | 1 | 0s | my $receiver = delete $args{receiver}; | ||
36 | 1 | 1µs | if ($receiver) { | ||
37 | $self->set_receiver($receiver); | ||||
38 | } | ||||
39 | 1 | 8µ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 | 3µs | # spent 1µs within YAML::PP::Parser::receiver which was called:
# once (1µs+0s) by YAML::PP::Loader::new at line 39 of YAML/PP/Loader.pm | ||
52 | # spent 4µs within YAML::PP::Parser::set_receiver which was called:
# once (4µs+0s) by YAML::PP::Loader::new at line 39 of YAML/PP/Loader.pm | ||||
53 | 1 | 0s | my ($self, $receiver) = @_; | ||
54 | 1 | 0s | my $callback; | ||
55 | 1 | 0s | if (ref $receiver eq 'CODE') { | ||
56 | $callback = $receiver; | ||||
57 | } | ||||
58 | else { | ||||
59 | # spent 1.12s (85.7ms+1.03) within YAML::PP::Parser::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Parser.pm:62] which was called 35840 times, avg 31µs/call:
# 20764 times (47.8ms+709ms) by YAML::PP::Parser::scalar_event at line 723, avg 36µs/call
# 6730 times (16.2ms+148ms) by YAML::PP::Parser::remove_nodes at line 475, avg 24µs/call
# 6686 times (16.9ms+143ms) by YAML::PP::Parser::start_mapping at line 626, avg 24µs/call
# 331 times (949µs+6.22ms) by YAML::PP::Parser::start_flow_sequence at line 551, avg 22µs/call
# 331 times (900µs+5.15ms) by YAML::PP::Parser::end_flow_sequence at line 584, avg 18µs/call
# 305 times (1.04ms+6.47ms) by YAML::PP::Parser::start_sequence at line 527, avg 25µs/call
# 261 times (807µs+3.39ms) by YAML::PP::Parser::end_sequence at line 453, avg 16µs/call
# 214 times (672µs+3.96ms) by YAML::PP::Parser::end_flow_mapping at line 599, avg 22µs/call
# 214 times (475µs+3.98ms) by YAML::PP::Parser::start_flow_mapping at line 575, avg 21µs/call
# once (5µs+19µs) by YAML::PP::Parser::end_document at line 649
# once (7µs+9µs) by YAML::PP::Parser::start_document at line 501
# once (3µs+1000ns) by YAML::PP::Parser::end_stream at line 667
# once (3µs+1000ns) by YAML::PP::Parser::start_stream at line 486 | ||||
60 | 35840 | 7.78ms | my ($self, $event, $info) = @_; | ||
61 | 35840 | 72.9ms | 35840 | 1.03s | return $receiver->$event($info); # spent 709ms making 20764 calls to YAML::PP::Constructor::scalar_event, avg 34µs/call
# spent 152ms making 6900 calls to YAML::PP::Constructor::mapping_end_event, avg 22µs/call
# spent 147ms making 6900 calls to YAML::PP::Constructor::mapping_start_event, avg 21µs/call
# spent 12.7ms making 636 calls to YAML::PP::Constructor::sequence_start_event, avg 20µs/call
# spent 9.04ms making 636 calls to YAML::PP::Constructor::sequence_end_event, avg 14µs/call
# spent 19µs making 1 call to YAML::PP::Constructor::document_end_event
# spent 9µs making 1 call to YAML::PP::Constructor::document_start_event
# spent 1µs making 1 call to YAML::PP::Constructor::stream_end_event
# spent 1µs making 1 call to YAML::PP::Constructor::stream_start_event |
62 | 1 | 3µs | }; | ||
63 | } | ||||
64 | 1 | 1µs | $self->{callback} = $callback; | ||
65 | 1 | 2µs | $self->{receiver} = $receiver; | ||
66 | } | ||||
67 | sub reader { return $_[0]->lexer->{reader} } | ||||
68 | # spent 12µs (7+5) within YAML::PP::Parser::set_reader which was called:
# once (7µs+5µs) by YAML::PP::Loader::load_file at line 84 of YAML/PP/Loader.pm | ||||
69 | 1 | 1µs | my ($self, $reader) = @_; | ||
70 | 1 | 5µs | 2 | 5µs | $self->lexer->set_reader($reader); # spent 4µs making 1 call to YAML::PP::Lexer::set_reader
# spent 1µs making 1 call to YAML::PP::Parser::lexer |
71 | } | ||||
72 | 54888 | 61.5ms | # spent 24.4ms within YAML::PP::Parser::lexer which was called 54888 times, avg 445ns/call:
# 20764 times (11.6ms+0s) by YAML::PP::Parser::parse_tokens at line 379, avg 557ns/call
# 20764 times (7.13ms+0s) by YAML::PP::Parser::parse_tokens at line 381, avg 344ns/call
# 13356 times (5.71ms+0s) by YAML::PP::Parser::lex_next_tokens at line 179, avg 427ns/call
# once (1µs+0s) by YAML::PP::Parser::set_reader at line 70
# once (1µs+0s) by YAML::PP::Parser::init at line 115
# once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 344
# once (0s+0s) by YAML::PP::Parser::parse at line 151 | ||
73 | 35840 | 37.9ms | # spent 13.0ms within YAML::PP::Parser::callback which was called 35840 times, avg 363ns/call:
# 20764 times (7.17ms+0s) by YAML::PP::Parser::scalar_event at line 723, avg 345ns/call
# 6730 times (2.78ms+0s) by YAML::PP::Parser::remove_nodes at line 475, avg 413ns/call
# 6686 times (2.50ms+0s) by YAML::PP::Parser::start_mapping at line 626, avg 374ns/call
# 331 times (107µs+0s) by YAML::PP::Parser::end_flow_sequence at line 584, avg 323ns/call
# 331 times (95µs+0s) by YAML::PP::Parser::start_flow_sequence at line 551, avg 287ns/call
# 305 times (98µs+0s) by YAML::PP::Parser::start_sequence at line 527, avg 321ns/call
# 261 times (85µs+0s) by YAML::PP::Parser::end_sequence at line 453, avg 326ns/call
# 214 times (113µs+0s) by YAML::PP::Parser::start_flow_mapping at line 575, avg 528ns/call
# 214 times (64µs+0s) by YAML::PP::Parser::end_flow_mapping at line 599, avg 299ns/call
# once (1µs+0s) by YAML::PP::Parser::start_document at line 501
# once (0s+0s) by YAML::PP::Parser::end_document at line 649
# once (0s+0s) by YAML::PP::Parser::start_stream at line 486
# once (0s+0s) by YAML::PP::Parser::end_stream at line 667 | ||
74 | sub set_callback { $_[0]->{callback} = $_[1] } | ||||
75 | 6934 | 11.3ms | sub level { return $#{ $_[0]->{offset} } } | ||
76 | 31736 | 36.2ms | # spent 12.9ms within YAML::PP::Parser::offset which was called 31736 times, avg 406ns/call:
# 13356 times (5.38ms+0s) by YAML::PP::Parser::lex_next_tokens at line 177, avg 403ns/call
# 7238 times (2.49ms+0s) by YAML::PP::Parser::lex_next_tokens at line 239, avg 344ns/call
# 6686 times (3.20ms+0s) by YAML::PP::Parser::start_mapping at line 617, avg 478ns/call
# 2795 times (1.15ms+0s) by YAML::PP::Parser::remove_nodes at line 459, avg 411ns/call
# 331 times (142µs+0s) by YAML::PP::Parser::start_flow_sequence at line 532, avg 429ns/call
# 331 times (137µs+0s) by YAML::PP::Parser::end_flow_sequence at line 582, avg 414ns/call
# 305 times (124µs+0s) by YAML::PP::Parser::start_sequence at line 513, avg 407ns/call
# 261 times (93µs+0s) by YAML::PP::Parser::end_sequence at line 451, avg 356ns/call
# 214 times (83µs+0s) by YAML::PP::Parser::start_flow_mapping at line 556, avg 388ns/call
# 214 times (77µs+0s) by YAML::PP::Parser::end_flow_mapping at line 597, avg 360ns/call
# once (1µs+0s) by YAML::PP::Parser::end_stream at line 666
# once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 342
# once (1µs+0s) by YAML::PP::Parser::start_stream at line 485
# once (0s+0s) by YAML::PP::Parser::start_document at line 494
# once (0s+0s) by YAML::PP::Parser::end_document at line 648 | ||
77 | 1 | 2µs | # spent 1µs within YAML::PP::Parser::set_offset which was called:
# once (1µs+0s) by YAML::PP::Parser::init at line 104 | ||
78 | 62214 | 68.4ms | # spent 27.3ms within YAML::PP::Parser::events which was called 62214 times, avg 438ns/call:
# 20764 times (10.3ms+0s) by YAML::PP::Parser::scalar_event at line 715, avg 496ns/call
# 13356 times (4.89ms+0s) by YAML::PP::Parser::lex_next_tokens at line 178, avg 366ns/call
# 7415 times (3.07ms+0s) by YAML::PP::Parser::cb_send_scalar at line 1057, avg 413ns/call
# 7238 times (3.17ms+0s) by YAML::PP::Parser::lex_next_tokens at line 231, avg 438ns/call
# 6686 times (3.10ms+0s) by YAML::PP::Parser::start_mapping at line 618, avg 464ns/call
# 2795 times (1.07ms+0s) by YAML::PP::Parser::remove_nodes at line 460, avg 381ns/call
# 666 times (350µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1238, avg 526ns/call
# 522 times (213µs+0s) by YAML::PP::Parser::cb_end_outer_flow at line 610, avg 408ns/call
# 331 times (143µs+0s) by YAML::PP::Parser::start_flow_sequence at line 543, avg 432ns/call
# 331 times (139µs+0s) by YAML::PP::Parser::end_flow_sequence at line 580, avg 420ns/call
# 331 times (122µs+0s) by YAML::PP::Parser::start_flow_sequence at line 534, avg 369ns/call
# 305 times (118µs+0s) by YAML::PP::Parser::start_sequence at line 514, avg 387ns/call
# 305 times (113µs+0s) by YAML::PP::Parser::lex_next_tokens at line 216, avg 370ns/call
# 261 times (117µs+0s) by YAML::PP::Parser::lex_next_tokens at line 236, avg 448ns/call
# 261 times (109µs+0s) by YAML::PP::Parser::end_sequence at line 449, avg 418ns/call
# 214 times (94µs+0s) by YAML::PP::Parser::end_flow_mapping at line 595, avg 439ns/call
# 214 times (77µs+0s) by YAML::PP::Parser::start_flow_mapping at line 567, avg 360ns/call
# 214 times (74µs+0s) by YAML::PP::Parser::start_flow_mapping at line 558, avg 346ns/call
# once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 341
# once (1µs+0s) by YAML::PP::Parser::start_stream at line 484
# once (0s+0s) by YAML::PP::Parser::start_document at line 493
# once (0s+0s) by YAML::PP::Parser::end_document at line 632
# once (0s+0s) by YAML::PP::Parser::end_stream at line 664 | ||
79 | 1 | 3µs | # spent 4µs within YAML::PP::Parser::set_events which was called:
# once (4µs+0s) by YAML::PP::Parser::init at line 105 | ||
80 | 27254 | 30.5ms | # spent 11.5ms within YAML::PP::Parser::new_node which was called 27254 times, avg 422ns/call:
# 13354 times (5.31ms+0s) by YAML::PP::Parser::parse_tokens at line 430, avg 398ns/call
# 7238 times (3.28ms+0s) by YAML::PP::Parser::lex_next_tokens at line 209, avg 453ns/call
# 6115 times (2.70ms+0s) by YAML::PP::Parser::lex_next_tokens at line 204, avg 442ns/call
# 331 times (115µs+0s) by YAML::PP::Parser::start_flow_sequence at line 535, avg 347ns/call
# 214 times (82µs+0s) by YAML::PP::Parser::start_flow_mapping at line 559, avg 383ns/call
# once (1µs+0s) by YAML::PP::Parser::parse_tokens at line 350
# once (0s+0s) by YAML::PP::Parser::end_document at line 636 | ||
81 | 35930 | 41.3ms | # spent 17.3ms within YAML::PP::Parser::set_new_node which was called 35930 times, avg 482ns/call:
# 20764 times (11.7ms+0s) by YAML::PP::Parser::scalar_event at line 724, avg 563ns/call
# 6686 times (2.39ms+0s) by YAML::PP::Parser::cb_insert_map at line 1367, avg 358ns/call
# 6634 times (2.35ms+0s) by YAML::PP::Parser::cb_send_mapkey at line 1049, avg 354ns/call
# 666 times (279µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1239, avg 419ns/call
# 331 times (158µs+0s) by YAML::PP::Parser::cb_end_flowseq at line 1233, avg 477ns/call
# 305 times (169µs+0s) by YAML::PP::Parser::cb_seqstart at line 1141, avg 554ns/call
# 299 times (149µs+0s) by YAML::PP::Parser::cb_seqitem at line 1146, avg 498ns/call
# 214 times (122µs+0s) by YAML::PP::Parser::cb_end_flowmap at line 1268, avg 570ns/call
# 29 times (15µs+0s) by YAML::PP::Parser::cb_flow_colon at line 1248, avg 517ns/call
# once (1µs+0s) by YAML::PP::Parser::init at line 106
# once (0s+0s) by YAML::PP::Parser::start_document at line 508 | ||
82 | sub tagmap { return $_[0]->{tagmap} } | ||||
83 | 2 | 7µs | sub set_tagmap { $_[0]->{tagmap} = $_[1] } | ||
84 | 13355 | 16.0ms | sub tokens { return $_[0]->{tokens} } | ||
85 | 1 | 2µs | # spent 1µs within YAML::PP::Parser::set_tokens which was called:
# once (1µs+0s) by YAML::PP::Parser::init at line 110 | ||
86 | 69800 | 117ms | # spent 26.8ms within YAML::PP::Parser::event_stack which was called 69800 times, avg 383ns/call:
# 20764 times (6.54ms+0s) by YAML::PP::Parser::scalar_event at line 716, avg 315ns/call
# 12070 times (5.88ms+0s) by YAML::PP::Parser::cb_start_plain at line 1207, avg 487ns/call
# 7415 times (2.87ms+0s) by YAML::PP::Parser::cb_send_scalar at line 1054, avg 387ns/call
# 6686 times (2.62ms+0s) by YAML::PP::Parser::cb_insert_map at line 1362, avg 392ns/call
# 6686 times (2.03ms+0s) by YAML::PP::Parser::start_mapping at line 620, avg 304ns/call
# 6634 times (2.39ms+0s) by YAML::PP::Parser::cb_send_mapkey at line 1047, avg 360ns/call
# 6619 times (3.13ms+0s) by YAML::PP::Parser::cb_mapkey at line 1033, avg 473ns/call
# 2045 times (1.00ms+0s) by YAML::PP::Parser::cb_take_quoted at line 1152, avg 491ns/call
# 331 times (91µs+0s) by YAML::PP::Parser::start_flow_sequence at line 546, avg 275ns/call
# 305 times (124µs+0s) by YAML::PP::Parser::start_sequence at line 521, avg 407ns/call
# 214 times (73µs+0s) by YAML::PP::Parser::start_flow_mapping at line 570, avg 341ns/call
# 29 times (9µs+0s) by YAML::PP::Parser::cb_flowkey_plain at line 1280, avg 310ns/call
# once (0s+0s) by YAML::PP::Parser::cb_send_block_scalar at line 1420
# once (0s+0s) by YAML::PP::Parser::cb_send_block_scalar at line 1409 | ||
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 | 1µs | # spent 0s within YAML::PP::Parser::default_yaml_version which was called:
# once (0s+0s) by YAML::PP::Parser::init at line 113 | ||
89 | 1 | 2µ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 | 2µs | # spent 1µs within YAML::PP::Parser::yaml_version_directive which was called:
# once (1µs+0s) by YAML::PP::Parser::start_document at line 495 | ||
92 | 2 | 4µs | sub set_yaml_version_directive { $_[0]->{yaml_version_directive} = $_[1] } | ||
93 | |||||
94 | 13355 | 16.6ms | sub rule { return $_[0]->{rule} } | ||
95 | # spent 44.5ms within YAML::PP::Parser::set_rule which was called 54556 times, avg 816ns/call:
# 46373 times (38.2ms+0s) by YAML::PP::Parser::parse_tokens at line 408, avg 823ns/call
# 6933 times (5.38ms+0s) by YAML::PP::Parser::parse_tokens at line 434, avg 776ns/call
# 1246 times (978µs+0s) by YAML::PP::Parser::parse_tokens at line 415, avg 785ns/call
# once (2µs+0s) by YAML::PP::Parser::init at line 111
# once (1µs+0s) by YAML::PP::Parser::start_document at line 507
# once (0s+0s) by YAML::PP::Parser::end_document at line 659
# once (0s+0s) by YAML::PP::Parser::parse at line 154 | ||||
96 | 54556 | 12.0ms | my ($self, $name) = @_; | ||
97 | 2 | 4.86ms | 2 | 32µs | # spent 19µs (6+13) within YAML::PP::Parser::BEGIN@97 which was called:
# once (6µs+13µs) by YAML::PP::Loader::BEGIN@8 at line 97 # spent 19µs making 1 call to YAML::PP::Parser::BEGIN@97
# spent 13µs making 1 call to warnings::unimport |
98 | DEBUG and $self->info("set_rule($name)"); | ||||
99 | 54556 | 68.2ms | $self->{rule} = $name; | ||
100 | } | ||||
101 | |||||
102 | # spent 44µs (29+15) within YAML::PP::Parser::init which was called:
# once (29µs+15µs) by YAML::PP::Parser::parse at line 150 | ||||
103 | 1 | 1µs | my ($self) = @_; | ||
104 | 1 | 2µs | 1 | 1µs | $self->set_offset([]); # spent 1µs making 1 call to YAML::PP::Parser::set_offset |
105 | 1 | 3µs | 1 | 4µs | $self->set_events([]); # spent 4µs making 1 call to YAML::PP::Parser::set_events |
106 | 1 | 1µ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 | 1µs | 1 | 1µs | $self->set_tokens([]); # spent 1µs making 1 call to YAML::PP::Parser::set_tokens |
111 | 1 | 1µs | 1 | 2µs | $self->set_rule(undef); # spent 2µs making 1 call to YAML::PP::Parser::set_rule |
112 | 1 | 2µs | 1 | 1µs | $self->set_event_stack([]); # spent 1µs making 1 call to YAML::PP::Parser::set_event_stack |
113 | 1 | 1µs | 2 | 1µs | $self->set_yaml_version($self->default_yaml_version); # spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version
# spent 0s making 1 call to YAML::PP::Parser::default_yaml_version |
114 | 1 | 0s | 1 | 1µs | $self->set_yaml_version_directive(undef); # spent 1µs making 1 call to YAML::PP::Parser::set_yaml_version_directive |
115 | 1 | 3µs | 2 | 2µs | $self->lexer->init; # spent 1µs making 1 call to YAML::PP::Lexer::init
# spent 1µs making 1 call to YAML::PP::Parser::lexer |
116 | } | ||||
117 | |||||
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 | 8µ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 5.21s (17µs+5.21) within YAML::PP::Parser::parse which was called:
# once (17µs+5.21s) by YAML::PP::Loader::load at line 94 of YAML/PP/Loader.pm | ||||
147 | 1 | 0s | my ($self) = @_; | ||
148 | TRACE and warn "=== parse()\n"; | ||||
149 | TRACE and $self->debug_yaml; | ||||
150 | 1 | 1µs | 1 | 44µs | $self->init; # spent 44µs making 1 call to YAML::PP::Parser::init |
151 | 1 | 1µ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 | 24µs | $self->start_stream; # spent 24µs making 1 call to YAML::PP::Parser::start_stream |
154 | 1 | 0s | 1 | 0s | $self->set_rule( 'STREAM' ); # spent 0s making 1 call to YAML::PP::Parser::set_rule |
155 | |||||
156 | 1 | 1µs | 1 | 5.21s | $self->parse_tokens(); # spent 5.21s making 1 call to YAML::PP::Parser::parse_tokens |
157 | |||||
158 | 1 | 3µs | 1 | 15µs | $self->end_stream; # spent 15µ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 | 3µs | TRACE and $self->debug_tokens; | ||
169 | } | ||||
170 | |||||
171 | sub lex_next_tokens { | ||||
172 | 13356 | 3.11ms | my ($self) = @_; | ||
173 | |||||
174 | DEBUG and $self->info("----------------> lex_next_tokens"); | ||||
175 | TRACE and $self->debug_events; | ||||
176 | |||||
177 | 13356 | 9.08ms | 13356 | 5.38ms | my $indent = $self->offset->[-1]; # spent 5.38ms making 13356 calls to YAML::PP::Parser::offset, avg 403ns/call |
178 | 13356 | 7.16ms | 13356 | 4.89ms | my $event_types = $self->events; # spent 4.89ms making 13356 calls to YAML::PP::Parser::events, avg 366ns/call |
179 | 13356 | 17.8ms | 26712 | 791ms | my $next_tokens = $self->lexer->fetch_next_tokens($indent); # spent 785ms making 13356 calls to YAML::PP::Lexer::fetch_next_tokens, avg 59µs/call
# spent 5.71ms making 13356 calls to YAML::PP::Parser::lexer, avg 427ns/call |
180 | 13356 | 1.71ms | return unless @$next_tokens; | ||
181 | |||||
182 | 13355 | 2.46ms | my $next = $next_tokens->[0]; | ||
183 | |||||
184 | 13355 | 4.21ms | return 1 if ($next->{name} ne 'SPACE'); | ||
185 | 13354 | 20.6ms | 13354 | 4.50ms | my $flow = $event_types->[-1] =~ m/^FLOW/; # spent 4.50ms making 13354 calls to YAML::PP::Parser::CORE:match, avg 337ns/call |
186 | 13354 | 5.21ms | my $space = length $next->{value}; | ||
187 | 13354 | 9.68ms | 13354 | 7.44ms | my $tokens = $self->tokens; # spent 7.44ms making 13354 calls to YAML::PP::Parser::tokens, avg 557ns/call |
188 | |||||
189 | 13354 | 4.11ms | if (not $space) { | ||
190 | shift @$next_tokens; | ||||
191 | } | ||||
192 | else { | ||||
193 | 13349 | 3.70ms | push @$tokens, shift @$next_tokens; | ||
194 | } | ||||
195 | 13354 | 1.40ms | if ($flow) { | ||
196 | if ($space >= $indent) { | ||||
197 | return 1; | ||||
198 | } | ||||
199 | $self->exception("Bad indendation in " . $self->events->[-1]); | ||||
200 | } | ||||
201 | 13354 | 2.43ms | $next = $next_tokens->[0]; | ||
202 | 13354 | 3.18ms | if ($space > $indent ) { | ||
203 | 6116 | 1.20ms | return 1 if $indent < 0; | ||
204 | 6115 | 4.72ms | 6115 | 2.70ms | unless ($self->new_node) { # spent 2.70ms making 6115 calls to YAML::PP::Parser::new_node, avg 442ns/call |
205 | $self->exception("Bad indendation in " . $self->events->[-1]); | ||||
206 | } | ||||
207 | 6115 | 9.42ms | return 1; | ||
208 | } | ||||
209 | 7238 | 6.57ms | 7238 | 3.28ms | if ($self->new_node) { # spent 3.28ms making 7238 calls to YAML::PP::Parser::new_node, avg 453ns/call |
210 | 305 | 258µ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 | 305 | 316µs | 305 | 113µs | my $exp = $self->events->[-1]; # spent 113µs making 305 calls to YAML::PP::Parser::events, avg 370ns/call |
217 | 305 | 168µs | my $seq_start = $next->{name} eq 'DASH'; | ||
218 | 305 | 196µ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 | 6933 | 3.91ms | 2794 | 221ms | if ($space < $indent) { # spent 221ms making 2794 calls to YAML::PP::Parser::remove_nodes, avg 79µs/call |
227 | $self->remove_nodes($space); | ||||
228 | } | ||||
229 | } | ||||
230 | |||||
231 | 7238 | 5.91ms | 7238 | 3.17ms | my $exp = $self->events->[-1]; # spent 3.17ms making 7238 calls to YAML::PP::Parser::events, avg 438ns/call |
232 | |||||
233 | 7238 | 2.61ms | if ($exp eq 'SEQ0' and $next->{name} ne 'DASH') { | ||
234 | TRACE and $self->info("In unindented sequence"); | ||||
235 | 261 | 265µs | 261 | 7.11ms | $self->end_sequence; # spent 7.11ms making 261 calls to YAML::PP::Parser::end_sequence, avg 27µs/call |
236 | 261 | 247µs | 261 | 117µs | $exp = $self->events->[-1]; # spent 117µs making 261 calls to YAML::PP::Parser::events, avg 448ns/call |
237 | } | ||||
238 | |||||
239 | 7238 | 5.05ms | 7238 | 2.49ms | if ($self->offset->[-1] != $space) { # spent 2.49ms making 7238 calls to YAML::PP::Parser::offset, avg 344ns/call |
240 | $self->exception("Expected " . $self->events->[-1]); | ||||
241 | } | ||||
242 | 7238 | 11.8ms | return 1; | ||
243 | } | ||||
244 | |||||
245 | 1 | 4µ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 | 2µ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 | 4µs | my %fetch_method = ( | ||
332 | '"' => 'fetch_quoted', | ||||
333 | "'" => 'fetch_quoted', | ||||
334 | '|' => 'fetch_block', | ||||
335 | '>' => 'fetch_block', | ||||
336 | '' => 'fetch_plain', | ||||
337 | ); | ||||
338 | |||||
339 | # spent 5.21s (637ms+4.57) within YAML::PP::Parser::parse_tokens which was called:
# once (637ms+4.57s) by YAML::PP::Parser::parse at line 156 | ||||
340 | 1 | 1µs | my ($self) = @_; | ||
341 | 1 | 0s | 1 | 1µs | my $event_types = $self->events; # spent 1µ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 | 1µs | 1 | 0s | my $tokens = $self->tokens; # spent 0s making 1 call to YAML::PP::Parser::tokens |
344 | 1 | 2µs | 2 | 3µs | my $next_tokens = $self->lexer->next_tokens; # spent 2µs making 1 call to YAML::PP::Lexer::next_tokens
# spent 1µs making 1 call to YAML::PP::Parser::lexer |
345 | |||||
346 | 1 | 1µs | 1 | 13.9ms | unless ($self->lex_next_tokens) { # spent 13.9ms making 1 call to YAML::PP::Parser::lex_next_tokens |
347 | $self->end_document(1); | ||||
348 | return 0; | ||||
349 | } | ||||
350 | 1 | 2µs | 1 | 1µs | unless ($self->new_node) { # spent 1µs making 1 call to YAML::PP::Parser::new_node |
351 | 1 | 2µs | 1 | 3µs | if ($self->level > 0) { # spent 3µs making 1 call to YAML::PP::Parser::level |
352 | my $new_rule = $nodetypes{ $event_types->[-1] } | ||||
353 | or die "Did not find '$event_types->[-1]'"; | ||||
354 | $self->set_rule( $new_rule ); | ||||
355 | } | ||||
356 | } | ||||
357 | |||||
358 | 1 | 2µs | 1 | 2µs | my $rule_name = $self->rule; # spent 2µs making 1 call to YAML::PP::Parser::rule |
359 | DEBUG and $self->info("----------------> parse_tokens($rule_name)"); | ||||
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 | 7.32ms | RULE: while ($rule_name) { | ||
368 | DEBUG and $self->info("RULE: $rule_name"); | ||||
369 | TRACE and $self->debug_tokens($next_tokens); | ||||
370 | |||||
371 | 110006 | 10.8ms | unless (@$next_tokens) { | ||
372 | $self->exception("No more tokens"); | ||||
373 | } | ||||
374 | TRACE and warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$next_tokens->[0]], ['next_token']); | ||||
375 | 110006 | 26.5ms | my $got = $next_tokens->[0]->{name}; | ||
376 | 110006 | 12.8ms | if ($got eq 'CONTEXT') { | ||
377 | 20764 | 3.85ms | my $context = shift @$next_tokens; | ||
378 | 20764 | 3.61ms | my $indent = $offsets->[-1]; | ||
379 | 20764 | 23.9ms | 41528 | 19.5ms | $indent++ unless $self->lexer->flowcontext; # spent 11.6ms making 20764 calls to YAML::PP::Parser::lexer, avg 557ns/call
# spent 7.97ms making 20764 calls to YAML::PP::Lexer::flowcontext, avg 384ns/call |
380 | 20764 | 8.15ms | my $method = $fetch_method{ $context->{value} }; | ||
381 | 20764 | 27.1ms | 41528 | 1.69s | my $partial = $self->lexer->$method($indent, $context->{value}); # spent 1.49s making 18718 calls to YAML::PP::Lexer::fetch_plain, avg 80µs/call
# spent 198ms making 2045 calls to YAML::PP::Lexer::fetch_quoted, avg 97µs/call
# spent 7.13ms making 20764 calls to YAML::PP::Parser::lexer, avg 344ns/call
# spent 272µs making 1 call to YAML::PP::Lexer::fetch_block |
382 | 20764 | 21.9ms | next RULE; | ||
383 | } | ||||
384 | 89242 | 28.4ms | my $def = $rule->{ $got }; | ||
385 | 89242 | 28.3ms | if ($def) { | ||
386 | push @$tokens, shift @$next_tokens; | ||||
387 | } | ||||
388 | elsif ($def = $rule->{DEFAULT}) { | ||||
389 | $got = 'DEFAULT'; | ||||
390 | } | ||||
391 | else { | ||||
392 | $self->expected( | ||||
393 | expected => [keys %$rule], | ||||
394 | got => $next_tokens->[0], | ||||
395 | ); | ||||
396 | } | ||||
397 | |||||
398 | DEBUG and $self->got("---got $got"); | ||||
399 | 89242 | 29.8ms | if (my $sub = $def->{match}) { | ||
400 | DEBUG and $self->info("CALLBACK $sub"); | ||||
401 | 43398 | 45.1ms | 43398 | 1.53s | $self->$sub(@$tokens ? $tokens->[-1] : ()); # spent 591ms making 6686 calls to YAML::PP::Parser::cb_insert_map, avg 88µs/call
# spent 383ms making 6619 calls to YAML::PP::Parser::cb_send_mapkey, avg 58µs/call
# spent 343ms making 6417 calls to YAML::PP::Parser::cb_send_scalar, avg 53µs/call
# spent 53.8ms making 12070 calls to YAML::PP::Parser::cb_start_plain, avg 4µs/call
# spent 39.3ms making 666 calls to YAML::PP::Parser::cb_flow_comma, avg 59µs/call
# spent 30.8ms making 6619 calls to YAML::PP::Parser::cb_mapkey, avg 5µs/call
# spent 29.5ms making 331 calls to YAML::PP::Parser::cb_end_flowseq, avg 89µs/call
# spent 15.0ms making 331 calls to YAML::PP::Parser::cb_start_flowseq, avg 45µs/call
# spent 13.2ms making 305 calls to YAML::PP::Parser::cb_seqstart, avg 43µs/call
# spent 12.3ms making 2030 calls to YAML::PP::Parser::cb_take_quoted, avg 6µs/call
# spent 9.16ms making 214 calls to YAML::PP::Parser::cb_start_flowmap, avg 43µs/call
# spent 8.82ms making 214 calls to YAML::PP::Parser::cb_end_flowmap, avg 41µs/call
# spent 2.03ms making 522 calls to YAML::PP::Parser::cb_end_outer_flow, avg 4µs/call
# spent 1.79ms making 29 calls to YAML::PP::Parser::cb_flowkey_plain, avg 62µs/call
# spent 902µs making 299 calls to YAML::PP::Parser::cb_seqitem, avg 3µs/call
# spent 742µs making 15 calls to YAML::PP::Parser::cb_take_quoted_key, avg 49µs/call
# spent 71µs making 29 calls to YAML::PP::Parser::cb_flow_colon, avg 2µs/call
# spent 48µs making 1 call to YAML::PP::Parser::cb_doc_start_explicit
# spent 35µs making 1 call to YAML::PP::Parser::cb_send_block_scalar |
402 | } | ||||
403 | 89242 | 14.4ms | my $eol = $got eq 'EOL'; | ||
404 | 89242 | 19.2ms | my $new = $def->{new}; | ||
405 | 89242 | 19.3ms | if ($new) { | ||
406 | DEBUG and $self->got("NEW: $new"); | ||||
407 | 46373 | 6.06ms | $rule_name = $new; | ||
408 | 46373 | 29.2ms | 46373 | 38.2ms | $self->set_rule($rule_name); # spent 38.2ms making 46373 calls to YAML::PP::Parser::set_rule, avg 823ns/call |
409 | } | ||||
410 | elsif ($eol) { | ||||
411 | } | ||||
412 | elsif ($def->{return}) { | ||||
413 | 1246 | 670µs | $rule_name = $nodetypes{ $event_types->[-1] } | ||
414 | or die "Unexpected event type $event_types->[-1]"; | ||||
415 | 1246 | 816µs | 1246 | 978µs | $self->set_rule($rule_name); # spent 978µs making 1246 calls to YAML::PP::Parser::set_rule, avg 785ns/call |
416 | } | ||||
417 | else { | ||||
418 | 34689 | 14.7ms | $rule_name .= " - $got"; # for debugging | ||
419 | 34689 | 3.62ms | $rule = $def; | ||
420 | 34689 | 9.79ms | next RULE; | ||
421 | } | ||||
422 | 54553 | 7.39ms | if ($eol) { | ||
423 | 13355 | 11.2ms | 13355 | 1.24s | unless ($self->lex_next_tokens) { # spent 1.24s making 13355 calls to YAML::PP::Parser::lex_next_tokens, avg 93µs/call |
424 | 1 | 0s | if ($rule_name eq 'DIRECTIVE') { | ||
425 | $self->exception("Directive needs document start"); | ||||
426 | } | ||||
427 | 1 | 2µs | 1 | 1.04ms | $self->end_document(1); # spent 1.04ms making 1 call to YAML::PP::Parser::end_document |
428 | 1 | 4µs | return 0; | ||
429 | } | ||||
430 | 13354 | 9.15ms | 13354 | 5.31ms | unless ($self->new_node) { # spent 5.31ms making 13354 calls to YAML::PP::Parser::new_node, avg 398ns/call |
431 | 6933 | 6.68ms | 6933 | 6.19ms | if ($self->level > 0) { # spent 6.19ms making 6933 calls to YAML::PP::Parser::level, avg 892ns/call |
432 | 6933 | 3.26ms | $rule_name = $nodetypes{ $event_types->[-1] } | ||
433 | or die "Did not find '$event_types->[-1]'"; | ||||
434 | 6933 | 4.27ms | 6933 | 5.38ms | $self->set_rule( $rule_name ); # spent 5.38ms making 6933 calls to YAML::PP::Parser::set_rule, avg 776ns/call |
435 | } | ||||
436 | } | ||||
437 | 13354 | 11.1ms | 13354 | 7.71ms | $rule_name = $self->rule; # spent 7.71ms making 13354 calls to YAML::PP::Parser::rule, avg 577ns/call |
438 | } | ||||
439 | 54552 | 34.7ms | $rule = $GRAMMAR->{ $rule_name } | ||
440 | or die "Unexpected rule $rule_name"; | ||||
441 | |||||
442 | } | ||||
443 | |||||
444 | die "Unexpected"; | ||||
445 | } | ||||
446 | |||||
447 | # spent 7.11ms (2.62+4.49) within YAML::PP::Parser::end_sequence which was called 261 times, avg 27µs/call:
# 261 times (2.62ms+4.49ms) by YAML::PP::Parser::lex_next_tokens at line 235, avg 27µs/call | ||||
448 | 261 | 109µs | my ($self) = @_; | ||
449 | 261 | 184µs | 261 | 109µs | my $event_types = $self->events; # spent 109µs making 261 calls to YAML::PP::Parser::events, avg 418ns/call |
450 | 261 | 116µs | pop @{ $event_types }; | ||
451 | 261 | 157µs | 261 | 93µs | pop @{ $self->offset }; # spent 93µs making 261 calls to YAML::PP::Parser::offset, avg 356ns/call |
452 | 261 | 190µs | my $info = { name => 'sequence_end_event' }; | ||
453 | 261 | 418µs | 522 | 4.28ms | $self->callback->($self, $info->{name} => $info ); # spent 4.20ms making 261 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 16µs/call
# spent 85µs making 261 calls to YAML::PP::Parser::callback, avg 326ns/call |
454 | 261 | 688µs | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
455 | } | ||||
456 | |||||
457 | sub remove_nodes { | ||||
458 | 2795 | 798µs | my ($self, $space) = @_; | ||
459 | 2795 | 1.95ms | 2795 | 1.15ms | my $offset = $self->offset; # spent 1.15ms making 2795 calls to YAML::PP::Parser::offset, avg 411ns/call |
460 | 2795 | 1.97ms | 2795 | 1.07ms | my $event_types = $self->events; # spent 1.07ms making 2795 calls to YAML::PP::Parser::events, avg 381ns/call |
461 | |||||
462 | 2795 | 954µs | my $exp = $event_types->[-1]; | ||
463 | 2795 | 891µs | while (@$offset) { | ||
464 | 9525 | 2.20ms | if ($offset->[ -1 ] <= $space) { | ||
465 | 2795 | 882µs | last; | ||
466 | } | ||||
467 | 6730 | 1.16ms | if ($exp eq 'MAPVALUE') { | ||
468 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | ||||
469 | $exp = 'MAP'; | ||||
470 | } | ||||
471 | 6730 | 3.39ms | my $info = { name => $exp }; | ||
472 | 6730 | 3.69ms | $info->{name} = $event_to_method{ $exp } . '_end_event'; | ||
473 | 6730 | 1.44ms | pop @{ $event_types }; | ||
474 | 6730 | 1.05ms | pop @{ $offset }; | ||
475 | 6730 | 8.11ms | 13460 | 167ms | $self->callback->($self, $info->{name} => $info ); # spent 164ms making 6730 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 24µs/call
# spent 2.78ms making 6730 calls to YAML::PP::Parser::callback, avg 413ns/call |
476 | 6730 | 3.21ms | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
477 | 6730 | 5.01ms | $exp = $event_types->[-1]; | ||
478 | } | ||||
479 | 2795 | 4.01ms | return $exp; | ||
480 | } | ||||
481 | |||||
482 | # spent 24µs (18+6) within YAML::PP::Parser::start_stream which was called:
# once (18µs+6µs) by YAML::PP::Parser::parse at line 153 | ||||
483 | 1 | 1µs | my ($self) = @_; | ||
484 | 1 | 2µs | 1 | 1µs | push @{ $self->events }, 'STR'; # spent 1µs making 1 call to YAML::PP::Parser::events |
485 | 1 | 2µs | 1 | 1µs | push @{ $self->offset }, -1; # spent 1µs making 1 call to YAML::PP::Parser::offset |
486 | 1 | 5µ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 44µs (24+20) within YAML::PP::Parser::start_document which was called:
# once (24µs+20µs) by YAML::PP::Parser::cb_doc_start_explicit at line 1441 | ||||
492 | 1 | 1µs | my ($self, $implicit) = @_; | ||
493 | 1 | 1µs | 1 | 0s | push @{ $self->events }, 'DOC'; # spent 0s making 1 call to YAML::PP::Parser::events |
494 | 1 | 1µs | 1 | 0s | push @{ $self->offset }, -1; # spent 0s making 1 call to YAML::PP::Parser::offset |
495 | 1 | 2µs | 1 | 1µs | my $directive = $self->yaml_version_directive; # spent 1µs making 1 call to YAML::PP::Parser::yaml_version_directive |
496 | 1 | 0s | my %directive; | ||
497 | 1 | 1µs | if ($directive) { | ||
498 | my ($major, $minor) = split m/\./, $self->yaml_version; | ||||
499 | %directive = ( version_directive => { major => $major, minor => $minor } ); | ||||
500 | } | ||||
501 | 1 | 4µs | 2 | 17µs | $self->callback->($self, 'document_start_event', { # spent 16µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62]
# spent 1µs making 1 call to YAML::PP::Parser::callback |
502 | name => 'document_start_event', | ||||
503 | implicit => $implicit, | ||||
504 | %directive, | ||||
505 | }); | ||||
506 | 1 | 1µ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 | 1µs | $self->set_rule( 'FULLNODE' ); # spent 1µs making 1 call to YAML::PP::Parser::set_rule |
508 | 1 | 3µs | 1 | 0s | $self->set_new_node(1); # spent 0s making 1 call to YAML::PP::Parser::set_new_node |
509 | } | ||||
510 | |||||
511 | # spent 11.3ms (3.28+7.98) within YAML::PP::Parser::start_sequence which was called 305 times, avg 37µs/call:
# 305 times (3.28ms+7.98ms) by YAML::PP::Parser::cb_seqstart at line 1140, avg 37µs/call | ||||
512 | 305 | 104µs | my ($self, $offset) = @_; | ||
513 | 305 | 182µs | 305 | 124µs | my $offsets = $self->offset; # spent 124µs making 305 calls to YAML::PP::Parser::offset, avg 407ns/call |
514 | 305 | 387µs | 305 | 118µs | if ($offsets->[-1] == $offset) { # spent 118µs making 305 calls to YAML::PP::Parser::events, avg 387ns/call |
515 | push @{ $self->events }, 'SEQ0'; | ||||
516 | } | ||||
517 | else { | ||||
518 | push @{ $self->events }, 'SEQ'; | ||||
519 | } | ||||
520 | 305 | 161µs | push @{ $offsets }, $offset; | ||
521 | 305 | 182µs | 305 | 124µs | my $event_stack = $self->event_stack; # spent 124µs making 305 calls to YAML::PP::Parser::event_stack, avg 407ns/call |
522 | 305 | 231µs | my $info = { name => 'sequence_start_event' }; | ||
523 | 305 | 52µ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 | 305 | 969µs | 610 | 7.61ms | $self->callback->($self, 'sequence_start_event', $info); # spent 7.52ms making 305 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 25µs/call
# spent 98µs making 305 calls to YAML::PP::Parser::callback, avg 321ns/call |
528 | } | ||||
529 | |||||
530 | # spent 13.9ms (5.89+8.04) within YAML::PP::Parser::start_flow_sequence which was called 331 times, avg 42µs/call:
# 331 times (5.89ms+8.04ms) by YAML::PP::Parser::cb_start_flowseq at line 1221, avg 42µs/call | ||||
531 | 331 | 93µs | my ($self, $offset) = @_; | ||
532 | 331 | 269µs | 331 | 142µs | my $offsets = $self->offset; # spent 142µs making 331 calls to YAML::PP::Parser::offset, avg 429ns/call |
533 | 331 | 181µs | my $new_offset = $offsets->[-1]; | ||
534 | 331 | 256µs | 331 | 122µs | my $event_types = $self->events; # spent 122µs making 331 calls to YAML::PP::Parser::events, avg 369ns/call |
535 | 331 | 378µs | 331 | 115µs | if ($new_offset < 0) { # spent 115µs making 331 calls to YAML::PP::Parser::new_node, avg 347ns/call |
536 | $new_offset = 0; | ||||
537 | } | ||||
538 | elsif ($self->new_node) { | ||||
539 | 331 | 660µs | 331 | 166µs | if ($event_types->[-1] !~ m/^FLOW/) { # spent 166µs making 331 calls to YAML::PP::Parser::CORE:match, avg 502ns/call |
540 | $new_offset++; | ||||
541 | } | ||||
542 | } | ||||
543 | 331 | 429µs | 331 | 143µs | push @{ $self->events }, 'FLOWSEQ'; # spent 143µs making 331 calls to YAML::PP::Parser::events, avg 432ns/call |
544 | 331 | 102µs | push @{ $offsets }, $new_offset; | ||
545 | |||||
546 | 331 | 264µs | 331 | 91µs | my $event_stack = $self->event_stack; # spent 91µs making 331 calls to YAML::PP::Parser::event_stack, avg 275ns/call |
547 | 331 | 407µs | my $info = { style => YAML_FLOW_SEQUENCE_STYLE, name => 'sequence_start_event' }; | ||
548 | 331 | 135µs | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||
549 | $self->fetch_inline_properties($event_stack, $info); | ||||
550 | } | ||||
551 | 331 | 970µs | 662 | 7.26ms | $self->callback->($self, 'sequence_start_event', $info); # spent 7.17ms making 331 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 22µs/call
# spent 95µs making 331 calls to YAML::PP::Parser::callback, avg 287ns/call |
552 | } | ||||
553 | |||||
554 | # spent 8.40ms (3.34+5.06) within YAML::PP::Parser::start_flow_mapping which was called 214 times, avg 39µs/call:
# 214 times (3.34ms+5.06ms) by YAML::PP::Parser::cb_start_flowmap at line 1226, avg 39µs/call | ||||
555 | 214 | 75µs | my ($self, $offset, $implicit_flowseq_map) = @_; | ||
556 | 214 | 158µs | 214 | 83µs | my $offsets = $self->offset; # spent 83µs making 214 calls to YAML::PP::Parser::offset, avg 388ns/call |
557 | 214 | 97µs | my $new_offset = $offsets->[-1]; | ||
558 | 214 | 176µs | 214 | 74µs | my $event_types = $self->events; # spent 74µs making 214 calls to YAML::PP::Parser::events, avg 346ns/call |
559 | 214 | 256µs | 214 | 82µs | if ($new_offset < 0) { # spent 82µs making 214 calls to YAML::PP::Parser::new_node, avg 383ns/call |
560 | $new_offset = 0; | ||||
561 | } | ||||
562 | elsif ($self->new_node) { | ||||
563 | 214 | 377µs | 214 | 105µs | if ($event_types->[-1] !~ m/^FLOW/) { # spent 105µs making 214 calls to YAML::PP::Parser::CORE:match, avg 491ns/call |
564 | $new_offset++; | ||||
565 | } | ||||
566 | } | ||||
567 | 214 | 215µs | 214 | 77µs | push @{ $self->events }, $implicit_flowseq_map ? 'IMAP' : 'FLOWMAP'; # spent 77µs making 214 calls to YAML::PP::Parser::events, avg 360ns/call |
568 | 214 | 32µs | push @{ $offsets }, $new_offset; | ||
569 | |||||
570 | 214 | 111µs | 214 | 73µs | my $event_stack = $self->event_stack; # spent 73µs making 214 calls to YAML::PP::Parser::event_stack, avg 341ns/call |
571 | 214 | 154µs | my $info = { name => 'mapping_start_event', style => YAML_FLOW_MAPPING_STYLE }; | ||
572 | 214 | 43µs | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||
573 | $self->fetch_inline_properties($event_stack, $info); | ||||
574 | } | ||||
575 | 214 | 701µs | 428 | 4.57ms | $self->callback->($self, 'mapping_start_event', $info); # spent 4.46ms making 214 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 21µs/call
# spent 113µs making 214 calls to YAML::PP::Parser::callback, avg 528ns/call |
576 | } | ||||
577 | |||||
578 | # spent 10.6ms (3.65+6.91) within YAML::PP::Parser::end_flow_sequence which was called 331 times, avg 32µs/call:
# 331 times (3.65ms+6.91ms) by YAML::PP::Parser::cb_end_flowseq at line 1232, avg 32µs/call | ||||
579 | 331 | 107µs | my ($self) = @_; | ||
580 | 331 | 218µs | 331 | 139µs | my $event_types = $self->events; # spent 139µs making 331 calls to YAML::PP::Parser::events, avg 420ns/call |
581 | 331 | 115µs | pop @{ $event_types }; | ||
582 | 331 | 312µs | 331 | 137µs | pop @{ $self->offset }; # spent 137µs making 331 calls to YAML::PP::Parser::offset, avg 414ns/call |
583 | 331 | 261µs | my $info = { name => 'sequence_end_event' }; | ||
584 | 331 | 440µs | 662 | 6.15ms | $self->callback->($self, $info->{name}, $info); # spent 6.05ms making 331 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 18µs/call
# spent 107µs making 331 calls to YAML::PP::Parser::callback, avg 323ns/call |
585 | 331 | 1.52ms | 331 | 481µs | if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { # spent 481µs making 331 calls to YAML::PP::Parser::CORE:match, avg 1µs/call |
586 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||||
587 | } | ||||
588 | else { | ||||
589 | 308 | 218µs | push @$event_types, 'END_FLOW'; | ||
590 | } | ||||
591 | } | ||||
592 | |||||
593 | # spent 7.75ms (2.57+5.18) within YAML::PP::Parser::end_flow_mapping which was called 214 times, avg 36µs/call:
# 214 times (2.57ms+5.18ms) by YAML::PP::Parser::cb_end_flowmap at line 1267, avg 36µs/call | ||||
594 | 214 | 56µs | my ($self) = @_; | ||
595 | 214 | 196µs | 214 | 94µs | my $event_types = $self->events; # spent 94µs making 214 calls to YAML::PP::Parser::events, avg 439ns/call |
596 | 214 | 87µs | pop @{ $event_types }; | ||
597 | 214 | 228µs | 214 | 77µs | pop @{ $self->offset }; # spent 77µs making 214 calls to YAML::PP::Parser::offset, avg 360ns/call |
598 | 214 | 148µs | my $info = { name => 'mapping_end_event' }; | ||
599 | 214 | 247µs | 428 | 4.70ms | $self->callback->($self, $info->{name}, $info); # spent 4.63ms making 214 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 22µs/call
# spent 64µs making 214 calls to YAML::PP::Parser::callback, avg 299ns/call |
600 | 214 | 1.07ms | 214 | 312µs | if ($event_types->[-1] =~ m/^FLOW|^IMAP/) { # spent 312µs making 214 calls to YAML::PP::Parser::CORE:match, avg 1µs/call |
601 | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||||
602 | } | ||||
603 | else { | ||||
604 | 214 | 96µs | push @$event_types, 'END_FLOW'; | ||
605 | } | ||||
606 | } | ||||
607 | |||||
608 | # spent 2.03ms (1.81+213µs) within YAML::PP::Parser::cb_end_outer_flow which was called 522 times, avg 4µs/call:
# 522 times (1.81ms+213µs) by YAML::PP::Parser::parse_tokens at line 401, avg 4µs/call | ||||
609 | 522 | 168µs | my ($self) = @_; | ||
610 | 522 | 406µs | 522 | 213µs | my $event_types = $self->events; # spent 213µs making 522 calls to YAML::PP::Parser::events, avg 408ns/call |
611 | 522 | 183µs | pop @$event_types; | ||
612 | 522 | 942µs | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
613 | } | ||||
614 | |||||
615 | # spent 227ms (56.0+171) within YAML::PP::Parser::start_mapping which was called 6686 times, avg 34µs/call:
# 6686 times (56.0ms+171ms) by YAML::PP::Parser::cb_insert_map at line 1365, avg 34µs/call | ||||
616 | 6686 | 1.67ms | my ($self, $offset) = @_; | ||
617 | 6686 | 4.84ms | 6686 | 3.20ms | my $offsets = $self->offset; # spent 3.20ms making 6686 calls to YAML::PP::Parser::offset, avg 478ns/call |
618 | 6686 | 6.00ms | 6686 | 3.10ms | push @{ $self->events }, 'MAP'; # spent 3.10ms making 6686 calls to YAML::PP::Parser::events, avg 464ns/call |
619 | 6686 | 1.52ms | push @{ $offsets }, $offset; | ||
620 | 6686 | 3.32ms | 6686 | 2.03ms | my $event_stack = $self->event_stack; # spent 2.03ms making 6686 calls to YAML::PP::Parser::event_stack, avg 304ns/call |
621 | 6686 | 3.71ms | my $info = { name => 'mapping_start_event' }; | ||
622 | 6686 | 1.38ms | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||
623 | my $properties = pop @$event_stack; | ||||
624 | $self->node_properties($properties->[1], $info); | ||||
625 | } | ||||
626 | 6686 | 17.2ms | 13372 | 163ms | $self->callback->($self, 'mapping_start_event', $info); # spent 160ms making 6686 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 24µs/call
# spent 2.50ms making 6686 calls to YAML::PP::Parser::callback, avg 374ns/call |
627 | } | ||||
628 | |||||
629 | # spent 1.04ms (49µs+992µs) within YAML::PP::Parser::end_document which was called:
# once (49µs+992µs) by YAML::PP::Parser::parse_tokens at line 427 | ||||
630 | 1 | 1µs | my ($self, $implicit) = @_; | ||
631 | |||||
632 | 1 | 0s | 1 | 0s | my $event_types = $self->events; # spent 0s making 1 call to YAML::PP::Parser::events |
633 | 1 | 2µs | 1 | 0s | if ($event_types->[-1] =~ m/FLOW/) { # spent 0s making 1 call to YAML::PP::Parser::CORE:match |
634 | die "Unexpected end of flow context"; | ||||
635 | } | ||||
636 | 1 | 1µs | 1 | 0s | if ($self->new_node) { # spent 0s making 1 call to YAML::PP::Parser::new_node |
637 | $self->scalar_event({ style => YAML_PLAIN_SCALAR_STYLE, value => '' }); | ||||
638 | } | ||||
639 | 1 | 1µs | 1 | 964µs | $self->remove_nodes(-1); # spent 964µs 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 | 1µs | my $last = pop @{ $event_types }; | ||
645 | 1 | 1µs | if ($last ne 'DOC' and $last ne 'DOC_END') { | ||
646 | $self->exception("Unexpected event type $last"); | ||||
647 | } | ||||
648 | 1 | 2µs | 1 | 0s | pop @{ $self->offset }; # spent 0s making 1 call to YAML::PP::Parser::offset |
649 | 1 | 2µs | 2 | 24µs | $self->callback->($self, 'document_end_event', { # spent 24µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62]
# spent 0s making 1 call to YAML::PP::Parser::callback |
650 | name => 'document_end_event', | ||||
651 | implicit => $implicit, | ||||
652 | }); | ||||
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 | 2µs | 1 | 0s | $self->set_rule('STREAM'); # spent 0s making 1 call to YAML::PP::Parser::set_rule |
660 | } | ||||
661 | |||||
662 | # spent 15µs (10+5) within YAML::PP::Parser::end_stream which was called:
# once (10µs+5µs) by YAML::PP::Parser::parse at line 158 | ||||
663 | 1 | 0s | my ($self) = @_; | ||
664 | 1 | 1µ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 | 0s | 1 | 1µs | pop @{ $self->offset }; # spent 1µs making 1 call to YAML::PP::Parser::offset |
667 | 1 | 3µs | 2 | 4µs | $self->callback->($self, 'stream_end_event', { # spent 4µs making 1 call to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62]
# spent 0s making 1 call to YAML::PP::Parser::callback |
668 | name => 'stream_end_event', | ||||
669 | }); | ||||
670 | } | ||||
671 | |||||
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 994ms (202+793) within YAML::PP::Parser::scalar_event which was called 20764 times, avg 48µs/call:
# 7415 times (98.2ms+244ms) by YAML::PP::Parser::cb_send_scalar at line 1056, avg 46µs/call
# 6686 times (52.5ms+255ms) by YAML::PP::Parser::cb_insert_map at line 1366, avg 46µs/call
# 6634 times (50.8ms+292ms) by YAML::PP::Parser::cb_send_mapkey at line 1048, avg 52µs/call
# 29 times (232µs+1.33ms) by YAML::PP::Parser::cb_flowkey_plain at line 1289, avg 54µs/call | ||||
714 | 20764 | 3.24ms | my ($self, $info) = @_; | ||
715 | 20764 | 12.7ms | 20764 | 10.3ms | my $event_types = $self->events; # spent 10.3ms making 20764 calls to YAML::PP::Parser::events, avg 496ns/call |
716 | 20764 | 10.4ms | 20764 | 6.54ms | my $event_stack = $self->event_stack; # spent 6.54ms making 20764 calls to YAML::PP::Parser::event_stack, avg 315ns/call |
717 | 20764 | 3.55ms | if (@$event_stack and $event_stack->[-1]->[0] eq 'properties') { | ||
718 | my $properties = pop @$event_stack; | ||||
719 | $properties = $self->node_properties($properties->[1], $info); | ||||
720 | } | ||||
721 | |||||
722 | 20764 | 5.87ms | $info->{name} = 'scalar_event'; | ||
723 | 20764 | 23.2ms | 41528 | 764ms | $self->callback->($self, 'scalar_event', $info); # spent 757ms making 20764 calls to YAML::PP::Parser::__ANON__[YAML/PP/Parser.pm:62], avg 36µs/call
# spent 7.17ms making 20764 calls to YAML::PP::Parser::callback, avg 345ns/call |
724 | 20764 | 13.5ms | 20764 | 11.7ms | $self->set_new_node(0); # spent 11.7ms making 20764 calls to YAML::PP::Parser::set_new_node, avg 563ns/call |
725 | 20764 | 36.8ms | $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 30.8ms (27.7+3.13) within YAML::PP::Parser::cb_mapkey which was called 6619 times, avg 5µs/call:
# 6619 times (27.7ms+3.13ms) by YAML::PP::Parser::parse_tokens at line 401, avg 5µs/call | ||||
1032 | 6619 | 1.21ms | my ($self, $token) = @_; | ||
1033 | 6619 | 4.62ms | 6619 | 3.13ms | my $stack = $self->event_stack; # spent 3.13ms making 6619 calls to YAML::PP::Parser::event_stack, avg 473ns/call |
1034 | my $info = { | ||||
1035 | style => YAML_PLAIN_SCALAR_STYLE, | ||||
1036 | value => $token->{value}, | ||||
1037 | offset => $token->{column}, | ||||
1038 | 6619 | 7.88ms | }; | ||
1039 | 6619 | 1.72ms | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1040 | $self->fetch_inline_properties($stack, $info); | ||||
1041 | } | ||||
1042 | 6619 | 12.3ms | push @{ $stack }, [ scalar => $info ]; | ||
1043 | } | ||||
1044 | |||||
1045 | sub cb_send_mapkey { | ||||
1046 | 6634 | 842µs | my ($self, $res) = @_; | ||
1047 | 6634 | 4.85ms | 6634 | 2.39ms | my $last = pop @{ $self->event_stack }; # spent 2.39ms making 6634 calls to YAML::PP::Parser::event_stack, avg 360ns/call |
1048 | 6634 | 4.85ms | 6634 | 343ms | $self->scalar_event($last->[1]); # spent 343ms making 6634 calls to YAML::PP::Parser::scalar_event, avg 52µs/call |
1049 | 6634 | 15.9ms | 6634 | 2.35ms | $self->set_new_node(1); # spent 2.35ms making 6634 calls to YAML::PP::Parser::set_new_node, avg 354ns/call |
1050 | } | ||||
1051 | |||||
1052 | # spent 393ms (45.2+348) within YAML::PP::Parser::cb_send_scalar which was called 7415 times, avg 53µs/call:
# 6417 times (39.5ms+303ms) by YAML::PP::Parser::parse_tokens at line 401, avg 53µs/call
# 666 times (3.67ms+30.2ms) by YAML::PP::Parser::cb_flow_comma at line 1241, avg 51µs/call
# 331 times (2.03ms+14.7ms) by YAML::PP::Parser::cb_end_flowseq at line 1231, avg 51µs/call
# once (3µs+21µs) by YAML::PP::Parser::cb_send_block_scalar at line 1421 | ||||
1053 | 7415 | 1.50ms | my ($self, $res) = @_; | ||
1054 | 7415 | 5.62ms | 7415 | 2.87ms | my $last = pop @{ $self->event_stack }; # spent 2.87ms making 7415 calls to YAML::PP::Parser::event_stack, avg 387ns/call |
1055 | 7415 | 1.09ms | return unless $last; | ||
1056 | 7415 | 4.77ms | 7415 | 342ms | $self->scalar_event($last->[1]); # spent 342ms making 7415 calls to YAML::PP::Parser::scalar_event, avg 46µs/call |
1057 | 7415 | 4.35ms | 7415 | 3.07ms | my $e = $self->events; # spent 3.07ms making 7415 calls to YAML::PP::Parser::events, avg 413ns/call |
1058 | 7415 | 16.8ms | 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 13.2ms (1.79+11.4) within YAML::PP::Parser::cb_seqstart which was called 305 times, avg 43µs/call:
# 305 times (1.79ms+11.4ms) by YAML::PP::Parser::parse_tokens at line 401, avg 43µs/call | ||||
1138 | 305 | 117µs | my ($self, $token) = @_; | ||
1139 | 305 | 123µs | my $column = $token->{column}; | ||
1140 | 305 | 468µs | 305 | 11.3ms | $self->start_sequence($column); # spent 11.3ms making 305 calls to YAML::PP::Parser::start_sequence, avg 37µs/call |
1141 | 305 | 719µs | 305 | 169µs | $self->set_new_node(1); # spent 169µs making 305 calls to YAML::PP::Parser::set_new_node, avg 554ns/call |
1142 | } | ||||
1143 | |||||
1144 | # spent 902µs (753+149) within YAML::PP::Parser::cb_seqitem which was called 299 times, avg 3µs/call:
# 299 times (753µs+149µs) by YAML::PP::Parser::parse_tokens at line 401, avg 3µs/call | ||||
1145 | 299 | 83µs | my ($self, $res) = @_; | ||
1146 | 299 | 644µs | 299 | 149µs | $self->set_new_node(1); # spent 149µs making 299 calls to YAML::PP::Parser::set_new_node, avg 498ns/call |
1147 | } | ||||
1148 | |||||
1149 | sub cb_take_quoted { | ||||
1150 | 2045 | 618µs | my ($self, $token) = @_; | ||
1151 | 2045 | 468µs | my $subtokens = $token->{subtokens}; | ||
1152 | 2045 | 1.85ms | 2045 | 1.00ms | my $stack = $self->event_stack; # spent 1.00ms making 2045 calls to YAML::PP::Parser::event_stack, avg 491ns/call |
1153 | my $info = { | ||||
1154 | style => $subtokens->[0]->{value} eq '"' | ||||
1155 | ? YAML_DOUBLE_QUOTED_SCALAR_STYLE | ||||
1156 | : YAML_SINGLE_QUOTED_SCALAR_STYLE, | ||||
1157 | value => $token->{value}, | ||||
1158 | offset => $token->{column}, | ||||
1159 | 2045 | 3.39ms | }; | ||
1160 | 2045 | 529µs | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1161 | $self->fetch_inline_properties($stack, $info); | ||||
1162 | } | ||||
1163 | 2045 | 3.76ms | 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 742µs (85+657) within YAML::PP::Parser::cb_take_quoted_key which was called 15 times, avg 49µs/call:
# 15 times (85µs+657µs) by YAML::PP::Parser::parse_tokens at line 401, avg 49µs/call | ||||
1185 | 15 | 4µs | my ($self, $token) = @_; | ||
1186 | 15 | 21µs | 15 | 90µs | $self->cb_take_quoted($token); # spent 90µs making 15 calls to YAML::PP::Parser::cb_take_quoted, avg 6µs/call |
1187 | 15 | 38µs | 15 | 567µs | $self->cb_send_mapkey; # spent 567µs making 15 calls to YAML::PP::Parser::cb_send_mapkey, avg 38µ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 53.8ms (47.9+5.87) within YAML::PP::Parser::cb_start_plain which was called 12070 times, avg 4µs/call:
# 12070 times (47.9ms+5.87ms) by YAML::PP::Parser::parse_tokens at line 401, avg 4µs/call | ||||
1206 | 12070 | 1.87ms | my ($self, $token) = @_; | ||
1207 | 12070 | 8.53ms | 12070 | 5.88ms | my $stack = $self->event_stack; # spent 5.88ms making 12070 calls to YAML::PP::Parser::event_stack, avg 487ns/call |
1208 | my $info = { | ||||
1209 | style => YAML_PLAIN_SCALAR_STYLE, | ||||
1210 | value => $token->{value}, | ||||
1211 | offset => $token->{column}, | ||||
1212 | 12070 | 14.1ms | }; | ||
1213 | 12070 | 2.66ms | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1214 | $self->fetch_inline_properties($stack, $info); | ||||
1215 | } | ||||
1216 | 12070 | 18.5ms | push @{ $stack }, [ scalar => $info ]; | ||
1217 | } | ||||
1218 | |||||
1219 | # spent 15.0ms (1.02+13.9) within YAML::PP::Parser::cb_start_flowseq which was called 331 times, avg 45µs/call:
# 331 times (1.02ms+13.9ms) by YAML::PP::Parser::parse_tokens at line 401, avg 45µs/call | ||||
1220 | 331 | 104µs | my ($self, $token) = @_; | ||
1221 | 331 | 960µs | 331 | 13.9ms | $self->start_flow_sequence($token->{column}); # spent 13.9ms making 331 calls to YAML::PP::Parser::start_flow_sequence, avg 42µs/call |
1222 | } | ||||
1223 | |||||
1224 | # spent 9.16ms (760µs+8.40) within YAML::PP::Parser::cb_start_flowmap which was called 214 times, avg 43µs/call:
# 214 times (760µs+8.40ms) by YAML::PP::Parser::parse_tokens at line 401, avg 43µs/call | ||||
1225 | 214 | 99µs | my ($self, $token) = @_; | ||
1226 | 214 | 565µs | 214 | 8.40ms | $self->start_flow_mapping($token->{column}); # spent 8.40ms making 214 calls to YAML::PP::Parser::start_flow_mapping, avg 39µs/call |
1227 | } | ||||
1228 | |||||
1229 | # spent 29.5ms (1.99+27.5) within YAML::PP::Parser::cb_end_flowseq which was called 331 times, avg 89µs/call:
# 331 times (1.99ms+27.5ms) by YAML::PP::Parser::parse_tokens at line 401, avg 89µs/call | ||||
1230 | 331 | 100µs | my ($self, $res) = @_; | ||
1231 | 331 | 269µs | 331 | 16.8ms | $self->cb_send_scalar; # spent 16.8ms making 331 calls to YAML::PP::Parser::cb_send_scalar, avg 51µs/call |
1232 | 331 | 481µs | 331 | 10.6ms | $self->end_flow_sequence; # spent 10.6ms making 331 calls to YAML::PP::Parser::end_flow_sequence, avg 32µs/call |
1233 | 331 | 626µs | 331 | 158µs | $self->set_new_node(0); # spent 158µs making 331 calls to YAML::PP::Parser::set_new_node, avg 477ns/call |
1234 | } | ||||
1235 | |||||
1236 | # spent 39.3ms (4.44+34.9) within YAML::PP::Parser::cb_flow_comma which was called 666 times, avg 59µs/call:
# 666 times (4.44ms+34.9ms) by YAML::PP::Parser::parse_tokens at line 401, avg 59µs/call | ||||
1237 | 666 | 134µs | my ($self) = @_; | ||
1238 | 666 | 435µs | 666 | 350µs | my $event_types = $self->events; # spent 350µs making 666 calls to YAML::PP::Parser::events, avg 526ns/call |
1239 | 666 | 412µs | 666 | 279µs | $self->set_new_node(0); # spent 279µs making 666 calls to YAML::PP::Parser::set_new_node, avg 419ns/call |
1240 | 666 | 2.49ms | 666 | 387µs | if ($event_types->[-1] =~ m/^FLOWSEQ/) { # spent 387µs making 666 calls to YAML::PP::Parser::CORE:match, avg 581ns/call |
1241 | 666 | 386µs | 666 | 33.8ms | $self->cb_send_scalar; # spent 33.8ms making 666 calls to YAML::PP::Parser::cb_send_scalar, avg 51µs/call |
1242 | 666 | 311µs | $event_types->[-1] = $next_event{ $event_types->[-1] }; | ||
1243 | } | ||||
1244 | } | ||||
1245 | |||||
1246 | # spent 71µs (56+15) within YAML::PP::Parser::cb_flow_colon which was called 29 times, avg 2µs/call:
# 29 times (56µs+15µs) by YAML::PP::Parser::parse_tokens at line 401, avg 2µs/call | ||||
1247 | 29 | 6µs | my ($self) = @_; | ||
1248 | 29 | 56µs | 29 | 15µs | $self->set_new_node(1); # spent 15µs making 29 calls to YAML::PP::Parser::set_new_node, avg 517ns/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 8.82ms (943µs+7.87) within YAML::PP::Parser::cb_end_flowmap which was called 214 times, avg 41µs/call:
# 214 times (943µs+7.87ms) by YAML::PP::Parser::parse_tokens at line 401, avg 41µs/call | ||||
1266 | 214 | 59µs | my ($self, $res) = @_; | ||
1267 | 214 | 291µs | 214 | 7.75ms | $self->end_flow_mapping; # spent 7.75ms making 214 calls to YAML::PP::Parser::end_flow_mapping, avg 36µs/call |
1268 | 214 | 371µs | 214 | 122µs | $self->set_new_node(0); # spent 122µs making 214 calls to YAML::PP::Parser::set_new_node, avg 570ns/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 1.79ms (211µs+1.58) within YAML::PP::Parser::cb_flowkey_plain which was called 29 times, avg 62µs/call:
# 29 times (211µs+1.58ms) by YAML::PP::Parser::parse_tokens at line 401, avg 62µs/call | ||||
1279 | 29 | 5µs | my ($self, $token) = @_; | ||
1280 | 29 | 23µs | 29 | 9µs | my $stack = $self->event_stack; # spent 9µs making 29 calls to YAML::PP::Parser::event_stack, avg 310ns/call |
1281 | my $info = { | ||||
1282 | style => YAML_PLAIN_SCALAR_STYLE, | ||||
1283 | value => $token->{value}, | ||||
1284 | offset => $token->{column}, | ||||
1285 | 29 | 66µs | }; | ||
1286 | 29 | 5µs | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1287 | $self->fetch_inline_properties($stack, $info); | ||||
1288 | } | ||||
1289 | 29 | 94µs | 29 | 1.57ms | $self->scalar_event($info); # spent 1.57ms making 29 calls to YAML::PP::Parser::scalar_event, avg 54µ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 591ms (51.1+539) within YAML::PP::Parser::cb_insert_map which was called 6686 times, avg 88µs/call:
# 6686 times (51.1ms+539ms) by YAML::PP::Parser::parse_tokens at line 401, avg 88µs/call | ||||
1361 | 6686 | 1.42ms | my ($self, $res) = @_; | ||
1362 | 6686 | 3.77ms | 6686 | 2.62ms | my $stack = $self->event_stack; # spent 2.62ms making 6686 calls to YAML::PP::Parser::event_stack, avg 392ns/call |
1363 | 6686 | 1.74ms | my $scalar = pop @$stack; | ||
1364 | 6686 | 1.36ms | my $info = $scalar->[1]; | ||
1365 | 6686 | 6.91ms | 6686 | 227ms | $self->start_mapping($info->{offset}); # spent 227ms making 6686 calls to YAML::PP::Parser::start_mapping, avg 34µs/call |
1366 | 6686 | 5.10ms | 6686 | 307ms | $self->scalar_event($info); # spent 307ms making 6686 calls to YAML::PP::Parser::scalar_event, avg 46µs/call |
1367 | 6686 | 17.5ms | 6686 | 2.39ms | $self->set_new_node(1); # spent 2.39ms making 6686 calls to YAML::PP::Parser::set_new_node, avg 358ns/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 | 0s | my $type = $token->{subtokens}->[0]->{value}; | ||
1409 | 1 | 1µs | 1 | 0s | my $stack = $self->event_stack; # spent 0s making 1 call to YAML::PP::Parser::event_stack |
1410 | my $info = { | ||||
1411 | style => $type eq '|' | ||||
1412 | ? YAML_LITERAL_SCALAR_STYLE | ||||
1413 | : YAML_FOLDED_SCALAR_STYLE, | ||||
1414 | value => $token->{value}, | ||||
1415 | offset => $token->{column}, | ||||
1416 | 1 | 1µs | }; | ||
1417 | 1 | 0s | if (@$stack and $stack->[-1]->[0] eq 'properties') { | ||
1418 | $self->fetch_inline_properties($stack, $info); | ||||
1419 | } | ||||
1420 | 1 | 2µs | 1 | 0s | push @{ $self->event_stack }, [ scalar => $info ]; # spent 0s making 1 call to YAML::PP::Parser::event_stack |
1421 | 1 | 3µs | 1 | 24µs | $self->cb_send_scalar; # spent 24µ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 48µs (4+44) within YAML::PP::Parser::cb_doc_start_explicit which was called:
# once (4µs+44µs) by YAML::PP::Parser::parse_tokens at line 401 | ||||
1440 | 1 | 0s | my ($self, $token) = @_; | ||
1441 | 1 | 3µs | 1 | 44µs | $self->start_document(0); # spent 44µ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 | 16µs | 1; | ||
# spent 5.95ms within YAML::PP::Parser::CORE:match which was called 15111 times, avg 394ns/call:
# 13354 times (4.50ms+0s) by YAML::PP::Parser::lex_next_tokens at line 185, avg 337ns/call
# 666 times (387µs+0s) by YAML::PP::Parser::cb_flow_comma at line 1240, avg 581ns/call
# 331 times (481µs+0s) by YAML::PP::Parser::end_flow_sequence at line 585, avg 1µs/call
# 331 times (166µs+0s) by YAML::PP::Parser::start_flow_sequence at line 539, avg 502ns/call
# 214 times (312µs+0s) by YAML::PP::Parser::end_flow_mapping at line 600, avg 1µs/call
# 214 times (105µs+0s) by YAML::PP::Parser::start_flow_mapping at line 563, avg 491ns/call
# once (0s+0s) by YAML::PP::Parser::end_document at line 633 | |||||
# spent 5µs within YAML::PP::Parser::__ANON__ which was called 4 times, avg 1µs/call:
# once (2µs+0s) by YAML::PP::Parser::BEGIN@17 at line 17
# once (1µs+0s) by YAML::PP::Parser::BEGIN@18 at line 18
# once (1µs+0s) by YAML::PP::Parser::BEGIN@20 at line 20
# once (1µs+0s) by YAML::PP::Parser::BEGIN@21 at line 21 |