Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: Piotr Grzybowski Newsgroups: gnu.bash.bug Subject: ./parse.y: warning: 1 shift/reduce conflict [-Wconflicts-sr] Date: Wed, 27 Jun 2018 12:59:34 +0200 Lines: 51 Approved: bug-bash@gnu.org Message-ID: NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: usenet.stanford.edu 1530097184 17128 208.118.235.17 (27 Jun 2018 10:59:44 GMT) X-Complaints-To: action@cs.stanford.edu To: bug-bash Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:content-transfer-encoding:subject:date:message-id:to :mime-version; bh=fLNpA6ZuQU8kPAtIAr592Weh8ixe7oKUEaqkPN68t1Y=; b=AImBV/l7G8OEm2Uoy27aNU3NzBncx0mOUtxb1u4oX4A/r6NlX4ncmfwox1CquGxHN0 doQmuTCFEif4E/gfq878Y7UGrpXqw/vGrrN3K6qc1G+WVYR306yOFlWCd4yKiaAFyBAB ac6UIkSSoO9QZvoi5kkvmZXRGoXU6Qk6SqxDR638K7K6a+Zx4tdqmjprkI4JVCUPHM4p Uf4ntoAuSBVq1IF+K/ys34PJFq31gb1gdXpT4Be4yypqGl1PLYfwAsNO9PTt2s+c5Zk5 YBglROkldtDI3TI36X9IYYXdtOr8RSG/LwBKvTs3p32dBx+hPbm+bG1Xl171JfaGiGwg 2xfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:subject:date :message-id:to:mime-version; bh=fLNpA6ZuQU8kPAtIAr592Weh8ixe7oKUEaqkPN68t1Y=; b=BcL70Kxq0D1eujFSaZZY9GzjtDz6k1zX6RrCqfgFkx1Q+Dh0niWDVb6fT/4MqnI3Cc W49yhTa9UBI2mqhhRQYRHf0h+RAMJEs3Y6nwxhRBFdHZXVSjRlISRCvy3QY4uWQDo0pm 4gG//Y07aBudeaUygT0zvMH/dMxb/P9cFB7d5KHkt3GvN1/0f6BYqQAU/PamQPskOdGU etALktwWa9iTxZdJvruofE63Aywp7N4Yh6wyHIx4Pdo7jQQsp3coM/oHVSOCVe/edbDV RQqpDUd1JKKzxtjF5gmhYrB3aimZMxvV2thU+RT2oR8EAHkaFBoYhp8qT5iN5+Aa5S0r 2GXA== X-Gm-Message-State: APt69E2Z3kwkaxBpYfnDlCGxDhK2YIvJCY/v41tK5s1AhCXwSDaiWvwx AGcKkkCZvIvD/zPS/GgypPMP8A== X-Google-Smtp-Source: AAOMgpci+vnOtficetHbqB9TWGoQmr1lWzljv56PrTzAAPGOkxx6LnjBDDpgoLVtf4uSb72FSC1D8Q== X-Received: by 2002:a19:1003:: with SMTP id f3-v6mr4029665lfi.116.1530097176616; Wed, 27 Jun 2018 03:59:36 -0700 (PDT) X-Mailer: Apple Mail (2.1085) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::244 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14279 Hey, I case anyone noticed, in the current devel there is shift/reduce = conflict reported by bison. Those usually are a symptom of not fully = controlled grammar, and I would like to think that we are in full = control over parse.y. It is caused by function_def rule, namely the combination of '(' and = newline_list. A quick fix: diff --git a/parse.y b/parse.y index 6457782..f7d84ff 100644 --- a/parse.y +++ b/parse.y @@ -913,16 +913,15 @@ case_command: CASE WORD newline_list IN = newline_list ESAC } ; =20 -function_def: WORD '(' ')' newline_list function_body - { $$ =3D make_function_def ($1, $5, = function_dstart, function_bstart); } - - | FUNCTION WORD '(' ')' newline_list function_body - { $$ =3D make_function_def ($2, $6, = function_dstart, function_bstart); } - - | FUNCTION WORD newline_list function_body +function_def: WORD function_newline_list function_body + { $$ =3D make_function_def ($1, $3, = function_dstart, function_bstart); } + | FUNCTION WORD function_newline_list function_body { $$ =3D make_function_def ($2, $4, = function_dstart, function_bstart); } ; =20 +function_newline_list: '(' ')' | function_newline_list '\n' + ; + function_body: shell_command { $$ =3D $1; } | shell_command redirection_list cheers, pg P.S. the last rule maybe does not give justice to the syntax, but tokenizer = will not let anything stray go through.