A newbie for x3... The code is adapted from the roman.cpp in the x3 tutorial. Suppose I have a symbol table like below:
struct car_models_ : x3::symbols<char, unsigned>
{
car_models_()
{
add
("sedan", 1)
("compact", 2)
("suv", 3)
;
}
} car_models;
Then parse,
char const *first = "Model: sedan";
char const *last = first + std::strlen(first);
parse(first, last, "Model: " >> car_models[action()]);
If there is new model not listed in the symbol table, what would be the right way to handle it? Is there a way to add a wildcard as the last entry in the symbol table, and then somehow pass an unknown model to action (e.g., number "0" in this case)?