line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Xslate::Symbol; |
2
|
172
|
|
|
172
|
|
931
|
use Mouse; |
|
172
|
|
|
|
|
368
|
|
|
172
|
|
|
|
|
1038
|
|
3
|
|
|
|
|
|
|
|
4
|
172
|
|
|
172
|
|
49939
|
use Text::Xslate::Util qw(p $DEBUG); |
|
172
|
|
|
|
|
380
|
|
|
172
|
|
|
|
|
34057
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
use overload |
7
|
|
|
|
|
|
|
bool => sub() { 1 }, |
8
|
389
|
|
|
389
|
|
2570
|
'""' => sub { $_[0]->id }, |
9
|
172
|
|
|
|
|
3185
|
fallback => 1, |
10
|
172
|
|
|
172
|
|
34289
|
; |
|
172
|
|
|
|
|
23770
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @CARP_NOT = qw(Text::Xslate::Parser); |
13
|
|
|
|
|
|
|
|
14
|
172
|
|
|
172
|
|
22474
|
use constant _DUMP_DENOTE => scalar($DEBUG =~ /\b dump=denote \b/xmsi); |
|
172
|
|
|
|
|
358
|
|
|
172
|
|
|
|
|
142705
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has id => ( |
17
|
|
|
|
|
|
|
is => 'rw', |
18
|
|
|
|
|
|
|
isa => 'Str', |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has lbp => ( # left binding power |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
isa => 'Int', |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
lazy => 1, |
27
|
|
|
|
|
|
|
default => 0, |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has ubp => ( # unary binding power |
31
|
|
|
|
|
|
|
is => 'rw', |
32
|
|
|
|
|
|
|
isa => 'Int', |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
required => 0, |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has value => ( |
38
|
|
|
|
|
|
|
is => 'rw', |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
lazy => 1, |
41
|
|
|
|
|
|
|
builder => 'id', |
42
|
|
|
|
|
|
|
trigger => sub { |
43
|
|
|
|
|
|
|
my($self) = @_; |
44
|
|
|
|
|
|
|
$self->is_value(1); |
45
|
|
|
|
|
|
|
return; |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
# default => sub{ |
48
|
|
|
|
|
|
|
# if(!defined $_[0]) { #XXX: Mouse::XS's bug |
49
|
|
|
|
|
|
|
# my(undef, $file, $line) = caller; |
50
|
|
|
|
|
|
|
# warn "[bug] no invocant at $file line $line.\n"; |
51
|
|
|
|
|
|
|
# return '(null)'; |
52
|
|
|
|
|
|
|
# } |
53
|
|
|
|
|
|
|
# return $_[0]->id |
54
|
|
|
|
|
|
|
# }, |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# some tokens have the counterpart token (e.g. '{' to '}') |
58
|
|
|
|
|
|
|
has counterpart => ( |
59
|
|
|
|
|
|
|
is => 'rw', |
60
|
|
|
|
|
|
|
isa => 'Str', |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
required => 0, |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# flags |
66
|
|
|
|
|
|
|
has [ |
67
|
|
|
|
|
|
|
'is_reserved', # set by reserve() |
68
|
|
|
|
|
|
|
'is_defined', # set by define() |
69
|
|
|
|
|
|
|
'is_block_end', # block ending markers |
70
|
|
|
|
|
|
|
'is_logical', # logical operators |
71
|
|
|
|
|
|
|
'is_comma', # comma like operators |
72
|
|
|
|
|
|
|
'is_value', # symbols with values |
73
|
|
|
|
|
|
|
'is_statement', # expr but a statement (e.g. assignment) |
74
|
|
|
|
|
|
|
'can_be_modifier', # statement modifiers (e.g. expr if cond) |
75
|
|
|
|
|
|
|
] => ( |
76
|
|
|
|
|
|
|
is => 'rw', |
77
|
|
|
|
|
|
|
isa => 'Bool', |
78
|
|
|
|
|
|
|
required => 0, |
79
|
|
|
|
|
|
|
); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
has nud => ( # null denotation |
82
|
|
|
|
|
|
|
is => 'bare', |
83
|
|
|
|
|
|
|
isa => 'CodeRef', |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
writer => 'set_nud', |
86
|
|
|
|
|
|
|
reader => 'get_nud', |
87
|
|
|
|
|
|
|
predicate => 'has_nud', |
88
|
|
|
|
|
|
|
clearer => 'remove_nud', |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
trigger => sub{ |
91
|
|
|
|
|
|
|
my($self) = @_; |
92
|
|
|
|
|
|
|
$self->is_value(1); |
93
|
|
|
|
|
|
|
return; |
94
|
|
|
|
|
|
|
}, |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
lazy_build => 1, |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
required => 0, |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
has led => ( # left denotation |
102
|
|
|
|
|
|
|
is => 'bare', |
103
|
|
|
|
|
|
|
isa => 'CodeRef', |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
writer => 'set_led', |
106
|
|
|
|
|
|
|
reader => 'get_led', |
107
|
|
|
|
|
|
|
predicate => 'has_led', |
108
|
|
|
|
|
|
|
clearer => 'remove_led', |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
lazy_build => 1, |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
required => 0, |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
has std => ( # statement denotation |
116
|
|
|
|
|
|
|
is => 'bare', |
117
|
|
|
|
|
|
|
isa => 'CodeRef', |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
writer => 'set_std', |
120
|
|
|
|
|
|
|
reader => 'get_std', |
121
|
|
|
|
|
|
|
predicate => 'has_std', |
122
|
|
|
|
|
|
|
clearer => 'remove_std', |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
lazy_build => 1, |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
required => 0, |
127
|
|
|
|
|
|
|
); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
has [qw(first second third)] => ( |
131
|
|
|
|
|
|
|
is => 'rw', |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
required => 0, |
134
|
|
|
|
|
|
|
); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
has type => ( |
137
|
|
|
|
|
|
|
is => 'rw', |
138
|
|
|
|
|
|
|
isa => 'Str', |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
required => 0, |
141
|
|
|
|
|
|
|
); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
has arity => ( |
144
|
|
|
|
|
|
|
is => 'rw', |
145
|
|
|
|
|
|
|
isa => 'Str', |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
lazy => 1, |
148
|
|
|
|
|
|
|
default => 'name', |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
required => 0, |
151
|
|
|
|
|
|
|
); |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
has assignment => ( |
154
|
|
|
|
|
|
|
is => 'rw', |
155
|
|
|
|
|
|
|
isa => 'Bool', |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
required => 0, |
158
|
|
|
|
|
|
|
); |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
#has scope => ( |
161
|
|
|
|
|
|
|
# is => 'rw', |
162
|
|
|
|
|
|
|
# isa => 'HashRef', |
163
|
|
|
|
|
|
|
# |
164
|
|
|
|
|
|
|
# required => 0, |
165
|
|
|
|
|
|
|
#); |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
has line => ( |
168
|
|
|
|
|
|
|
is => 'rw', |
169
|
|
|
|
|
|
|
isa => 'Int', |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
lazy => 1, |
172
|
|
|
|
|
|
|
default => 0, |
173
|
|
|
|
|
|
|
); |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub _build_nud { |
177
|
461
|
|
|
461
|
|
1899
|
return \&_nud_default; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub _build_led { |
181
|
0
|
|
|
0
|
|
0
|
return \&_led_default; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub _build_std { |
185
|
0
|
|
|
0
|
|
0
|
return \&_std_default; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub _nud_default { |
189
|
462
|
|
|
462
|
|
769
|
my($parser, $symbol) = @_; |
190
|
462
|
|
|
|
|
1564
|
return $parser->default_nud($symbol); |
191
|
|
|
|
|
|
|
} |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub _led_default { |
194
|
0
|
|
|
0
|
|
0
|
my($parser, $symbol) = @_; |
195
|
0
|
|
|
|
|
0
|
return $parser->default_led($symbol); |
196
|
|
|
|
|
|
|
} |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
sub _std_default { |
199
|
0
|
|
|
0
|
|
0
|
my($parser, $symbol) = @_; |
200
|
0
|
|
|
|
|
0
|
return $parser->default_std($symbol); |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub nud { |
204
|
21948
|
|
|
21948
|
0
|
41409
|
my($self, $parser, @args) = @_; |
205
|
21948
|
|
|
|
|
27708
|
$self->_dump_denote('nud', $parser) if _DUMP_DENOTE; |
206
|
21948
|
|
|
|
|
81268
|
return $self->get_nud()->($parser, $self, @args); |
207
|
|
|
|
|
|
|
} |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub led { |
210
|
1923
|
|
|
1923
|
0
|
3872
|
my($self, $parser, @args) = @_; |
211
|
1923
|
|
|
|
|
2205
|
$self->_dump_denote('led', $parser) if _DUMP_DENOTE; |
212
|
1923
|
|
|
|
|
7267
|
return $self->get_led()->($parser, $self, @args); |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
sub std { |
216
|
13685
|
|
|
13685
|
0
|
28468
|
my($self, $parser, @args) = @_; |
217
|
13685
|
|
|
|
|
19053
|
$self->_dump_denote('std', $parser) if _DUMP_DENOTE; |
218
|
13685
|
|
|
|
|
55039
|
return $self->get_std()->($parser, $self, @args); |
219
|
|
|
|
|
|
|
} |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
sub clone { |
222
|
95450
|
|
|
95450
|
0
|
167633
|
my $self = shift; |
223
|
95450
|
|
|
|
|
267685
|
return $self->meta->clone_object($self, @_); |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub _dump_denote { |
227
|
0
|
|
|
0
|
|
|
my($self, $type, $parser) = @_; |
228
|
0
|
|
|
|
|
|
my $attr = $self->meta->get_attribute($type); |
229
|
|
|
|
|
|
|
|
230
|
0
|
0
|
|
|
|
|
my $entity = $attr->has_value($self) |
231
|
|
|
|
|
|
|
? $attr->get_value($self) |
232
|
|
|
|
|
|
|
: $parser->can('default_' . $type); |
233
|
|
|
|
|
|
|
|
234
|
0
|
|
|
|
|
|
require B; |
235
|
0
|
|
|
|
|
|
my $cvgv = B::svref_2object($entity)->GV; |
236
|
0
|
|
|
|
|
|
printf STDERR "%s: %s::%s (%s:%s)\n", |
237
|
|
|
|
|
|
|
$type, |
238
|
|
|
|
|
|
|
$cvgv->STASH->NAME, $cvgv->NAME, |
239
|
|
|
|
|
|
|
$self->id, $self->line, |
240
|
|
|
|
|
|
|
; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
172
|
|
|
172
|
|
1094
|
no Mouse; |
|
172
|
|
|
|
|
332
|
|
|
172
|
|
|
|
|
970
|
|
244
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
__END__ |