Home | History | Annotate | Download | only in zero-one
      1 #!/usr/bin/perl
      2 
      3 use blib;
      4 
      5 use English qw( -no_match_vars );
      6 use ANTLR::Runtime::ANTLRStringStream;
      7 use TLexer;
      8 
      9 use strict;
     10 use warnings;
     11 
     12 my $input = ANTLR::Runtime::ANTLRStringStream->new({ '01X0' });
     13 my $lexer = TLexer->new($input);
     14 
     15 while (1) {
     16     my $token = eval { $lexer->next_token(); };
     17     if ($EVAL_ERROR) {
     18         my $exception = $EVAL_ERROR;
     19         print $exception;
     20         next;
     21     }
     22     last if $token->get_type() == $TLexer::EOF;
     23 
     24     print "type: ", $token->get_type(), "\n";
     25     print "text: ", $token->get_text(), "\n";
     26     print "\n";
     27 }
     28