Changeset 708 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp
- Timestamp:
- Jul 26, 2008, 7:27:20 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer_Procedure.cpp
r671 r708 2 2 3 3 using namespace ActiveBasic::Compiler; 4 5 bool LexicalAnalyzer::ExtractParameterVarNames( const char *sourceOfParams, Jenga::Common::Strings ¶mVarNames, int nowLine ) 6 { 7 int i = 0; 8 int i2,i3,sw; 9 char temporary[8192],temp2[VN_SIZE]; 10 11 while(1){ 12 if(sourceOfParams[i]=='\0') break; 13 14 //ByRef 15 bool isRef; 16 if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){ 17 isRef = false; 18 i+=2; 19 } 20 else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){ 21 isRef = true; 22 i+=2; 23 } 24 else isRef = false; 25 26 //パラメータ名 27 bool isArray = false; 28 Subscripts subscripts; 29 char name[VN_SIZE]; 30 sw=0; 31 for(i2=0;;i++,i2++){ 32 if(sourceOfParams[i]=='('){ 33 if(!sw) sw=1; 34 35 i3=GetStringInPare(name+i2,sourceOfParams+i); 36 i2+=i3-1; 37 i+=i3-1; 38 continue; 39 } 40 if(sourceOfParams[i]=='['){ 41 if(!sw) sw=1; 42 43 i3=GetStringInBracket(name+i2,sourceOfParams+i); 44 i2+=i3-1; 45 i+=i3-1; 46 continue; 47 } 48 if(!IsVariableChar(sourceOfParams[i])){ 49 name[i2]=0; 50 break; 51 } 52 name[i2]=sourceOfParams[i]; 53 } 54 if(sw){ 55 //配列パラメータ 56 if( isRef == false ) compiler.errorMessenger.Output(29,NULL,nowLine); 57 isArray = true; 58 59 if((name[i2-2]=='('&&name[i2-1]==')')|| 60 (name[i2-2]=='['&&name[i2-1]==']')) 61 { 62 subscripts.push_back( LONG_MAX ); 63 64 name[i2-2]=0; 65 } 66 else{ 67 GetArrange(name,temp2,subscripts); 68 lstrcpy(name,temp2); 69 } 70 71 i2=lstrlen(name); 72 } 73 74 paramVarNames.push_back( name ); 75 76 //型 77 Type type( DEF_NON ); 78 if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS) 79 { 80 i+=2; 81 82 i2=0; 83 while(sourceOfParams[i]=='*'){ 84 temporary[i2]=sourceOfParams[i]; 85 i++; 86 i2++; 87 } 88 for(;;i++,i2++){ 89 if(!IsVariableChar(sourceOfParams[i], true)){ 90 if(sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){ 91 temporary[i2++]=sourceOfParams[i++]; 92 temporary[i2]=sourceOfParams[i]; 93 continue; 94 } 95 temporary[i2]=0; 96 break; 97 } 98 temporary[i2]=sourceOfParams[i]; 99 } 100 } 101 102 if(sourceOfParams[i]==','){ 103 i++; 104 continue; 105 } 106 else if(sourceOfParams[i]=='\0') break; 107 else{ 108 compiler.errorMessenger.Output(1,NULL,nowLine); 109 break; 110 } 111 } 112 113 return true; 114 } 4 115 5 116 bool LexicalAnalyzer::AnalyzeParameter( Parameters ¶ms, const Jenga::Common::Strings ¶meterStrings, int nowLine )
Note:
See TracChangeset
for help on using the changeset viewer.