瀏覽代碼

Fixes #32963 by correctly parsing bin/hex literals

Micheál Keane 5 年之前
父節點
當前提交
4b9fd961d6
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. 4 3
      modules/gdscript/gdscript_tokenizer.cpp

+ 4 - 3
modules/gdscript/gdscript_tokenizer.cpp

@@ -937,8 +937,10 @@ void GDScriptTokenizerText::_advance() {
 								return;
 								return;
 							}
 							}
 							hexa_found = true;
 							hexa_found = true;
-						} else if (GETCHAR(i) == 'b') {
-							if (hexa_found || bin_found || str.length() != 1 || !((i == 1 && str[0] == '0') || (i == 2 && str[1] == '0' && str[0] == '-'))) {
+						} else if (hexa_found && _is_hex(GETCHAR(i))) {
+
+						} else if (!hexa_found && GETCHAR(i) == 'b') {
+							if (bin_found || str.length() != 1 || !((i == 1 && str[0] == '0') || (i == 2 && str[1] == '0' && str[0] == '-'))) {
 								_make_error("Invalid numeric constant at 'b'");
 								_make_error("Invalid numeric constant at 'b'");
 								return;
 								return;
 							}
 							}
@@ -951,7 +953,6 @@ void GDScriptTokenizerText::_advance() {
 							exponent_found = true;
 							exponent_found = true;
 						} else if (_is_number(GETCHAR(i))) {
 						} else if (_is_number(GETCHAR(i))) {
 							//all ok
 							//all ok
-						} else if (hexa_found && _is_hex(GETCHAR(i))) {
 
 
 						} else if (bin_found && _is_bin(GETCHAR(i))) {
 						} else if (bin_found && _is_bin(GETCHAR(i))) {