public void M2() { var data = " 77 AND45 OR( NO"; var p = new LexemeScanner(data); var items = new List <Operators>(); while (p.IsSafeToRead) { var machine = new OperatorMachine(p); var op = machine.Get(); if (op.IsSome) { items.Add(op.First().@operator); machine.Done(); } else { p.Next(); } } Assert.IsTrue(items.Any(), "Nothing extracted"); Assert.IsTrue(items.Count == 2, "not found required number of elements"); }
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); } }