Skip to content

Commit

Permalink
filterx: fix white space issues in the grammar
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed Jan 7, 2025
1 parent 1431a7a commit 97dee88
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions lib/filterx/filterx-grammar.ym
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,18 @@ plus_assignment
| expr '[' expr ']' KW_PLUS_ASSIGN expr { $$ = filterx_set_subscript_new(filterx_expr_ref($1), filterx_expr_ref($3), filterx_operator_plus_new(filterx_get_subscript_new($1, $3), $6)); }
| expr '.' identifier KW_PLUS_ASSIGN expr
{
$$ = filterx_setattr_new(filterx_expr_ref($1), filterx_config_frozen_string(configuration, $3), filterx_operator_plus_new(filterx_getattr_new($1, filterx_config_frozen_string(configuration, $3)), $5));
free($3);
$$ = filterx_setattr_new(filterx_expr_ref($1),
filterx_config_frozen_string(configuration, $3),
filterx_operator_plus_new(filterx_getattr_new($1, filterx_config_frozen_string(configuration, $3)),
$5));
free($3);
}
;


assignment
/* TODO extract lvalues */
: variable KW_ASSIGN expr { $$ = filterx_assign_new($1, $3); }
: variable KW_ASSIGN expr { $$ = filterx_assign_new($1, $3); }
| expr '.' identifier KW_ASSIGN expr { $$ = filterx_setattr_new($1, filterx_config_frozen_string(configuration, $3), $5); free($3); }
| expr '[' expr ']' KW_ASSIGN expr { $$ = filterx_set_subscript_new($1, $3, $6); }
| expr '[' ']' KW_ASSIGN expr { $$ = filterx_set_subscript_new($1, NULL, $5); }
Expand Down Expand Up @@ -308,7 +311,7 @@ generator_assignment
;

generator_plus_assignment
: variable KW_PLUS_ASSIGN expr_generator { $$ = $3; filterx_generator_set_fillable($3, $1); }
: variable KW_PLUS_ASSIGN expr_generator { $$ = $3; filterx_generator_set_fillable($3, $1); }
| expr '[' expr ']' KW_PLUS_ASSIGN expr_generator { $$ = $6; filterx_generator_set_fillable($6, filterx_get_subscript_new($1, $3)); }
| expr '.' identifier KW_PLUS_ASSIGN expr_generator { $$ = $5; filterx_generator_set_fillable($5, filterx_getattr_new($1, filterx_config_frozen_string(configuration, $3))); free($3);}

Expand Down Expand Up @@ -397,16 +400,16 @@ declaration
}
;

expr: __expr { $$ = $1; filterx_expr_set_location($1, lexer, &@1); }
expr: __expr { $$ = _assign_location($1, lexer, &@1); }

__expr
: expr_value
| function_call
| expr_operator
| '(' expr ')' { $$ = $2; }
| KW_ISSET '(' expr ')' { $$ = filterx_isset_new($3); }
| KW_DROP { $$ = filterx_expr_drop_msg(); }
| KW_DONE { $$ = filterx_expr_done(); }
| '(' expr ')' { $$ = $2; }
| KW_ISSET '(' expr ')' { $$ = filterx_isset_new($3); }
| KW_DROP { $$ = filterx_expr_drop_msg(); }
| KW_DONE { $$ = filterx_expr_done(); }
;

expr_operator
Expand All @@ -417,7 +420,7 @@ expr_operator
| default
/* TODO extract lvalues */
| expr '.' identifier { $$ = filterx_getattr_new($1, filterx_config_frozen_string(configuration, $3)); free($3); }
| expr '[' expr ']' { $$ = filterx_get_subscript_new($1, $3); }
| expr '[' expr ']' { $$ = filterx_get_subscript_new($1, $3); }
;

boolalg_operator
Expand Down

0 comments on commit 97dee88

Please sign in to comment.