bool VdfParser::ProcessStatement(Tokens& tokens) { while (!tokens.AtEnd()) { switch (tokens.GetCurrentToken().type) { case TokenKeywordBool: case TokenKeywordInt: case TokenKeywordFloat: case TokenKeywordString: ProcessSimpleDeclaration(tokens); break; case TokenId: ProcessSimpleDeclaration(tokens); break; case TokenKeywordArray: ProcessArrayDeclaration(tokens, *_variables); break; case TokenKeywordStruct: ProcessStructDeclaration(tokens); break; case TokenKeywordEnum: ProcessEnumDeclaration(tokens); break; case TokenKeywordNamespace: ProcessNamespace(tokens); break; case TokenKeywordUsing: ProcessUsing(tokens); break; case TokenSemiColon: tokens.FinishProcessingStatement(); break; case TokenRightBrace: // This function maybe called when the processing iterator is pointing to // the beginning of a tokens, which maybe hosted in a namespace. // If current tokens is enclosed in a namespace, then the right brace // means the end of namespace. if (_current_namespace.empty()) { throw CompileError(tokens.GetCurrentToken(), CompileErrorTypeExpected, L"Unexpected \'}\'"); } else return true; default: throw(CompileError(tokens.GetCurrentToken(), CompileErrorTypeExpected, L"Expected one of float, int, string, bool, array, struct.")); } } return true; }