Index: /BasicCompiler32/Compile_CallProc.cpp
===================================================================
--- /BasicCompiler32/Compile_CallProc.cpp	(revision 112)
+++ /BasicCompiler32/Compile_CallProc.cpp	(revision 113)
@@ -363,5 +363,5 @@
 	extern BOOL bDebugCompile;
 	extern BOOL bDebugSupportProc;
-	if(bDebugCompile&&bDebugSupportProc==0&& pDllProc->GetName() != "DebugBreak" ){
+	if(bDebugCompile&&bDebugSupportProc==0&& pDllProc->IsEqualSymbol( "DebugBreak" ) ){
 		Call_DebugSys_SaveContext();
 	}
Index: /BasicCompiler_Common/Compile.cpp
===================================================================
--- /BasicCompiler_Common/Compile.cpp	(revision 112)
+++ /BasicCompiler_Common/Compile.cpp	(revision 113)
@@ -161,4 +161,9 @@
 
 			case ESC_TYPEDEF:
+				if( UserProc::IsLocalAreaCompiling() ){
+					// ローカル領域をコンパイルしているとき
+					SetError(65,"TypeDef",cp );
+				}
+
 				//既に収集済み
 				break;
@@ -219,4 +224,8 @@
 				break;
 			case ESC_DECLARE:
+				if( UserProc::IsLocalAreaCompiling() ){
+					// ローカル領域をコンパイルしているとき
+					SetError(65,"Declare",cp );
+				}
 				break;
 
Index: /BasicCompiler_Common/DebugMiddleFile.cpp
===================================================================
--- /BasicCompiler_Common/DebugMiddleFile.cpp	(revision 112)
+++ /BasicCompiler_Common/DebugMiddleFile.cpp	(revision 113)
@@ -139,5 +139,5 @@
 	i2+=sizeof(long);
 	for(i3=0;i3<(int)Smoothie::Meta::typeDefs.size();i3++){
-		lstrcpy(buffer+i2,Smoothie::Meta::typeDefs[i3].GetNewName().c_str() );
+		lstrcpy(buffer+i2,Smoothie::Meta::typeDefs[i3].GetName().c_str() );
 		i2+=lstrlen(buffer+i2)+1;
 
@@ -509,5 +509,6 @@
 		i2+=lstrlen(buffer+i2)+1;
 
-		Smoothie::Meta::typeDefs.push_back( TypeDef( temp5, buffer+i2 ) );
+		// 名前空間に未対応
+		Smoothie::Meta::typeDefs.push_back( TypeDef( NamespaceScopes(), temp5, buffer+i2 ) );
 
 		i2+=lstrlen(buffer+i2)+1;
Index: /BasicCompiler_Common/Procedure.cpp
===================================================================
--- /BasicCompiler_Common/Procedure.cpp	(revision 112)
+++ /BasicCompiler_Common/Procedure.cpp	(revision 113)
@@ -539,4 +539,37 @@
 }
 
+bool DllProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
+{
+	if( GetName() != name ){
+		return false;
+	}
+	return NamespaceScopes::IsSameArea( this->namespaceScopes, namespaceScopes );
+}
+bool DllProc::IsEqualSymbol( const string &fullName ) const
+{
+	char AreaName[VN_SIZE] = "";		//オブジェクト変数
+	char NestName[VN_SIZE] = "";		//入れ子メンバ
+	bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
+
+	if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){
+		return true;
+	}
+
+	if( isNest ){
+		// 静的メンバを考慮
+
+		char AreaName2[VN_SIZE] = "";		//オブジェクト変数
+		char NestName2[VN_SIZE] = "";		//入れ子メンバ
+		bool isNest = SplitMemberName( AreaName, AreaName2, NestName2 );
+		lstrcat( NestName2, "." );
+		lstrcat( NestName2, NestName );
+
+		return IsEqualSymbol( NamespaceScopes( AreaName2 ), NestName2 );
+	}
+
+	return false;
+}
+
+
 bool DllProc::SetParamsAndReturnType( const char *sourceOfParams, int nowLine ){
 	int i = 0;
Index: /BasicCompiler_Common/Procedure.h
===================================================================
--- /BasicCompiler_Common/Procedure.h	(revision 112)
+++ /BasicCompiler_Common/Procedure.h	(revision 113)
@@ -311,4 +311,12 @@
 	~DllProc(){}
 
+	bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
+	bool IsEqualSymbol( const string &name ) const;
+
+	const NamespaceScopes &GetNamespaceScopes() const
+	{
+		return namespaceScopes;
+	}
+
 	virtual bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine );
 
