Merge pull request #46543 from Chaosus/shader_fix_hex

Fix parsing hexadecimal (lowercase `e`,`f`) in shaders
This commit is contained in:
Rémi Verschelde 2021-03-01 09:17:08 +01:00 committed by GitHub
commit fb8cfc442d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -558,13 +558,13 @@ ShaderLanguage::Token ShaderLanguage::_get_token() {
return _make_token(TK_ERROR, "Invalid numeric constant"); return _make_token(TK_ERROR, "Invalid numeric constant");
} }
hexa_found = true; hexa_found = true;
} else if (GETCHAR(i) == 'e') { } else if (GETCHAR(i) == 'e' && !hexa_found) {
if (hexa_found || exponent_found || float_suffix_found) { if (exponent_found || float_suffix_found) {
return _make_token(TK_ERROR, "Invalid numeric constant"); return _make_token(TK_ERROR, "Invalid numeric constant");
} }
exponent_found = true; exponent_found = true;
} else if (GETCHAR(i) == 'f') { } else if (GETCHAR(i) == 'f' && !hexa_found) {
if (hexa_found || exponent_found) { if (exponent_found) {
return _make_token(TK_ERROR, "Invalid numeric constant"); return _make_token(TK_ERROR, "Invalid numeric constant");
} }
float_suffix_found = true; float_suffix_found = true;