-
Notifications
You must be signed in to change notification settings - Fork 1
/
Term.pm
47 lines (38 loc) · 1001 Bytes
/
Term.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package Term;
use strict;
use Token;
our @ISA = ( 'Token' );
# --- konstr
sub new {
my $class = shift;
my $self = $class->SUPER::new();
$self->{PRE} = ''; # repr: string
$self->{POST} = ''; # repr: string
# a regexp atomokon kívüli részei: ?*+, zárójelek, vagylagosság
# tetszõleges Perl regexp-beli dolog megengedett
$self->{COMP} = ''; # repr: string (összehasonlítási módja) e {=,!}
bless $self, $class;
}
# --- setter-getter-ek
sub pre { shift->_sg( shift, 'PRE' ); }
sub post { shift->_sg( shift, 'POST' ); }
sub comp { shift->_sg( shift, 'COMP' ); }
sub as_string {
my $self = shift;
( $self->pre ? $self->pre : '' ) .
$self->SUPER::as_string .
( $self->post ? $self->post : '' );
}
sub info {
my $self = shift;
( $self->pre ? ( " PRE=" . $self->pre ) : '' ) .
'{' .
$self->SUPER::info .
'}' .
( $self->post ? ( " POST=" . $self->post ) : '' ) .
( $self->comp ? ( " COMP=" . $self->comp ) : '' );
}
# --- egyebek: a lényeg
# sub xxx {
# }
1;