//Выражение в скобках public void WoLExpr(ref string Input, out WoLNode Node) { Input = Input.Trim(); Node = null; if (Input.Length != 0) { _WoLAnd(ref Input, out Node); if (pars_Err != 0) return; Input = Input.Trim(); while ((Input.Length > 0) && (Input[0] == '|')) { _WoLTakeElements(ref Input, 1); if (Input.Length == 0) { pars_Err = 0; return; } WoLNode SecondNode; _WoLOr(ref Input, out SecondNode); if (pars_Err != 0) return; WoLNode FirstNode = Node; WoLOperations Op = WoLOperations.OR; Node = new WoLOperation(Op, FirstNode, SecondNode); } } }
//AND void _WoLAnd(ref string Input, out WoLNode Node) { Input = Input.Trim(); Node = null; if (Input.Length != 0) { _WoLFact(ref Input, out Node); if (pars_Err != 0) return; while ((Input.Length != 0) && (Input[0] == '&')) { _WoLTakeElements(ref Input, 1); if (Input.Length == 0) { pars_Err = 6; //Нужен множитель return; } WoLNode SecondNode; _WoLFact(ref Input, out SecondNode); if (pars_Err != 0) return; WoLNode FirstNode = Node; WoLOperations Op = WoLOperations.AND; Node = new WoLOperation(Op, FirstNode, SecondNode); } } else pars_Err = 5; //Нужно слагаемое }