Home | History | Annotate | Download | only in Runtime
      1 package ANTLR::Runtime::MismatchedTokenException;
      2 
      3 use ANTLR::Runtime::Token;
      4 
      5 use Moose;
      6 
      7 use overload
      8     '""' => \&to_string,
      9     'bool' => sub { 1 },
     10     fallback => 1
     11     ;
     12 
     13 extends 'ANTLR::Runtime::RecognitionException';
     14 
     15 has 'expecting' => (
     16     is  => 'ro',
     17     isa => 'Int',
     18     default => ANTLR::Runtime::Token->INVALID_TOKEN_TYPE,
     19 );
     20 
     21 sub get_expecting {
     22     my ($self) = @_;
     23     return $self->expecting;
     24 }
     25 
     26 sub to_string {
     27     my ($self) = @_;
     28     return "MismatchedTokenException(" . $self->get_unexpected_type() . "!=" . $self->expecting . ")";
     29 }
     30 
     31 no Moose;
     32 __PACKAGE__->meta->make_immutable();
     33 1;
     34