Annotate and combine the 'etype' and 'symtype' checks done in bison
parser for readability and because JSON parser will start doing the same
in a follow-up patch.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
extern struct expr *symbol_expr_alloc(const struct location *loc,
enum symbol_types type, struct scope *scope,
const char *identifier);
+#define is_symbol_value_expr(expr) \
+ ((expr)->etype == EXPR_SYMBOL && (expr)->symtype == SYMBOL_VALUE)
const char *expr_name(const struct expr *e);
range_rhs_expr : basic_rhs_expr DASH basic_rhs_expr
{
- if ($1->etype == EXPR_SYMBOL &&
- $1->symtype == SYMBOL_VALUE &&
- $3->etype == EXPR_SYMBOL &&
- $3->symtype == SYMBOL_VALUE) {
+ if (is_symbol_value_expr($1) &&
+ is_symbol_value_expr($3)) {
$$ = symbol_range_expr_alloc(&@$, $1->symtype, $1->scope, $1->identifier, $3->identifier);
expr_free($1);
expr_free($3);