Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp511640imu; Tue, 11 Dec 2018 03:04:31 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xe8Qd6w3QOeeYmVAL+ys2LtyZVjHMj/5nWEJ12nB+2u6zh/7cAPRcPQBgRY8kw4xkhavq+ X-Received: by 2002:a63:ef47:: with SMTP id c7mr14363750pgk.386.1544526271317; Tue, 11 Dec 2018 03:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544526271; cv=none; d=google.com; s=arc-20160816; b=aOIOYb/jbSr06mAvO2SKPbFuu9Px4rd/ioOqgzofIcxYD900D1zGyo0H1fnp0ayVIJ OkT7hb8BY2xJduardK6pPDEJ0J/p6Ps1Z4j4faaejyztQhT8RlTyF4LVB7CvKHa/q1/D yFUppo73CCwLfrVTNSUL78BVYefHW26fLb0zIxOFyroP2KE3Mb9PyixYygKV84iDldP1 +ILq/VF3Ou/W4JWYV/tU2p8xKKSw1xq2+G3FE7IFjRRQtT8W4TmCeJVFVjMnmGpql1y3 /xz8sJf5P7KS3ppJzWSF471wLhBusUlg9X7wZIBZe2LblAj3pHjwCB68mGnfudyMBhTD Wpyg== 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 h5si11474762pgc.237.2018.12.11.03.04.16; Tue, 11 Dec 2018 03:04:31 -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 S1726667AbeLKLBm (ORCPT + 99 others); Tue, 11 Dec 2018 06:01:42 -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(-) 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); -- 2.7.4