switching qi::rule while parsing?
Frank Bergemann <[email protected]> Tue, 19 Jan 2021 19:05:48 +0100
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
Let me change the summary for a new aspect:
In https://github.com/F-Bergemann/RegexSplitter
when trying to allow '(' and ')' also _within_ groups here:
tok_something =
( +(qi::char_ /* - qi::char_("()") */) ) [ qi::_val =
phx::new_<ASTNode> (qi::_1, ASTNode::BREAKABLE_c) ];
it seems to start with qi::rule tok_group, but then switches over to
qi::rule tok_something. For this even creates #2 ASTNode instances, and
one is leaking:
TEST:(hello)
### ASTNode c'tor #1: Breakable
### ASTNode c'tor #2: B:hello)
### ASTNode c'tor #1: Breakable
### ASTNode c'tor #2: B:(hello)
### ASTNode c'tor: Collection
### ASTNode d'tor Breakable
### ASTNode c'tor: Collection
B:(hello),
### ASTNode d'tor Collection
What's happening here? Where can i read about the details of this
behavior? Why and when does it decide to switch over to tok_something
for the entire input? Especially: how to detect/track for the leak here?
Do i have to use a smart-ptr and spirit will bring it out-of-scope?