public virtual IP5ScalarBody Assign(Runtime runtime, IP5ScalarBody other) { var osn = other as P5Reference; if (osn == null) return other.CloneBody(runtime); referred = osn.referred; return this; }
public virtual IP5ScalarBody Assign(Runtime runtime, IP5ScalarBody other) { var osb = other as P5StringNumber; if (osb == null) return other.CloneBody(runtime); flags = osb.flags; pos = -1; pos_set = false; stringValue = osb.stringValue; integerValue = osb.integerValue; floatValue = osb.floatValue; return this; }
public virtual void Undef(Runtime runtime) { if (!(body is P5Undef)) body = P5Undef.Undef; }
public void SetString(Runtime runtime, string value) { var str_num = body as P5StringNumber; if (str_num != null) str_num.SetString(runtime, value); else body = new P5StringNumber(runtime, value); }
public void SetHandle(Runtime runtime, P5Handle handle) { var reference = body as P5Reference; if (reference != null) { reference.Referred = handle; return; } if (IsDefined(runtime)) throw new System.NotImplementedException("No SetHandle for defined scalars"); body = new P5Reference(runtime, handle); }
public void SetFloat(Runtime runtime, double value) { var str_num = body as P5StringNumber; if (str_num != null) str_num.SetFloat(runtime, value); else body = new P5StringNumber(runtime, value); }
public P5Scalar(IP5ScalarBody b) { body = b; }
public virtual P5Scalar VivifyScalar(Runtime runtime) { var undef = body as P5Undef; if (undef != null) body = new P5Reference(runtime, new P5Scalar(runtime)); return body.DereferenceScalar(runtime); }
public virtual P5Scalar Assign(Runtime runtime, IP5Any other) { body = body.Assign(runtime, other.AsScalar(runtime).body); return this; }
public virtual IP5ScalarBody Assign(Runtime runtime, IP5ScalarBody other) { return other.CloneBody(runtime); }
public static P5Scalar SymbolicReferenceScalar(Runtime runtime, IP5ScalarBody any, bool create) { string name = any.AsString(runtime); var glob = SymbolicReference(runtime, name, create); if (glob == null) return null; if (glob.Scalar != null || !create) return glob.Scalar; return glob.Scalar = new P5Scalar(runtime); }
public static P5Hash SymbolicReferenceHash(Runtime runtime, IP5ScalarBody any, bool create) { string name = any.AsString(runtime); if (name.EndsWith("::")) { var pack = runtime.SymbolTable.GetPackage(runtime, name.Substring(0, name.Length - 2), create); return pack; } var glob = SymbolicReference(runtime, name, create); if (glob == null) return null; if (glob.Hash != null || !create) return glob.Hash; return glob.Hash = new P5Hash(runtime); }
public static P5Handle SymbolicReferenceHandle(Runtime runtime, IP5ScalarBody any, bool create) { string name = any.AsString(runtime); var glob = SymbolicReference(runtime, name, create); if (glob == null) return null; return glob.Handle; }
public static P5Typeglob SymbolicReferenceGlob(Runtime runtime, IP5ScalarBody any, bool create) { string name = any.AsString(runtime); return SymbolicReference(runtime, name, create); }
public static P5Code SymbolicReferenceCode(Runtime runtime, IP5ScalarBody any, bool create) { string name = any.AsString(runtime); var glob = SymbolicReference(runtime, name, create); if (glob == null) return null; if (glob.Code != null || !create) return glob.Code; return glob.Code = new P5Code(name, null); }
public virtual IP5Array VivifyArray(Runtime runtime) { var undef = body as P5Undef; if (undef != null) body = new P5Reference(runtime, new P5Array(runtime)); return body.DereferenceArray(runtime); }
public virtual P5Hash VivifyHash(Runtime runtime) { var undef = body as P5Undef; if (undef != null) body = new P5Reference(runtime, new P5Hash(runtime)); return body.DereferenceHash(runtime); }
public virtual IP5Any AssignIterator(Runtime runtime, IEnumerator<IP5Any> iter) { if (iter.MoveNext()) Assign(runtime, iter.Current); else body = P5Undef.Undef; return this; }
private P5StringNumber ForceString(Runtime runtime) { P5StringNumber sn = body as P5StringNumber; if (sn == null) body = sn = new P5StringNumber(runtime, body.AsString(runtime)); else if (sn.stringValue == null) { sn.stringValue = sn.AsString(runtime); sn.flags = P5StringNumber.HasString; } return sn; }
public P5Scalar ConcatAssign(Runtime runtime, IP5Any other) { P5StringNumber sn = body as P5StringNumber; if (sn == null) body = sn = new P5StringNumber(runtime, body.AsString(runtime)); else sn.flags = P5StringNumber.HasString; sn.stringValue = sn.stringValue + other.AsScalar(runtime).AsString(runtime); sn.pos = -1; return this; }
public virtual IP5ScalarBody Assign(Runtime runtime, IP5ScalarBody other) { var osb = other as P5TypeglobBody; if (osb == null) return other.CloneBody(runtime); scalar = osb.scalar; array = osb.array; hash = osb.hash; handle = osb.handle; code = osb.code; return this; }
public virtual P5Scalar PreIncrement(Runtime runtime) { var sb = body as P5StringNumber; if (sb != null) sb.Increment(runtime); else body = new P5StringNumber(runtime, body.AsInteger(runtime) + 1); return this; }