//----< collect semiExpression from filtered token stream >---------- public bool getSemi() { semiExp.RemoveRange(0, semiExp.Count); // empty container do { get(); if (currTok == "") { return(false); // end of file } if (returnNewLines || currTok != "\n") { semiExp.Add(currTok); } } while (!isTerminator(currTok) || count == 0); // if for then append next two semiExps, e.g., for(int i=0; i<se.count; ++i) { if (semiExp.Contains("for")) { CSemiExp se = clone(); getSemi(); se.Add(semiExp.ToArray()); getSemi(); se.Add(semiExp.ToArray()); semiExp.Clear(); for (int i = 0; i < se.count; ++i) { semiExp.Add(se[i]); } } return(semiExp.Count > 0); }
// //----< make a copy of semiEpression >------------------------------- public CSemiExp clone() { CSemiExp copy = new CSemiExp(); for (int i = 0; i < count; ++i) { copy.Add(this[i]); } return(copy); }