コード例 #1
0
        public override IElement CreateCopy()
        {
            WaittillFrameEndStatement e = new WaittillFrameEndStatement();

            e.AddChildren(this.CopyChildren());
            return(e);
        }
コード例 #2
0
ファイル: Statement.cs プロジェクト: PetX1996/CODSCRIPT
        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);
        }
コード例 #3
0
        private static void Parse(MoveInfo parentInfo, ParsingInfo parsingInfo, ScriptInfo scriptInfo)
        {
            WaittillFrameEndStatement waittillFrameEnd = new WaittillFrameEndStatement();
            MoveInfo moveInfo = new MoveInfo(parentInfo);

            // terminal
            IElement terminalTry = moveInfo.FindNextBlack(SearchDirection.LeftToRight);

            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;

            waittillFrameEnd.AddChildren(parentInfo.CurrentElements.GetRange(startIndex, length));
            parentInfo.Replace(length, waittillFrameEnd);
        }