示例#1
0
        /// <summary>
        /// Processes a statement, which can recursively process additional statements if
        /// a code-block structure is encountered (function, if, while, etc.). Returns false
        /// if a right curly brace or the end of file is reached. (Does not consume right
        /// curly brace.) Otheriwse, true is returned.
        /// </summary>
        private bool ParseStatement()
        {
            Token token = Lexer.GetNextSkipNewLines();

            switch (token.Type)
            {
            case TokenType.Keyword:
                ParseKeyword(token);
                break;

            case TokenType.Symbol:
                ParseSymbol(token);
                break;

            case TokenType.EndOfFile:
                return(false);

            case TokenType.RightBrace:
                Lexer.UngetToken(token);
                return(false);

            default:
                Error(ErrorCode.UnexpectedToken, token);
                NextLine();
                break;
            }
            return(true);
        }