From b387609a56d1b5840697ac718ba2c59a08313eaa Mon Sep 17 00:00:00 2001 From: arookas Date: Mon, 28 Dec 2015 00:57:43 -0500 Subject: [PATCH] Cleanup. --- ssc/symbol table.cs | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ssc/symbol table.cs b/ssc/symbol table.cs index be0d01c..b1e0e85 100644 --- a/ssc/symbol table.cs +++ b/ssc/symbol table.cs @@ -9,20 +9,26 @@ namespace arookas { class sunSymbolTable : IEnumerable { - List symbols = new List(10); - public int Count { get { return symbols.Count; } } - public int BuiltinCount { get { return symbols.Count(sym => sym.Type == sunSymbolType.Builtin); } } - public int FunctionCount { get { return symbols.Count(sym => sym.Type == sunSymbolType.Function); } } - public int VariableCount { get { return symbols.Count(sym => sym.Type == sunSymbolType.Variable); } } - public IEnumerable Callables { get { return symbols.OfType(); } } - public IEnumerable Builtins { get { return symbols.Where(sym => sym.Type == sunSymbolType.Builtin).Cast(); } } - public IEnumerable Functions { get { return symbols.Where(sym => sym.Type == sunSymbolType.Function).Cast(); } } - public IEnumerable Variables { get { return symbols.Where(sym => sym.Type == sunSymbolType.Variable).Cast(); } } + List Symbols { get; set; } + public int Count { get { return Symbols.Count; } } + public int CallableCount { get { return Callables.Count(); } } + public int BuiltinCount { get { return Builtins.Count(); } } + public int FunctionCount { get { return Functions.Count(); } } + public int VariableCount { get { return Variables.Count(); } } + public IEnumerable Callables { get { return Symbols.OfType(); } } + public IEnumerable Builtins { get { return Symbols.OfType(); } } + public IEnumerable Functions { get { return Symbols.OfType(); } } + public IEnumerable Variables { get { return Symbols.OfType(); } } - public void Add(sunSymbol symbol) { symbols.Add(symbol); } - public void Clear() { symbols.Clear(); } + public sunSymbolTable() + { + Symbols = new List(10); + } + + public void Add(sunSymbol symbol) { Symbols.Add(symbol); } + public void Clear() { Symbols.Clear(); } public void Write(aBinaryWriter writer) { @@ -45,7 +51,7 @@ namespace arookas } } - public IEnumerator GetEnumerator() { return symbols.GetEnumerator(); } + public IEnumerator GetEnumerator() { return Symbols.GetEnumerator(); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } }