From: Francis De Brabandere <francisdb@gmail.com> Use %prec LOWER_THAN_ELSE on the empty EndIf_opt rule to explicitly resolve 4 dangling Else / End If shift/reduce conflicts. The remaining 6 conflicts are benign colon-chain ambiguities documented with %expect 6. --- dlls/vbscript/parser.y | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dlls/vbscript/parser.y b/dlls/vbscript/parser.y index 4977358b333..8242edf9483 100644 --- a/dlls/vbscript/parser.y +++ b/dlls/vbscript/parser.y @@ -93,6 +93,15 @@ static statement_t *link_statements(statement_t*,statement_t*); %define api.pure %start Program +/* Resolve dangling Else / End If conflicts via precedence: the empty + * EndIf_opt rule gets lower precedence than tELSE and tEND so that + * shift (binding to innermost If) always wins. The remaining 6 + * shift/reduce conflicts are benign colon-chain ambiguities where + * bison's default shift gives the correct greedy behavior. */ +%nonassoc LOWER_THAN_ELSE +%nonassoc tELSE tEND +%expect 6 + %union { const WCHAR *string; statement_t *statement; @@ -315,7 +324,7 @@ IfStatement { $$ = new_if_statement(ctx, @$, $2, $4, NULL, NULL); CHECK_ERROR; } EndIf_opt - : /* empty */ + : /* empty */ %prec LOWER_THAN_ELSE | tEND tIF ElseIfs_opt -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10343