line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Language::MinCaml::Token; |
2
|
5
|
|
|
5
|
|
723
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
208
|
|
3
|
5
|
|
|
5
|
|
32
|
use base qw(Class::Accessor::Fast Exporter); |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
1871
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(kind value line column)); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT = |
8
|
|
|
|
|
|
|
qw(Token_BOOL Token_FLOAT Token_INT Token_IDENT Token_LPAREN Token_RPAREN |
9
|
|
|
|
|
|
|
Token_PLUS Token_PLUS_DOT Token_MINUS Token_MINUS_DOT Token_AST_DOT |
10
|
|
|
|
|
|
|
Token_SLASH_DOT Token_EQUAL Token_LESS_GREATER Token_LESS_EQUAL |
11
|
|
|
|
|
|
|
Token_LESS_MINUS Token_LESS Token_GREATER_EQUAL Token_GREATER Token_COMMA |
12
|
|
|
|
|
|
|
Token_DOT Token_SEMICOLON Token_ARRAY_CREATE Token_NOT Token_IF |
13
|
|
|
|
|
|
|
Token_THEN Token_ELSE Token_LET Token_IN Token_REC Token_EOF); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
for my $routine_name (@EXPORT){ |
16
|
|
|
|
|
|
|
my $kind = $routine_name; |
17
|
|
|
|
|
|
|
$kind =~ s/^Token_//; |
18
|
0
|
|
|
0
|
|
0
|
my $routine = sub { my $value = shift; __PACKAGE__->new($kind, $value); }; |
|
0
|
|
|
|
|
0
|
|
19
|
5
|
|
|
5
|
|
3974
|
no strict 'refs'; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
898
|
|
20
|
|
|
|
|
|
|
*{$routine_name} = $routine; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
2
|
|
|
2
|
1
|
11
|
my($class, $kind, $value) = @_; |
25
|
2
|
|
|
|
|
10
|
return bless {kind => $kind, value => $value}, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub to_str { |
29
|
1
|
|
|
1
|
0
|
4
|
my $self = shift; |
30
|
1
|
|
|
|
|
6
|
return "$self->{kind}\[$self->{value}\]"; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |