private static void Parse(MoveInfo parentInfo, ParsingInfo parsingInfo, ScriptInfo scriptInfo) { WaitStatement waitStatement = new WaitStatement(); MoveInfo moveInfo = new MoveInfo(parentInfo); IElement tryExp = moveInfo.FindNextBlack(SearchDirection.LeftToRight); if (tryExp == null) { throw new SyntaxException("Could not find wait expression", parentInfo.GetErrorInfo()); } Expression exp = Expression.Parse(moveInfo, parsingInfo, scriptInfo); if (exp == null) { throw new SyntaxException("Could not parse wait expression", parentInfo.GetErrorInfo()); } IElement terminalTry = moveInfo.FindNextBlack(SearchDirection.LeftToRight); // terminal if (terminalTry == null || !terminalTry.IsTT(TokenType.SemiColon)) { throw new SyntaxException("Missing directive ';'?", parentInfo.GetErrorInfo()); } // build int startIndex = parentInfo.CurrentIndex; int length = (moveInfo.CurrentIndex + 1) - startIndex; waitStatement.AddChildren(parentInfo.CurrentElements.GetRange(startIndex, length)); parentInfo.Replace(length, waitStatement); }
public override IElement CreateCopy() { WaitStatement e = new WaitStatement(); e.AddChildren(this.CopyChildren()); return(e); }