!3 bug: 允许文件直接以 EOF 结束 <code>end module</code>
Merge pull request !3 from Luke/bugfix/fix-module-space-line-can-not-compile
This commit is contained in:
commit
ff488ae595
@ -17,7 +17,7 @@ public record ParserEngine(ParserContext ctx) {
|
||||
List<String> errs = new ArrayList<>();
|
||||
TokenStream ts = ctx.getTokens();
|
||||
|
||||
while (ts.isAtEnd()) { // ← 取反
|
||||
while (ts.isAtEnd()) {
|
||||
// 跳过空行
|
||||
if (ts.peek().getType() == TokenType.NEWLINE) {
|
||||
ts.next();
|
||||
|
||||
@ -88,7 +88,6 @@ public class ModuleParser implements TopLevelParser {
|
||||
// 确保模块体以 "end module" 结束
|
||||
ts.expect("end");
|
||||
ts.expect("module");
|
||||
ts.expectType(TokenType.NEWLINE);
|
||||
|
||||
// 构建并返回完整的模块语法树节点
|
||||
return new ModuleNode(name, imports, functions);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user