/// <summary> /// 添加一张符号表 /// </summary> /// <param name="kt">待添加符号表</param> public void addSymbolTable(KagaTable kt) { this.tableContainer.Add(kt); }
/// <summary> /// 代码树节点构造器 /// </summary> /// <param name="nname">节点名字</param> /// <param name="nt">节点类型</param> /// <param name="nodeDepth">节点深度</param> /// <param name="nodeIndex">节点广度</param> /// <param name="paraParent">节点双亲</param> public KagaNode(string nname, NodeType nt, int nodeDepth, int nodeIndex, KagaNode paraParent) { // 初始化节点信息 this.atype = nt; this.anodeName = nname; this.depth = nodeDepth; this.parent = paraParent; this.children = new List<KagaNode>(); // 如果是代码块,那就要生成符号表 if (nt.ToString().Contains(Consta.prefix_block)) { this.isNewBlock = true; this.symbolTable = new KagaTable(this.depth, this); } }