示例#1
0
        public void M1()
        {
            var p = new LexemeScanner("   Name");


            var p2 = new IdentifierMachine(p);

            var t = p2.Get();

            Assert.IsTrue(t.IsSome);
            Assert.IsTrue(t.FirstOrDefault().value == "Name");
        }
示例#2
0
        public void P1()
        {
            var lp    = new LexemeScanner("Hello = New AND Parent = SOSO ");
            var items = new List <object>();

            while (lp.IsSafeToRead)
            {
                var idm         = new IdentifierMachine(lp);
                var canContinue = true;

                do
                {
                    var t0 = idm.Get();
                    t0.Match(x =>
                    {
                        items.Add(x);
                        idm.Done();
                    }, () => canContinue = false);
                } while(canContinue);



                var om = new OperatorMachine(lp);
                canContinue = true;

                do
                {
                    var t0 = om.Get();
                    t0.Match(x =>
                    {
                        items.Add(x);
                        om.Done();
                    }, () => canContinue = false);
                } while(canContinue);
            }
        }