Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp511434imu; Tue, 11 Dec 2018 03:04:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/UQMueVKm7xbhR1/XiaBmGREjWz1yucz5gqszgfEaPmJbk8/lKecFEHelO3mN3T/vdEoGhd X-Received: by 2002:a65:4049:: with SMTP id h9mr13973319pgp.304.1544526260519; Tue, 11 Dec 2018 03:04:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544526260; cv=none; d=google.com; s=arc-20160816; b=dmjs6Sk2LR50ErIqI14unRe13UWQbwtJBxW4jBXiuil4rNm1vikjllZyOp4BZ0Lvjq s/yrqJx8bFjZYOOkVLUURG3eIbyFshsAgs8EyBQGzpNv/OmkIovI2+B7utUer0Cy4L5+ 73Y8/RfHLIPdtqi4BRgqaTEpshvug9KuT1jOnZsNSXeSbOxwtvsizYd3TaCT0tHulk2e Fln+weiP02iyE/VFeVZtMZoHFTgszMsXyk0G/ZoYK1jcLmjzWeN9gKMqE70YBuZe5Gx3 hUvv/muCpS09DjNo+eTqJWONJ9/rfeLgfUCjennGGc3gi9DbuJJ5hKSRtHmpUgCDv70u btSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter; bh=azx+pnU1cXACJgUuzQ4P92840L9XD8VA47ps+ZrPfdo=; b=y0WxAjuyzvpEnyjBSJE5ZZ1/nlqsEasML3nZHTt7Le569t9qjUu7PndLQOgK/MQjHY z8KJ7x0UzoLQZb1XxPBEdG3OrFF/voDCK9M1gzdyrZUdsjxfKfuCZrf961kuf0T9aSS2 ouCQMCPxEKh4go4e00GM2ixbUScD3aDbzhAnCCRYoe3inruas8e9e+scYM94HwhMB1kT kJS5nvgmxOpLvqEc9I8KQTKlKi4g6V73eeq26iAF8oVW4hbka57mYU6z8twZ+JZN8yxA 7Y6iUxLOJ74d8O1kSgJhe4t4PkoLAfetla1YDJ3WJwmvfkwR430wqTihLsLUlwwE3Vm5 VjrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Yi532WXo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t74si12155843pgc.150.2018.12.11.03.04.05; Tue, 11 Dec 2018 03:04:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=Yi532WXo; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726707AbeLKLBp (ORCPT + 99 others); Tue, 11 Dec 2018 06:01:45 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:36701 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726584AbeLKLBn (ORCPT ); Tue, 11 Dec 2018 06:01:43 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-11.nifty.com with ESMTP id wBBB1C5l017210; Tue, 11 Dec 2018 20:01:20 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com wBBB1C5l017210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544526080; bh=azx+pnU1cXACJgUuzQ4P92840L9XD8VA47ps+ZrPfdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yi532WXoQr1Nj9YE15y7UbTWaAHCmFQLxNrYlPd1hGNIzqOnIH/bnSmFKsA5wsoMH TwS6z0h/Pl64Dm5/8NZf7Om3zuq0H6BNSNbNZZnWI2gA4ND4kVwgx2OG+JH2vIq4kk pwM7lnHJ8tZBxyKiqN60WZ1KqriEaaBukqXrrmoaP+WeLO2wlALkcHtvblpJ5R4dCU vho2rC7EfxPhfjTUxqY3EQUCmJ7XtozHjNAYNO1wevXORwI7udyblg0x+F8ocM5QR1 MzPnU54F5Ndkgc6QHFbmhAOMvZgqGuyUp/4MUAWLQlf2Q/bAnva1iE690Luf62tviM L3yAaQ1X8GYWA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ulf Magnusson , linux-kernel@vger.kernel.org, Masahiro Yamada Subject: [PATCH 10/27] kconfig: remove grammatically ambiguous option_error Date: Tue, 11 Dec 2018 20:00:53 +0900 Message-Id: <1544526070-16690-11-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1544526070-16690-1-git-send-email-yamada.masahiro@socionext.com> References: <1544526070-16690-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This commit decreases 6 shift/reduce conflicts, and finally achieves conflict-free parser. Since Kconfig has no terminator for a config block, detecting the end of config_stmt is not easy. For example, there are two ways for handling the error in the following code: 1 config FOO 2 = [A] Print "unknown option" error, assuming the line 2 is a part of config_option_list [B] Print "invalid statement", assuming the line 1 is reduced into a config_stmt by itself Bison actually chooses [A] because it performs the shift rather than the reduction where both are possible. However, there is no reason to choose one over the other since the code above can be written as follows: 1 config FOO 2 3 = Remove the option_error, and let it fall back to [B]. Signed-off-by: Masahiro Yamada --- scripts/kconfig/zconf.y | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index cef6123..a92f167 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -31,7 +31,6 @@ struct symbol *symbol_hash[SYMBOL_HASHSIZE]; static struct menu *current_menu, *current_entry; %} -%expect 6 %union { @@ -138,12 +137,6 @@ common_stmt: | assignment_stmt ; -option_error: - T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); } - | error T_EOL { zconf_error("invalid option"); } -; - - /* config/menuconfig entry */ config_entry_start: T_CONFIG nonconst_symbol T_EOL @@ -180,7 +173,6 @@ config_option_list: | config_option_list symbol_option | config_option_list depends | config_option_list help - | config_option_list option_error ; config_option: T_TYPE prompt_stmt_opt T_EOL @@ -280,7 +272,6 @@ choice_option_list: | choice_option_list choice_option | choice_option_list depends | choice_option_list help - | choice_option_list option_error ; choice_option: T_PROMPT prompt if_expr T_EOL @@ -429,7 +420,6 @@ help: help_start T_HELPTEXT depends_list: /* empty */ | depends_list depends - | depends_list option_error ; depends: T_DEPENDS T_ON expr T_EOL -- 2.7.4