pkt1583 / functionaljava

Automatically exported from code.google.com/p/functionaljava
0 stars 0 forks source link

[Parser] Using not in conjunction with repeat or repeat1 causes StackOverflowError #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
See attached testcase... this represents what I think should happen, but
please review it. In any case, it's overflowing which obviously ain't right.

Original issue reported on code.google.com by pelo...@gmail.com on 19 Mar 2010 at 2:20

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, I think this was a case of user error. Parser.not(e) does not, and cannot,
consume any input upon success, because it was generated by a failure of the
underlying parser, and failures do not consume input. Therefore in order to use 
a
not() with a repeat() or repeat1(), one has to add a parser in between which 
consumes
the right amount of input, e.g.

character(e, sat, 'A').not(e).repeat1()

must be rewritten as:

character(e, sat, 'A').not(e).sequence(character(e)).repeat1()

Original comment by pelo...@gmail.com on 19 Mar 2010 at 7:57

GoogleCodeExporter commented 9 years ago

Original comment by pelo...@gmail.com on 19 Mar 2010 at 7:59