-
|
Hi, I'm still trying to wrap my head around lexy, for the most My issue is the behavior of So basically The strange part (for my understanding) is the omitted whitespace at the end. I've tried to create a simple keyword parser but I have to also parse the (actually expected) https://godbolt.org/z/s9z7b8EWT It basically adds the usual whitespace class constexpr auto ws = dsl::ascii::blank;
// ...
return LEXY_KEYWORD("int", id) >> ws + id;The example for struct production
{
static constexpr auto rule = [] {
// Define the general identifier syntax.
auto head = dsl::ascii::alpha_underscore;
auto tail = dsl::ascii::alpha_digit_underscore;
auto id = dsl::identifier(head, tail);
// Parse a keyword.
return LEXY_KEYWORD("int", id);
}();
};Would my approach be the "correct" way to implement |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
If you want to skip whitespace, you need to enable whitespace skipping: https://godbolt.org/z/sTajc74sh Read more here: https://lexy.foonathan.net/reference/dsl/whitespace/#doc |
Beta Was this translation helpful? Give feedback.
If you want to skip whitespace, you need to enable whitespace skipping: https://godbolt.org/z/sTajc74sh
Read more here: https://lexy.foonathan.net/reference/dsl/whitespace/#doc