I'm trying to figure out the way of parsing the following texts
function() {body ...}
function(args_) {body...}
Should i use the same struct for both variants or it could be done with only one struct
struct function
{
std::string name_;
std::vector<std::string> args_;
statement_list body_;
};
The way i parse it for now (how to skip arguments if there is no arguments):
auto const identifier_def = raw[lexeme[(alpha | '_') >> *(alnum | '_')]];
auto const function_def =
lexeme["function" >> !(alnum | '_')] >> identifier
>> '(' >> ((identifier % ',') )>> ')'
>> '{' >> statement >> '}'
;
And i could parse the variant with arguments, but not the one with no arguments!
I'm trying to use something like OR operator, but there was no success.
Thanks!