Re: qi::rule<> mix

Frank Bergemann <[email protected]> Thu, 4 Feb 2021 17:34:29 +0100
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 03.02.21 18:45, Frank Bergemann wrote:
> I try to combine 1) qi::rule<Iterator, ASTNode*> with 2) 
> qi::rule<Iterator> for parsing.
> 1) intended to create AST nodes, 2) intended to just parse the data and 
> hand to another 1) for some AST node.
> 
> Please see https://github.com/F-Bergemann/RegexSplitter 
> (RegexSplitter.cpp) for trying to handle regex character sets with 2).
> 
> But i get:
>  > ./regex-splitter "[012345]hello"
> TEST:[012345]hello
> U:, B:hello,
> 
> respectively, when enabling
> #define PRINT_DEBUG
> then i get:
> 
>  > ./regex-splitter "[012345]hello"
> TEST:[012345]hello
> ### ASTNode c'tor (std::string &) #1: Unbreakable
> ### ASTNode c'tor (std::string &) #2: U:
> ### ASTNode c'tor (std::string &) #1: Breakable
> ### ASTNode c'tor (std::string &) #2: B:hello
> ### ASTNode c'tor (ASTNode const *, std::vector<ASTNode *> &) #1: 
> Collection
> ### ASTNode d'tor #1: Unbreakable
> ### ASTNode d'tor #2: U:
> ### ASTNode d'tor #1: Breakable
> ### ASTNode d'tor #2: B:hello
> ### ASTNode c'tor (ASTNode const *, std::vector<ASTNode *> &) #2: 
> Collection
> U:, B:hello,
> ### ASTNode d'tor #1: Collection
> ### ASTNode d'tor #2: C:hello
> 
> I.e. no Iterator data for the corresponding tok_set in the code.
> 
> Is it invalid trying to combine qi::rule<Iterator, ASTNode*> and 
> qi::rule<Iterator> ?

This problem is solved: i had to switch to
   qi::rule<Iterator, std::string()>
to generate output, that can be next adopted from some
   qi::rule<Iterator, ASTNode*>