Skip to content

integers of different sizes #209

Answered by d-frey
RavikumarTulugu asked this question in Q&A
Discussion options

You must be logged in to vote

You can use maximum_rule< std::uint8_t >, as seen in tao/pegtl/contrib/uri.hpp. The maximum_rule allows you to specify the datatype into which a parsed number must fit, as well as an optional maximum value. You could use maximum_rule< std::uint8_t, 123 > as a rule that parses/matches any number from 0 to 123.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by d-frey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #209 on December 09, 2020 08:11.