line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Inline::Nouse; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '0.04'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
require Inline; |
6
|
|
|
|
|
|
|
require Inline::Interp; |
7
|
|
|
|
|
|
|
require Language::Nouse; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@ISA = qw(Inline Inline::Interp); |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
764
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
12
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
478
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $g_io; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub register { |
17
|
|
|
|
|
|
|
return { |
18
|
0
|
|
|
0
|
1
|
0
|
language => 'nouse', |
19
|
|
|
|
|
|
|
aliases => ['Nouse', 'nouse'], |
20
|
|
|
|
|
|
|
type => 'interpreted', |
21
|
|
|
|
|
|
|
suffix => 'ns', |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub do_load { |
26
|
1
|
|
|
1
|
1
|
5160
|
my ($funcs, $code) = @_; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
15
|
while($code =~ m/function(\s+)([a-z0-9_]+)(\s*){(.*?)}/isg){ |
29
|
1
|
|
|
|
|
8
|
Inline::Interp::add_func($funcs, $2, $4); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub load { |
34
|
1
|
|
|
1
|
1
|
11896
|
Inline::Interp::load(@_); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub get_char { |
38
|
0
|
|
|
0
|
0
|
0
|
return Inline::Interp::input_char($g_io); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub put_char { |
42
|
14
|
|
|
14
|
0
|
1171
|
my ($out) = @_; |
43
|
14
|
|
|
|
|
33
|
Inline::Interp::output_char($g_io, $out); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub do_run { |
47
|
1
|
|
|
1
|
1
|
964
|
my ($code, $io) = @_; |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
3
|
$g_io = $io; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
10
|
my $interp = new Language::Nouse; |
52
|
1
|
|
|
|
|
31
|
$interp->load_linenoise($code); |
53
|
1
|
|
|
|
|
462
|
$interp->set_get(\&get_char); |
54
|
1
|
|
|
|
|
8
|
$interp->set_put(\&put_char); |
55
|
|
|
|
|
|
|
|
56
|
1
|
|
|
|
|
10
|
$interp->run(); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |