parboiled
parboiled copied to clipboard
Stack overflow
Rule TypeApplicationAsProxyType(@NotNull Var<IfDevNamespace> namespaceVar)
{
return FirstOf(PrimitiveTypeApplicationAsProxyType(),
ArrayTypeApplicationAsProxyType(namespaceVar),
Sequence(ElementIdAsFqn(), push(proxyDefaultNamespace((IfDevFqn) pop(),
namespaceVar.get()))));
}
Rule ArrayTypeApplicationAsProxyType(@NotNull Var<IfDevNamespace> namespaceVar)
{
return Sequence(Sequence('[', OptEW(), TypeApplicationAsProxyType(namespaceVar), drop(), OptEW(), ',', OptEW(), LengthFrom(),
Optional(OptEW(), "..", OptEW(), LengthTo()), OptEW(), ']'),
push(proxyForSystem(ImmutableIfDevName.newInstanceFromSourceName(match()))));
}
Exception:
java.lang.StackOverflowError
at ru.cpb9.ifdev.parser.IfDevParboiledParser$$parboiled.ArrayTypeApplicationAsProxyType(Unknown Source)
at ru.cpb9.ifdev.parser.IfDevParboiledParser$$parboiled.TypeApplicationAsProxyType(Unknown Source)
at ru.cpb9.ifdev.parser.IfDevParboiledParser$$parboiled.ArrayTypeApplicationAsProxyType(Unknown Source)
at ru.cpb9.ifdev.parser.IfDevParboiledParser$$parboiled.TypeApplicationAsProxyType(Unknown Source)
at ru.cpb9.ifdev.parser.IfDevParboiledParser$$parboiled.ArrayTypeApplicationAsProxyType(Unknown Source)
at ru.cpb9.ifdev.parser.IfDevParboiledParser$$parboiled.TypeApplicationAsProxyType(Unknown Source)
...
What's wrong? Am I missing something important?
Hmm...
What happens when you flatten the nested Sequence
in ArrayTypeApplicationAsProxyType
?
It doesn't appear to add any value, does it?
It does, it's followed by push(match())
.
Flattening the nested Sequence
does not fix the problem.
Removing the Var<>
parameters from both rules does fix the problem.
Code to reproduce the bug:
@BuildParseTree
public class BugParser extends BaseParser<Object>
{
Rule Root()
{
Var<Object> var = new Var<>();
return Expr(var);
}
Rule Expr(Var<Object> var)
{
return SubExpr(var);
}
Rule SubExpr(Var<Object> var)
{
return Sequence('(', Expr(var), ')');
}
}
Ok, thank you! That looks indeed like a bug. Thanks for reporting!
Running into similar issues, any news?
Same for me.