Esempio n. 1
0
        private void nonLabelledStatement()
        {
            switch (symbol.Token)
            {
            case Token.TokenOpenCBrackets:
                functionParser = new FunctionParser();
                symbol         = functionParser.ParseBlock(symbol);
                break;

            case Token.TokenKeywordBreak:
                breakStatement();
                break;

            case Token.TokenKeywordContinue:
                continueStatement();
                break;

            case Token.TokenKeywordReturn:
                returnStatement();
                break;

            case Token.TokenKeywordFor:
            case Token.TokenKeywordAwait:
                forStatement();
                if (symbol.Token != Token.TokenCloseCBrackets)
                {
                    error("Esperava um '}'");
                }
                break;

            case Token.TokenKeywordWhile:
                whileStatement();
                if (symbol.Token != Token.TokenCloseCBrackets)
                {
                    error("Esperava um '}'");
                }
                break;

            case Token.TokenKeywordDo:
                doStatement();

                break;

            case Token.TokenKeywordSwitch:
                switchStatement();
                break;

            case Token.TokenKeywordIf:
                ifStatement();
                if (symbol.Token != Token.TokenCloseCBrackets)
                {
                    error("Esperava um '}'");
                }
                break;

            case Token.TokenKeywordTry:
                // tryStatement();
                break;

            case Token.TokenKeywordConst:
            case Token.TokenKeywordFinal:
            case Token.TokenKeywordVar:
                localVarDeclaration();
                break;

            default:
                if (symbol.isDataType())
                {
                    localVarDeclaration();
                }
                else
                {
                    expressionStatement();
                }
                break;
            }
        }