Index: branches/egtra/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_TypeDef.cpp
===================================================================
--- branches/egtra/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_TypeDef.cpp	(revision 812)
+++ branches/egtra/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_TypeDef.cpp	(revision 814)
@@ -4,35 +4,25 @@
 #include "Compiler.h"
 #include "StrOperation.h"
+#include <boost/algorithm/string/predicate.hpp>
 
 using namespace ActiveBasic::Compiler;
 
-void LexicalAnalyzer::AddTypeDef( TypeDefCollection &typeDefs, const NamespaceScopes &namespaceScopes, const std::string &expression, int nowLine )
+void LexicalAnalyzer::AddTypeDef( TypeDefCollection &typeDefs, const NamespaceScopes &namespaceScopes, const boost::iterator_range<char const*> &expression, int nowLine )
 {
-	int i;
-	char temporary[VN_SIZE];
+	auto name = boost::find<boost::return_begin_found>(expression, '=');
 
-	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);
+	if (boost::end(name) == boost::end(expression))
+	{
+		compiler.errorMessenger.Output(10, "TypeDef", nowLine);
 		return;
 	}
 
-	const char *pTemp=expression.c_str()+i+1;
+	const char *pTemp = expression.begin() + boost::size(name) + 1;
 
 	//識別文字のエラーチェック（新しい型）
-	i=0;
-	for(;;i++){
-		if(temporary[i]=='\0') break;
-		if( !( IsVariableChar( temporary[i], true) ) ){
-			compiler.errorMessenger.Output(10,"TypeDef",nowLine);
-			return;
-		}
+	if (!boost::algorithm::all(name, [](char c) {return IsVariableChar(c, true);}))
+	{
+		compiler.errorMessenger.Output(10, "TypeDef", nowLine);
+		return;
 	}
 
@@ -45,19 +35,20 @@
 		}
 	}
-	else{
-		i=0;
+	else
+	{
+		int 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 (!boost::algorithm::all(name, [](char c) {return IsVariableChar(c, true);}))
+		{
+			compiler.errorMessenger.Output(10,"TypeDef",nowLine);
+			return;
 		}
 	}
 
+	std::string baseName(pTemp, expression.end());
+
 	//識別子が重複している場合はエラーにする
-	if(lstrcmp(temporary,pTemp)==0){
+	if (boost::algorithm::equals(name, baseName))
+	{
 		compiler.errorMessenger.Output(1,NULL,nowLine);
 		return;
@@ -71,7 +62,7 @@
 
 	Type baseType;
-	if( !compiler.StringToType( pTemp, baseType ) )
+	if( !compiler.StringToType( baseName, baseType ) )
 	{
-		compiler.errorMessenger.Output(3, pTemp, nowLine );
+		compiler.errorMessenger.Output(3, baseName, nowLine );
 		return;
 	}
@@ -79,6 +70,6 @@
 	typeDefs.push_back(
 		TypeDef(
-			Symbol( namespaceScopes, temporary ),
-			pTemp,
+			Symbol(namespaceScopes, boost::copy_range<std::string>(name)),
+			baseName,
 			baseType
 		)
@@ -94,19 +85,14 @@
 	compiler.GetNamespaceSupporter().ClearImportedNamespaces();
 
-	int i=-1, i2;
-	char temporary[VN_SIZE];
-	while(1){
-
-		i++;
-
+	for (int i = 0; ; ++i)
+	{
 		if( source[i] == 1 && source[i+1] == ESC_NAMESPACE ){
-			for(i+=2,i2=0;;i2++,i++){
-				if( IsCommandDelimitation( source[i] ) ){
-					temporary[i2]=0;
-					break;
-				}
-				temporary[i2]=source[i];
+			i+=2;
+			char const* p = &source[i];
+			while (!IsCommandDelimitation(source[i]))
+			{
+				++i;
 			}
-			namespaceScopes.push_back( temporary );
+			namespaceScopes.push_back(std::string(p, &source[i]));
 
 			continue;
@@ -124,14 +110,14 @@
 		}
 		else if( source[i] == 1 && source[i+1] == ESC_IMPORTS ){
-			for(i+=2,i2=0;;i2++,i++){
-				if( IsCommandDelimitation( source[i] ) ){
-					temporary[i2]=0;
-					break;
-				}
-				temporary[i2]=source[i];
+			i+=2;
+			char const* p = &source[i];
+			while (!IsCommandDelimitation(source[i]))
+			{
+				++i;
 			}
-			if( !compiler.GetNamespaceSupporter().ImportsNamespace( temporary ) )
+			std::string s(p, &source[i]);
+			if (!compiler.GetNamespaceSupporter().ImportsNamespace(s))
 			{
-				compiler.errorMessenger.Output(64,temporary,i );
+				compiler.errorMessenger.Output(64, s.c_str(), i);
 			}
 
@@ -148,15 +134,11 @@
 			char temporary[VN_SIZE];
 			if(source[i+1]==ESC_TYPEDEF){
-				int i2 = 0;
-				for(i+=2;;i2++,i++){
-					if(source[i]=='\n'){
-						temporary[i2]=0;
-						break;
-					}
-					temporary[i2]=source[i];
-					if(source[i]=='\0') break;
+				i+=2;
+				char const* p = &source[i];
+				while (!IsCommandDelimitation(source[i]))
+				{
+					++i;
 				}
-				AddTypeDef( typeDefs, namespaceScopes, temporary, i );
-
+				AddTypeDef(typeDefs, namespaceScopes, boost::make_iterator_range(p, &source[i]), i);
 				continue;
 			}
@@ -172,15 +154,9 @@
 				}
 
-				Type baseType;
-				if( !compiler.StringToType( "Long", baseType ) )
-				{
-					throw;
-				}
-
 				typeDefs.push_back(
 					TypeDef(
 						Symbol( namespaceScopes, temporary ),
 						"Long",
-						baseType
+						Type(DEF_LONG)
 					)
 				);
