Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2173581ybk; Mon, 11 May 2020 13:55:10 -0700 (PDT) X-Google-Smtp-Source: APiQypI0Yv/2rDiQN2OX9HZ1A22gciU3Up1wuQg6CFwztjm8UcHTJor/mZ4wc3RSuj4USLw4KC6/ X-Received: by 2002:a05:6402:129a:: with SMTP id w26mr14519635edv.254.1589230510207; Mon, 11 May 2020 13:55:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589230510; cv=none; d=google.com; s=arc-20160816; b=zx+uDKhZzNIIw1u0a7kxgKTUnEOjMye+QseRZP30ZEO33JvPAPJrNM71C0erGdCNwp UDnt9m70RIPb6KaQn5H4s9Ti4rgHOzhwyojtNgzwMnPn5x/m/73d+lhD7g32/4uqcWqP KzrVnRpTwB44coUL9/enGjwBKmjhr6vYEYmYenZQe1MwusIbKwVCBpX4FU+heHS8OAyS SdlHL7CcwoeNDxg8VUbk/EdpTiq8CovNqSVkFU34c+/8s/Cn0RM7KAUvzPdTM5D9TAEp zCdEq5Pq86CtPYehSqL4h0OtxmfvEEwObvW6b8WShJ4B47vgAYIehx2keXns5iAJ4w4O nzcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jgEY1RxOef+3oxH1L8HRdsbebjkxAEQCw+O32dtIqMU=; b=ksjNo1N12LMlVgKCRYAnzaAYlk4vmLN+yU39imBY/g5WJ/YxndWUb6sNlyyr0WoZXK MBAvoDSIeLKeiRnaWm9Ir0kyiwprZmdt4OJ08XSKeVRU6+RtIH/PufwgF1lMQHM3k55q r7447FyGqiBd+P6Bwkp2YAzCsI9i2WgQ1KVaDSKxPW/CGZlad1dh6HmoOaZXcevmOdxP ldvjnTa7Ulmsq2JExPTcMm4XUEWBFC+tsblWyZ0JsxkyuWLCY58pIHlokYBtYJBejz/C JCFUgP/iSpMwQIG40Lc6FCJMC10Z3qnZrjJZqA71GYCL0KqTr7j3DKcKI6jXxpDf1Sfj vZOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bi11si2963968edb.606.2020.05.11.13.54.46; Mon, 11 May 2020 13:55:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731775AbgEKUxZ convert rfc822-to-8bit (ORCPT + 99 others); Mon, 11 May 2020 16:53:25 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35405 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727873AbgEKUxY (ORCPT ); Mon, 11 May 2020 16:53:24 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-139-Xd5Dz6Z9OYqR5urTgn-IWA-1; Mon, 11 May 2020 16:53:19 -0400 X-MC-Unique: Xd5Dz6Z9OYqR5urTgn-IWA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 174D7460; Mon, 11 May 2020 20:53:18 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 516887526E; Mon, 11 May 2020 20:53:15 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , Joe Mario , Andi Kleen , Kajol Jain , John Garry Subject: [PATCH 2/4] perf expr: Allow comments in custom metric file Date: Mon, 11 May 2020 22:53:05 +0200 Message-Id: <20200511205307.3107775-3-jolsa@kernel.org> In-Reply-To: <20200511205307.3107775-1-jolsa@kernel.org> References: <20200511205307.3107775-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 4 X-Mimecast-Originator: kernel.org Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding support to use comments within the custom metric file with both the shell '# ... ' and C '/* ... */ styles. Signed-off-by: Jiri Olsa --- tools/perf/util/expr.l | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l index c6a930ed22e6..e9b294ba09fc 100644 --- a/tools/perf/util/expr.l +++ b/tools/perf/util/expr.l @@ -82,6 +82,8 @@ static int str(yyscan_t scanner, int token, int runtime) %} %x custom +%x comment_single +%x comment_multi number [0-9]*\.?[0-9]+ @@ -116,6 +118,16 @@ else { return ELSE; } #smt_on { return SMT_ON; } {number} { return value(yyscanner); } {symbol} { return str(yyscanner, ID, sctx->runtime); } + +"//" { BEGIN(comment_single); } +\n { BEGIN(INITIAL); } +. { } + +"/*" { BEGIN(comment_multi); } +"*/" { BEGIN(INITIAL); } +\n { } +. { } + "|" { return '|'; } "^" { return '^'; } "&" { return '&'; } -- 2.25.4