Merge pull request #116 from mrdomino/h-validate-apply
H_VALIDATE_APPLY macro
This commit is contained in:
commit
b2f247b029
1 changed files with 14 additions and 7 deletions
|
|
@ -11,7 +11,8 @@
|
||||||
//
|
//
|
||||||
// A few standard semantic actions are defined below. The H_ACT_APPLY macro
|
// A few standard semantic actions are defined below. The H_ACT_APPLY macro
|
||||||
// allows semantic actions to be defined by "partial application" of
|
// 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
|
// The definition of more complex semantic actions will usually consist of
|
||||||
// extracting data from the given parse tree and constructing a token of custom
|
// 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); \
|
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
|
// Working with HParsedTokens
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue