Index: /BasicCompiler32/BasicCompiler.vcproj
===================================================================
--- /BasicCompiler32/BasicCompiler.vcproj	(revision 100)
+++ /BasicCompiler32/BasicCompiler.vcproj	(revision 101)
@@ -1833,4 +1833,8 @@
 					Name="Meta Parts"
 					>
+					<File
+						RelativePath="..\BasicCompiler_Common\src\Namespace.cpp"
+						>
+					</File>
 					<File
 						RelativePath="..\BasicCompiler_Common\Procedure.cpp"
Index: /BasicCompiler32/Compile_ProcOp.cpp
===================================================================
--- /BasicCompiler32/Compile_ProcOp.cpp	(revision 100)
+++ /BasicCompiler32/Compile_ProcOp.cpp	(revision 101)
@@ -266,4 +266,7 @@
 	//コンパイル中の関数
 	UserProc::CompileStartForUserProc( pUserProc );
+
+	// コンパイル中の関数が属する名前空間
+	Smoothie::Lexical::liveingNamespaceScopes = pUserProc->GetNamespaceScopes();
 
 	if(pUserProc->IsSystem()){
Index: /BasicCompiler64/BasicCompiler.vcproj
===================================================================
--- /BasicCompiler64/BasicCompiler.vcproj	(revision 100)
+++ /BasicCompiler64/BasicCompiler.vcproj	(revision 101)
@@ -1821,4 +1821,8 @@
 					>
 					<File
+						RelativePath="..\BasicCompiler_Common\src\Namespace.cpp"
+						>
+					</File>
+					<File
 						RelativePath="..\BasicCompiler_Common\Procedure.cpp"
 						>
Index: /BasicCompiler64/Compile_ProcOp.cpp
===================================================================
--- /BasicCompiler64/Compile_ProcOp.cpp	(revision 100)
+++ /BasicCompiler64/Compile_ProcOp.cpp	(revision 101)
@@ -256,4 +256,7 @@
 	//コンパイル中の関数
 	UserProc::CompileStartForUserProc( pUserProc );
+
+	// コンパイル中の関数が属する名前空間
+	Smoothie::Lexical::liveingNamespaceScopes = pUserProc->GetNamespaceScopes();
 
 	if(pUserProc->IsSystem()){
Index: /BasicCompiler_Common/Class.cpp
===================================================================
--- /BasicCompiler_Common/Class.cpp	(revision 100)
+++ /BasicCompiler_Common/Class.cpp	(revision 101)
@@ -144,5 +144,6 @@
 
 
-CClass::CClass(const char *name):
+CClass::CClass( const NamespaceScopes &namespaceScopes, const char *name ):
+	namespaceScopes( namespaceScopes ),
 	ConstructorMemberSubIndex( 0 ),
 	DestructorMemberSubIndex( 0 ),
@@ -193,4 +194,9 @@
 }
 
+bool CClass::IsEqualSymbol() const
+{
+	return false;
+}
+
 bool CClass::IsUsing() const
 {
@@ -803,5 +809,5 @@
 }
 
-CClass *CDBClass::AddClass(const char *name,int nowLine){
+CClass *CDBClass::AddClass( const NamespaceScopes &namespaceScopes, const char *name,int nowLine){
 	//////////////////////////////////////////////////////////////////////////
 	// クラスを追加
@@ -810,5 +816,5 @@
 
 	CClass *pobj_c;
-	pobj_c=new CClass(name);
+	pobj_c=new CClass(namespaceScopes, name);
 
 	if(lstrcmp(name,"String")==0){
@@ -852,8 +858,37 @@
 void CDBClass::InitNames(void){
 	extern char *basbuf;
-	int i;
+	int i, i2;
+	char temporary[VN_SIZE];
+
+	// 名前空間管理
+	NamespaceScopes &namespaceScopes = Smoothie::Lexical::liveingNamespaceScopes;
+	namespaceScopes.clear();
 
 	for(i=0;;i++){
 		if(basbuf[i]=='\0') break;
+
+		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;
+		}
 
 		if(basbuf[i]==1&&(
@@ -891,5 +926,5 @@
 
 				//クラスを追加
-				CClass *pClass = pobj_DBClass->AddClass(temporary,nowLine);
+				CClass *pClass = pobj_DBClass->AddClass(namespaceScopes, temporary,nowLine);
 				if( pClass ){
 					if( basbuf[nowLine+1] == ESC_CLASS ){
Index: /BasicCompiler_Common/Class.h
===================================================================
--- /BasicCompiler_Common/Class.h	(revision 100)
+++ /BasicCompiler_Common/Class.h	(revision 101)
@@ -61,4 +61,7 @@
 	friend CDBClass;
 	friend CDebugSection;
+
+	// 名前空間
+	NamespaceScopes namespaceScopes;
 
 	//静的メンバ情報
@@ -104,6 +107,13 @@
 
 public:
-	CClass(const char *name);
+	CClass( const NamespaceScopes &namespaceScopes, const char *name );
 	~CClass();
+
+	virtual const NamespaceScopes &GetNamespaceScopes() const
+	{
+		return namespaceScopes;
+	}
+
+	bool IsEqualSymbol() const;
 
 	bool IsUsing() const;
@@ -232,5 +242,5 @@
 	CClass *check(const char *name);
 
-	CClass *AddClass(const char *name,int nowLine);
+	CClass *AddClass( const NamespaceScopes &namespaceScopes, const char *name,int nowLine);
 
 	void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
Index: /BasicCompiler_Common/DebugMiddleFile.cpp
===================================================================
--- /BasicCompiler_Common/DebugMiddleFile.cpp	(revision 100)
+++ /BasicCompiler_Common/DebugMiddleFile.cpp	(revision 101)
@@ -486,5 +486,6 @@
 	for(i3=0;i3<iMaxClassCount;i3++){
 		//クラス名
-		pobj_DBClass->AddClass(buffer+i2,0);
+		// TODO: 名前空間が未完成
+		pobj_DBClass->AddClass(NamespaceScopes(),buffer+i2,0);
 		i2+=lstrlen(buffer+i2)+1;
 	}
Index: /BasicCompiler_Common/Procedure.cpp
===================================================================
--- /BasicCompiler_Common/Procedure.cpp	(revision 100)
+++ /BasicCompiler_Common/Procedure.cpp	(revision 101)
@@ -370,8 +370,15 @@
 	return ( pMethod->bVirtual != 0 );
 }
-bool UserProc::EqualName( const string &name ) const
+const NamespaceScopes &UserProc::GetNamespaceScopes() const
+{
+	if( !pParentClass ){
+		SetError();
+	}
+	return pParentClass->GetNamespaceScopes();
+}
+bool UserProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
 {
 	SetError();
-	return true;
+	return false;
 }
 
@@ -503,13 +510,9 @@
 	return true;
 }
-bool GlobalProc::EqualName( const string &name ) const
+bool GlobalProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
 {
-	char AreaName[VN_SIZE];		//オブジェクト変数
-	char NestName[VN_SIZE];		//入れ子メンバ
-	bool isNest = SplitMemberName( name.c_str(), AreaName, NestName );
-
-	if( isNest ){
-		if( GetNamespaceScopes().Equal( AreaName ) ){
-			if( GetName() == NestName ){
+	if( namespaceScopes.size() ){
+		if( GetNamespaceScopes().IsCoverd( namespaceScopes ) ){
+			if( GetName() == name ){
 				return true;
 			}
@@ -519,15 +522,30 @@
 		if( GetNamespaceScopes().size() ){
 			// 名前空間の判断が必要なとき
-			if( !GetNamespaceScopes().IsUsing() ){
+			if( !GetNamespaceScopes().IsUsing()
+				&& !GetNamespaceScopes().IsLiving() ){
 				// この名前空間は暗黙的に参照できないとき
 				return false;
 			}
 		}
-		if( GetName() == name ){
-			return true;
+		else{
+			if( GetName() == name ){
+				return true;
+			}
 		}
 	}
 
 	return false;
+}
+bool GlobalProc::IsEqualSymbol( const GlobalProc &globalProc ) const
+{
+	return IsEqualSymbol( globalProc.GetNamespaceScopes(), globalProc.GetName() );
+}
+bool GlobalProc::IsEqualSymbol( const string &fullName ) const
+{
+	char AreaName[VN_SIZE] = "";		//オブジェクト変数
+	char NestName[VN_SIZE] = "";		//入れ子メンバ
+	bool isNest = SplitMemberName( fullName.c_str(), AreaName, NestName );
+
+	return IsEqualSymbol( NamespaceScopes( AreaName ), NestName );
 }
 
Index: /BasicCompiler_Common/Procedure.h
===================================================================
--- /BasicCompiler_Common/Procedure.h	(revision 100)
+++ /BasicCompiler_Common/Procedure.h	(revision 101)
@@ -221,4 +221,7 @@
 	}
 
+	virtual const NamespaceScopes &GetNamespaceScopes() const;
+	virtual bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
+
 	// ローカル変数
 	Variables localVars;
@@ -249,6 +252,4 @@
 		return *pCompilingUserProc;
 	}
-
-	virtual bool EqualName( const string &name ) const;
 };
 
@@ -270,10 +271,12 @@
 	bool AddGlobalProc( const NamespaceScopes &namespaceScopes, char *buffer,int nowLine );
 
-	const NamespaceScopes &GetNamespaceScopes() const
+	virtual const NamespaceScopes &GetNamespaceScopes() const
 	{
 		return namespaceScopes;
 	}
 
-	virtual bool EqualName( const string &name ) const;
+	virtual bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
+	virtual bool IsEqualSymbol( const GlobalProc &globalProc ) const;
+	virtual bool IsEqualSymbol( const string &name ) const;
 };
 
Index: /BasicCompiler_Common/Subroutine.cpp
===================================================================
--- /BasicCompiler_Common/Subroutine.cpp	(revision 100)
+++ /BasicCompiler_Common/Subroutine.cpp	(revision 101)
@@ -618,5 +618,5 @@
 			if(pobj_c==psi2->GetParentClassPtr()){
 				//重複エラーチェックを行う
-				if( pUserProc->GetName() == psi2->GetName() ){
+				if( pUserProc->IsEqualSymbol( *psi2 ) ){
 					if( Parameter::Equals( psi2->Params(), pUserProc->Params() ) ){
 						SetError(15,pUserProc->GetName().c_str(),nowLine);
@@ -661,5 +661,6 @@
 
 	// 名前空間管理
-	NamespaceScopes namespaceScopes;
+	NamespaceScopes &namespaceScopes = Smoothie::Lexical::liveingNamespaceScopes;
+	namespaceScopes.clear();
 
 	i=-1;
Index: /BasicCompiler_Common/hash.cpp
===================================================================
--- /BasicCompiler_Common/hash.cpp	(revision 100)
+++ /BasicCompiler_Common/hash.cpp	(revision 101)
@@ -64,4 +64,7 @@
 	else lstrcpy(name,lpszName);
 
+	if( (string)lpszName == "Test2.Proc3" ){
+		int test=0;
+	}
 
 	char ObjName[VN_SIZE];		//オブジェクト変数
@@ -92,5 +95,5 @@
 		}
 
-		if( pobj_c ){
+		if( pobj_c && pobj_c != (CClass *)-1 ){
 			if( isStatic ){
 				// 静的メソッドから列挙
@@ -131,5 +134,5 @@
 	while(pUserProc){
 		if(!pUserProc->GetParentClassPtr()){
-			if( pUserProc->EqualName( name ) ){
+			if( pUserProc->IsEqualSymbol( name ) ){
 				subs.push_back( pUserProc );
 			}
Index: /BasicCompiler_Common/include/Namespace.h
===================================================================
--- /BasicCompiler_Common/include/Namespace.h	(revision 100)
+++ /BasicCompiler_Common/include/Namespace.h	(revision 101)
@@ -11,8 +11,10 @@
 public:
 	NamespaceScopes(){}
+	NamespaceScopes( const char *name );
 	~NamespaceScopes(){}
 
-	void ToString( string &namespaceStr ) const
+	string ToString() const
 	{
+		string namespaceStr;
 		const vector<string> &me = *this;
 
@@ -28,11 +30,11 @@
 			namespaceStr += itemStr;
 		}
+		return namespaceStr;
 	}
 
-	bool Equal( const string &name ) const
+	// 等しいかをチェック
+	bool IsEqual( const string &name ) const
 	{
-		string tempName;
-		ToString( tempName );
-		if( tempName == name ){
+		if( ToString() == name ){
 			return true;
 		}
@@ -40,7 +42,47 @@
 	}
 
+	// 等しいかをチェック
+	bool IsEqual( const NamespaceScopes &namespaceScopes ) const
+	{
+		if( ToString() == namespaceScopes.ToString() ){
+			return true;
+		}
+		return false;
+	}
+
+	// 所属しているかをチェック
+	// 例:
+	// baseNamespaceScopes =  "Discoversoft"
+	// entryNamespaceScopes = "Discoversoft.ActiveBasic"
+	// この場合、entryNamespaceScopes は baseNamespaceScopes に所属している。
+	static bool IsBelong( const NamespaceScopes &baseNamespaceScopes, const NamespaceScopes &entryNamespaceScopes )
+	{
+		if( baseNamespaceScopes.size() > entryNamespaceScopes.size() ){
+			return false;
+		}
+
+		for( int i=0; i<(int)baseNamespaceScopes.size(); i++ ){
+			if( baseNamespaceScopes[i] != entryNamespaceScopes[i] ){
+				return false;
+			}
+		}
+		return true;
+	}
+
 	bool IsUsing() const
 	{
+		// TODO: 実装
 		return false;
 	}
+
+	bool IsLiving() const;
+
+	// 包括しているかをチェック
+	// 例:
+	// this =   "Discoversoft.ActiveBasic"
+	// living = "Discoversoft.ActiveBasic"
+	// name =   "ActiveBasic"
+	// この場合、living は name を包括している。
+	bool IsCoverd( const string &name ) const;
+	bool IsCoverd( const NamespaceScopes &namespaceScopes ) const;
 };
Index: /BasicCompiler_Common/include/Smoothie.h
===================================================================
--- /BasicCompiler_Common/include/Smoothie.h	(revision 100)
+++ /BasicCompiler_Common/include/Smoothie.h	(revision 101)
@@ -40,4 +40,5 @@
 	public:
 		static BasicSource source;
+		static NamespaceScopes liveingNamespaceScopes;
 	};
 
Index: /BasicCompiler_Common/src/Namespace.cpp
===================================================================
--- /BasicCompiler_Common/src/Namespace.cpp	(revision 101)
+++ /BasicCompiler_Common/src/Namespace.cpp	(revision 101)
@@ -0,0 +1,62 @@
+#include "../common.h"
+
+
+NamespaceScopes::NamespaceScopes( const char *namespaceStr ){
+	int i = 0;
+	while( namespaceStr[i] ){
+		char temporary[VN_SIZE];
+		for( int i2=0; ; i2++, i++ ){
+			if( namespaceStr[i] == '.' || namespaceStr[i] == '\0' ){
+				temporary[i2] = 0;
+				break;
+			}
+			temporary[i2] = namespaceStr[i];
+		}
+		push_back( temporary );
+
+		if( namespaceStr[i] == '.' ){
+			i++;
+		}
+	}
+}
+
+bool NamespaceScopes::IsLiving() const
+{
+	if( IsBelong( *this, Smoothie::Lexical::liveingNamespaceScopes ) ){
+		return true;
+	}
+	return false;
+}
+
+// 包括しているかをチェック
+// 例:
+// this =   "Discoversoft.ActiveBasic"
+// living = "Discoversoft.ActiveBasic"
+// name =   "ActiveBasic"
+// この場合、living は name を包括している。
+bool NamespaceScopes::IsCoverd( const string &name ) const
+{
+	if( IsEqual( name ) ){
+		return true;
+	}
+
+	string thisStr = ToString();
+
+	NamespaceScopes tempLivingNamespaceScopes = Smoothie::Lexical::liveingNamespaceScopes;
+
+	while( tempLivingNamespaceScopes.size() ){
+		NamespaceScopes tempNamespaceScopes = tempLivingNamespaceScopes;
+
+		string tempStr = tempNamespaceScopes.ToString() + "." + name;
+		if( thisStr == tempStr ){
+			return true;
+		}
+
+		tempLivingNamespaceScopes.pop_back();
+	}
+	return false;
+}
+bool NamespaceScopes::IsCoverd( const NamespaceScopes &namespaceScopes ) const
+{
+	return IsCoverd( namespaceScopes.ToString() );
+}
Index: /BasicCompiler_Common/src/Smoothie.cpp
===================================================================
--- /BasicCompiler_Common/src/Smoothie.cpp	(revision 100)
+++ /BasicCompiler_Common/src/Smoothie.cpp	(revision 101)
@@ -4,4 +4,5 @@
 
 BasicSource Smoothie::Lexical::source;
+NamespaceScopes Smoothie::Lexical::liveingNamespaceScopes;
 
 TypeDefCollection Smoothie::Meta::typeDefs;
Index: /ProjectEditor/SubOperation.cpp
===================================================================
--- /ProjectEditor/SubOperation.cpp	(revision 100)
+++ /ProjectEditor/SubOperation.cpp	(revision 101)
@@ -538,4 +538,5 @@
 	}
 	else if(str[0]=='n'||str[0]=='N'){
+		if(lstrcmpi(str,"Namespace")==0) return -1;
 		if(lstrcmpi(str,"Next")==0) return COM_NEXT;
 		if(lstrcmpi(str,"New")==0) return -1;
