CommonTokenStream inherits getTokens() which returns a List of Tokens. You'll need to cast them to a Token (or something that extends a Token), since it's a non-generics List list:
CommonTokenStream tokens = new CommonTokenStream(lexer); for(Object o : tokens.getTokens()) { Token t = (Token)o; System.out.println(t); } Regards, Bart. On Wed, May 11, 2011 at 1:40 PM, Lars von Wedel <lars.vonwe...@gmail.com>wrote: > Hello, > > I am writing an interactive interpreter and I would like to obtain all > tokens from a lexer of token stream to test, whether the input is complete > or continued on the next line. > > What is the easiest approach to do this ? I tried a CommonTokenStream but I > am not sure how to tell it to pull all tokens from the lexer. > > Thanks and Regards, > Lars > > List: http://www.antlr.org/mailman/listinfo/antlr-interest > Unsubscribe: > http://www.antlr.org/mailman/options/antlr-interest/your-email-address > List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.