9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-19 15:09:15 +00:00

忽略大小写匹配

This commit is contained in:
Catnies
2025-06-27 03:16:17 +08:00
parent 2b4ed81b72
commit d09a632804

View File

@@ -93,8 +93,7 @@ public final class SNBTReader extends DefaultStringReader {
// 检查接下来的2个非空格字符, 确认是否要走数组解析. // 检查接下来的2个非空格字符, 确认是否要走数组解析.
if (canRead()) { if (canRead()) {
setMarker(cursor); // 记录指针, 尝试解析数组. setMarker(cursor); // 记录指针, 尝试解析数组.
char typeChar = peek(); char typeChar = Character.toLowerCase(peek());
if (typeChar < 'a') typeChar = (char) (typeChar + 32); // 强制转小写进行匹配.
if (typeChar == BYTE_ARRAY || typeChar == INT_ARRAY || typeChar == LONG_ARRAY) { if (typeChar == BYTE_ARRAY || typeChar == INT_ARRAY || typeChar == LONG_ARRAY) {
skip(); skip();
skipWhitespace(); skipWhitespace();
@@ -253,7 +252,7 @@ public final class SNBTReader extends DefaultStringReader {
if (tokenLength > 1) { if (tokenLength > 1) {
// 至少有1个字符给了后缀的可能性 // 至少有1个字符给了后缀的可能性
char lastChar = charAt(tokenStart + tokenLength - 1); char lastChar = charAt(tokenStart + tokenLength - 1);
if (lastChar < 'a') lastChar = (char) (lastChar + 32); // 强制转小写进行匹配. lastChar = Character.toLowerCase(lastChar); // 强制转小写进行匹配.
try { try {
switch (lastChar) { switch (lastChar) {
case BYTE_SUFFIX -> { case BYTE_SUFFIX -> {