From 15242a65b65932431d16e26d1c82a135fabea185 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Fri, 3 Apr 2020 08:56:19 +0200 Subject: [PATCH] tools/nxstyle.c: handle scientific notation with a negative exponent (eg. 9e-10) --- tools/nxstyle.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/nxstyle.c b/tools/nxstyle.c index dc9a2e10cd..3da8b6c6d0 100644 --- a/tools/nxstyle.c +++ b/tools/nxstyle.c @@ -2033,6 +2033,19 @@ int main(int argc, char **argv, char **envp) check_spaces_leftright(line, lineno, n, n + 1); n++; } + + /* Scientific notation with a negative exponent (eg. 10e-10) + * REVISIT: This fails for cases where the variable name + * ends with 'e' preceded by a digit: + * a = abc1e-10; + * a = ABC1E-10; + */ + + else if ((line[n - 1] == 'e' || line[n - 1] == 'E') && + isdigit(line[n + 1]) && isdigit(line[n - 2])) + { + n++; + } else { /* '-' may function as a unary operator and snuggle