Re: boost::regex: regex meta data or AST for regex?

Frank Bergemann <[email protected]> Sun, 17 Jan 2021 09:48:09 +0100
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 17.01.21 09:33, Frank Bergemann wrote:
> cross-posting from boost users - it fits better here:
> 
> in concrete:
> Is it possible to not only get the #no of groups (sub-expressions) via 
> basic_regex::mark_count(), but also their position (begin() / end() 
> iterators) in the given regex string (c'tor argument)?
> 
> more general:
> Can an AST be created for a the given regex string (c'tor argument)?
> E.g with boost::spirit?

I am busy with #2 parsers:

1) RegexParser: Intended to be a full regular expression parser
https://github.com/F-Bergemann/RegexParser

2) RegexSplitter: to just break up regular expression into substrings 
for top level regex-group & non-regex-group substrings:
https://github.com/F-Bergemann/RegexSplitter


It's just a start and so much wrong within, i know.
But i have one concrete question for the RegexSplitter:

How can i avoid in RegexSplitter.cpp to use

#157 ( tok_element >> *tok_element ) [ qi::_val = phx::new_<ASTNode> 
(qi::_1, qi::_2, ASTNode::COLLECTION_c) ];

I want to pass a SINGLE std::vector<ATSNode *> only to the receiving

#51 // COLLECTION_c
#52 ASTNode::ASTNode(
#53        ASTNode const * first,
#54        std::vector<ASTNode *> & others,
#55        Type const type)

without the SEPARATE parameter 'first'.
I.e. i need to "merge" qi::_1 and qi::_2.