H_VALIDATE_APPLY macro
I've found this especially useful in combination with my own _attr_uint_const for things like flags and type specifiers. It's possible that its usefulness might be diminished significantly if there were a built-in bitfield constant parser -- that certainly would eliminate all of my current uses of it -- but it still seems nicely symmetric with H_ACT_APPLY.
This commit is contained in:
parent
5abe74f890
commit
2dad0c48b4
1 changed files with 8 additions and 1 deletions
|
|
@ -11,7 +11,8 @@
|
|||
//
|
||||
// A few standard semantic actions are defined below. The H_ACT_APPLY macro
|
||||
// allows semantic actions to be defined by "partial application" of
|
||||
// a generic action to fixed paramters.
|
||||
// a generic action to fixed paramters. H_VALIDATE_APPLY is similar for
|
||||
// h_atter_bool.
|
||||
//
|
||||
// The definition of more complex semantic actions will usually consist of
|
||||
// extracting data from the given parse tree and constructing a token of custom
|
||||
|
|
@ -113,6 +114,12 @@ HParsedToken *h_act_ignore(const HParseResult *p, void* user_data);
|
|||
return paction(__VA_ARGS__, p, user_data); \
|
||||
}
|
||||
|
||||
// Similar, but for validations.
|
||||
#define H_VALIDATE_APPLY(myvalidation, pvalidation, ...) \
|
||||
bool myvalidation(HParseResult* p, void* user_data) { \
|
||||
return pvalidation(__VA_ARGS__, p, user_data); \
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Working with HParsedTokens
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue