Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp511424imu; Tue, 11 Dec 2018 03:04:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/UaiOZJRSBaq3z+4fzaMJ2yUwG6Omz4ldeDE4gvMUsS1vTAmlRpLPcTIDzf4Gz04v5ZxQ17 X-Received: by 2002:a62:4255:: with SMTP id p82mr15714334pfa.13.1544526260160; 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=YphkjAxmnoyvd3yiN9Tm5Z6CdGBUprtHumgDtCU4nULe3+kIn4IWVzl7WlDmEsNVD0 uB++IIFgJqrj7Y775+zJPf+yDopIOzwlpBF1gG5zC8vt904piwcVu2t9be7JKj3TqRjK mXGGa552Wz5k+oSomN9IRstCrXpzX2xxrkBwfOgEg2ZOxxfdZ/lCMbUzUc7qXL6AoZ0f /na1PsXx9JxylZSLo0xQ4o1y+UadJ9up6lpMU1SuvvC666gppno540wBnp0xSRgPeBBH PLSEpfUx9y+XUEivZNz218d7cjKvYidRSufrupe1SZ//aNPB6F1AdC2wCjfKmxcOKWW0 fBKg== 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=H7uIjhRZd78YuhKatcgyhcv31egGnNdh5y9Y0vrPiac=; b=R/lKNvFDFS8WYibIQeqfpCzY3zz6EvnNzNu9VnKRT23eQxpQ4OZWZgBNDSKwpDqXbp /gM0yrBMkXttQKRdNeCa3EcOj6cu6Gs3mGHEsEfGXrO0MvEZ5gsvcZHrtZNQmU4ap081 TpsVS2/Gvi8kfkOyWAw+vYkONe7aatS9yB91+ZjLPx5fo3od/4Hn+xEM4K0Hje8mczPc QeeYEPFCJwe9vvtVgLkUGuz1jTW9aFnRkeDBA9YirxdZtFkcgwySKXUvtyb9GS3oABO7 HfI4KxnC7Wo2McXXEPtxyqGx33vMDxWJwfBmtwISo1e93mltwG+fH3JhBSQVIWRRWzIC EGdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=FUBA9gOB; 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 c17si11885751pgl.385.2018.12.11.03.04.04; 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=FUBA9gOB; 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 S1726819AbeLKLC0 (ORCPT + 99 others); Tue, 11 Dec 2018 06:02:26 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:36853 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726705AbeLKLBs (ORCPT ); Tue, 11 Dec 2018 06:01:48 -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 wBBB1C63017210; Tue, 11 Dec 2018 20:01:31 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com wBBB1C63017210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544526092; bh=H7uIjhRZd78YuhKatcgyhcv31egGnNdh5y9Y0vrPiac=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUBA9gOBQNlZQC+gbVwyI/JVuq2QwxVbg4+BTaUgI5eWsBKric0VcEtND1MKaxGVw p4VUq9iVDrh9e9GUD5YxVvLxjqiU/C8yabrIFv/az7eJ3Q3oGtaBW2C+aoo8BNPZLQ afdAVOtDI55NTh4DgADa+xvm/DXTZMepBthKzxhvrG2p1OtIx5bu3ls8MsFLH6Q+kI 0v9x1LWWZPW27rl6UN2HA+zdPHx06iUVAlJpZghLoM6Gku/RID9Mzc4I/ajSdrp0Bl d3V8kmZI5BDHqH6/CWFCUrYJ0bYWQGrooxHgPfntnPSs9IE6PMfx69weLiiyIvkQ2N 8Zmaa7A+0sVwg== 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 26/27] kconfig: update current_pos in the second lexer Date: Tue, 11 Dec 2018 20:01:09 +0900 Message-Id: <1544526070-16690-27-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 To simplify the generated lexer, let the hand-made lexer update the file name and line number for the parser. I tested this with DEBUG_PARSE, and confirmed the same file names and line numbers were dumped. Signed-off-by: Masahiro Yamada --- scripts/kconfig/zconf.l | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index d462507..f0734abe 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -108,8 +108,6 @@ n [A-Za-z0-9_-] { {n}+ { const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); - current_pos.file = current_file; - current_pos.lineno = yylineno; if (id && id->flags & TF_COMMAND) { BEGIN(PARAM); return id->token; @@ -291,9 +289,21 @@ int yylex(void) repeat: token = yylex1(); - /* Do not pass unneeded T_EOL to the parser. */ - if ((prev_token == T_EOL || prev_token == T_HELPTEXT) && token == T_EOL) - goto repeat; + if (prev_token == T_EOL || prev_token == T_HELPTEXT) { + if (token == T_EOL) { + /* Do not pass unneeded T_EOL to the parser. */ + goto repeat; + } else { + /* + * For the parser, update file/lineno at the first token + * of each statement. Generally, \n is a statement + * terminator in Kconfig, but it is not always true + * because \n could be escaped by a backslash. + */ + current_pos.file = current_file; + current_pos.lineno = yylineno; + } + } if (prev_prev_token == T_EOL && prev_token == T_WORD && (token == T_EQUAL || token == T_COLON_EQUAL || token == T_PLUS_EQUAL)) -- 2.7.4