jruby / jruby-parser

JRuby's parser customized for IDE usage

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IndexOutOfBounds with an array node

ftomassetti opened this issue · comments

Hi, I am parsing this code:

'a,@b,c = 1,2,3'

with:

r = JRubyParser.parse(code)
man = r.childNodes[0].childNodes[0]

Now, if I invoke man.pre.count I get a 4 but if I later try to get man.pre.get(3) it blows up. Any ideas about that? Am I using it uncorrectly?

We pre-alloc'd a size of 4 elements in the list for performance in Main JRuby parser. This unfortunately always would return a size of 4 if there were 4 or less elements in the list. I fixed this in JRuby-parser. It will now work. In your example it will show a size of 3 for a,@b, and c. Thanks for reporting this.

Thank you! Will the fix be in 0.5.2?

Yeah, but next version will be 0.5.4. I skipped a few releases as a gem
and only released on Java side.

On Wed, Jan 1, 2014 at 3:34 AM, Federico Tomassetti <
notifications@github.com> wrote:

Thank you! Will the fix be in 0.5.2?


Reply to this email directly or view it on GitHubhttps://github.com//issues/30#issuecomment-31420657
.

blog: http://blog.enebo.com twitter: tom_enebo
mail: tom.enebo@gmail.com