1#!/usr/bin/perl
2
3use blib;
4
5use English qw( -no_match_vars );
6use ANTLR::Runtime::ANTLRStringStream;
7use IDLexer;
8
9use strict;
10use warnings;
11
12my $input = ANTLR::Runtime::ANTLRStringStream->new({ input => "Hello World!\n42\n" });
13my $lexer = IDLexer->new({ input => $input });
14
15while (1) {
16    my $token = $lexer->next_token();
17    last if $token->get_type() == IDLexer->EOF;
18
19    print "text: ", $token->get_text(), "\n";
20    print "type: ", $token->get_type(), "\n";
21    print "pos: ", $token->get_line(), ':', $token->get_char_position_in_line(), "\n";
22    print "channel: ", $token->get_channel(), "\n";
23    print "token index: ", $token->get_token_index(), "\n";
24    print "\n";
25}
26