aboutsummaryrefslogtreecommitdiff
path: root/antlr-3.4/runtime/Perl5/lib/ANTLR/Runtime/MismatchedTokenException.pm
blob: b141e9919445f19fe88a52b308c5a723a2df26d6 (plain)
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
package ANTLR::Runtime::MismatchedTokenException;

use ANTLR::Runtime::Token;

use Moose;

use overload
    '""' => \&to_string,
    'bool' => sub { 1 },
    fallback => 1
    ;

extends 'ANTLR::Runtime::RecognitionException';

has 'expecting' => (
    is  => 'ro',
    isa => 'Int',
    default => ANTLR::Runtime::Token->INVALID_TOKEN_TYPE,
);

sub get_expecting {
    my ($self) = @_;
    return $self->expecting;
}

sub to_string {
    my ($self) = @_;
    return "MismatchedTokenException(" . $self->get_unexpected_type() . "!=" . $self->expecting . ")";
}

no Moose;
__PACKAGE__->meta->make_immutable();
1;