Index: /BasicCompiler_Common/Subroutine.cpp
===================================================================
--- /BasicCompiler_Common/Subroutine.cpp	(revision 112)
+++ /BasicCompiler_Common/Subroutine.cpp	(revision 113)
@@ -441,8 +441,7 @@
 	extern DllProc **ppDeclareHash;
 	if(ppDeclareHash[key]){
-		DllProc *pTempProc;
-		pTempProc=ppDeclareHash[key];
+		DllProc *pTempProc = ppDeclareHash[key];
 		while(1){
-			if( pDllProc->GetName() == pTempProc->GetName() ){
+			if( pTempProc->IsEqualSymbol( pDllProc->GetNamespaceScopes(), pDllProc->GetName() ) ){
 				//重複エラー
 				SetError(15,procName,nowLine);
Index: /BasicCompiler_Common/TypeDef.cpp
===================================================================
--- /BasicCompiler_Common/TypeDef.cpp	(revision 112)
+++ /BasicCompiler_Common/TypeDef.cpp	(revision 113)
@@ -2,7 +2,8 @@
 
 
-TypeDef::TypeDef( const string &newName, const string &baseName ):
-	newName( newName ),
-	baseName( baseName )
+TypeDef::TypeDef( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName )
+	: namespaceScopes( namespaceScopes )
+	, name( name )
+	, baseName( baseName )
 {
 	if( !Type::StringToType( baseName, baseType ) ){
@@ -14,4 +15,37 @@
 }
 
+bool TypeDef::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
+{
+	if( GetName() != name ){
+		return false;
+	}
+	return NamespaceScopes::IsSameArea( this->namespaceScopes, namespaceScopes );
+}
+bool TypeDef::IsEqualSymbol( const string &fullName ) const
+{
+	char AreaName[VN_SIZE] = "";		//オブジェクト変数
+	char NestName[VN_SIZE] = "";		//入れ子メンバ
+	bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
+
+	if( IsEqualSymbol( NamespaceScopes( AreaName ), NestName ) ){
+		return true;
+	}
+
+	if( isNest ){
+		// 静的メンバを考慮
+
+		char AreaName2[VN_SIZE] = "";		//オブジェクト変数
+		char NestName2[VN_SIZE] = "";		//入れ子メンバ
+		bool isNest = SplitMemberName( AreaName, AreaName2, NestName2 );
+		lstrcat( NestName2, "." );
+		lstrcat( NestName2, NestName );
+
+		return IsEqualSymbol( NamespaceScopes( AreaName2 ), NestName2 );
+	}
+
+	return false;
+}
+
+
 
 TypeDefCollection::TypeDefCollection(){
@@ -19,6 +53,6 @@
 TypeDefCollection::~TypeDefCollection(){
 }
-void TypeDefCollection::Add( const string &newName, const string &baseName ){
-	TypeDef typeDef( newName, baseName );
+void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName ){
+	TypeDef typeDef( namespaceScopes, name, baseName );
 	this->push_back( typeDef );
 }
@@ -26,5 +60,5 @@
 	int max = (int)(*this).size();
 	for( int i=0; i<max; i++ ){
-		if( (*this)[i].newName == typeName ){
+		if( (*this)[i].IsEqualSymbol( typeName ) ){
 			return i;
 		}
@@ -33,5 +67,5 @@
 }
 
-void TypeDefCollection::Add( const string &expression, int nowLine ){
+void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const string &expression, int nowLine ){
 	int i;
 	char temporary[VN_SIZE];
@@ -98,5 +132,5 @@
 	cp = nowLine;
 
-	Smoothie::Meta::typeDefs.Add(temporary,pTemp);
+	Add( namespaceScopes, temporary, pTemp );
 }
 
@@ -105,9 +139,59 @@
 	clear();
 
-	int i=-1;
+	// 名前空間管理
+	NamespaceScopes &namespaceScopes = Smoothie::Lexical::liveingNamespaceScopes;
+	namespaceScopes.clear();
+
+	// Importsされた名前空間の管理
+	NamespaceScopesCollection &importedNamespaces = Smoothie::Meta::importedNamespaces;
+	importedNamespaces.clear();
+
+	int i=-1, i2;
+	char temporary[VN_SIZE];
 	while(1){
+		extern char *basbuf;
+
 		i++;
 
-		extern char *basbuf;
+		if( basbuf[i] == 1 && basbuf[i+1] == ESC_NAMESPACE ){
+			for(i+=2,i2=0;;i2++,i++){
+				if( IsCommandDelimitation( basbuf[i] ) ){
+					temporary[i2]=0;
+					break;
+				}
+				temporary[i2]=basbuf[i];
+			}
+			namespaceScopes.push_back( temporary );
+
+			continue;
+		}
+		else if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENDNAMESPACE ){
+			if( namespaceScopes.size() <= 0 ){
+				SetError(12, "End Namespace", i );
+			}
+			else{
+				namespaceScopes.pop_back();
+			}
+
+			i += 2;
+			continue;
+		}
+		else if( basbuf[i] == 1 && basbuf[i+1] == ESC_IMPORTS ){
+			for(i+=2,i2=0;;i2++,i++){
+				if( IsCommandDelimitation( basbuf[i] ) ){
+					temporary[i2]=0;
+					break;
+				}
+				temporary[i2]=basbuf[i];
+			}
+			importedNamespaces.Imports( temporary );
+
+			continue;
+		}
+		else if( basbuf[i] == 1 && basbuf[i+1] == ESC_CLEARNAMESPACEIMPORTED ){
+			importedNamespaces.clear();
+			continue;
+		}
+
 		if( basbuf[i]==1 ){
 			char temporary[VN_SIZE];
@@ -122,5 +206,5 @@
 					if(basbuf[i]=='\0') break;
 				}
-				Add(temporary,i);
+				Add( namespaceScopes, temporary, i );
 
 				continue;
@@ -136,5 +220,5 @@
 					if(basbuf[i]=='\0') break;
 				}
-				Smoothie::Meta::typeDefs.Add(temporary,"Long");
+				Add( namespaceScopes, temporary, "Long" );
 			}
 		}
Index: /BasicCompiler_Common/TypeDef.h
===================================================================
--- /BasicCompiler_Common/TypeDef.h	(revision 112)
+++ /BasicCompiler_Common/TypeDef.h	(revision 113)
@@ -13,20 +13,28 @@
 	friend TypeDefCollection;
 
-	string newName;
+	NamespaceScopes namespaceScopes;
+
+	string name;
 	string baseName;
 	Type baseType;
 public:
-	TypeDef( const string &newName, const string &baseName );
+	TypeDef( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName );
 	~TypeDef();
 
-	const string &GetNewName(){
-		return newName;
+	const string &GetName() const
+	{
+		return name;
 	}
-	const string &GetBaseName(){
+	const string &GetBaseName() const
+	{
 		return baseName;
 	}
-	const Type &GetBaseType(){
+	const Type &GetBaseType() const
+	{
 		return baseType;
 	}
+
+	bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
+	bool IsEqualSymbol( const string &name ) const;
 };
 
@@ -37,9 +45,9 @@
 	~TypeDefCollection();
 
-	void Add( const string &newName, const string &baseName );
+	void Add( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName );
 	int GetIndex( const string &typeName ) const;
 
 private:
-	void Add( const string &expression, int nowLine );
+	void Add( const NamespaceScopes &namespaceScopes, const string &expression, int nowLine );
 public:
 	void Init();
Index: /BasicCompiler_Common/error.cpp
===================================================================
--- /BasicCompiler_Common/error.cpp	(revision 112)
+++ /BasicCompiler_Common/error.cpp	(revision 113)
@@ -154,4 +154,5 @@
 	if(num==63) lstrcpy(msg,"名前空間が正しく閉じられていません。");
 	if(num==64) sprintf(msg,"\"%s\" 無効な名前空間です。",tempKeyWord);
+	if(num==65) sprintf(msg,"ローカル領域で%sは使用できません。",tempKeyWord);
 
 
Index: /BasicCompiler_Common/hash.cpp
===================================================================
--- /BasicCompiler_Common/hash.cpp	(revision 112)
+++ /BasicCompiler_Common/hash.cpp	(revision 113)
@@ -35,8 +35,12 @@
 }
 
-DllProc *GetDeclareHash(char *name){
+DllProc *GetDeclareHash(char *fullName){
+	char ObjName[VN_SIZE];		//オブジェクト変数
+	char NestMember[VN_SIZE];	//入れ子メンバ
+	bool isObjectMember = SplitMemberName( fullName, ObjName, NestMember );
+
 	//ハッシュ値を取得
 	int key;
-	key=hash_default(name);
+	key=hash_default(NestMember);
 
 	//格納位置を取得
@@ -45,5 +49,6 @@
 	pDllProc=ppDeclareHash[key];
 	while(pDllProc){
-		if( pDllProc->GetName() == name ){
+		// TODO: Declare名前空間対応
+		if( pDllProc->IsEqualSymbol( fullName ) ){
 			break;
 		}
