Minor cleanup
This commit is contained in:
parent
8e093a98c7
commit
07646b11b3
2 changed files with 44 additions and 22 deletions
28
ssc/data.cs
28
ssc/data.cs
|
@ -3,21 +3,33 @@ using System.Collections.Generic;
|
||||||
|
|
||||||
namespace arookas {
|
namespace arookas {
|
||||||
class sunDataTable : IEnumerable<string> {
|
class sunDataTable : IEnumerable<string> {
|
||||||
List<string> data = new List<string>(10);
|
List<string> mData;
|
||||||
|
|
||||||
public int Count { get { return data.Count; } }
|
public int Count {
|
||||||
|
get { return mData.Count; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public sunDataTable() {
|
||||||
|
mData = new List<string>(10);
|
||||||
|
}
|
||||||
|
|
||||||
public int Add(string value) {
|
public int Add(string value) {
|
||||||
int index = data.IndexOf(value);
|
var index = mData.IndexOf(value);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
index = data.Count;
|
index = mData.Count;
|
||||||
data.Add(value);
|
mData.Add(value);
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
public void Clear() { data.Clear(); }
|
public void Clear() {
|
||||||
|
mData.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerator<string> GetEnumerator() { return data.GetEnumerator(); }
|
public IEnumerator<string> GetEnumerator() {
|
||||||
IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
|
return mData.GetEnumerator();
|
||||||
|
}
|
||||||
|
IEnumerator IEnumerable.GetEnumerator() {
|
||||||
|
return GetEnumerator();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using arookas.Collections;
|
using arookas.Collections;
|
||||||
using arookas.IO.Binary;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -7,9 +6,9 @@ using System.Linq;
|
||||||
|
|
||||||
namespace arookas {
|
namespace arookas {
|
||||||
class sunSymbolTable : IEnumerable<sunSymbol> {
|
class sunSymbolTable : IEnumerable<sunSymbol> {
|
||||||
List<sunSymbol> Symbols { get; set; }
|
List<sunSymbol> mSymbols;
|
||||||
|
|
||||||
public int Count { get { return Symbols.Count; } }
|
public int Count { get { return mSymbols.Count; } }
|
||||||
public int CallableCount { get { return Callables.Count(); } }
|
public int CallableCount { get { return Callables.Count(); } }
|
||||||
public int BuiltinCount { get { return Builtins.Count(); } }
|
public int BuiltinCount { get { return Builtins.Count(); } }
|
||||||
public int FunctionCount { get { return Functions.Count(); } }
|
public int FunctionCount { get { return Functions.Count(); } }
|
||||||
|
@ -17,22 +16,33 @@ namespace arookas {
|
||||||
public int VariableCount { get { return Variables.Count(); } }
|
public int VariableCount { get { return Variables.Count(); } }
|
||||||
public int ConstantCount { get { return Constants.Count(); } }
|
public int ConstantCount { get { return Constants.Count(); } }
|
||||||
|
|
||||||
public IEnumerable<sunCallableSymbol> Callables { get { return Symbols.OfType<sunCallableSymbol>(); } }
|
public IEnumerable<sunCallableSymbol> Callables { get { return mSymbols.OfType<sunCallableSymbol>(); } }
|
||||||
public IEnumerable<sunBuiltinSymbol> Builtins { get { return Symbols.OfType<sunBuiltinSymbol>(); } }
|
public IEnumerable<sunBuiltinSymbol> Builtins { get { return mSymbols.OfType<sunBuiltinSymbol>(); } }
|
||||||
public IEnumerable<sunFunctionSymbol> Functions { get { return Symbols.OfType<sunFunctionSymbol>(); } }
|
public IEnumerable<sunFunctionSymbol> Functions { get { return mSymbols.OfType<sunFunctionSymbol>(); } }
|
||||||
public IEnumerable<sunStorableSymbol> Storables { get { return Symbols.OfType<sunStorableSymbol>(); } }
|
public IEnumerable<sunStorableSymbol> Storables { get { return mSymbols.OfType<sunStorableSymbol>(); } }
|
||||||
public IEnumerable<sunVariableSymbol> Variables { get { return Symbols.OfType<sunVariableSymbol>(); } }
|
public IEnumerable<sunVariableSymbol> Variables { get { return mSymbols.OfType<sunVariableSymbol>(); } }
|
||||||
public IEnumerable<sunConstantSymbol> Constants { get { return Symbols.OfType<sunConstantSymbol>(); } }
|
public IEnumerable<sunConstantSymbol> Constants { get { return mSymbols.OfType<sunConstantSymbol>(); } }
|
||||||
|
|
||||||
public sunSymbolTable() {
|
public sunSymbolTable() {
|
||||||
Symbols = new List<sunSymbol>(10);
|
mSymbols = new List<sunSymbol>(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(sunSymbol symbol) { Symbols.Add(symbol); }
|
public void Add(sunSymbol symbol) {
|
||||||
public void Clear() { Symbols.Clear(); }
|
if (symbol == null) {
|
||||||
|
throw new ArgumentNullException("symbol");
|
||||||
|
}
|
||||||
|
mSymbols.Add(symbol);
|
||||||
|
}
|
||||||
|
public void Clear() {
|
||||||
|
mSymbols.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerator<sunSymbol> GetEnumerator() { return Symbols.GetEnumerator(); }
|
public IEnumerator<sunSymbol> GetEnumerator() {
|
||||||
IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); }
|
return mSymbols.GetEnumerator();
|
||||||
|
}
|
||||||
|
IEnumerator IEnumerable.GetEnumerator() {
|
||||||
|
return GetEnumerator();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract class sunSymbol {
|
abstract class sunSymbol {
|
||||||
|
|
Loading…
Reference in a new issue