Changeset 571 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp
- Timestamp:
- May 6, 2008, 9:10:21 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp
r568 r571 3 3 using namespace ActiveBasic::Compiler; 4 4 5 bool LexicalAnalyzer::AnalyzeParameter( Parameters ¶ms, const char *sourceOfParams, int nowLine )5 bool LexicalAnalyzer::AnalyzeParameter( Parameters ¶ms, const Jenga::Common::Strings ¶meterStrings, int nowLine ) 6 6 { 7 7 int i2,i3,sw; … … 9 9 10 10 //パラメータ 11 int i = 0; 12 while(1){ 13 if( sourceOfParams[i] == '\0' ) 11 BOOST_FOREACH( const std::string ¶mStr, parameterStrings ) 12 { 13 int i = 0; 14 15 if( paramStr[i] == '\0' ) 14 16 { 15 17 break; … … 18 20 //ByRef 19 21 bool isRef; 20 if( sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){22 if(paramStr[i]==1&¶mStr[i+1]==ESC_BYVAL){ 21 23 isRef = false; 22 24 i+=2; 23 25 } 24 else if( sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){26 else if(paramStr[i]==1&¶mStr[i+1]==ESC_BYREF){ 25 27 isRef = true; 26 28 i+=2; … … 34 36 sw=0; 35 37 for(i2=0;;i++,i2++){ 36 if( sourceOfParams[i]=='('){38 if(paramStr[i]=='('){ 37 39 if(!sw) sw=1; 38 40 39 i3=GetStringInPare(name+i2, sourceOfParams+i);41 i3=GetStringInPare(name+i2,paramStr.c_str()+i); 40 42 i2+=i3-1; 41 43 i+=i3-1; 42 44 continue; 43 45 } 44 if( sourceOfParams[i]=='['){46 if(paramStr[i]=='['){ 45 47 if(!sw) sw=1; 46 48 47 i3=GetStringInBracket(name+i2, sourceOfParams+i);49 i3=GetStringInBracket(name+i2,paramStr.c_str()+i); 48 50 i2+=i3-1; 49 51 i+=i3-1; 50 52 continue; 51 53 } 52 if(!IsVariableChar( sourceOfParams[i])){54 if(!IsVariableChar(paramStr[i])){ 53 55 name[i2]=0; 54 56 break; 55 57 } 56 name[i2]= sourceOfParams[i];58 name[i2]=paramStr[i]; 57 59 } 58 60 if(sw){ … … 81 83 Type type( DEF_NON ); 82 84 char initValue[8192] = ""; 83 if( sourceOfParams[i] == '=' ){85 if( paramStr[i] == '=' ){ 84 86 i++; 85 i = GetOneParameter( sourceOfParams, i, initValue );87 i = GetOneParameter( paramStr.c_str(), i, initValue ); 86 88 87 89 // TODO: エラー用 fix me!!! … … 95 97 } 96 98 } 97 else if( sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){99 else if(paramStr[i]==1&¶mStr[i+1]==ESC_AS){ 98 100 // As指定 99 101 i+=2; 100 102 101 103 i2=0; 102 while( sourceOfParams[i]=='*'){103 temporary[i2]= sourceOfParams[i];104 while(paramStr[i]=='*'){ 105 temporary[i2]=paramStr[i]; 104 106 i++; 105 107 i2++; 106 108 } 107 109 for(;;i++,i2++){ 108 if(!IsVariableChar( sourceOfParams[i])){109 if( sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){110 temporary[i2++]= sourceOfParams[i++];111 temporary[i2]= sourceOfParams[i];110 if(!IsVariableChar(paramStr[i])){ 111 if(paramStr[i]==1&&(paramStr[i+1]==ESC_FUNCTION||paramStr[i+1]==ESC_SUB)){ 112 temporary[i2++]=paramStr[i++]; 113 temporary[i2]=paramStr[i]; 112 114 continue; 113 115 } … … 115 117 break; 116 118 } 117 temporary[i2]= sourceOfParams[i];119 temporary[i2]=paramStr[i]; 118 120 } 119 121 … … 144 146 //パラメータを追加 145 147 params.push_back( pParam ); 146 147 if( sourceOfParams[i] == ',' )148 {149 i++;150 continue;151 }152 else if( sourceOfParams[i] == '\0' )153 {154 break;155 }156 else{157 compiler.errorMessenger.Output(1,NULL,nowLine);158 break;159 }160 148 } 161 149
Note:
See TracChangeset
for help on using the changeset viewer.