Messages in this thread Patch in this message | | | From | Jiri Olsa <> | Subject | [PATCH 2/3] perf expr: Allow comments in custom metric file | Date | Tue, 21 Apr 2020 20:13:35 +0200 |
| |
Adding support to use comments within the custom metric file with both the shell '# ... ' and C '/* ... */ styles.
Signed-off-by: Jiri Olsa <jolsa@kernel.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 5561c360cd27..99547182ef79 100644 --- a/tools/perf/util/expr.l +++ b/tools/perf/util/expr.l @@ -69,6 +69,8 @@ static int str(yyscan_t scanner, int token) %} %x custom +%x comment_C +%x comment_sh number [0-9]+ @@ -103,6 +105,16 @@ else { return ELSE; } #smt_on { return SMT_ON; } {number} { return value(yyscanner, 10); } {symbol} { return str(yyscanner, ID); } + +"/*" { BEGIN(comment_C); } +<comment_C>"*/" { BEGIN(INITIAL); } +<comment_C>\n { } +<comment_C>. { } + +"#" { BEGIN(comment_sh); } +<comment_sh>\n { BEGIN(INITIAL); } +<comment_sh>. { } + "|" { return '|'; } "^" { return '^'; } "&" { return '&'; } -- 2.25.3
| |