[antlr-interest] Please help me!

丘成桐 questionhelper at gmail.com
Sun Apr 29 00:03:54 PDT 2007


Hi !   I  am a beginner, I  have some question to ask you about the
examples from antlr-2.7.7\examples;

source code as follow:
#include <iostream>

#include "T.hpp"

int main( int, char** )
{
    ANTLR_USING_NAMESPACE(std)
    ANTLR_USING_NAMESPACE(antlr)

    try
    {
        T lexer(cin);

        for(;;)
        {
            RefToken t = lexer.nextToken();

            if ( t->getType() == Token::EOF_TYPE )
                break;

            cout << "Token: " << t->toString() << endl;
        }
        cout << "done lexing..." << endl;
    }
    catch( ANTLRException& e )
    {
        cerr << "exception: " << e.getMessage() << endl;
        return -1;
    }
    catch( exception& e )
    {
        cerr << "exception: " << e.what() << endl;
        return -1;
    }
    return 0;
}

Questions as follow:
1. What do the ANTLR_USING_NAMESPACE(std)  and
NTLR_USING_NAMESPACE(antlr)  mean ?  Where could I find more
information?

2. RefToken t = lexer.nextToken();
   where can I find the documents about RefToken and nextToken ;

3. Where could I find the detailed information about the examples form
antlr-2.7.7\examples;

Many thanks for your help, I am looking forward for your reply.


More information about the antlr-interest mailing list