Merge pull request #116 from mrdomino/h-validate-apply

H_VALIDATE_APPLY macro
This commit is contained in:
Meredith L. Patterson 2015-01-04 04:12:06 +01:00
commit b2f247b029

View file

@ -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