David-Sarah Hopwood wrote:
Gavin Lambert wrote:
  
At 10:12 14/08/2009, [email protected] wrote:
 >QuizLexer lexer = new QuizLexer(new ANTLRFileStream(input));
 >CommonTokenStream tokens = new CommonTokenStream(lexer);
 >// prints 0
 >System.out.println(tokens.size());
 >
 >So according to this there are no tokens, which would explain 
 >the blank debugger Input window. If the ANTLRWorks Interpreter runs
 >the code correctly, why not the Debugger or unit tests?

Actually that's a bit deceptive :)

The stream starts out empty, and thus .size() returns 0.
    

You're right, and that seems like a bug. In CommonTokenStream:
  
No - you need to calls something like LT(1) first - otherwise all methods have to check for init which is an overhead that isn't really needed.

JIm

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to