using KumiScript.Interpreter; namespace KumiScript.Reader { public class SymbolTable { static SymbolTable? _instance; readonly Dictionary _table; private SymbolTable() { _instance = this; _table = new Dictionary(); } public static SymbolTable GetInstance() { if (_instance is null) return new SymbolTable(); return _instance; } public Symbol FromString(string s) { Symbol? sym; _table.TryGetValue(s, out sym); if (sym is null) { sym = new Symbol(s); _table.Add(s, sym); } return sym; } } }