From fbdc20dd3aadbe4cd1e28052a0bb3e1a86c526c6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 27 Jan 2018 14:09:55 +0100 Subject: [PATCH] xgettext: Support '_' in number tokens in C++. * gettext-tools/src/x-c.c (phase5_get): Recognize '_' in C++. * NEWS: Update. --- NEWS | 2 ++ gettext-tools/src/x-c.c | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/NEWS b/NEWS index 57933c35d..d5c09799f 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ - C, C++: xgettext now supports 'p'/'P' exponent markers in number tokens, as specified in C99 and C++17. + - C++: + xgettext now supports underscores in number tokens. - C++: xgettext now supports single-quotes in number tokens, as specified in C++14. diff --git a/gettext-tools/src/x-c.c b/gettext-tools/src/x-c.c index 3dd25499a..e2d4e5448 100644 --- a/gettext-tools/src/x-c.c +++ b/gettext-tools/src/x-c.c @@ -1438,6 +1438,17 @@ phase5_get (token_ty *tp) case '.': continue; + case '_': + if (cxx_extensions) + /* In C++, an underscore can be part of a preprocessing number + token. */ + continue; + else + { + phase4_ungetc (c); + break; + } + case '\'': if (cxx_extensions) { -- 2.47.3