public bool Equals(LiteValue Other) { if (Type != Other.Type) { return(false); } switch (Type) { case LiteValueType.Error: return(false); case LiteValueType.Nil: return(true); case LiteValueType.Boolean: case LiteValueType.String: case LiteValueType.Numeric: case LiteValueType.Function: case LiteValueType.Class: case LiteValueType.Object: case LiteValueType.Elements: return((int)Numeric == (int)Other.Numeric); } return(false); }
public LiteValue Get(LiteValue Name) { if (Name.Type == LiteValueType.String) { return(Get(StringTable.GetString((int)Name.Numeric))); } Logger.DError($"unknown var : {StringTable.GetString((int)Name.Numeric)}"); return(LiteValue.Nil); }
public LiteValue Set(int Index, LiteValue Val) { if (Index < 0 || Index >= Values_.Length) { Logger.DError($"index [{Index}] out of range, max len = {Values_.Length}"); return(LiteValue.Error); } Values_[Index] = Val; return(Val); }
public LiteValue Write(string Member, LiteValue Val) { var Env = GetEnv(Member); if (Env != null) { Env.SetSelf(Member, Val); return(Val); } return(LiteValue.Error); }
public void SetSelf(string Name, LiteValue Val) { if (!Variable_.ContainsKey(Name)) { Variable_.Add(Name, Val); } else { Variable_[Name] = Val; } }
public void Set(LiteValue Name, LiteValue Val) { if (Name.Type == LiteValueType.String) { Set(StringTable.GetString((int)Name.Numeric), Val); } else { Logger.DError($"unknown var : {StringTable.GetString((int)Name.Numeric)}"); } }
public void Set(string Name, LiteValue Val) { var Env = Where(Name); if (Env == null) { Env = this; } Env.SetSelf(Name, Val); }
public void Push(LiteValue Val) { Stack_.Push(Val); }