You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
564 B
28 lines
564 B
#!/usr/bin/perl
|
|
|
|
use blib;
|
|
|
|
use English qw( -no_match_vars );
|
|
use ANTLR::Runtime::ANTLRStringStream;
|
|
use TLexer;
|
|
|
|
use strict;
|
|
use warnings;
|
|
|
|
my $input = ANTLR::Runtime::ANTLRStringStream->new({ '01X0' });
|
|
my $lexer = TLexer->new($input);
|
|
|
|
while (1) {
|
|
my $token = eval { $lexer->next_token(); };
|
|
if ($EVAL_ERROR) {
|
|
my $exception = $EVAL_ERROR;
|
|
print $exception;
|
|
next;
|
|
}
|
|
last if $token->get_type() == $TLexer::EOF;
|
|
|
|
print "type: ", $token->get_type(), "\n";
|
|
print "text: ", $token->get_text(), "\n";
|
|
print "\n";
|
|
}
|