Skip to content

Commit

Permalink
Fix confusing yacc rule names
Browse files Browse the repository at this point in the history
  • Loading branch information
yhabteab committed Aug 1, 2024
1 parent b299ca4 commit af89454
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions internal/filter/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ func reduceFilter(left Filter, op string, right Filter) Filter {
}

%type <expr> filter_rule
%type <expr> filter_chain_list
%type <expr> filter_chain
%type <expr> conditions_expr
%type <expr> maybe_negated_condition_expr
%type <expr> condition_expr
%type <expr> exists_expr
Expand All @@ -100,7 +100,7 @@ func reduceFilter(left Filter, op string, right Filter) Filter {
%type <text> "!"

// This is just used for declaring explicit precedence and resolves shift/reduce conflicts
// in `filter_chain` and `conditions_expr` rules.
// in `filter_chain_list` and `filter_chain` rules.
%nonassoc PREFER_SHIFTING_LOGICAL_OP

%nonassoc T_EQUAL T_UNEQUAL T_LIKE T_UNLIKE
Expand All @@ -113,30 +113,30 @@ func reduceFilter(left Filter, op string, right Filter) Filter {

%%

filter_rule: filter_chain logical_op filter_chain
filter_rule: filter_chain_list logical_op filter_chain_list
{
$$ = reduceFilter($1, $2, $3)
yylex.(*Lexer).rule = $$
}
| filter_chain %prec PREFER_SHIFTING_LOGICAL_OP
| filter_chain_list %prec PREFER_SHIFTING_LOGICAL_OP
{
yylex.(*Lexer).rule = $$
}
| filter_rule logical_op filter_chain
| filter_rule logical_op filter_chain_list
{
$$ = reduceFilter($1, $2, $3)
yylex.(*Lexer).rule = $$
}
;

filter_chain: conditions_expr logical_op maybe_negated_condition_expr
filter_chain_list: filter_chain logical_op maybe_negated_condition_expr
{
$$ = reduceFilter($1, $2, $3)
}
| conditions_expr %prec PREFER_SHIFTING_LOGICAL_OP
| filter_chain %prec PREFER_SHIFTING_LOGICAL_OP
;

conditions_expr: maybe_negated_condition_expr logical_op maybe_negated_condition_expr
filter_chain: maybe_negated_condition_expr logical_op maybe_negated_condition_expr
{
$$ = reduceFilter($1, $2, $3)
}
Expand Down

0 comments on commit af89454

Please sign in to comment.