Beispiel #1
0
 /// <summary>
 /// 层次符号表的构造器
 /// </summary>
 /// <param name="tableDepth">符号表深度</param>
 /// <param name="belonging">符号表的属节点</param>
 public KagaTable(int tableDepth, KagaNode belonging)
 {
     this.depth = tableDepth;
     this.belong = belonging;
     this.symbols = new List<KagaVar>();
     this.prefix = String.Format("{0}_{1}_{2}", Consta.prefix_var, this.depth, this.belong.index);
     // 把自己追加到符号表里
     this.symbolMana = SymbolManager.getInstance();
     this.symbolMana.addSymbolTable(this);
 }
Beispiel #2
0
 /// <summary>
 /// 私有构造器
 /// </summary>
 private CodeManager()
 {
     symbolMana = SymbolManager.getInstance();
     this.initCodeTree();
 }
Beispiel #3
0
 /// <summary>
 /// 刷新引用
 /// </summary>
 public void refreshRef()
 {
     this.symbolMana = SymbolManager.getInstance();
     this.codeMana   = CodeManager.getInstance();
 }
Beispiel #4
0
 /// <summary>
 /// 重新指定唯一单例的内存位置
 /// 用于存取文件时
 /// </summary>
 /// <param name="newAlloc">新的单例引用</param>
 public static void setSynObj(SymbolManager newAlloc)
 {
     synObject = newAlloc;
 }
Beispiel #5
0
 /// <summary>
 /// 工厂方法:获得唯一实例
 /// </summary>
 /// <returns>返回符号管理器的唯一实例</returns>
 public static SymbolManager getInstance()
 {
     return synObject == null ? synObject = new SymbolManager() : synObject;
 }
Beispiel #6
0
 /// <summary>
 /// 清空指定的符号管理器单元
 /// </summary>
 /// <param name="flag">待清除的单元:0 - 所有符号;1 - 符号表容器;2 - 函数容器;3 - 宏定义容器</param>
 public void clear(int flag = 0)
 {
     switch (flag)
     {
         case 0:
             synObject = null;
             break;
         case 1:
             this.tableContainer.Clear();
             break;
         case 2:
             this.callfunContainer.Clear();
             break;
         case 3:
             this.marcoContainer = "";
             break;
         default:
             this.callfunContainer.Clear();
             this.tableContainer.Clear();
             this.marcoContainer = "";
             break;
     }
 }
Beispiel #7
0
 /// <summary>
 /// 重新指定唯一单例的内存位置
 /// 用于存取文件时
 /// </summary>
 /// <param name="newAlloc">新的单例引用</param>
 public static void setSynObj(SymbolManager newAlloc)
 {
     synObject = newAlloc;
 }
Beispiel #8
0
 /// <summary>
 /// 工厂方法:获得唯一实例
 /// </summary>
 /// <returns>返回符号管理器的唯一实例</returns>
 public static SymbolManager getInstance()
 {
     return(synObject == null ? synObject = new SymbolManager() : synObject);
 }
Beispiel #9
0
 /// <summary>
 /// 私有构造器
 /// </summary>
 private CodeManager()
 {
     symbolMana = SymbolManager.getInstance();
     this.initCodeTree();
 }