Foxoft.Ci.CiParser.ParseStatement C# (CSharp) Method

ParseStatement() private method

private ParseStatement ( ) : ICiStatement
return ICiStatement
        ICiStatement ParseStatement()
        {
            while (Eat(CiToken.Macro))
            this.Symbols.Add(ParseMacro());
            if (See(CiToken.Id))
            return ParseVarOrExpr();
            if (See(CiToken.LeftBrace)) {
            OpenScope();
            CiBlock result = ParseBlock();
            CloseScope();
            return result;
            }
            if (Eat(CiToken.Break)) {
            Expect(CiToken.Semicolon);
            return new CiBreak();
            }
            if (See(CiToken.Const)) {
            CiConst konst = ParseConst();
            this.Symbols.Add(konst);
            return konst;
            }
            if (Eat(CiToken.Continue)) {
            Expect(CiToken.Semicolon);
            return new CiContinue();
            }
            if (Eat(CiToken.Delete)) {
            CiExpr expr = ParseExpr();
            Expect(CiToken.Semicolon);
            return new CiDelete { Expr = expr };
            }
            if (Eat(CiToken.Do)) {
            CiDoWhile result = new CiDoWhile();
            result.Body = ParseStatement();
            Expect(CiToken.While);
            result.Cond = ParseCond();
            Expect(CiToken.Semicolon);
            return result;
            }
            if (Eat(CiToken.For)) {
            Expect(CiToken.LeftParenthesis);
            OpenScope();
            CiFor result = new CiFor();
            if (See(CiToken.Id))
                result.Init = ParseVarOrExpr();
            else
                Expect(CiToken.Semicolon);
            if (!See(CiToken.Semicolon))
                result.Cond = ParseExpr();
            Expect(CiToken.Semicolon);
            if (!See(CiToken.RightParenthesis))
                result.Advance = ParseExprWithSideEffect();
            Expect(CiToken.RightParenthesis);
            result.Body = ParseStatement();
            CloseScope();
            return result;
            }
            if (Eat(CiToken.If)) {
            CiIf result = new CiIf();
            result.Cond = ParseCond();
            result.OnTrue = ParseStatement();
            if (Eat(CiToken.Else))
                result.OnFalse = ParseStatement();
            return result;
            }
            if (Eat(CiToken.Native))
            return ParseNativeBlock();
            if (Eat(CiToken.Return)) {
            CiReturn result = new CiReturn();
            if (this.CurrentMethod.Signature.ReturnType != CiType.Void)
                result.Value = ParseExpr();
            Expect(CiToken.Semicolon);
            return result;
            }
            if (Eat(CiToken.Switch))
            return ParseSwitch();
            if (Eat(CiToken.Throw)) {
            CiThrow result = new CiThrow();
            result.Message = ParseExpr();
            Expect(CiToken.Semicolon);
            return result;
            }
            if (Eat(CiToken.While)) {
            CiWhile result = new CiWhile();
            result.Cond = ParseCond();
            result.Body = ParseStatement();
            return result;
            }
            throw new ParseException("Invalid statement");
        }