Closed excursus closed 3 years ago
Hey @excursus! Thanks for the issue!
Could you provide and example of a string on which the doubleQuotedString
Parser
is failing? It will help with testing a fix for the issue. Thanks!
Sure! I think the any string that is long enough will do it, although I imagine that "long enough" is runtime specific. For instance this will do it:
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam egestas diam at augue tincidunt ultrices. Phasellus sagittis dictum sem, eu fermentum tellus auctor sit amet. Mauris ac scelerisque felis, nec tempor lectus. Cras rutrum massa non ligula vulputate, ut rutrum nibh efficitur. Sed pellentesque, orci ut malesuada tincidunt, mauris ex blandit eros, quis posuere magna augue auctor nulla. Aenean ut dui elit. Vestibulum convallis lacinia posuere. Donec id mollis turpis. Curabitur aliquam urna vel ligula posuere, ut lacinia urna imperdiet. Praesent auctor lectus quis mi elementum varius. Suspendisse tortor nunc, iaculis sed venenatis non, imperdiet id lacus. Quisque sodales suscipit nibh in consectetur. Quisque eget lacinia massa, porttitor dictum nisi. Pellentesque at orci fringilla, ornare mi gravida, vulputate eros. Vestibulum pharetra ornare accumsan. Donec lacinia diam erat, ut feugiat quam semper in. Nulla vel velit urna. Suspendisse id elit odio. Curabitur posuere mauris nulla, non elementum nulla maximus quis. Duis erat eros, tincidunt et fermentum eget, efficitur sit amet diam. Donec placerat, felis non elementum pretium, ipsum sapien rhoncus ipsum, ac convallis justo odio id dui. Vivamus convallis tellus ut turpis pretium, at volutpat orci eleifend. Pellentesque porttitor vitae leo quis auctor. Donec tincidunt, lectus a sagittis efficitur, velit arcu varius eros, vitae interdum diam ex et ipsum."
where it throws RangeError: Maximum call stack size exceeded
.
Thanks for the bug report @excursus! You actually helped me identify a bug in the ChainRec
implementation for Parser
as well! Follow #42 for more info on when the fix will be released!
Running the
string.doubleQuotedString
parser on long-ish strings causes it to hit the recursion limit. I tried getting around this by writing a regex to match such a string, but since streams of strings are arrays of characters, there is no way to match that regex to a string longer than a single character.Is there some official workaround for this? Thanks!