From 98471a88b9b31161f37be84bd70c22dc69033dcc Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Wed, 10 Apr 2024 17:25:26 +0200 Subject: [PATCH] Fix mixed tab & space indentention --- internal/filter/parser.go | 2 ++ internal/filter/parser.y | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/internal/filter/parser.go b/internal/filter/parser.go index b782cbcd..5599b978 100644 --- a/internal/filter/parser.go +++ b/internal/filter/parser.go @@ -481,6 +481,7 @@ yydefault: goto yystack } } + /* the current p has no shift on "error", pop stack */ if yyDebug >= 2 { __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys) @@ -575,6 +576,7 @@ yydefault: //line parser.y:147 { if yyDollar[1].text != "" { + // NewChain is only going to return an error if an invalid operator is specified, and since // we explicitly provide the None operator, we don't expect an error to be returned. yyVAL.expr, _ = NewChain(None, yyDollar[2].expr) } else { diff --git a/internal/filter/parser.y b/internal/filter/parser.y index ccce10d6..eef0010f 100644 --- a/internal/filter/parser.y +++ b/internal/filter/parser.y @@ -124,8 +124,8 @@ filter_rule: filter_chain logical_op filter_chain } | filter_rule logical_op filter_chain { - $$ = reduceFilter($2, $1, $3) - yylex.(*Lexer).rule = $$ + $$ = reduceFilter($2, $1, $3) + yylex.(*Lexer).rule = $$ } ; @@ -182,15 +182,15 @@ exists_expr: identifier ; identifier: T_IDENTIFIER - { - column, err := url.QueryUnescape($1) - if err != nil { - // Something went wrong, so just panic and filter.Parse will try to recover from this. - panic(err) - } - - $$ = column - } + { + column, err := url.QueryUnescape($1) + if err != nil { + // Something went wrong, so just panic and filter.Parse will try to recover from this. + panic(err) + } + + $$ = column + } ; optional_negation: /* empty */ { $$ = "" }