ArrayList tokenArray; //массив всех кусков формулы (числа, переменные, операторы) #endregion Fields #region Constructors public ReversePolish(string str) { VariableSet = new ArrayList(); InputString = str; ac = new AlphabetConst(); tokenArray = new ArrayList(); StringLikeArray sla = new StringLikeArray(); tokenArray = sla.CreateArray(InputString); //разодрали формулу на лексемы polishStack = new Stack<double>(); }
public ArrayList UnaryMinusReplace(ArrayList ar) { AlphabetConst ac = new AlphabetConst(); if ((string)ar[0] == "-") ar[0] = "~"; for (int i = 1; i < ar.Count; i++) { if (ar[i]=="-") { Statement stat = ac.IsStatement((string)ar[i-1]); if ((stat!=null)&&stat.symbol!=")") ar[i] = "~"; } } return ar; }
public ShuntingYard(string str) { InputString = str; ac = new AlphabetConst(); SYStack = new Stack<string>(); }
public SpaceInserter(string str) { InputString = str; ac = new AlphabetConst(); }