blynn / nex

Lexer for Go
http://cs.stanford.edu/~blynn/nex/
GNU General Public License v3.0
416 stars 47 forks source link

Different output on reruns #22

Closed lucas-clemente closed 5 years ago

lucas-clemente commented 9 years ago

It seems that running nex multiple times on the same file generates different output sometimes. Example:

/a|A/ { return A }
//
package main

I get two different versions (filenames are their shas):

→ diff 55b29ae5b5679cab92281c8e9d3d493cb0f5be6c.go 73edf909a04d60e4f253d456fc4bf8b3ca6eee9c.go
155,156c155,156
<       case 65: return 1
<       case 97: return 2

---
>       case 65: return 2
>       case 97: return 1

I haven't looked at your code yet, but a possible source of randomness could be go's map iteration order (c.f. http://stackoverflow.com/a/9621526/220918).

dragonsinth commented 8 years ago

https://github.com/blynn/nex/pull/35

purpleidea commented 6 years ago

This issue can be closed AIUI.