Пример #1
0
        private SwitchStmt switchStatement()
        {
            String variableName = readString("Variable name");
            Exp    expr         = new VarExp(variableName);

            print("Case 1 expression:");
            Exp expCase1 = inputExpression();

            print("Case 1 Statement:");
            IStmt case1 = inputStatement();

            print("Case 2 expression:");
            Exp expCase2 = inputExpression();

            print("Case 2 Statement:");
            IStmt case2 = inputStatement();

            print("Default case Statement:");
            IStmt caseDefault = inputStatement();

            return(new SwitchStmt(expr, expCase1, case1, expCase2, case2, caseDefault));
        }
Пример #2
0
        private SwitchStmt switchStatement()
        {
            String variableName = readString ("Variable name");
            Exp expr = new VarExp (variableName);
            print ("Case 1 expression:");
            Exp expCase1 = inputExpression ();
            print ("Case 1 Statement:");
            IStmt case1 = inputStatement ();
            print ("Case 2 expression:");
            Exp expCase2 = inputExpression ();
            print ("Case 2 Statement:");
            IStmt case2 = inputStatement ();
            print ("Default case Statement:");
            IStmt caseDefault = inputStatement ();

            return new SwitchStmt (expr, expCase1, case1, expCase2, case2, caseDefault);
        }