Hi,
I have a trivial parser, which is just sketched out as:
peg::parser parser(R"(
UCI <- Position0
Position0 <- Position StartPos / Position Fen
Position <- 'position'
StartPos <- 'startpos'
Fen <- < [a-zA-Z0-9] [a-zA-Z0-9-_]* >
%whitespace <- [ \t]*
)");
parser["Fen"] = [&](peg::SemanticValues& vs)
{
// delegate to fenp.
auto tmp = vs; // vs empty on input: position foobarbaz
};
As you can see the Grammar is trivial, but I'm not sure why the semantic values captured by 'Fen' is empty.
It is at this point that I'd expect to see the contents matched by' < [a-zA-Z0-9] [a-zA-Z0-9-_]* >' ??
@lewismj in your situation, you have to call vs.token_to_string() to the matched string since it's a token instead of a semantic value. You can see more detail in README. Hope it helps!
Hi, I have a trivial parser, which is just sketched out as:
As you can see the Grammar is trivial, but I'm not sure why the semantic values captured by 'Fen' is empty. It is at this point that I'd expect to see the contents matched by' < [a-zA-Z0-9] [a-zA-Z0-9-_]* >' ??