As no-one has responded, I thought I would chip in...

I'm sure you probably know this... but just in-case,

"Stack too deep" literally means you have too many functions calling onto
other function, detected by the virtual machine (or OS) to prevent you from
getting run away recursion.

So.. causes..

Either someone is monkey patching something that Parslet is relying on, so
the code that is executing is different somehow,

OR

You are just unlucky, and were running near the stack limit with your
existing code but didn't know it and running it from within another calling
mechanize has just pushed you over the edge (as it would add it's own calls
to the stack).

Parsing can be a very stack intensive activity depending on the
implementation and the complexity of the document. I believe Parslet will
be creating another call on the stack for each sub-entity it starts
parsing... so if you have expressions that contains expressions that
contain expressions.. etc...
then at some point you'll hit the limit..

Solution?

I'd suggest trying to set your stack depth a little deeper  (
http://dalibornasevic.com/posts/5-ruby-stack-level-too-deep-systemstackerror)
first.. and see if that's the problem. If you still hit it, then you
probably have some run away recursion.. so the code is somehow different in
the Goliath environment. If it starts working, then you just have a deep
stack.

Either you can make this your default stack depth setting, or change your
grammar to reduce the number of rules and hence the stack depth.

These are just my suppositions, so I hope they are of some help.


Cheers
Nigel
---
"No man is an island... except Philip"


On 27 November 2011 07:32, David Jenkins <[email protected]> wrote:

> I have an app that uses Parslet and works fine in "normal" circumstances.
>  But the same code, when called called from Goliath.response, gives me
> "error: stack level too deep".
>
> Any ideas?
>
> I'll try and whittle down the code to a reasonable repro size in the
> meantime.
>
> Thanks
>
> David Jenkins
>

Reply via email to