package frontend.ast.decl; import error.Errors; import frontend.ast.Node; import frontend.ast.SyntaxType; import frontend.lexer.TokenStream; import frontend.lexer.TokenType; public class Decl extends Node { public Decl(TokenStream ts) { super(SyntaxType.DECL, ts); } public void parse(Errors errors) { if (getCurrToken().getType() == TokenType.CONSTTK) { ConstDecl cd = new ConstDecl(this.ts); cd.parse(errors); addChild(cd); } else { VarDecl vd = new VarDecl(this.ts); vd.parse(errors); addChild(vd); } } }