Hi Ben,

Do me a favor and add this method

        @Override
        public Object[] toArray() {
                return elements.toArray();
        }

to OrdereredHashSet in org.antlr.misc.

I think that is a source of some nondeterminism. it helps in v4.  Let me know 
if this helps for you.

Ter
On Jun 9, 2010, at 10:34 AM, Ben McCann wrote:

> I'm not sure what you're referring to when you say timestamps.  The issue is 
> that the code comments keep changing.  Would it be possible to just use a 
> List instead of a Set?  That should solve the issue.
> 
> Thanks,
> Ben
> 
> 
> $ diff {/tmp/tmpaX6PX1,/tmp/tmp2-04O_}/JsonTemplateParser.java
> 307c307
> <             // elements: value, DOC_COMMENT, startCommand
> ---
> >             // elements: startCommand, value, DOC_COMMENT
> 521c521
> <             // elements: DOC_COMMENT, entry, startCommand
> ---
> >             // elements: startCommand, entry, DOC_COMMENT
> 1031c1031
> <             // elements: DOC_COMMENT, entry
> ---
> >             // elements: entry, DOC_COMMENT
> 1161c1161
> <                     // elements: DOC_COMMENT, key, value
> ---
> >                     // elements: key, value, DOC_COMMENT
> 1365c1365
> <             // elements: value, DOC_COMMENT
> ---
> >             // elements: DOC_COMMENT, value
> 
> 
> 
> 
> On Wed, Jun 9, 2010 at 10:21 AM, Terence Parr <[email protected]> wrote:
> yeah, there are Sets in there. i wonder why (how?) java alters the order for 
> same computation across runs.  Come to think of it, i'm chasing something 
> similar in ANTLR v4 unit tests.  I thought it was static data somewhere but 
> could be some weird Set thing.
> 
> damn java. grr.... not sure how easily i can help you here...
> 
> Ter
> 
> On Jun 9, 2010, at 10:15 AM, Ben McCann wrote:
> 
>> We're using 3.2.  The only thing I've noticed changing between runs thus far 
>> is the code comments.  I should also mention the input is not changing at 
>> all.  I'm guessing it's something along the lines of using an Iterator from 
>> a Set instead of List so that there's no ordering guarantee.
>> 
>> Thanks,
>> Ben
>> 
>> 
>> On Wed, Jun 9, 2010 at 10:03 AM, Terence Parr <[email protected]> wrote:
>> wow. that's weird.  surely the grammar changes between runs?  Computers are 
>> usually good about determinism ;)
>> What version of antlr?
>> Ter
>> On Jun 8, 2010, at 9:52 PM, Ben McCann wrote:
>> 
>>> Hi,
>>> It appears that ANTLR is generating varying output between runs.  This 
>>> causes problems for us when trying to diff to see if anything has changed.  
>>> Could someone file a bug for this?  I was not able to register for the JIRA.
>>> 
>>> Thanks,
>>> Ben McCann
>>> Software Engineer
>>> Google Inc.
>>> 
>>> 
>>> $diff ~/PathParser.java.1 ~/PathParser.java.2
>>> 560c560
>>> <                     // elements: Variable, expr
>>> ---
>>> >                     // elements: expr, Variable
>>> 
>>> _______________________________________________
>>> antlr-dev mailing list
>>> [email protected]
>>> http://www.antlr.org/mailman/listinfo/antlr-dev
>> 
>> 
> 
> 

_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to