Replies: 4 comments 11 replies
-
Seems the queue in the Pairs object is over 700 elements long at the time of crash Also |
Beta Was this translation helpful? Give feedback.
-
I updated my grammar to dramatically simplify the output tree, and now Pest simply freezes indefinitely on any nested expression, such as Running the updated grammar with breakpoints in the debugger reveals that it seems to be parsing each character as TERM, over and over...? It seems to be looping around the whole tree from TOPLEVEL_EXPRESSION to ATOMIC_VALUE for some reason Any ideas? Grammar:
|
Beta Was this translation helpful? Give feedback.
-
Also; I had to manually set the breakpoints on rules, as setting the |
Beta Was this translation helpful? Give feedback.
-
I got it working!! Rewrote the grammar again, removing the TRY_* rules, and instead solved the deep-nested trees issue like this // Bypass single-child nodes
// They should not be parsed into a node directly
// Except for the script and line nodes, which are allowed to be single-child
while target.clone().into_inner().count() == 1
&& target.as_rule() != Rule::SCRIPT
&& target.as_rule() != Rule::LINE
{
target = target.into_inner().next().unwrap();
} While flattens out the long precedence chains, allowing me to parse |
Beta Was this translation helpful? Give feedback.
-
My grammar is attached below
Deeply nested expressions such as
(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2*(2))))))))))))))))))
cause stack overflows very quicklyThe expression above gets ~halfway down the tree and crashes at around 256kb of stack usage
I thought a {1,3} in
int_literal
may have been the culprit but breaking that down changed littleThe grammar works fine, besides the nested expression crashes
Is there some issue in my grammar?
Beta Was this translation helpful? Give feedback.
All reactions