修复IDE错误

This commit is contained in:
Luke 2025-04-27 14:32:26 +08:00
parent c3c77345b7
commit 3411616870
3 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,6 @@ package org.jcnc.snow.compiler;
import org.jcnc.snow.compiler.lexer.LexerEngine;
import org.jcnc.snow.compiler.lexer.token.Token;
import org.jcnc.snow.compiler.lexer.utils.TokenPrinter;
import org.jcnc.snow.compiler.parser.ParserEngine;
import org.jcnc.snow.compiler.parser.context.ParserContext;
import org.jcnc.snow.compiler.parser.ast.base.Node;
@ -28,6 +27,8 @@ public class Main {
ParserContext ctx = new ParserContext(tokens);
List<Node> ast = new ParserEngine(ctx).parse();
// 3. 语义分析
// 打印

View File

@ -13,7 +13,7 @@ import java.util.List;
/**
* 解析 if 语句
*
* <p>
* 支持格式
* if <condition> then
* <then-statements>

View File

@ -203,8 +203,8 @@ public class JSONParser {
if (currentChar() == '-') advance();
while (isDigit(currentChar())) advance();
if (currentChar() == '.') {
advance();
while (isDigit(currentChar())) advance();
do advance();
while (isDigit(currentChar()));
}
if (currentChar() == 'e' || currentChar() == 'E') {
advance();
@ -316,14 +316,13 @@ public class JSONParser {
/**
* 根据对象类型选择合适的写入方式
*/
@SuppressWarnings("unchecked")
private static void writeValue(Object obj, StringBuilder sb) {
if (obj == null) {
sb.append("null");
} else if (obj instanceof String) {
quote((String) obj, sb);
} else if (obj instanceof Number || obj instanceof Boolean) {
sb.append(obj.toString());
sb.append(obj);
} else if (obj instanceof Map) {
sb.append('{');
boolean first = true;