Add error position and json_path to the JRuby extension - #1067
Conversation
|
Hey @byroot could you kindly review this. |
|
Uh, no idea what I haven't seen this until now. |
63352da to
4994fe3
Compare
3220ded to
442961f
Compare
|
Why did coverage need to be disabled? |
You can see the failing builds on the first commit. |
|
Hey @byroot thanks for the quick review and approval. No it is not your fault, the thing the github automated algo falsely flagged my github account , so my github account, repo etc were not visible to other, even though i raised my PR for this follow fix, but still is was not showing to others and as I am not a prod users , so it took more than 2 weeks to get their human support for get my account back :( |
Ah, so it is not including prism as a gem dependency and expecting it to just be available. We don't include prism in the box yet because JRuby is cross-platform and prism requires a native library. If it were in a Gemfile, it would install and work just fine. I'm working on shipping a cross-platform version using wasm but it's not ready yet. It would probably be healthy to include it as an explicit dependency. |
Follow-up to #1062, as suggested there: this brings
ParserError#line,#columnand#json_pathto the JRuby extension.The Java parser already shares the C parser's architecture (frame stack + value stack), so the implementation mirrors it closely: positions are computed by scanning backwards from the error offset like
cursor_positiondoes in C, and@json_pathis collected as raw segments from the frame stack, then formatted by the shared Ruby code from #1062. Everything happens at raise time, so nothing is added to the happy path.NestingErrorstays bare, matching the C extension.Positions and paths come out identical to the C parser:
The duplicate key case reuses the existing cursor rewind to the object's opening brace, so line/column match C exactly there too. Error message wording still differs between the two extensions ("unexpected token at" vs "unexpected character:"); I left that alone to keep the diff focused.
The four
json_pathtest methods now run on JRuby (omit guards removed), plus a newtest_parse_error_positionasserting line/column values on both extensions. JRuby suite goes from 53 omissions to 49 with 0 failures; CRuby stays at 0 failures, 0 omissions.