From patchwork Tue Dec 11 11:00:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 153437 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp476433ljp; Tue, 11 Dec 2018 03:03:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wv5YYedR0B9rOatET9l3SFguQpNh0JKtLR3ZN6u+cabv2GNEKGLN6WzyjBQiDznTCxUO+j X-Received: by 2002:aa7:80d7:: with SMTP id a23mr15651973pfn.86.1544526205299; Tue, 11 Dec 2018 03:03:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544526205; cv=none; d=google.com; s=arc-20160816; b=qc8v89QehDcVtrBs+l0qEddNRokesT8H5u9tE+JEIPKJoCp+Cvw0J9zZ2jmu7bdaLG zoPrWHWq7I7JoejAW6MDa/djGyIcxGZ6kbawTMrcE6mhK4VXruq4Z0Efz1U7FZzKZepb S+raVYDlfBAS8Kak327YYHSda1nSvIwTC7wPzOWmnu9lQQViKJDBxUde+nqzNCZasF95 oIkSDT6sdMAYpW/DeSlBDdx4iwykJVX5E71uZ7psE6EiN0w2qP5K5tNxLPNER+xk9wGC 22rwmeab+zH37Bl9NlWuo4eP2fhQMeZKzeuV0GWpZ6nJS2kLWQiFw/F1bimpmmomNkh7 NhmQ== 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=BD7gkp9jc0123daEs5SstZ3+OOaAroiN8LQ5Qi2IAvY=; b=LsLjlWclkDbCIz+JXYSpDLXFJ6S6XA1DTBNpaWV0qKQYAwWAS2HdIu9nhsifxXoQ2p 6UTS5t/YntpLOhBpfhg/nG1lrBdHw2T7DDhfq+pYXdeXlbgp/fdqmQmh7h8SbOVSqvEA WaENOxwUu9Sfm5HD+k9GCEgN/ZpNhfjqvOrEclDy/qUBvFlqJayWQfRlp5OLTb4pkICa JPF5LfzU68pVcK9FTD6eTK+Qs+8+If9o+JG+e9wcrhXfkc4TjzSYrD9hcwbrtSJEn773 qbJ6KlZKXt9zPr4/YJBGKukUdf3NfbxwgC1pH7CcXc2JKvYXhN2u+j3Z9R9kG+lz6U++ lbuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=vtQymvHw; 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 x5si11065485pga.440.2018.12.11.03.03.24; Tue, 11 Dec 2018 03:03:25 -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=vtQymvHw; 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 S1726671AbeLKLBn (ORCPT + 31 others); Tue, 11 Dec 2018 06:01:43 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:36638 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726432AbeLKLBm (ORCPT ); Tue, 11 Dec 2018 06:01:42 -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 wBBB1C5g017210; Tue, 11 Dec 2018 20:01:16 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com wBBB1C5g017210 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1544526077; bh=BD7gkp9jc0123daEs5SstZ3+OOaAroiN8LQ5Qi2IAvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vtQymvHw5414mFzvRj4NBDaSSaiZJNO7bEecnyK3MbfpDeYHkNJNVE01rTLfLs8q+ ea0MP3E/3j51FfqurmdvhFbO7kxQy8daYTbOcw0IV2OkbVHLXRJm1n3Gic1LzS0UON EJygDGqoNfO8IXY1Xx6w8RJtqIt0iW1WPK4cPZEGiROo2YTKPZev3vK/LrpVa76qfk 608AqTbSqicDriywfFqdwjvkJvTpJKczGK6gWUyBpvG0KPEOM9JJsL8vSLQZ7oeDLD gIEOW1lSfqOqZCc3amFXoFno6Yg/4WGwHnoO+R8JvO/An2LT7e3ktJPTTp7n7BRdXk fzcH/5b7X9yRg== 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 05/27] kconfig: refactor pattern matching in STRING state Date: Tue, 11 Dec 2018 20:00:48 +0900 Message-Id: <1544526070-16690-6-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 Here, similar matching patters are duplicated in order to look ahead the '\n' character. If the next character is '\n', the lexer returns T_WORD_QUOTE because it must be prepared to return T_EOL at the next match. Use unput('\n') trick to reduce the code duplication. Signed-off-by: Masahiro Yamada --- scripts/kconfig/zconf.l | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) -- 2.7.4 diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 709b774..b7bc164 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l @@ -182,19 +182,9 @@ n [A-Za-z0-9_-] { "$".* append_expanded_string(yytext); - [^$'"\\\n]+/\n { - append_string(yytext, yyleng); - yylval.string = text; - return T_WORD_QUOTE; - } [^$'"\\\n]+ { append_string(yytext, yyleng); } - \\.?/\n { - append_string(yytext + 1, yyleng - 1); - yylval.string = text; - return T_WORD_QUOTE; - } \\.? { append_string(yytext + 1, yyleng - 1); } @@ -210,8 +200,10 @@ n [A-Za-z0-9_-] fprintf(stderr, "%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); + unput('\n'); BEGIN(INITIAL); - return T_EOL; + yylval.string = text; + return T_WORD_QUOTE; } <> { BEGIN(INITIAL);