-
Hi! I've been trying to get to grips with lexy by writing a chemical formula parser, and I can't quite I'm quite new to this kind of thing so there is absolutely a chance that I've just glossed over/not understood the right bit of the documentation. Thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You can use either Although, if you're having a fixed list of symbols, it might make sense to use |
Beta Was this translation helpful? Give feedback.
You can use either
dsl::if_()
ordsl::opt()
for that. The latter gives you a value when the rule didn't match, the former doesn't.Although, if you're having a fixed list of symbols, it might make sense to use
dsl::symbol
: you specify a mapping of e.g. element names to enum values in a table, then read one of those.