优化输入逻辑

This commit is contained in:
Luke 2025-04-27 14:15:36 +08:00
parent d3494091a0
commit dbdb906a49
3 changed files with 19 additions and 3 deletions

16
.run/Main.run.xml Normal file
View File

@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Main" type="Application" factoryName="Application" nameIsGenerated="true">
<option name="MAIN_CLASS_NAME" value="org.jcnc.snow.compiler.Main" />
<module name="SCompiler" />
<option name="PROGRAM_PARAMETERS" value="test" />
<extension name="coverage">
<pattern>
<option name="PATTERN" value="org.jcnc.snow.compiler.parser.preprocessor.lexer.impl.api.*" />
<option name="ENABLED" value="true" />
</pattern>
</extension>
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>

View File

@ -17,8 +17,8 @@ import java.util.List;
public class Main {
public static void main(String[] args) throws IOException {
// 读取源文件
String filePath = args.length > 0 ? args[0] : "test";
String source = Files.readString(Path.of(filePath), StandardCharsets.UTF_8);
String source = Files.readString(Path.of(args[0]), StandardCharsets.UTF_8);
// 1. 词法分析
LexerEngine lexerEngine = new LexerEngine(source);

2
test
View File

@ -80,7 +80,7 @@ module: MainModule
j = j + 1
body:
if j == 1 then
BuiltinUtils.print(" first inner")
BuiltinUtils.print("first inner")
else
if j % 2 == 0 then
BuiltinUtils.print("j even")