修复了注释相关的分段错误

This commit is contained in:
2025-10-18 17:26:07 +08:00
parent 7b48066aaf
commit 58f3d1067c

View File

@@ -56,16 +56,8 @@ namespace Convention.RScript
// Skip single-line comment
if (line[i + 1] == '/')
{
while (i < line.Length && line[i] != '\n')
i++;
}
// Skip multi-line comment
else if (line[i + 1] == '*')
{
i += 2;
while (i + 1 < line.Length && !(line[i] == '*' && line[i + 1] == '/'))
i++;
i++;
PushBuilder();
break;
}
else
{
@@ -74,9 +66,8 @@ namespace Convention.RScript
}
else if (c == '#')
{
// Skip single-line comment
while (i < line.Length && line[i] != '\n')
i++;
PushBuilder();
break;
}
else if (c == '\"')
{
@@ -126,10 +117,7 @@ namespace Convention.RScript
}
}
}
if (builder.Length > 0)
{
PushBuilder();
}
PushBuilder();
return statements.Where(s => !string.IsNullOrWhiteSpace(s));
}