public override MValue Eval(IdentifierTable t) { return(new MFunc() { formalParams = formalParams, statements = statements, captures = captures.Map((x) => (x, t.Search(x))) });
public void Run() { var g = new IdentifierTable(); g.Create("ReadChar", new MBuiltinReadChar()); g.Create("ReadInt", new MBuiltinReadInt()); g.Create("ReadFloat", new MBuiltinReadFloat()); g.Create("Write", new MBuiltinWrite()); g.Create("ToChar", new MBuiltInToChar()); g.Create("ToInt", new MBuiltInToInt()); g.Create("ToFloat", new MBuiltInToFloat()); program.Run(g); }
public override MValue Run(IdentifierTable t) { var v = t[paramPlaceHolder].downref.target; switch (v) { case MChar c: return(new MChar(c.value)); case MInt c: return(new MChar(c.value)); default: throw new LogicException("Cannot convert " + v.type + " to char!"); } }
/// <summary>Create a XmppEL.</summary> public XmppEdgeListener(XmppService xmpp) { _it = new IdentifierTable(); _running = 0; _started = 0; _ready = 0; _xmpp = xmpp; xmpp.OnStreamInit += XmppRelayFactory.HandleStreamInit; // After we've authenticated we setup the rest of our paths xmpp.OnAuthenticate += HandleAuthenticate; if(xmpp.IsAuthenticated) { HandleAuthenticate(null); } }
/// <summary>Create a SubringEdgeListener.</summary> /// <param name="shared_node">The overlay used for the transport.</param> /// <param name="private_node">The overlay needing edges.</param> public SubringEdgeListener(Node shared_node, Node private_node) { _shared_node = shared_node; _private_node = private_node; _it = new IdentifierTable(); _local_ta = new SubringTransportAddress(shared_node.Address as AHAddress, shared_node.Realm); _ptype = new PType("ns:" + shared_node.Realm); shared_node.DemuxHandler.GetTypeSource(_ptype).Subscribe(this, null); _running = 0; _started = 0; }
public override MValue Run(IdentifierTable t) { foreach (var i in statements) { if (i is MStatementRetEmpty) { return(new MNone()); } if (i is MStatementRet j) { return(j.exp.Eval(t)); } i.Run(t); } return(new MNone()); }
/// <summary>Create a XmppEL.</summary> public XmppEdgeListener(XmppService xmpp) { _it = new IdentifierTable(); _running = 0; _started = 0; _ready = 0; _xmpp = xmpp; xmpp.OnStreamInit += XmppRelayFactory.HandleStreamInit; // After we've authenticated we setup the rest of our paths xmpp.OnAuthenticate += HandleAuthenticate; if (xmpp.IsAuthenticated) { HandleAuthenticate(null); } }
public override void Run(IdentifierTable t) { while (true) { MValue c = condition.Eval(t); if (c is MInt i) { if (i == 0) { break; } } else { throw new Exception("conditon should be int!"); } exp.Eval(t); } }
/// <summary></summary> public DtlsOverlord(RSACryptoServiceProvider private_key, CertificateHandler ch, PType ptype) : base(private_key, ch) { _osch = ch as OpenSslCertificateHandler; if (_osch == null) { throw new Exception("CertificateHandler is invalid type: " + ch.GetType()); } _it = new IdentifierTable(); _sas_helper = new IdentifierTableAsDtlsAssociation(_it); _rwl = new ReaderWriterLock(); _sender_to_sa = new Dictionary <ISender, DtlsAssociation>(); PType = ptype; _ptype_mb = ptype.ToMemBlock(); _ctx = new SslContext(SslMethod.DTLSv1_method); _ctx.SetCertificateStore(_osch.Store); _ctx.SetVerify(VerifyMode.SSL_VERIFY_PEER | VerifyMode.SSL_VERIFY_FAIL_IF_NO_PEER_CERT, RemoteCertificateValidation); _ctx.UsePrivateKey(AsymmetricKeyToOpenSslFormat(_private_key)); _ctx.UseCertificate(_osch.LocalCertificate); _ctx.CheckPrivateKey(); _ctx.Options = SslOptions.SSL_OP_SINGLE_DH_USE; var rng = new RNGCryptoServiceProvider(); byte[] sid = new byte[4]; rng.GetBytes(sid); _ctx.SetSessionIdContext(sid); _ctx.SetCookieGenerateCallback(GenerateCookie); _ctx.SetCookieVerifyCallback(VerifyCookie); _ctx.Options = SslOptions.SSL_OP_COOKIE_EXCHANGE; UpdateCookie(); }
public override MValue Run(IdentifierTable t) => new MChar(ConsoleExt.ReadChar());
public override void Run(IdentifierTable t) => throw new InvalidOperationException("Empty return does nothing.");
public override MValue Eval(IdentifierTable t) => value;
public override MValue Eval(IdentifierTable t) { // This will return the reference of a variable. return(t.Search(identifier, line, col).target); }
public abstract MValue Eval(IdentifierTable t);
public IdentifierTableAsDtlsAssociation(IdentifierTable it) { _it = it; }
public void Tokenizer_Recognize_Identifier() { IdentifierTable id = new IdentifierTable(); string code; bool expected; bool actual; code = "t123"; expected = true; actual = id.Find(code); Assert.AreEqual(expected, actual); id.Add(new Identifier("x1", 0, 0, 0)); code = "x1"; expected = true; actual = id.Find(code); Assert.AreEqual(expected, actual); code = "_text"; expected = true; actual = id.Find(code); Assert.AreEqual(expected, actual); code = "TEXT"; expected = true; actual = id.Find(code); Assert.AreEqual(expected, actual); code = "\"text\""; expected = false; actual = id.Find(code); Assert.AreEqual(expected, actual); code = "&text"; expected = false; actual = id.Find(code); Assert.AreEqual(expected, actual); code = "1text"; expected = false; actual = id.Find(code); Assert.AreEqual(expected, actual); code = "країна"; expected = true; actual = id.Find(code); Assert.AreEqual(expected, actual); IdentifierType exp; IdentifierType act; code = "SomeFunction() "; exp = IdentifierType.Function; act = id.IdentifyType(code); Assert.AreEqual(exp, act); code = "SomeArray[]"; exp = IdentifierType.Array; act = id.IdentifyType(code); Assert.AreEqual(exp, act); }
public override MValue Run(IdentifierTable t) => new MFloat(ConsoleExt.ReadFloat());
public override MValue Run(IdentifierTable t) { WriteLine(t[paramPlaceHolder].deref); return(new MNone()); }
public abstract void Run(IdentifierTable t);
public abstract MValue Run(IdentifierTable t);
public override void Run(IdentifierTable t) { }
public CleanupToken(IdentifierTable table) { this.table = table; }
public override void Run(IdentifierTable t) { exp.Eval(t); }
/// <summary> /// Создание области действия /// </summary> public Scope() { IdentifierTable = new IdentifierTable(); TypeTable = new TypeTable(); }
public override void Run(IdentifierTable t) => throw new InvalidOperationException("Use inner expression to evaluate return.");