From 29616f4a35d835fd81a45d9519d829881bba9d9a Mon Sep 17 00:00:00 2001 From: Yuri Roubinsky Date: Mon, 1 Mar 2021 09:08:44 +0300 Subject: [PATCH] Fix parsing hexadecimal (lowercase `e`,`f`) in shaders (cherry picked from commit 19e0a1ec9dce4d0a550a944bbd77f0db427dec78) --- servers/visual/shader_language.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/servers/visual/shader_language.cpp b/servers/visual/shader_language.cpp index 3f6f99938ff..520512b6f32 100644 --- a/servers/visual/shader_language.cpp +++ b/servers/visual/shader_language.cpp @@ -546,12 +546,12 @@ ShaderLanguage::Token ShaderLanguage::_get_token() { if (hexa_found || str.length() != 1 || str[0] != '0') return _make_token(TK_ERROR, "Invalid numeric constant"); hexa_found = true; - } else if (GETCHAR(i) == 'e') { - if (hexa_found || exponent_found || float_suffix_found) + } else if (GETCHAR(i) == 'e' && !hexa_found) { + if (exponent_found || float_suffix_found) return _make_token(TK_ERROR, "Invalid numeric constant"); exponent_found = true; - } else if (GETCHAR(i) == 'f') { - if (hexa_found || exponent_found) + } else if (GETCHAR(i) == 'f' && !hexa_found) { + if (exponent_found) return _make_token(TK_ERROR, "Invalid numeric constant"); float_suffix_found = true; } else if (_is_number(GETCHAR(i))) {