summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/tests/expr.c1
-rw-r--r--tools/perf/util/expr.l2
2 files changed, 2 insertions, 1 deletions
diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c
index 13350c500e34..1cb02ca2b15f 100644
--- a/tools/perf/tests/expr.c
+++ b/tools/perf/tests/expr.c
@@ -38,6 +38,7 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)
ret |= test(&ctx, "max(1,2) + 1", 3);
ret |= test(&ctx, "1+1 if 3*4 else 0", 2);
ret |= test(&ctx, "1.1 + 2.1", 3.2);
+ ret |= test(&ctx, ".1 + 2.", 2.1);
if (ret)
return ret;
diff --git a/tools/perf/util/expr.l b/tools/perf/util/expr.l
index ceab11bea6f9..f397bf8b1a48 100644
--- a/tools/perf/util/expr.l
+++ b/tools/perf/util/expr.l
@@ -81,7 +81,7 @@ static int str(yyscan_t scanner, int token, int runtime)
}
%}
-number [0-9]*\.?[0-9]+
+number ([0-9]+\.?[0-9]*|[0-9]*\.?[0-9]+)
sch [-,=]
spec \\{sch}