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

Frank Bergemann <[email protected]> Sun, 24 Jan 2021 15:04:27 +0100
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 21.01.21 02:09, Seth wrote:
> Op 19-01-2021 om 19:07 schreef Frank Bergemann:
>> Hi Seth,
>>
>> isn't Xpressive about static regexes at compile time, plus a wrapping
>> for both: dynamic _and_ static regexes?
>> How can that help to create an AST for a dynamic regular expression
>> (string)?
> 
> It actually cannot (see https://stackoverflow.com/a/7659255/85371) but
> it might do what you were hoping to achieve - I don't claim I understood
> much of the goal.
> 
> Also, that's why I linked to the other answer there because it DOES
> create an AST from dynamic regulare expressions (string).
> https://stackoverflow.com/a/21419351/85371.
> 
> Right off the bat I sense confusion in the name ("RegexSplitter" -
> regexes aren't split, they're _parsed_) and the way you attack the
> grammar (which appears to be more about scanning than parsing?). Instead
> of me poring over your code and making sense of your code you can look
> at mine for inspiration
> 
> Sorry I can't be of more active help.
> 
> Good luck,
> 
> Seth
> 

Hi Seth,

please see my original post:
 >> 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)?

Actually, it's a even simpler: I want to split a regular expression 
string into TOP LEVEL groups and non-group areas (substrings).
E.g. "here is( some| any| a) string( with optional( data| text)( at the 
end)?)?"
Should be split into #4 substrings:
   "here is"
   "(some | any| a)"
   " string"
   (with optional( data| text)( at the end)?)?"

I.e. i do NOT need to break up groups again this way, recursively.

regards,
Frank