While loop
Наследование: Statement
        void WhileStmt(out Statement whileStmt)
        {
            Expression        exp         = null;
            StatementSequence whileBranch = null;
            Statement         branchStmt  = null;

            whileStmt = null;

            Expect(22);
            int sl = t.line; int sc = t.col; Token tok = t;

            Expr(out exp);
            if (!ExpectBool(exp, tok, true))
            {
                return;
            }
            Expect(23);
            int el = t.line; int ec = t.col + t.val.Length;

            if (Options.BookVersion)
            {
                Stmt(out branchStmt);
                whileBranch = ToStatementSequence(branchStmt);
            }
            else if (StartOf(1))
            {
                StmtSeq(out whileBranch);
                Expect(24);
                whileBranch.AddSequencePoint(t);
            }
            else
            {
                SynErr(54);
            }
            whileStmt = new While.AST.Statements.While((TypedExpression <bool>)exp, whileBranch);
            whileStmt.AddSequencePoint(sl, sc, el, ec);
        }
Пример #2
0
 public virtual void Visit(While.AST.Statements.While node)
 {
 }
Пример #3
0
 public virtual void Visit(While.AST.Statements.While node)
 {
 }
        void WhileStmt(out Statement whileStmt)
        {
            Expression exp = null;
            StatementSequence whileBranch = null;
            Statement branchStmt = null;
            whileStmt = null;

            Expect(22);
            int sl = t.line; int sc = t.col; Token tok = t;
            Expr(out exp);
            if (!ExpectBool(exp, tok, true)) { return; }
            Expect(23);
            int el = t.line; int ec = t.col+t.val.Length;
            if (Options.BookVersion) {
            Stmt(out branchStmt);
            whileBranch = ToStatementSequence(branchStmt);
            } else if (StartOf(1)) {
            StmtSeq(out whileBranch);
            Expect(24);
            whileBranch.AddSequencePoint(t);
            } else SynErr(54);
            whileStmt = new While.AST.Statements.While((TypedExpression<bool>)exp, whileBranch);
            whileStmt.AddSequencePoint(sl,sc,el,ec);
        }