[antlr-interest] mystery in printing order

Greg Lindholm glindholm at yahoo.com
Fri Apr 16 07:11:31 PDT 2004


(I assume reportError is going to System.err)
 
I've seen similar behaviour in other Java apps when you print to both System.out and System.err you can never count on seeing the output weaved together in a timestamp based order. I'm guessing it's because of buffering.
 
If you change to print to System.err you should see what you expect.


idontwantanidwith2000init <idontwantanidwith2000init at yahoo.com> wrote:
Hi,
I turned errorDefaultHandler off.
I wrote the following:
System.out.print("#");
reportError(exceptionVariable.toString());
consumeUntil(NEWLINE);
consume();
System.out.print("? please type an id =>");
t = idToken();

idToken is the rule we are tring to parse.
It will lead to recursion but this is not the issue.
The issue is the output order:
#? please type an id =>error: line 1:16: expecting ID, found 'moo'
While the expected output is:
#error: line 1:16: expecting ID, found 'moo'
? please type an id =>

It seems like System.out.print is quicker to print then reportError.
Is there threading invoved?
How can I make reportError output to be writethrough ?


BTW,
Could I read ANTLR code?

Tal.





Yahoo! Groups Links





		
---------------------------------
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20040416/54a56a76/attachment.html


More information about the antlr-interest mailing list