mjackson / citrus

Parsing Expressions for Ruby
http://mjackson.github.io/citrus
405 stars 28 forks source link

multiple parses show "warning: already initialized constant Kget" #31

Closed zipizap closed 13 years ago

zipizap commented 13 years ago

If a program makes multiple citrus parses, then a ruby warning will be shown:

"...gems/citrus-2.4.0/lib/citrus/file.rb:56: warning: already initialized constant Kget"

This should be easy to fix (if constant is already defined, don't redefine it), but when I dived in the source code of file.rb, I've seen in line 56 that the constant definition uses metaprogramming, so I better leave the change for expert hands...

PD: The parser is fantastic :) PD2: I've tested and seen that citrus is 10x faster in MRI-ruby than in Jruby - maybe it would be usefull to leave some tip in the readme about it

mjackson commented 13 years ago

This behavior is intentional. It's designed to prevent you from loading the same grammar twice unnecessarily.

zipizap commented 13 years ago

Ok, thanks for the info