package se.chalmers.cs.gf.dot; import se.chalmers.cs.gf.dot.Absyn.*; /*** BNFC-Generated Visitor Design Pattern Skeleton. ***/ /* This implements the common visitor design pattern. Tests show it to be slightly less efficient than the instanceof method, but easier to use. Replace the R and A parameters with the desired return and context types.*/ public class VisitSkel { public class GraphVisitor implements Graph.Visitor { public R visit(se.chalmers.cs.gf.dot.Absyn.Graph p, A arg) { /* Code For Graph Goes Here */ p.graphtype_.accept(new GraphTypeVisitor(), arg); for (Stmt x : p.liststmt_) { } return null; } } public class GraphTypeVisitor implements GraphType.Visitor { public R visit(se.chalmers.cs.gf.dot.Absyn.Digraph p, A arg) { /* Code For Digraph Goes Here */ return null; } } public class StmtVisitor implements Stmt.Visitor { public R visit(se.chalmers.cs.gf.dot.Absyn.NodeStmt p, A arg) { /* Code For NodeStmt Goes Here */ p.id_.accept(new IDVisitor(), arg); p.maybeattrlist_.accept(new MaybeAttrListVisitor(), arg); return null; } public R visit(se.chalmers.cs.gf.dot.Absyn.EdgeStmt p, A arg) { /* Code For EdgeStmt Goes Here */ p.id_1.accept(new IDVisitor(), arg); p.id_2.accept(new IDVisitor(), arg); p.maybeattrlist_.accept(new MaybeAttrListVisitor(), arg); return null; } } public class MaybeAttrListVisitor implements MaybeAttrList.Visitor { public R visit(se.chalmers.cs.gf.dot.Absyn.NoAttrList p, A arg) { /* Code For NoAttrList Goes Here */ return null; } public R visit(se.chalmers.cs.gf.dot.Absyn.AnAttrList p, A arg) { /* Code For AnAttrList Goes Here */ for (Attr x : p.listattr_) { } return null; } } public class AttrVisitor implements Attr.Visitor { public R visit(se.chalmers.cs.gf.dot.Absyn.Attr p, A arg) { /* Code For Attr Goes Here */ p.id_1.accept(new IDVisitor(), arg); p.id_2.accept(new IDVisitor(), arg); return null; } } public class IDVisitor implements ID.Visitor { public R visit(se.chalmers.cs.gf.dot.Absyn.IdentID p, A arg) { /* Code For IdentID Goes Here */ //p.ident_; return null; } public R visit(se.chalmers.cs.gf.dot.Absyn.StringID p, A arg) { /* Code For StringID Goes Here */ //p.string_; return null; } public R visit(se.chalmers.cs.gf.dot.Absyn.IntID p, A arg) { /* Code For IntID Goes Here */ //p.integer_; return null; } public R visit(se.chalmers.cs.gf.dot.Absyn.DoubleID p, A arg) { /* Code For DoubleID Goes Here */ //p.double_; return null; } } }