line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mylisp::OptMyAst;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20
|
use 5.012;
|
|
1
|
|
|
|
|
5
|
|
4
|
1
|
|
|
1
|
|
7
|
use experimental 'switch';
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
122
|
use Exporter;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
83
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(Exporter);
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @EXPORT = qw(OptMyAst);
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
8
|
use Mylisp::Builtin;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
251
|
|
12
|
1
|
|
|
1
|
|
9
|
use Mylisp::Estr;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4225
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub OptMyAst {
|
15
|
0
|
|
|
0
|
0
|
|
my $ast = shift;
|
16
|
0
|
0
|
|
|
|
|
if (is_atom($ast)) {
|
17
|
0
|
|
|
|
|
|
return estr(opt_my_atom($ast))
|
18
|
|
|
|
|
|
|
}
|
19
|
0
|
|
|
|
|
|
return opt_my_atoms($ast)
|
20
|
|
|
|
|
|
|
}
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub opt_my_atoms {
|
23
|
0
|
|
|
0
|
0
|
|
my $atoms = shift;
|
24
|
0
|
|
|
|
|
|
return estr_strs([ map { opt_my_atom($_) } @{atoms($atoms)} ])
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
}
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub opt_my_atom {
|
28
|
0
|
|
|
0
|
0
|
|
my $atom = shift;
|
29
|
0
|
|
|
|
|
|
my ($name,$rest) = match($atom);
|
30
|
0
|
|
|
|
|
|
given ($name) {
|
31
|
0
|
|
|
|
|
|
when ('Expr') {
|
32
|
0
|
|
|
|
|
|
return opt_my_expr($rest)
|
33
|
|
|
|
|
|
|
}
|
34
|
0
|
|
|
|
|
|
when ('Ocall') {
|
35
|
0
|
|
|
|
|
|
return opt_my_ocall($rest)
|
36
|
|
|
|
|
|
|
}
|
37
|
0
|
|
|
|
|
|
when ('Array') {
|
38
|
0
|
|
|
|
|
|
return opt_my_values($name,$rest)
|
39
|
|
|
|
|
|
|
}
|
40
|
0
|
|
|
|
|
|
when ('Hash') {
|
41
|
0
|
|
|
|
|
|
return opt_my_values($name,$rest)
|
42
|
|
|
|
|
|
|
}
|
43
|
0
|
|
|
|
|
|
when ('Pair') {
|
44
|
0
|
|
|
|
|
|
return opt_my_pair($rest)
|
45
|
|
|
|
|
|
|
}
|
46
|
0
|
|
|
|
|
|
when ('Aindex') {
|
47
|
0
|
|
|
|
|
|
return opt_my_values($name,$rest)
|
48
|
|
|
|
|
|
|
}
|
49
|
0
|
|
|
|
|
|
when ('Arange') {
|
50
|
0
|
|
|
|
|
|
return opt_my_values($name,$rest)
|
51
|
|
|
|
|
|
|
}
|
52
|
0
|
|
|
|
|
|
when ('String') {
|
53
|
0
|
|
|
|
|
|
return opt_my_string($rest)
|
54
|
|
|
|
|
|
|
}
|
55
|
0
|
|
|
|
|
|
when ('Str') {
|
56
|
0
|
|
|
|
|
|
return opt_my_str($rest)
|
57
|
|
|
|
|
|
|
}
|
58
|
0
|
|
|
|
|
|
when ('Lstr') {
|
59
|
0
|
|
|
|
|
|
return opt_my_lstr($rest)
|
60
|
|
|
|
|
|
|
}
|
61
|
0
|
|
|
|
|
|
when ('Kstr') {
|
62
|
0
|
|
|
|
|
|
return opt_my_kstr($rest)
|
63
|
|
|
|
|
|
|
}
|
64
|
0
|
|
|
|
|
|
when ('Sub') {
|
65
|
0
|
|
|
|
|
|
return opt_my_sym($rest)
|
66
|
|
|
|
|
|
|
}
|
67
|
0
|
|
|
|
|
|
when ('Var') {
|
68
|
0
|
|
|
|
|
|
return opt_my_sym($rest)
|
69
|
|
|
|
|
|
|
}
|
70
|
0
|
|
|
|
|
|
when ('Scalar') {
|
71
|
0
|
|
|
|
|
|
return opt_my_sym($rest)
|
72
|
|
|
|
|
|
|
}
|
73
|
0
|
|
|
|
|
|
when ('Oper') {
|
74
|
0
|
|
|
|
|
|
return opt_my_sym($rest)
|
75
|
|
|
|
|
|
|
}
|
76
|
0
|
|
|
|
|
|
default {
|
77
|
0
|
|
|
|
|
|
return $atom
|
78
|
|
|
|
|
|
|
}
|
79
|
|
|
|
|
|
|
}
|
80
|
|
|
|
|
|
|
}
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub opt_my_expr {
|
83
|
0
|
|
|
0
|
0
|
|
my $value = shift;
|
84
|
0
|
|
|
|
|
|
my ($expr,$off) = flat($value);
|
85
|
0
|
0
|
|
|
|
|
if (is_oper_expr($expr)) {
|
86
|
0
|
|
|
|
|
|
return opt_my_infix_op_expr($expr,$off)
|
87
|
|
|
|
|
|
|
}
|
88
|
0
|
|
|
|
|
|
my ($first,$atoms) = match($expr);
|
89
|
0
|
|
|
|
|
|
my ($type,$name) = flat($first);
|
90
|
0
|
|
|
|
|
|
my $args = opt_my_atoms($atoms);
|
91
|
0
|
0
|
|
|
|
|
if ($type eq 'Oper') {
|
92
|
0
|
|
|
|
|
|
return estr($name,$args,$off)
|
93
|
|
|
|
|
|
|
}
|
94
|
0
|
|
|
|
|
|
return opt_my_sub($name,$args,$off)
|
95
|
|
|
|
|
|
|
}
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub is_oper_expr {
|
98
|
0
|
|
|
0
|
0
|
|
my $expr = shift;
|
99
|
0
|
|
|
|
|
|
my $atoms = atoms($expr);
|
100
|
0
|
0
|
|
|
|
|
if (len($atoms) == 3) {
|
101
|
0
|
|
|
|
|
|
my $op_atom = $atoms->[1];
|
102
|
0
|
|
|
|
|
|
return is_atom_name($op_atom,'Oper')
|
103
|
|
|
|
|
|
|
}
|
104
|
0
|
|
|
|
|
|
return 0
|
105
|
|
|
|
|
|
|
}
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub opt_my_infix_op_expr {
|
108
|
0
|
|
|
0
|
0
|
|
my ($expr,$off) = @_;
|
109
|
0
|
|
|
|
|
|
my $atoms = atoms($expr);
|
110
|
0
|
|
|
|
|
|
my $name = value($atoms->[1]);
|
111
|
0
|
|
|
|
|
|
my $args = estr($atoms->[0],$atoms->[2]);
|
112
|
0
|
|
|
|
|
|
$args = opt_my_atoms($args);
|
113
|
0
|
|
|
|
|
|
return estr($name,$args,$off)
|
114
|
|
|
|
|
|
|
}
|
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
sub opt_my_sub {
|
117
|
0
|
|
|
0
|
0
|
|
my ($name,$args,$off) = @_;
|
118
|
0
|
|
|
|
|
|
given ($name) {
|
119
|
0
|
|
|
|
|
|
when ('struct') {
|
120
|
0
|
|
|
|
|
|
return opt_my_struct($args,$off)
|
121
|
|
|
|
|
|
|
}
|
122
|
0
|
|
|
|
|
|
when ('package') {
|
123
|
0
|
|
|
|
|
|
return opt_my_package($args,$off)
|
124
|
|
|
|
|
|
|
}
|
125
|
0
|
|
|
|
|
|
when ('use') {
|
126
|
0
|
|
|
|
|
|
return opt_my_use($args,$off)
|
127
|
|
|
|
|
|
|
}
|
128
|
0
|
|
|
|
|
|
when ('func') {
|
129
|
0
|
|
|
|
|
|
return opt_my_func($args,$off)
|
130
|
|
|
|
|
|
|
}
|
131
|
0
|
|
|
|
|
|
when ('for') {
|
132
|
0
|
|
|
|
|
|
return opt_my_for($args,$off)
|
133
|
|
|
|
|
|
|
}
|
134
|
0
|
|
|
|
|
|
default {
|
135
|
0
|
|
|
|
|
|
return estr($name,$args,$off)
|
136
|
|
|
|
|
|
|
}
|
137
|
|
|
|
|
|
|
}
|
138
|
|
|
|
|
|
|
}
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub opt_my_struct {
|
141
|
0
|
|
|
0
|
0
|
|
my ($args,$off) = @_;
|
142
|
0
|
|
|
|
|
|
my ($type,$hash) = flat($args);
|
143
|
0
|
|
|
|
|
|
my $name = value($type);
|
144
|
0
|
0
|
|
|
|
|
if (is_atom_name($hash,'Hash')) {
|
145
|
0
|
|
|
|
|
|
my $value = value($hash);
|
146
|
0
|
|
|
|
|
|
my $fields = [ map { opt_my_field($_) } @{atoms($value)} ];
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
my $struct = estr($name,estr_strs($fields),$off);
|
148
|
0
|
|
|
|
|
|
return estr('struct',$struct,$off)
|
149
|
|
|
|
|
|
|
}
|
150
|
|
|
|
|
|
|
}
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub opt_my_field {
|
153
|
0
|
|
|
0
|
0
|
|
my $pair = shift;
|
154
|
0
|
|
|
|
|
|
my ($key,$rest) = match($pair);
|
155
|
0
|
|
|
|
|
|
my ($value,$off) = flat($rest);
|
156
|
0
|
0
|
|
|
|
|
if (is_sym($value)) {
|
157
|
0
|
|
|
|
|
|
my $type = value($value);
|
158
|
0
|
|
|
|
|
|
return estr($key,$type,$off)
|
159
|
|
|
|
|
|
|
}
|
160
|
|
|
|
|
|
|
}
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub opt_my_package {
|
163
|
0
|
|
|
0
|
0
|
|
my ($args,$off) = @_;
|
164
|
0
|
|
|
|
|
|
my $ns = value(first(atoms($args)));
|
165
|
0
|
|
|
|
|
|
return estr('package',$ns,$off)
|
166
|
|
|
|
|
|
|
}
|
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub opt_my_use {
|
169
|
0
|
|
|
0
|
0
|
|
my ($args,$off) = @_;
|
170
|
0
|
|
|
|
|
|
my $ns = value(first(atoms($args)));
|
171
|
0
|
|
|
|
|
|
return estr('use',$ns,$off)
|
172
|
|
|
|
|
|
|
}
|
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
sub opt_my_func {
|
175
|
0
|
|
|
0
|
0
|
|
my ($args,$off) = @_;
|
176
|
0
|
|
|
|
|
|
my $call_exprs = opt_my_call($args);
|
177
|
0
|
|
|
|
|
|
return estr('func',$call_exprs,$off)
|
178
|
|
|
|
|
|
|
}
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub opt_my_call {
|
181
|
0
|
|
|
0
|
0
|
|
my $args = shift;
|
182
|
0
|
|
|
|
|
|
my ($name_args,$exprs) = match($args);
|
183
|
0
|
|
|
|
|
|
my $opt_args = opt_my_func_args($name_args);
|
184
|
0
|
|
|
|
|
|
my $return = first(atoms($exprs));
|
185
|
0
|
0
|
|
|
|
|
if ('->' ne name($return)) {
|
186
|
0
|
|
|
|
|
|
my $expr = estr('->',estr(estr('Sym','Nil')));
|
187
|
0
|
|
|
|
|
|
$exprs = eunshift($expr,$exprs);
|
188
|
|
|
|
|
|
|
}
|
189
|
0
|
|
|
|
|
|
my $func_exprs = eunshift($opt_args,$exprs);
|
190
|
0
|
|
|
|
|
|
return $func_exprs
|
191
|
|
|
|
|
|
|
}
|
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub opt_my_func_args {
|
194
|
0
|
|
|
0
|
0
|
|
my $name_args = shift;
|
195
|
0
|
|
|
|
|
|
my ($name,$args) = flat($name_args);
|
196
|
0
|
|
|
|
|
|
my $opt_args = [ map { opt_my_func_arg($_) } @{atoms($args)} ];
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
|
my $off = off($name_args);
|
198
|
0
|
|
|
|
|
|
return estr($name,estr_strs($opt_args),$off)
|
199
|
|
|
|
|
|
|
}
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
sub opt_my_func_arg {
|
202
|
0
|
|
|
0
|
0
|
|
my $arg = shift;
|
203
|
0
|
|
|
|
|
|
my $value = value($arg);
|
204
|
0
|
|
|
|
|
|
my $off = off($arg);
|
205
|
0
|
0
|
|
|
|
|
if (is_arg($arg)) {
|
206
|
0
|
|
|
|
|
|
my $names = estr_strs(asplit(':',$value));
|
207
|
0
|
|
|
|
|
|
my ($name,$type) = flat($names);
|
208
|
0
|
|
|
|
|
|
return estr($name,$type,$off)
|
209
|
|
|
|
|
|
|
}
|
210
|
0
|
|
|
|
|
|
return estr($value,'Str',$off)
|
211
|
|
|
|
|
|
|
}
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
sub is_arg {
|
214
|
0
|
|
|
0
|
0
|
|
my $atom = shift;
|
215
|
0
|
|
|
|
|
|
return is_atom_name($atom,'Arg')
|
216
|
|
|
|
|
|
|
}
|
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub opt_my_for {
|
219
|
0
|
|
|
0
|
0
|
|
my ($args,$off) = @_;
|
220
|
0
|
|
|
|
|
|
my ($iter_expr,$rest) = match($args);
|
221
|
0
|
|
|
|
|
|
my $iter_atom = opt_my_iter($iter_expr);
|
222
|
0
|
|
|
|
|
|
my $exprs = eunshift($iter_atom,$rest);
|
223
|
0
|
|
|
|
|
|
return estr('for',$exprs,$off)
|
224
|
|
|
|
|
|
|
}
|
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub opt_my_iter {
|
227
|
0
|
|
|
0
|
0
|
|
my $expr = shift;
|
228
|
0
|
|
|
|
|
|
my $args = value($expr);
|
229
|
0
|
|
|
|
|
|
my ($loop_sym,$iter_atom) = flat($args);
|
230
|
0
|
|
|
|
|
|
my $loop = value($loop_sym);
|
231
|
0
|
|
|
|
|
|
my $off = off($expr);
|
232
|
0
|
|
|
|
|
|
return estr($loop,$iter_atom,$off)
|
233
|
|
|
|
|
|
|
}
|
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub opt_my_ocall_value {
|
236
|
0
|
|
|
0
|
0
|
|
my $value = shift;
|
237
|
0
|
|
|
|
|
|
my ($sym,$call) = flat($value);
|
238
|
0
|
|
|
|
|
|
my $sym_name = value($sym);
|
239
|
0
|
|
|
|
|
|
my $call_name = value($call);
|
240
|
0
|
|
|
|
|
|
return estr($sym_name,$call_name)
|
241
|
|
|
|
|
|
|
}
|
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
sub opt_my_ocall {
|
244
|
0
|
|
|
0
|
0
|
|
my $rest = shift;
|
245
|
0
|
|
|
|
|
|
my ($value,$off) = flat($rest);
|
246
|
0
|
|
|
|
|
|
my $opt_value = opt_my_ocall_value($value);
|
247
|
0
|
|
|
|
|
|
return estr(':ocall',$opt_value,$off)
|
248
|
|
|
|
|
|
|
}
|
249
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
sub opt_my_pair {
|
251
|
0
|
|
|
0
|
0
|
|
my $rest = shift;
|
252
|
0
|
|
|
|
|
|
my ($args,$off) = flat($rest);
|
253
|
0
|
|
|
|
|
|
my $atoms = opt_my_atoms($args);
|
254
|
0
|
|
|
|
|
|
my ($key,$value) = flat($atoms);
|
255
|
0
|
|
|
|
|
|
return estr(value($key),$value,$off)
|
256
|
|
|
|
|
|
|
}
|
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
sub opt_my_values {
|
259
|
0
|
|
|
0
|
0
|
|
my ($name,$value) = @_;
|
260
|
0
|
|
|
|
|
|
my ($args,$off) = flat($value);
|
261
|
0
|
|
|
|
|
|
my $atoms = opt_my_atoms($args);
|
262
|
0
|
|
|
|
|
|
return estr($name,$atoms,$off)
|
263
|
|
|
|
|
|
|
}
|
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
sub opt_my_string {
|
266
|
0
|
|
|
0
|
0
|
|
my $value = shift;
|
267
|
0
|
|
|
|
|
|
my ($string,$off) = flat($value);
|
268
|
0
|
|
|
|
|
|
my $chars = [];
|
269
|
0
|
|
|
|
|
|
my $strs = [];
|
270
|
0
|
|
|
|
|
|
my $mode = 0;
|
271
|
0
|
|
|
|
|
|
my $str = substr($string, 1,-1);
|
272
|
0
|
|
|
|
|
|
for my $char (@{to_chars($str)}) {
|
|
0
|
|
|
|
|
|
|
273
|
0
|
0
|
|
|
|
|
if ($mode == 0) {
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
274
|
0
|
0
|
|
|
|
|
if ($char eq '$') {
|
|
|
0
|
|
|
|
|
|
275
|
0
|
|
|
|
|
|
$mode = 1;
|
276
|
0
|
|
|
|
|
|
apush($chars,$char);
|
277
|
|
|
|
|
|
|
}
|
278
|
|
|
|
|
|
|
elsif ($char eq Ep) {
|
279
|
0
|
|
|
|
|
|
$mode = 3;
|
280
|
0
|
|
|
|
|
|
apush($chars,$char);
|
281
|
|
|
|
|
|
|
}
|
282
|
|
|
|
|
|
|
else {
|
283
|
0
|
|
|
|
|
|
$mode = 2;
|
284
|
0
|
|
|
|
|
|
apush($chars,$char);
|
285
|
|
|
|
|
|
|
}
|
286
|
|
|
|
|
|
|
}
|
287
|
|
|
|
|
|
|
elsif ($mode == 1) {
|
288
|
0
|
0
|
|
|
|
|
if (is_name($char)) {
|
289
|
0
|
|
|
|
|
|
apush($chars,$char);
|
290
|
|
|
|
|
|
|
}
|
291
|
|
|
|
|
|
|
else {
|
292
|
0
|
|
|
|
|
|
apush($strs,to_str($chars));
|
293
|
0
|
|
|
|
|
|
$chars = [];
|
294
|
0
|
|
|
|
|
|
apush($chars,$char);
|
295
|
0
|
0
|
|
|
|
|
if ($char eq '$') {
|
|
|
0
|
|
|
|
|
|
296
|
0
|
|
|
|
|
|
$mode = 1;
|
297
|
|
|
|
|
|
|
}
|
298
|
|
|
|
|
|
|
elsif ($char eq Ep) {
|
299
|
0
|
|
|
|
|
|
$mode = 3;
|
300
|
|
|
|
|
|
|
}
|
301
|
|
|
|
|
|
|
else {
|
302
|
0
|
|
|
|
|
|
$mode = 2;
|
303
|
|
|
|
|
|
|
}
|
304
|
|
|
|
|
|
|
}
|
305
|
|
|
|
|
|
|
}
|
306
|
|
|
|
|
|
|
elsif ($mode == 2) {
|
307
|
0
|
0
|
|
|
|
|
if ($char eq '$') {
|
|
|
0
|
|
|
|
|
|
308
|
0
|
|
|
|
|
|
apush($strs,to_str($chars));
|
309
|
0
|
|
|
|
|
|
$chars = [];
|
310
|
0
|
|
|
|
|
|
$mode = 1;
|
311
|
0
|
|
|
|
|
|
apush($chars,$char);
|
312
|
|
|
|
|
|
|
}
|
313
|
|
|
|
|
|
|
elsif ($char eq Ep) {
|
314
|
0
|
|
|
|
|
|
$mode = 3;
|
315
|
0
|
|
|
|
|
|
apush($chars,$char);
|
316
|
|
|
|
|
|
|
}
|
317
|
|
|
|
|
|
|
else {
|
318
|
0
|
|
|
|
|
|
apush($chars,$char);
|
319
|
|
|
|
|
|
|
}
|
320
|
|
|
|
|
|
|
}
|
321
|
|
|
|
|
|
|
else {
|
322
|
0
|
|
|
|
|
|
$mode = 2;
|
323
|
0
|
|
|
|
|
|
apush($chars,$char);
|
324
|
|
|
|
|
|
|
}
|
325
|
|
|
|
|
|
|
}
|
326
|
0
|
|
|
|
|
|
apush($strs,to_str($chars));
|
327
|
0
|
|
|
|
|
|
return estr('String',estr_strs($strs),$off)
|
328
|
|
|
|
|
|
|
}
|
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
sub is_name {
|
331
|
0
|
|
|
0
|
0
|
|
my $char = shift;
|
332
|
0
|
0
|
|
|
|
|
if (is_alpha($char)) {
|
333
|
0
|
|
|
|
|
|
return 1
|
334
|
|
|
|
|
|
|
}
|
335
|
0
|
0
|
|
|
|
|
if ($char eq '-') {
|
336
|
0
|
|
|
|
|
|
return 1
|
337
|
|
|
|
|
|
|
}
|
338
|
0
|
|
|
|
|
|
return 0
|
339
|
|
|
|
|
|
|
}
|
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
sub opt_my_str {
|
342
|
0
|
|
|
0
|
0
|
|
my $value = shift;
|
343
|
0
|
|
|
|
|
|
my ($str,$off) = flat($value);
|
344
|
0
|
|
|
|
|
|
$str = substr($str, 1,-1);
|
345
|
0
|
|
|
|
|
|
return estr('Str',$str,$off)
|
346
|
|
|
|
|
|
|
}
|
347
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
sub opt_my_lstr {
|
349
|
0
|
|
|
0
|
0
|
|
my $value = shift;
|
350
|
0
|
|
|
|
|
|
my ($lstr,$off) = flat($value);
|
351
|
0
|
|
|
|
|
|
my $str = substr($lstr, 3,-3);
|
352
|
0
|
|
|
|
|
|
return estr('Lstr',$str,$off)
|
353
|
|
|
|
|
|
|
}
|
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
sub opt_my_kstr {
|
356
|
0
|
|
|
0
|
0
|
|
my $value = shift;
|
357
|
0
|
|
|
|
|
|
my ($kstr,$off) = flat($value);
|
358
|
0
|
|
|
|
|
|
my $str = rest_str($kstr);
|
359
|
0
|
|
|
|
|
|
return estr('Str',$str,$off)
|
360
|
|
|
|
|
|
|
}
|
361
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub opt_my_sym {
|
363
|
0
|
|
|
0
|
0
|
|
my $value = shift;
|
364
|
0
|
|
|
|
|
|
my ($name,$off) = flat($value);
|
365
|
0
|
|
|
|
|
|
given ($name) {
|
366
|
0
|
|
|
|
|
|
when ('false') {
|
367
|
0
|
|
|
|
|
|
return estr('Bool',$name,$off)
|
368
|
|
|
|
|
|
|
}
|
369
|
0
|
|
|
|
|
|
when ('true') {
|
370
|
0
|
|
|
|
|
|
return estr('Bool',$name,$off)
|
371
|
|
|
|
|
|
|
}
|
372
|
0
|
|
|
|
|
|
default {
|
373
|
0
|
|
|
|
|
|
return estr('Sym',$name,$off)
|
374
|
|
|
|
|
|
|
}
|
375
|
|
|
|
|
|
|
}
|
376
|
|
|
|
|
|
|
}
|
377
|
|
|
|
|
|
|
1;
|