Closed Bockeman closed 3 years ago
In the rgw29_minimal.cpp.txt there is a way to make this compile:
//#define WITHOUT_CATCH_ALL // This code compiles successfully when this is uncommented.
and this essentially removes the catch_all
rule and replaces it with the contents in-line where catch_all
is used.
#ifdef WITHOUT_CATCH_ALL // This selection, an expansion, results in a successful compile.
auto const start_rule_def = +(gap | +(char_ -'{' -space)); // catch_all expanded
#else // This selection results in compile error messages
auto const start_rule_def = +catch_all; // catch_all as separate rule
#endif // but the catch_all rule is identical to the working expansion.
To be clear, this is not a work around but rather a demonstration of what might be the hub of an underlying bug or flawed user coding. The real problem, perhaps not very clear from the minimal example, is that I have many more cases like catch_all
and without the modularisation afforded by separate or distinct smaller rules, the overall code would contain rules that were impossibly large and difficult to get right, debug and so on.
make.log rgw29_minimal.cpp.txt
I have a very simple parser with 4 rules, one of which is [1]:
in other words, capture "gaps" (which include spaces and braced "comments") and everythings which is not a "gap", in a parser without any skip parser.
I would like to wrap this construct for use elsewhere, so I created a separate "catch_all" rule [2]:
Notice that the content of the rule (inside the +(...) ) is identical in both cases. So both should do exactly the same thing.
The erudite reader will of course realise that this code is a trivialization of my real world scenario.
However, [1] compiles successfully, whereas [2] generates compile errors (see attached make.log), and I believe the pertinent line is:
which I interpret to mean that there is a missing constructor of the form:
I don't think the problem is in the parser rules, but rather the ast. But I cannot see what is wrong with my ast:
I accept this variant has only one element, but that is not the case in the real world scenario, and I don't see why this should cause a problem. In the MCVE, attached, there are a few more variants for good measure.
Please could you kindly help me to interpret this error message and, if possible, (assuming a coding shortcoming on my part) help me and others from falling into the same trap. Thanks in advance.