aboutsummaryrefslogtreecommitdiff
path: root/antlr-3.4/runtime/Perl5/examples/zero-one/t.pl
blob: ed69cc2ece4accee8ed26c7b827f5896f1dcd28d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/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({ input => '010' });
my $lexer = TLexer->new($input);

while (1) {
    my $token = $lexer->next_token();
    last if $token->get_type() == $TLexer::EOF;

    print "type: ", $token->get_type(), "\n";
    print "text: ", $token->get_text(), "\n";
    print "\n";
}