package st; import syntaxtree.*; import visitor.*; import java.util.*; import misc.*; /** * Performs a bottom-up preliminary visit through the AST * initializing all ClassInstances and placing them in the passed ST */ public class SymTableExtend extends GJDepthFirst { /** * f0 -> "class" * f1 -> Identifier() * f2 -> "extends" * f3 -> Identifier() * f4 -> "{" * f5 -> ( VarDeclaration() )* * f6 -> ( MethodDeclaration() )* * f7 -> "}" */ public R visit(ClassExtendsDeclaration n, SymbolTable symt) { String act = n.f1.f0.tokenImage; symt.setActive(TypeEnum.classname, symt.getClass(act)); n.f0.accept(this, symt); n.f1.accept(this, symt); n.f2.accept(this, symt); n.f3.accept(this, symt); n.f4.accept(this, symt); n.f5.accept(this, symt); n.f6.accept(this, symt); n.f7.accept(this, symt); symt.setExtend(n.f3.f0.tokenImage); return null; } }