Skip to content

ignore output of part of a rule #51

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

You must be logged in to vote

Adding another idea:

struct decimal_plus : decimal {};
struct decimal_minus : decimal {};
struct decimal_plus_full : p::seq< p::one< '+' >, seps, decimal_plus > {};
struct decimal_minus_full : p::seq< p::one< '-' >, seps, decimal_minus > {};
struct decimal_signed : p::sor< decimal_plus_full, decimal_minus_full > {};

Then attach your actions to decimal_plus and decimal_minus. In the latter case, just convert the input to a number and negate that (positive) number after a proper range check.

Replies: 4 comments

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
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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 #51 on December 09, 2020 10:42.