[antlr-interest] HELP !!!!

taha hasan taha_hasan at hotmail.com
Fri Feb 12 15:26:04 PST 2010


I can print out the tokens...like this...
        CharStream Stream =new ANTLRStringStream("once taha");
        SampleLexer lex=new SampleLexer(Stream);
         Token token;
          
            while ((token = (Token) lex.nextToken())!=Token.EOF_TOKEN)
            {
                
                if (token.getChannel()==0)
                {
                    System.out.println("Token: "+token.getText());
                    
                }
            }

Now i want to print the type of Tokens...
According to my grammer rules..
once taha are both part of identifier group of tokens named  "IDENT"...given by... IDENT :('a'..'z')*;

i WANT TO print like this :-

IDENT : once
IDENT : taha...

Plz help me on this one...

Thanking you in anticipation ! 
 		 	   		  
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
https://signup.live.com/signup.aspx?id=60969


More information about the antlr-interest mailing list