refactor: 重构模板代码
This commit is contained in:
parent
87560db20d
commit
d11822f4ba
@ -71,7 +71,7 @@ public class ASTPrinter {
|
||||
NodeContext _
|
||||
) -> {
|
||||
System.out.println(pad + "function " + name
|
||||
+ "(params=" + parameters + ", return=" + returnType + ")");
|
||||
+ "(params=" + parameters + ", returns=" + returnType + ")");
|
||||
for (StatementNode stmt : body) {
|
||||
print(stmt, indent + 1);
|
||||
}
|
||||
|
||||
@ -24,8 +24,8 @@ public final class SnowExample {
|
||||
return """
|
||||
module: Math
|
||||
function: main
|
||||
parameter:
|
||||
return_type: int
|
||||
params:
|
||||
returns: int
|
||||
body:
|
||||
Math.factorial(6)
|
||||
return 0
|
||||
@ -33,9 +33,9 @@ public final class SnowExample {
|
||||
end function
|
||||
|
||||
function: factorial
|
||||
parameter:
|
||||
params:
|
||||
declare n: int
|
||||
return_type: int
|
||||
returns: int
|
||||
body:
|
||||
declare num1: int = 1
|
||||
loop:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user