New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexOutOfBoundsException with parseIterator #135

Closed
scand1sk opened this Issue Nov 30, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@scand1sk

scand1sk commented Nov 30, 2016

I have a fairly complicated parser for the FlatZinc language available here: https://github.com/concrete-cp/cspom/blob/master/src/main/scala/cspom/flatzinc/FlatZincFastParser.scala

It seems to work pretty well when I convert the input stream to a whole String and parse it using the parse() method. However, I may have to parse quite large files (~ 500 MB) and would like to use the parseIterator() technique. I splitted the input stream into 1024 chars chunks with val input = Source.fromInputStream(is).grouped(1024).map(_.mkString).

I got the following exception:

 java.lang.IndexOutOfBoundsException: UberBuffer index -1353 must be between 0 and 57
  at fastparse.utils.UberBuffer.apply(UberBuffer.scala:15)
  at fastparse.utils.IteratorParserInput.apply(ParserInput.scala:131)
  at fastparse.parsers.Terminals$.rec$1(Terminals.scala:93)
  at fastparse.parsers.Terminals$.startsWith(Terminals.scala:96)
  at fastparse.parsers.Terminals$Literal.parseRec(Terminals.scala:122)
  at fastparse.WhitespaceApi$CustomSequence.parseRec(WhitespaceApi.scala:26)
  at fastparse.WhitespaceApi$CustomSequence.parseRec(WhitespaceApi.scala:26)
  at fastparse.WhitespaceApi$CustomSequence.parseRec(WhitespaceApi.scala:26)
  at fastparse.WhitespaceApi$CustomSequence.parseRec(WhitespaceApi.scala:26)
  at fastparse.parsers.Combinators$Rule.parseRec(Combinators.scala:160)
  ...

Maybe I have done something wrong, but it may also be a bug in FastParse?

@vovapolu

This comment has been minimized.

Show comment
Hide comment
@vovapolu

vovapolu Nov 30, 2016

Collaborator

🤔 it looks like bug in fastparse. Can you send some basic working example with this error?

Collaborator

vovapolu commented Nov 30, 2016

🤔 it looks like bug in fastparse. Can you send some basic working example with this error?

@vovapolu

This comment has been minimized.

Show comment
Hide comment
@vovapolu

vovapolu Nov 30, 2016

Collaborator

Oh, it's WhitespaceApi :) It's quite unstable with Iterator parsing.

Collaborator

vovapolu commented Nov 30, 2016

Oh, it's WhitespaceApi :) It's quite unstable with Iterator parsing.

@lihaoyi lihaoyi added the bug label Nov 30, 2016

@lihaoyi

This comment has been minimized.

Show comment
Hide comment
@lihaoyi

lihaoyi Dec 1, 2016

Owner

Bah WhitespaceApi is always a source of bugs and internal confusion 😛 if only it wasn't so useful!

Owner

lihaoyi commented Dec 1, 2016

Bah WhitespaceApi is always a source of bugs and internal confusion 😛 if only it wasn't so useful!

@lihaoyi

This comment has been minimized.

Show comment
Hide comment
@lihaoyi

lihaoyi Oct 18, 2018

Owner

Closing due to inactivity, probably stale since 2.0.x is very different internally

Owner

lihaoyi commented Oct 18, 2018

Closing due to inactivity, probably stale since 2.0.x is very different internally

@lihaoyi lihaoyi closed this Oct 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment