llvmir some opt
This commit is contained in:
38
frontend/ast/func/FuncFParams.java
Normal file
38
frontend/ast/func/FuncFParams.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package frontend.ast.func;
|
||||
|
||||
import error.Errors;
|
||||
import frontend.ast.Node;
|
||||
import frontend.ast.SyntaxType;
|
||||
import frontend.lexer.TokenStream;
|
||||
import frontend.lexer.TokenType;
|
||||
import frontend.ast.token.TokenNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FuncFParams extends Node {
|
||||
public FuncFParams(TokenStream ts) {
|
||||
super(SyntaxType.FUNC_FORMAL_PARAM_S, ts);
|
||||
}
|
||||
|
||||
public void parse(Errors errors) {
|
||||
while (true) {
|
||||
FuncFParam ffp = new FuncFParam(this.ts);
|
||||
ffp.parse(errors);
|
||||
addChild(ffp);
|
||||
if (getCurrToken().getType() == TokenType.COMMA) {
|
||||
TokenNode comma = new TokenNode(this.ts);
|
||||
addChild(comma);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayList<FuncFParam> getParamList() {
|
||||
ArrayList<FuncFParam> paramList = new ArrayList<>();
|
||||
for (int i = 0; i < getChildren().size(); i += 2) {
|
||||
paramList.add((FuncFParam) getChild(i));
|
||||
}
|
||||
return paramList;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user