Filename | /home/s1/perl5/perlbrew/perls/perl-5.22.1/lib/site_perl/5.22.1/DateTime/Format/Alami/EN.pm |
Statements | Executed 10017 statements in 75.6ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 3.98ms | 4.05ms | BEGIN@8 | DateTime::Format::Alami::EN::
1 | 1 | 1 | 872µs | 971µs | BEGIN@7 | DateTime::Format::Alami::EN::
1 | 1 | 1 | 788µs | 2.16ms | BEGIN@14 | DateTime::Format::Alami::EN::
1 | 1 | 1 | 533µs | 5.94ms | BEGIN@91 | DateTime::Format::Alami::EN::
1 | 1 | 1 | 39µs | 39µs | BEGIN@6 | DateTime::Format::Alami::EN::
2 | 2 | 1 | 21µs | 21µs | CORE:qr (opcode) | DateTime::Format::Alami::EN::
1 | 1 | 1 | 10µs | 25.4ms | BEGIN@92 | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | __ANON__[:94] | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | __ANON__[:95] | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | _parse_num | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | o_ampm | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | o_cardinal_suffix | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | o_date | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | o_num | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_date_time | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_dateymd | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_dur_ago | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_dur_later | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_now | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_time | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_today | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_tomorrow | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_which_dow | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | p_yesterday | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_apr | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_aug | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_day | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_dec | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_feb | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_friday | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_hour | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_jan | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_jul | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_jun | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_mar | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_may | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_minute | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_monday | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_month | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_nov | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_oct | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_saturday | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_second | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_sep | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_sunday | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_thursday | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_tuesday | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_wednesday | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_week | DateTime::Format::Alami::EN::
0 | 0 | 0 | 0s | 0s | w_year | DateTime::Format::Alami::EN::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package DateTime::Format::Alami::EN; | ||||
2 | |||||
3 | 1 | 900ns | our $DATE = '2016-06-30'; # DATE | ||
4 | 1 | 200ns | our $VERSION = '0.11'; # VERSION | ||
5 | |||||
6 | 2 | 85µs | 1 | 39µs | # spent 39µs within DateTime::Format::Alami::EN::BEGIN@6 which was called:
# once (39µs+0s) by main::BEGIN@0 at line 6 # spent 39µs making 1 call to DateTime::Format::Alami::EN::BEGIN@6 |
7 | 2 | 595µs | 2 | 976µs | # spent 971µs (872+98) within DateTime::Format::Alami::EN::BEGIN@7 which was called:
# once (872µs+98µs) by main::BEGIN@0 at line 7 # spent 971µs making 1 call to DateTime::Format::Alami::EN::BEGIN@7
# spent 6µs making 1 call to strict::import |
8 | 2 | 3.85ms | 2 | 4.06ms | # spent 4.05ms (3.98+71µs) within DateTime::Format::Alami::EN::BEGIN@8 which was called:
# once (3.98ms+71µs) by main::BEGIN@0 at line 8 # spent 4.05ms making 1 call to DateTime::Format::Alami::EN::BEGIN@8
# spent 13µs making 1 call to warnings::import |
9 | |||||
10 | # XXX holidays -> christmas | new year | ... | ||||
11 | # XXX timezone in time | ||||
12 | # XXX more patterns from DF:Natural | ||||
13 | |||||
14 | 2 | 1.29ms | 2 | 2.24ms | # spent 2.16ms (788µs+1.37) within DateTime::Format::Alami::EN::BEGIN@14 which was called:
# once (788µs+1.37ms) by main::BEGIN@0 at line 14 # spent 2.16ms making 1 call to DateTime::Format::Alami::EN::BEGIN@14
# spent 83µs making 1 call to Exporter::import |
15 | |||||
16 | sub o_num { $Parse::Number::EN::Pat } | ||||
17 | sub _parse_num { parse_number_en(text => $_[1]) } | ||||
18 | sub w_year { ["year", "years", "y"] } | ||||
19 | sub w_month { ["month", "months", "mon"] } | ||||
20 | sub w_week { ["week", "weeks", "wk", "wks"] } | ||||
21 | sub w_day { ["day", "days", "d"] } | ||||
22 | sub w_hour { ["hour", "hours", "h"] } | ||||
23 | sub w_minute { ["minute", "minutes", "min", "mins"] } | ||||
24 | sub w_second { ["second", "seconds", "sec", "secs", "s"] } | ||||
25 | |||||
26 | sub w_jan { ["january", "jan"] } | ||||
27 | sub w_feb { ["february", "feb"] } | ||||
28 | sub w_mar { ["march", "mar"] } | ||||
29 | sub w_apr { ["april", "apr"] } | ||||
30 | sub w_may { ["may"] } | ||||
31 | sub w_jun { ["june", "jun"] } | ||||
32 | sub w_jul { ["july", "jul"] } | ||||
33 | sub w_aug { ["august", "aug"] } | ||||
34 | sub w_sep { ["september", "sept", "sep"] } | ||||
35 | sub w_oct { ["october", "oct"] } | ||||
36 | sub w_nov { ["november", "nov"] } | ||||
37 | sub w_dec { ["december", "dec"] } | ||||
38 | |||||
39 | sub w_monday { ["monday", "mon"] } | ||||
40 | sub w_tuesday { ["tuesday", "tue"] } | ||||
41 | sub w_wednesday { ["wednesday", "wed"] } | ||||
42 | sub w_thursday { ["thursday", "thu"] } | ||||
43 | sub w_friday { ["friday", "fri"] } | ||||
44 | sub w_saturday { ["saturday", "sat"] } | ||||
45 | sub w_sunday { ["sunday", "sun"] } | ||||
46 | |||||
47 | sub p_now { "(?:(?:(?:right|just) \\s+ )?now|immediately)" } | ||||
48 | sub p_today { "(?:today|this \\s+ day)" } | ||||
49 | sub p_tomorrow { "(?:tomorrow|tom)" } | ||||
50 | sub p_yesterday { "(?:yesterday|yest)" } | ||||
51 | |||||
52 | sub o_cardinal_suffix { '(?:\s*(?:th|nd|st))' } | ||||
53 | |||||
54 | sub p_dateymd { join( | ||||
55 | # we use the 'local' trick here in embedded code (see perlre) to be | ||||
56 | # backtrack-safe. we want to unset $m->{o_yearint} when date does not | ||||
57 | # contain year. $m->{o_yearint} might be set when we try the patterns but | ||||
58 | # might end up needing to be unset if the matching pattern ends up not | ||||
59 | # having year. | ||||
60 | "", | ||||
61 | '(?{ $DateTime::Format::Alami::_has_year = 0 })', | ||||
62 | '(?: <o_dayint><o_cardinal_suffix>? (?:\\s*|[ /-]) <o_monthname> | <o_monthname> (?:\\s*|[ /-]) <o_dayint><o_cardinal_suffix>?\\b | <o_monthint>[/-]<o_dayint>\\b )', | ||||
63 | '(?: \\s*[,/-]?\\s* <o_yearint> (?{ local $DateTime::Format::Alami::_has_year = $DateTime::Format::Alami::_has_year + 1 }))?', | ||||
64 | '(?{ delete $DateTime::Format::Alami::m->{o_yearint} unless $DateTime::Format::Alami::_has_year })', | ||||
65 | )} | ||||
66 | |||||
67 | sub p_dur_ago { "<o_dur> \\s+ (?:ago)" } | ||||
68 | sub p_dur_later { "<o_dur> \\s+ (?:later) | in \\s+ <o_dur>" } | ||||
69 | |||||
70 | sub p_which_dow { join( | ||||
71 | "", | ||||
72 | '(?{ $DateTime::Format::Alami::_offset = 0 })', | ||||
73 | "(?:", | ||||
74 | ' (?: (?:last \s+)(?{ local $DateTime::Format::Alami::_offset = -1 }) | (?:next \s+)(?{ local $DateTime::Format::Alami::_offset = 1 }) | (?:this \s+)?)', | ||||
75 | ' <o_dow>', | ||||
76 | ")", | ||||
77 | '(?{ $DateTime::Format::Alami::m->{offset} = $DateTime::Format::Alami::_offset })', | ||||
78 | )} | ||||
79 | |||||
80 | sub o_date { "(?: <p_which_dow>|<p_today>|<p_tomorrow>|<p_yesterday>|<p_dateymd>)" } | ||||
81 | sub o_ampm { "(?: am|pm)" } | ||||
82 | sub p_time { "(?: <o_hour>[:.]<o_minute>(?: [:.]<o_second>)? \\s* <o_ampm>?)" } # XXX am/pm | ||||
83 | sub p_date_time { "(?:<o_date> \\s+ (?:(?:on|at) \\s+)? <p_time>)" } | ||||
84 | |||||
85 | # the ordering is a bit weird because: we need to apply role at compile-time | ||||
86 | # before the precomputed $RE mentions $o & $m thus creating the package | ||||
87 | # DateTime::Format::Alami and this makes Role::Tiny::With complains that DT:F:A | ||||
88 | # is not a role. then, if we are to apply the role, we need to already declare | ||||
89 | # the methods required by the role. | ||||
90 | |||||
91 | 2 | 306µs | 2 | 5.99ms | # spent 5.94ms (533µs+5.41) within DateTime::Format::Alami::EN::BEGIN@91 which was called:
# once (533µs+5.41ms) by main::BEGIN@0 at line 91 # spent 5.94ms making 1 call to DateTime::Format::Alami::EN::BEGIN@91
# spent 51µs making 1 call to Exporter::import |
92 | 1 | 2.03ms | 2 | 50.8ms | # spent 25.4ms (10µs+25.4) within DateTime::Format::Alami::EN::BEGIN@92 which was called:
# once (10µs+25.4ms) by main::BEGIN@0 at line 92 # spent 25.4ms making 1 call to DateTime::Format::Alami::EN::BEGIN@92
# spent 25.4ms making 1 call to Role::Tiny::With::with |
93 | |||||
94 | 10001 | 67.4ms | 3001 | 2.46s | our $RE_DT = qr(((?&top))(?(DEFINE)(?<top>(?&p_date_time)|(?&p_dur_later)|(?&p_dur_ago)|(?&p_time)|(?&p_which_dow)|(?&p_today)|(?&p_tomorrow)|(?&p_yesterday)|(?&p_dateymd)|(?&p_now))(?<p_date_time> (\b (?:(?&o_date) \s+ (?:(?:on|at) \s+)? (?&p_time)) \b)(?{ $DateTime::Format::Alami::m->{p_date_time} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_date_time"; $DateTime::Format::Alami::o->a_date_time($DateTime::Format::Alami::m) }))(?<p_dur_later> (\b (?&o_dur) \s+ (?:later) | in \s+ (?&o_dur) \b)(?{ $DateTime::Format::Alami::m->{p_dur_later} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_dur_later"; $DateTime::Format::Alami::o->a_dur_later($DateTime::Format::Alami::m) }))(?<p_dur_ago> (\b (?&o_dur) \s+ (?:ago) \b)(?{ $DateTime::Format::Alami::m->{p_dur_ago} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_dur_ago"; $DateTime::Format::Alami::o->a_dur_ago($DateTime::Format::Alami::m) }))(?<o_date> ((?: (?&p_which_dow)|(?&p_today)|(?&p_tomorrow)|(?&p_yesterday)|(?&p_dateymd)))(?{ $DateTime::Format::Alami::m->{o_date} = $^N }))(?<p_time> (\b (?: (?&o_hour)[:.](?&o_minute)(?: [:.](?&o_second))? \s* (?&o_ampm)?) \b)(?{ $DateTime::Format::Alami::m->{p_time} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_time"; $DateTime::Format::Alami::o->a_time($DateTime::Format::Alami::m) }))(?<o_dur> ((?:((?:[+-]?(?:(?:\d{1,3}(?:[,]\d{3})+|\d+)(?:[.]\d*)?|[.]\d+)(?:[Ee][+-]?\d+)?)\s*(?:year|years|y|month|months|mon|week|weeks|wk|wks|day|days|d|hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s)\s*(?:,\s*)?)+))(?{ $DateTime::Format::Alami::m->{o_dur} = $^N }))(?<p_which_dow> (\b (?{ $DateTime::Format::Alami::_offset = 0 })(?: (?: (?:last \s+)(?{ local $DateTime::Format::Alami::_offset = -1 }) | (?:next \s+)(?{ local $DateTime::Format::Alami::_offset = 1 }) | (?:this \s+)?) (?&o_dow))(?{ $DateTime::Format::Alami::m->{offset} = $DateTime::Format::Alami::_offset }) \b)(?{ $DateTime::Format::Alami::m->{p_which_dow} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_which_dow"; $DateTime::Format::Alami::o->a_which_dow($DateTime::Format::Alami::m) }))(?<p_today> (\b (?:today|this \s+ day) \b)(?{ $DateTime::Format::Alami::m->{p_today} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_today"; $DateTime::Format::Alami::o->a_today($DateTime::Format::Alami::m) }))(?<p_tomorrow> (\b (?:tomorrow|tom) \b)(?{ $DateTime::Format::Alami::m->{p_tomorrow} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_tomorrow"; $DateTime::Format::Alami::o->a_tomorrow($DateTime::Format::Alami::m) }))(?<p_yesterday> (\b (?:yesterday|yest) \b)(?{ $DateTime::Format::Alami::m->{p_yesterday} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_yesterday"; $DateTime::Format::Alami::o->a_yesterday($DateTime::Format::Alami::m) }))(?<p_dateymd> (\b (?{ $DateTime::Format::Alami::_has_year = 0 })(?: (?&o_dayint)(?&o_cardinal_suffix)? (?:\s*|[ /-]) (?&o_monthname) | (?&o_monthname) (?:\s*|[ /-]) (?&o_dayint)(?&o_cardinal_suffix)?\b | (?&o_monthint)[/-](?&o_dayint)\b )(?: \s*[,/-]?\s* (?&o_yearint) (?{ local $DateTime::Format::Alami::_has_year = $DateTime::Format::Alami::_has_year + 1 }))?(?{ delete $DateTime::Format::Alami::m->{o_yearint} unless $DateTime::Format::Alami::_has_year }) \b)(?{ $DateTime::Format::Alami::m->{p_dateymd} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_dateymd"; $DateTime::Format::Alami::o->a_dateymd($DateTime::Format::Alami::m) }))(?<o_hour> ((?:[0-9][0-9]?))(?{ $DateTime::Format::Alami::m->{o_hour} = $^N }))(?<o_minute> ((?:[0-9][0-9]?))(?{ $DateTime::Format::Alami::m->{o_minute} = $^N }))(?<o_second> ((?:[0-9][0-9]?))(?{ $DateTime::Format::Alami::m->{o_second} = $^N }))(?<o_ampm> ((?: am|pm))(?{ $DateTime::Format::Alami::m->{o_ampm} = $^N }))(?<o_dow> ((?:monday|mon|tuesday|tue|wednesday|wed|thursday|thu|friday|fri|saturday|sat|sunday|sun))(?{ $DateTime::Format::Alami::m->{o_dow} = $^N }))(?<o_monthname> ((?:january|jan|february|feb|march|mar|april|apr|may|june|jun|july|jul|august|aug|september|sept|sep|october|oct|november|nov|december|dec))(?{ $DateTime::Format::Alami::m->{o_monthname} = $^N }))(?<o_cardinal_suffix> ((?:\s*(?:th|nd|st)))(?{ $DateTime::Format::Alami::m->{o_cardinal_suffix} = $^N }))(?<o_monthint> ((?:0?[1-9]|1[012]))(?{ $DateTime::Format::Alami::m->{o_monthint} = $^N }))(?<o_dayint> ((?:[12][0-9]|3[01]|0?[1-9]))(?{ $DateTime::Format::Alami::m->{o_dayint} = $^N }))(?<o_yearint> ((?:[0-9]{4}|[0-9]{2}))(?{ $DateTime::Format::Alami::m->{o_yearint} = $^N }))(?<o_timedur> ((?:((?:[+-]?(?:(?:\d{1,3}(?:[,]\d{3})+|\d+)(?:[.]\d*)?|[.]\d+)(?:[Ee][+-]?\d+)?)\s*(?:hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s)\s*(?:,\s*)?)+))(?{ $DateTime::Format::Alami::m->{o_timedur} = $^N }))(?<p_now> (\b (?:(?:(?:right|just) \s+ )?now|immediately) \b)(?{ $DateTime::Format::Alami::m->{p_now} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "p_now"; $DateTime::Format::Alami::o->a_now($DateTime::Format::Alami::m) }))(?<o_durwords> ((?:year|years|y|month|months|mon|week|weeks|wk|wks|day|days|d|hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s))(?{ $DateTime::Format::Alami::m->{o_durwords} = $^N }))(?<o_num> ((?:[+-]?(?:(?:\d{1,3}(?:[,]\d{3})+|\d+)(?:[.]\d*)?|[.]\d+)(?:[Ee][+-]?\d+)?))(?{ $DateTime::Format::Alami::m->{o_num} = $^N }))(?<o_timedurwords> ((?:hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s))(?{ $DateTime::Format::Alami::m->{o_timedurwords} = $^N }))))ix; # PRECOMPUTED FROM: do { DateTime::Format::Alami::EN->new; $DateTime::Format::Alami::EN::RE_DT } # spent 2.46s making 3000 calls to DateTime::Format::Alami::a_dateymd, avg 821µs/call
# spent 18µs making 1 call to DateTime::Format::Alami::EN::CORE:qr |
95 | 1 | 14µs | 1 | 2µs | our $RE_DUR = qr((?&top)(?(DEFINE)(?<top>(?&pdur_dur))(?<pdur_dur> (\b (?:(?&odur_dur)) \b)(?{ $DateTime::Format::Alami::m->{pdur_dur} = $^N })(?{ $DateTime::Format::Alami::o->{_pat} = "pdur_dur"; $DateTime::Format::Alami::o->adur_dur($DateTime::Format::Alami::m) }))(?<odur_dur> ((?:((?:[+-]?(?:(?:\d{1,3}(?:[,]\d{3})+|\d+)(?:[.]\d*)?|[.]\d+)(?:[Ee][+-]?\d+)?)\s*(?:year|years|y|month|months|mon|week|weeks|wk|wks|day|days|d|hour|hours|h|minute|minutes|min|mins|second|seconds|sec|secs|s)\s*(?:,\s*)?)+))(?{ $DateTime::Format::Alami::m->{odur_dur} = $^N }))))ix; # PRECOMPUTED FROM: do { DateTime::Format::Alami::EN->new; $DateTime::Format::Alami::EN::RE_DUR } # spent 2µs making 1 call to DateTime::Format::Alami::EN::CORE:qr |
96 | 1 | 16µs | our $MAPS = {dow=>{fri=>5,friday=>5,mon=>1,monday=>1,sat=>6,saturday=>6,sun=>7,sunday=>7,thu=>4,thursday=>4,tue=>2,tuesday=>2,wed=>3,wednesday=>3},months=>{apr=>4,april=>4,aug=>8,august=>8,dec=>12,december=>12,feb=>2,february=>2,jan=>1,january=>1,jul=>7,july=>7,jun=>6,june=>6,mar=>3,march=>3,may=>5,nov=>11,november=>11,oct=>10,october=>10,sep=>9,sept=>9,september=>9}}; # PRECOMPUTED FROM: do { DateTime::Format::Alami::EN->new; $DateTime::Format::Alami::EN::MAPS } | ||
97 | |||||
98 | 1 | 13µs | 1; | ||
99 | # ABSTRACT: Parse human date/time/duration expression (English) | ||||
100 | |||||
101 | __END__ | ||||
sub DateTime::Format::Alami::EN::CORE:qr; # opcode |