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); }
public static bool Check(MoveInfo parentInfo, ParsingInfo parsingInfo, ScriptInfo scriptInfo) { IElement next = parentInfo.Find(SearchDirection.LeftToRight, SearchVisibility.Visible); if (next == null) { return(false); } if (DevCode.Check(parentInfo, parsingInfo, scriptInfo) || PreProcessorRegion.Check(parentInfo, parsingInfo, scriptInfo)) { return(true); } if (EmptyStatement.Check(parentInfo, parsingInfo, scriptInfo) || BlockStatement.Check(parentInfo, parsingInfo, scriptInfo) ) { return(true); } if (IfElseStatement.Check(parentInfo, parsingInfo, scriptInfo) || SwitchStatement.Check(parentInfo, parsingInfo, scriptInfo) || WhileStatement.Check(parentInfo, parsingInfo, scriptInfo) || DoWhileStatement.Check(parentInfo, parsingInfo, scriptInfo) || ForStatement.Check(parentInfo, parsingInfo, scriptInfo) || ForEachStatement.Check(parentInfo, parsingInfo, scriptInfo) || ReturnStatement.Check(parentInfo, parsingInfo, scriptInfo) || BreakStatement.Check(parentInfo, parsingInfo, scriptInfo) || ContinueStatement.Check(parentInfo, parsingInfo, scriptInfo) || WaitStatement.Check(parentInfo, parsingInfo, scriptInfo) || WaittillFrameEndStatement.Check(parentInfo, parsingInfo, scriptInfo) ) { return(true); } if (ExpressionStatement.Check(parentInfo, parsingInfo, scriptInfo, true)) // nikdy nevráti false? { return(true); } return(false); }