Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer.cpp	(revision 541)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer.cpp	(revision 542)
@@ -237,4 +237,195 @@
 }
 
+void LexicalAnalyzer::AddTypeDef( TypeDefCollection &typeDefs, const NamespaceScopes &namespaceScopes, const std::string &expression, int nowLine )
+{
+	int i;
+	char temporary[VN_SIZE];
+
+	for(i=0;;i++){
+		if(expression[i]=='='||expression[i]=='\0'){
+			temporary[i]=0;
+			break;
+		}
+		temporary[i]=expression[i];
+	}
+
+	if(expression[i]!='='){
+		compiler.errorMessenger.Output(10,"TypeDef",nowLine);
+		return;
+	}
+
+	const char *pTemp=expression.c_str()+i+1;
+
+	//識別文字のエラーチェック（新しい型）
+	i=0;
+	for(;;i++){
+		if(temporary[i]=='\0') break;
+		if( !( IsVariableChar( temporary[i], true) ) ){
+			compiler.errorMessenger.Output(10,"TypeDef",nowLine);
+			return;
+		}
+	}
+
+	//識別文字のエラーチェック（コピー元の型）
+	if(pTemp[0]=='*'&&pTemp[1]==1&&(pTemp[2]==ESC_FUNCTION||pTemp[2]==ESC_SUB)){
+		//関数ポインタ
+		if(pTemp[3]!='('){
+			compiler.errorMessenger.Output(10,"TypeDef",nowLine);
+			return;
+		}
+	}
+	else{
+		i=0;
+		while(pTemp[i]=='*') i++;
+		for(;;i++){
+			if(pTemp[i]=='\0') break;
+			if( !( IsVariableChar( pTemp[i], true) ) )
+			{
+				compiler.errorMessenger.Output(10,"TypeDef",nowLine);
+				return;
+			}
+		}
+	}
+
+	//識別子が重複している場合はエラーにする
+	if(lstrcmp(temporary,pTemp)==0){
+		compiler.errorMessenger.Output(1,NULL,nowLine);
+		return;
+	}
+
+
+
+	//////////////////////////
+	// TypeDef情報を追加
+	//////////////////////////
+
+	Type baseType;
+	if( !compiler.StringToType( pTemp, baseType ) )
+	{
+		compiler.errorMessenger.Output(3, pTemp, nowLine );
+		return;
+	}
+
+	typeDefs.push_back(
+		TypeDef(
+			namespaceScopes,
+			temporary,
+			pTemp,
+			baseType
+		)
+	);
+}
+void LexicalAnalyzer::CollectTypeDefs( const char *source, TypeDefCollection &typeDefs )
+{
+	// 名前空間管理
+	NamespaceScopes &namespaceScopes = compiler.GetNamespaceSupporter().GetLivingNamespaceScopes();
+	namespaceScopes.clear();
+
+	// Importsされた名前空間の管理
+	NamespaceScopesCollection &importedNamespaces = compiler.GetNamespaceSupporter().GetImportedNamespaces();
+	importedNamespaces.clear();
+
+	int i=-1, i2;
+	char temporary[VN_SIZE];
+	while(1){
+		extern char *basbuf;
+
+		i++;
+
+		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 ){
+				compiler.errorMessenger.Output(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];
+			}
+			if( !compiler.GetNamespaceSupporter().ImportsNamespace( temporary ) )
+			{
+				compiler.errorMessenger.Output(64,temporary,i );
+			}
+
+			continue;
+		}
+		else if( basbuf[i] == 1 && basbuf[i+1] == ESC_CLEARNAMESPACEIMPORTED ){
+			importedNamespaces.clear();
+			continue;
+		}
+
+		if( basbuf[i]==1 ){
+			char temporary[VN_SIZE];
+			if(basbuf[i+1]==ESC_TYPEDEF){
+				int i2 = 0;
+				for(i+=2;;i2++,i++){
+					if(basbuf[i]=='\n'){
+						temporary[i2]=0;
+						break;
+					}
+					temporary[i2]=basbuf[i];
+					if(basbuf[i]=='\0') break;
+				}
+				AddTypeDef( typeDefs, namespaceScopes, temporary, i );
+
+				continue;
+			}
+			else if( basbuf[i+1] == ESC_CONST && basbuf[i+2] == 1 && basbuf[i+3] == ESC_ENUM ){
+				int i2 = 0;
+				for(i+=4;;i2++,i++){
+					if(!IsVariableChar(basbuf[i])){
+						temporary[i2]=0;
+						break;
+					}
+					temporary[i2]=basbuf[i];
+					if(basbuf[i]=='\0') break;
+				}
+
+				Type baseType;
+				if( !compiler.StringToType( "Long", baseType ) )
+				{
+					throw;
+				}
+
+				typeDefs.push_back(
+					TypeDef(
+						namespaceScopes,
+						temporary,
+						"Long",
+						baseType
+					)
+				);
+			}
+		}
+
+		//次の行
+		for(;;i++){
+			if(IsCommandDelimitation(basbuf[i])) break;
+		}
+		if(basbuf[i]=='\0') break;
+	}
+}
+
 UserProc* LexicalAnalyzer::ParseUserProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, char *buffer,int nowLine,bool isVirtual,CClass *pobj_c, bool isStatic, char *interfaceName )
 {
Index: trunk/ab5.0/abdev/BasicCompiler_Common/src/TypeDef.cpp
===================================================================
--- trunk/ab5.0/abdev/BasicCompiler_Common/src/TypeDef.cpp	(revision 541)
+++ trunk/ab5.0/abdev/BasicCompiler_Common/src/TypeDef.cpp	(revision 542)
@@ -4,12 +4,9 @@
 #include <Compiler.h>
 
-TypeDef::TypeDef( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, int nowLine )
+TypeDef::TypeDef( const NamespaceScopes &namespaceScopes, const std::string &name, const std::string &baseName, const Type &baseType )
 	: Symbol( namespaceScopes, name )
 	, baseName( baseName )
+	, baseType( baseType )
 {
-	if( !compiler.StringToType( baseName, baseType ) ){
-		compiler.errorMessenger.Output(3, baseName, nowLine );
-		return;
-	}
 }
 /*
@@ -56,4 +53,5 @@
 	this->push_back( typeDef );
 }
+
 int TypeDefCollection::GetIndex( const NamespaceScopes &namespaceScopes, const std::string &name ) const{
 	int max = (int)(*this).size();
@@ -72,165 +70,2 @@
 	return GetIndex( NamespaceScopes( AreaName ), NestName );
 }
-
-void TypeDefCollection::Add( const NamespaceScopes &namespaceScopes, const std::string &expression, int nowLine ){
-	int i;
-	char temporary[VN_SIZE];
-
-	for(i=0;;i++){
-		if(expression[i]=='='||expression[i]=='\0'){
-			temporary[i]=0;
-			break;
-		}
-		temporary[i]=expression[i];
-	}
-
-	if(expression[i]!='='){
-		compiler.errorMessenger.Output(10,"TypeDef",nowLine);
-		return;
-	}
-
-	const char *pTemp=expression.c_str()+i+1;
-
-	//識別文字のエラーチェック（新しい型）
-	i=0;
-	for(;;i++){
-		if(temporary[i]=='\0') break;
-		if( !( IsVariableChar( temporary[i], true) ) ){
-			compiler.errorMessenger.Output(10,"TypeDef",nowLine);
-			return;
-		}
-	}
-
-	//識別文字のエラーチェック（コピー元の型）
-	if(pTemp[0]=='*'&&pTemp[1]==1&&(pTemp[2]==ESC_FUNCTION||pTemp[2]==ESC_SUB)){
-		//関数ポインタ
-		if(pTemp[3]!='('){
-			compiler.errorMessenger.Output(10,"TypeDef",nowLine);
-			return;
-		}
-	}
-	else{
-		i=0;
-		while(pTemp[i]=='*') i++;
-		for(;;i++){
-			if(pTemp[i]=='\0') break;
-			if( !( IsVariableChar( pTemp[i], true) ) )
-			{
-				compiler.errorMessenger.Output(10,"TypeDef",nowLine);
-				return;
-			}
-		}
-	}
-
-	//識別子が重複している場合はエラーにする
-	if(lstrcmp(temporary,pTemp)==0){
-		compiler.errorMessenger.Output(1,NULL,nowLine);
-		return;
-	}
-
-
-
-	//////////////////////////
-	// TypeDef情報を追加
-	//////////////////////////
-
-	Add( namespaceScopes, temporary, pTemp, nowLine );
-}
-
-void TypeDefCollection::CollectTypeDefs(){
-
-	// 名前空間管理
-	NamespaceScopes &namespaceScopes = compiler.GetNamespaceSupporter().GetLivingNamespaceScopes();
-	namespaceScopes.clear();
-
-	// Importsされた名前空間の管理
-	NamespaceScopesCollection &importedNamespaces = compiler.GetNamespaceSupporter().GetImportedNamespaces();
-	importedNamespaces.clear();
-
-	int i=-1, i2;
-	char temporary[VN_SIZE];
-	while(1){
-		extern char *basbuf;
-
-		i++;
-
-		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 ){
-				compiler.errorMessenger.Output(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];
-			}
-			if( !compiler.GetNamespaceSupporter().ImportsNamespace( temporary ) )
-			{
-				compiler.errorMessenger.Output(64,temporary,i );
-			}
-
-			continue;
-		}
-		else if( basbuf[i] == 1 && basbuf[i+1] == ESC_CLEARNAMESPACEIMPORTED ){
-			importedNamespaces.clear();
-			continue;
-		}
-
-		if( basbuf[i]==1 ){
-			char temporary[VN_SIZE];
-			if(basbuf[i+1]==ESC_TYPEDEF){
-				int i2 = 0;
-				for(i+=2;;i2++,i++){
-					if(basbuf[i]=='\n'){
-						temporary[i2]=0;
-						break;
-					}
-					temporary[i2]=basbuf[i];
-					if(basbuf[i]=='\0') break;
-				}
-				Add( namespaceScopes, temporary, i );
-
-				continue;
-			}
-			else if( basbuf[i+1] == ESC_CONST && basbuf[i+2] == 1 && basbuf[i+3] == ESC_ENUM ){
-				int i2 = 0;
-				for(i+=4;;i2++,i++){
-					if(!IsVariableChar(basbuf[i])){
-						temporary[i2]=0;
-						break;
-					}
-					temporary[i2]=basbuf[i];
-					if(basbuf[i]=='\0') break;
-				}
-				Add( namespaceScopes, temporary, "Long", i );
-			}
-		}
-
-		//次の行
-		for(;;i++){
-			if(IsCommandDelimitation(basbuf[i])) break;
-		}
-		if(basbuf[i]=='\0') break;
-	}
-}
