jruby-parser icon indicating copy to clipboard operation
jruby-parser copied to clipboard

Invoke the 1.8 or 1.9 parser

Open ftomassetti opened this issue 12 years ago • 5 comments

Excuse my simple question but how do I specify which version of the parser do I want to use? Wouldn't be useful to have it in the README?

ftomassetti avatar Sep 04 '13 07:09 ftomassetti

Anyway, it should default to version 1.9 and I find a NotNode in my AST while the documentation of NotNode states that it should appear only in 1.8 ASTs

ftomassetti avatar Sep 04 '13 07:09 ftomassetti

The parser version is specified as a CompatVersion object - https://github.com/jruby/jruby-parser/blob/master/src/org/jrubyparser/CompatVersion.java. That goes into a ParserConfiguration - https://github.com/jruby/jruby-parser/blob/master/src/org/jrubyparser/parser/ParserConfiguration.java - and then into Parser - https://github.com/jruby/jruby-parser/blob/master/src/org/jrubyparser/Parser.java.

1.8 is the default at the moment, but I think all the current use cases will be very explicit about what version they're targeting so nobody's probably given the default too much thought. But why version 1.9? That's not the earliest, and it's not the current, so seems a strange choice?

The README could admittedly use some work. If you fork the repo and put questions that you've found as you use the library, we can fill in the answers and merge.

chrisseaton avatar Sep 04 '13 08:09 chrisseaton

1.9 is the most common version at the moment although 2.0 will be soon so if we change default (which I agree a default is probably not what should be encouraged) it should be set to 2.0.

To be clear on your notnode question it is because it is being parsed in 1.8 mode.

I also agree we should update the README or have a wiki page on getting up and running.

enebo avatar Sep 04 '13 15:09 enebo

Ok, I will drop some questions on the README.

As a user I had to look into the source code to understand the nature of some nodes. For some of them there is no Javadoc, so I had just to try them in the REPL to figure out what they used for. Maybe I could add some examples in the javadoc of the corresponding node, if you think that could help.

ftomassetti avatar Sep 09 '13 16:09 ftomassetti

I added a bit to the README recently, also, set up wiki and added a couple pages. It would be awesome to get some more articles in the wiki and then link to those from the README as appropriate.

edubkendo avatar Sep 09 '13 17:09 edubkendo