[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200511205307.3107775-3-jolsa@kernel.org>
Date: Mon, 11 May 2020 22:53:05 +0200
From: Jiri Olsa <jolsa@...nel.org>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: lkml <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Michael Petlan <mpetlan@...hat.com>,
Joe Mario <jmario@...hat.com>, Andi Kleen <ak@...ux.intel.com>,
Kajol Jain <kjain@...ux.ibm.com>,
John Garry <john.garry@...wei.com>
Subject: [PATCH 2/4] perf expr: Allow comments in custom metric file
Adding support to use comments within the custom metric file
with both the shell '# ... ' and C '/* ... */ styles.
Signed-off-by: Jiri Olsa <jolsa@...nel.org>
---
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); }
+<comment_single>\n { BEGIN(INITIAL); }
+<comment_single>. { }
+
+"/*" { BEGIN(comment_multi); }
+<comment_multi>"*/" { BEGIN(INITIAL); }
+<comment_multi>\n { }
+<comment_multi>. { }
+
"|" { return '|'; }
"^" { return '^'; }
"&" { return '&'; }
--
2.25.4
Powered by blists - more mailing lists