source: dev/ProjectEditor/analysis.cpp@ 83

Last change on this file since 83 was 3, checked in by dai_9181, 18 years ago
File size: 16.9 KB
RevLine 
[3]1#include "common.h"
2
3BOOL GetVarFormatString(char *buffer,char *array,char *array2,char *NestMember,int *pRefType){
4 extern int cp;
5 int i,i2,i3;
6 char cPare_Open,cPare_Close;
7
8 array[0]=0;
9 array2[0]=0;
10 NestMember[0]=0;
11 *pRefType=0;
12 for(i=0;;i++){
13 if(buffer[i]=='\"'){
14 for(i++;;i++){
15 if(IsDBCSLeadByte(buffer[i])){
16 i++;
17 continue;
18 }
19 if(buffer[i]=='\"') break;
20 }
21 }
22 if(buffer[i]=='['||buffer[i]=='('){
23 if(buffer[i]=='['){
24 cPare_Open='[';
25 cPare_Close=']';
26 }
27 else{
28 cPare_Open='(';
29 cPare_Close=')';
30 }
31 buffer[i]=0;
32 for(i++,i2=0;;i++,i2++){
33 if(buffer[i]==cPare_Open){
34 if(cPare_Open=='[') i3=GetStringInBracket(array+i2,buffer+i);
35 else i3=GetStringInPare(array+i2,buffer+i);
36 i+=i3-1;
37 i2+=i3-1;
38 continue;
39 }
40 if(buffer[i]==cPare_Close){
41 array[i2]=0;
42 break;
43 }
44 array[i2]=buffer[i];
45 }
46 if(buffer[i+1]==cPare_Open){
47 for(i+=2,i2=0;;i++,i2++){
48 if(buffer[i]==cPare_Open){
49 if(cPare_Open=='[') i3=GetStringInBracket(array2+i2,buffer+i);
50 else i3=GetStringInPare(array2+i2,buffer+i);
51 i+=i3-1;
52 i2+=i3-1;
53 continue;
54 }
55 if(buffer[i]==cPare_Close){
56 array2[i2]=0;
57 break;
58 }
59 array2[i2]=buffer[i];
60 }
61 if(buffer[i+1]==cPare_Open){
62 return 0;
63 }
64 }
65 continue;
66 }
67 if(buffer[i]=='.'){
68 lstrcpy(NestMember,buffer+i+1);
69 *pRefType=DEF_OBJECT;
70 buffer[i]=0;
71 break;
72 }
73 if(buffer[i]=='-'&&buffer[i+1]=='>'){
74 lstrcpy(NestMember,buffer+i+2);
75 *pRefType=DEF_PTR_OBJECT;
76 buffer[i]=0;
77 break;
78 }
79 if(buffer[i]=='\0') break;
80 }
81 return 1;
82}
83
84int GetTypeFixed(char *TypeName){
85 if(lstrcmpi(TypeName,"Double")==0) return DEF_DOUBLE;
86 else if(lstrcmpi(TypeName,"Single")==0) return DEF_SINGLE;
87 else if(lstrcmpi(TypeName,"DWORD")==0) return DEF_DWORD;
88 else if(lstrcmpi(TypeName,"Long")==0) return DEF_LONG;
89 else if(lstrcmpi(TypeName,"WORD")==0) return DEF_WORD;
90 else if(lstrcmpi(TypeName,"Integer")==0) return DEF_INTEGER;
91 else if(lstrcmpi(TypeName,"Byte")==0) return DEF_BYTE;
92 else if(lstrcmpi(TypeName,"String")==0) return DEF_STRING;
93 else if(lstrcmpi(TypeName,"Any")==0) return DEF_ANY;
94 else if(lstrcmpi(TypeName,"VoidPtr")==0) return DEF_PTR_VOID;
95 else if(TypeName[0]=='*'){
96 if(TypeName[1]=='*') return DEF_LONG;
97 else return DEF_PTR_OBJECT;
98 }
99 return DEF_OBJECT;
100}
101
102
103
104//////////////////////////////////////////////////////////////
105// ここから、クラス、構造体の即席構文解析を行うための関数郡
106//////////////////////////////////////////////////////////////
107
108BOOL CheckReferType(char *ClassName,BOOL bArray,char *VarArray,int VarRefType){
109 int type;
110
111 type=GetTypeFixed(ClassName);
112 if(!(type==DEF_OBJECT||type==DEF_PTR_OBJECT)) return 0;
113
114
115 //文字"*"を取り除く
116 if(type==DEF_PTR_OBJECT) SlideString(ClassName+1,-1);
117
118 if(type==DEF_OBJECT){
119 //実体オブジェクトを参照するとき
120
121 //配列のチェック
122 if(bArray){
123 if(VarArray[0]=='\0') return 0;
124 }
125 if(VarArray[0]){
126 if(!bArray) return 0;
127 }
128
129 if(type!=VarRefType) return 0;
130 }
131 else if(type==DEF_PTR_OBJECT){
132 //ポインタが示すオブジェクトを参照するとき
133
134 if(bArray){
135 if(VarArray[0]=='\0'||VarRefType==DEF_OBJECT) return 0;
136 }
137 else{
138 if(VarRefType==DEF_OBJECT){
139 //"."参照
140 if(VarArray[0]=='\0') return 0;
141 }
142 else{
143 //"->"参照
144 if(VarArray[0]) return 0;
145 }
146 }
147 }
148
149 return 1;
150}
151
152BOOL GetOriginalClassNameFromBuf(char *pBuf,char *ClassName){
153 int i,i2;
154 char temporary[VN_SIZE];
155
156 for(i=0;;i++){
157 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
158
159 if(memicmp(pBuf+i,"TypeDef",7)==0&&(pBuf[i+7]==' '||pBuf[i+7]=='\t')){
160 i+=8;
161 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
162
163 for(i2=0;;i++,i2++){
164 if(!IsVariableChar(pBuf[i])){
165 temporary[i2]=0;
166 break;
167 }
168 temporary[i2]=pBuf[i];
169 }
170 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
171
172 if(pBuf[i]=='='){
173 if(lstrcmp(temporary,ClassName)==0){
174 //TypeDef宣言の型名が一致したとき
175 i++;
176 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
177 for(i2=0;;i++,i2++){
178 if(!(IsVariableChar(pBuf[i])||pBuf[i]=='*')){
179 temporary[i2]=0;
180 break;
181 }
182 temporary[i2]=pBuf[i];
183 }
184
185 lstrcpy(ClassName,temporary);
186 return 1;
187 }
188 }
189 }
190
191 //次の行をサーチ
192 for(;;i++){
193 i2=IsCommandDelimitation(pBuf,i);
194 if(i2){
195 if(i2==2) i++;
196 break;
197 }
198 }
199
200 if(pBuf[i]=='\0') break;
201 }
202 return 0;
203}
204void GetOriginalClassName(char *ClassName){
205 extern char *pHeaderBuf;
206 extern char *pUserSource;
207 BOOL bRet;
208 int i;
209
210 do{
211 for(i=0;;i++){
212 if(ClassName[i]!='*') break;
213 }
214
215 //ユーザーソースコードからTypeDef宣言をサーチ
216 bRet=GetOriginalClassNameFromBuf(pUserSource,ClassName+i);
217 if(!bRet){
218 //basic.sbpからTypeDef宣言をサーチ
219 bRet=GetOriginalClassNameFromBuf(pHeaderBuf,ClassName+i);
220 }
221 }while(bRet);
222}
223
224int GetClassPos(char *pBuf,char *ClassName,DWORD *pdwClassType){
225 ////////////////////////////////////////////////////////
226 // pBuf内からClassNameと一致するクラスの定義位置を取得
227 ////////////////////////////////////////////////////////
228
229 int i,i2;
230 char temporary[VN_SIZE];
231
232 for(i=0;;i++){
233 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
234
235 if(memicmp(pBuf+i,"Class",5)==0&&(pBuf[i+5]==' '||pBuf[i+5]=='\t')||
236 memicmp(pBuf+i,"Interface",9)==0&&(pBuf[i+9]==' '||pBuf[i+9]=='\t')||
237 memicmp(pBuf+i,"Type",4)==0&&(pBuf[i+4]==' '||pBuf[i+4]=='\t')){
238
239 if(pBuf[i]=='c'||pBuf[i]=='C'){
240 //Class
241 i+=6;
242 *pdwClassType=ESC_CLASS;
243 }
244 else if(pBuf[i]=='i'||pBuf[i]=='I'){
245 //Interface
246 i+=10;
247 *pdwClassType=ESC_INTERFACE;
248 }
249 else{
250 //Type
251 i+=5;
252 *pdwClassType=ESC_TYPE;
253 }
254
255 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
256
257 for(i2=0;;i++,i2++){
258 if(!IsVariableChar(pBuf[i])){
259 temporary[i2]=0;
260 break;
261 }
262 temporary[i2]=pBuf[i];
263 }
264 if(lstrcmp(temporary,ClassName)==0){
265 //クラス名が一致したとき
266
267 for(;;i++){
268 if(pBuf[i]=='\0') break;
269 i2=IsCommandDelimitation(pBuf,i);
270 if(i2){
271 i+=i2;
272 break;
273 }
274 }
275 JumpBlank(pBuf,&i);
276 break;
277 }
278 }
279
280 //次の行をサーチ
281 for(;;i++){
282 i2=IsCommandDelimitation(pBuf,i);
283 if(i2){
284 if(i2==2) i++;
285 break;
286 }
287 }
288
289 if(pBuf[i]=='\0') break;
290 }
291
292 return i;
293}
294BOOL GetClassNameFromClassMember(char *pBuf,int iPos,char *VarName,char *ClassName,BOOL *pbArray){
295 //////////////////////////////////////////////////////
296 // クラス内のメンバ変数のタイプ型であるクラス名の取得
297 //////////////////////////////////////////////////////
298
299 int i,i2;
300 char temporary[8192];
301 DWORD dwProc;
302
303 i=iPos;
304
305 while(1){
306 temporary[0]=0;
307 if(pBuf[i]=='\0') break;
308 if(memicmp(pBuf+i,"End",3)==0){
309 /* End Class
310 End Interface
311 End Type
312 の検出 */
313 i2=i+3;
314 while(pBuf[i2]==' '||pBuf[i2]=='\t') i2++;
315
316 if(memicmp(pBuf+i2,"Class",5)==0&&(!IsVariableChar(pBuf[i2+5]))||
317 memicmp(pBuf+i2,"Interface",9)==0&&(!IsVariableChar(pBuf[i2+9]))||
318 memicmp(pBuf+i2,"Type",4)==0&&(!IsVariableChar(pBuf[i2+4]))) break;
319 }
320
321 if(memicmp(pBuf+i,"Abstract",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')||
322 memicmp(pBuf+i,"Virtual",7)==0&&(pBuf[i+7]==' '||pBuf[i+7]=='\t')||
323 memicmp(pBuf+i,"Override",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')||
324 memicmp(pBuf+i,"Function",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')||
325 memicmp(pBuf+i,"Sub",3)==0&&(pBuf[i+3]==' '||pBuf[i+3]=='\t')){
326 //メンバ関数のとき
327
328 if(pBuf[i]=='a'||pBuf[i]=='A'){
329 i+=9;
330 dwProc=ESC_ABSTRACT;
331 }
332 else{
333
334 if(pBuf[i]=='v'||pBuf[i]=='V'){
335 i+=8;
336 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
337 }
338 else if(pBuf[i]=='o'||pBuf[i]=='O'){
339 i+=9;
340 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
341 }
342
343 if(pBuf[i]=='f'||pBuf[i]=='F'){
344 i+=9;
345 dwProc=ESC_FUNCTION;
346 }
347 else if(pBuf[i]=='s'||pBuf[i]=='S'){
348 i+=4;
349 dwProc=ESC_SUB;
350 }
351 }
352
353 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
354 }
355 else{
356 //メンバ変数のとき
357 dwProc=0;
358 }
359
360 //変数名または関数名を取得
361 for(i2=0;;i++,i2++){
362 if(!IsVariableChar(pBuf[i])){
363 temporary[i2]=0;
364 break;
365 }
366 temporary[i2]=pBuf[i];
367 }
368
369 if(dwProc==0){
370 if(lstrcmp(temporary,VarName)==0) break;
371 }
372
373 //次の行をサーチ
374 for(;;i++){
375 if(pBuf[i]=='\0') break;
376 i2=IsCommandDelimitation(pBuf,i);
377 if(i2){
378 i+=i2;
379 break;
380 }
381 }
382 JumpBlank(pBuf,&i);
383
384 if(dwProc){
385 //Abstract定義以外はEnd Sub、End Functionをサーチする
386 if(dwProc==ESC_ABSTRACT) continue;
387
388 while(1){
389 if(pBuf[i]=='\0') break;
390
391 if(memicmp(pBuf+i,"End",3)==0){
392 /* End Sub
393 End Function
394 の検出 */
395 i+=3;
396 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
397
398 if(memicmp(pBuf+i,"Sub",3)==0&&(!IsVariableChar(pBuf[i+3]))||
399 memicmp(pBuf+i,"Function",8)==0&&(!IsVariableChar(pBuf[i+8]))) break;
400 }
401
402 //次の行をサーチ
403 for(;;i++){
404 if(pBuf[i]=='\0') break;
405 i2=IsCommandDelimitation(pBuf,i);
406 if(i2){
407 i+=i2;
408 break;
409 }
410 }
411 JumpBlank(pBuf,&i);
412 }
413
414 //次の行をサーチ
415 for(;;i++){
416 if(pBuf[i]=='\0') break;
417 i2=IsCommandDelimitation(pBuf,i);
418 if(i2){
419 i+=i2;
420 break;
421 }
422 }
423 JumpBlank(pBuf,&i);
424 }
425 }
426
427 *pbArray=0;
428 if(temporary[0]){
429 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
430 if(pBuf[i]=='['){
431 *pbArray=1;
432 for(i2=1,i++;;i++){
433 if(pBuf[i]=='\0') break;
434 if(pBuf[i]=='[') i2++;
435 if(pBuf[i]==']'){
436 i2--;
437 if(i2==0){
438 i++;
439 break;
440 }
441 }
442 }
443 }
444 if(pBuf[i]=='('){
445 *pbArray=1;
446 for(i2=1,i++;;i++){
447 if(pBuf[i]=='\0') break;
448 if(pBuf[i]=='(') i2++;
449 if(pBuf[i]==')'){
450 i2--;
451 if(i2==0){
452 i++;
453 break;
454 }
455 }
456 }
457 }
458
459 //"As ~" を解析
460 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
461 if(memicmp(pBuf+i,"As",2)==0&&(pBuf[i+2]==' '||pBuf[i+2]=='\t')){
462 i+=3;
463 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
464 for(i2=0;;i++,i2++){
465 if(!(IsVariableChar(pBuf[i])||pBuf[i]=='*')){
466 ClassName[i2]=0;
467 break;
468 }
469 ClassName[i2]=pBuf[i];
470 }
471 }
472 else ClassName[0]=0;
473
474 return 1;
475 }
476 return 0;
477}
478
479void GetCodeAreaType(char *pBuf,int iPos,int *piProcPos,char *NowClass){
480 ///////////////////////////////////////////////
481 // コード領域(グローバル/ローカル)を判定する
482 // ローカル領域のときはpiProcPosに関数の位置を格納する
483 // クラス定義内のときはNowClassにクラス名を格納する
484 ///////////////////////////////////////////////
485 int i,i2;
486
487 *piProcPos=-1;
488 for(i=0;;i++){
489 if(i>=iPos) break;
490
491 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
492
493 if(memicmp(pBuf+i,"Class",5)==0&&(pBuf[i+5]==' '||pBuf[i+5]=='\t')||
494 memicmp(pBuf+i,"Interface",9)==0&&(pBuf[i+9]==' '||pBuf[i+9]=='\t')||
495 memicmp(pBuf+i,"Type",4)==0&&(pBuf[i+4]==' '||pBuf[i+4]=='\t')){
496 //Class、Interface、Type
497 if(pBuf[i]=='c'||pBuf[i]=='C') i+=6;
498 else if(pBuf[i]=='i'||pBuf[i]=='I') i+=10;
499 else i+=5;
500
501 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
502
503 for(i2=0;;i++,i2++){
504 if(!IsVariableChar(pBuf[i])){
505 NowClass[i2]=0;
506 break;
507 }
508 NowClass[i2]=pBuf[i];
509 }
510 }
511 else if(memicmp(pBuf+i,"Sub",3)==0&&(pBuf[i+3]==' '||pBuf[i+3]=='\t')||
512 memicmp(pBuf+i,"Function",8)==0&&(pBuf[i+8]==' '||pBuf[i+8]=='\t')){
513 //Sub、Function
514
515 *piProcPos=i;
516 }
517 else if(memicmp(pBuf+i,"End",3)==0){
518 i+=3;
519 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
520
521 if(memicmp(pBuf+i,"Sub",3)==0&&(!IsVariableChar(pBuf[i+3]))||
522 memicmp(pBuf+i,"Function",8)==0&&(!IsVariableChar(pBuf[i+8]))){
523 //End Sub、End Function
524 *piProcPos=-1;
525 }
526 else if(memicmp(pBuf+i,"Class",5)==0&&(!IsVariableChar(pBuf[i+5]))||
527 memicmp(pBuf+i,"Interface",9)==0&&(!IsVariableChar(pBuf[i+9]))||
528 memicmp(pBuf+i,"Type",4)==0&&(!IsVariableChar(pBuf[i+4]))){
529 //End Class、End Interface、End Type
530 NowClass[0]=0;
531 }
532 }
533
534 //次の行をサーチ
535 for(;;i++){
536 i2=IsCommandDelimitation(pBuf,i);
537 if(i2){
538 if(i2==2) i++;
539 break;
540 }
541 }
542
543 if(pBuf[i]=='\0') break;
544 }
545}
546BOOL GetClassNameFromDim(char *pBuf,int *piPos,char *VarName,char *ClassName,BOOL *pbArray){
547 int i,i2;
548 char temporary[8192];
549
550 i=*piPos;
551
552 while(1){
553 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
554
555 if((memicmp(pBuf+i,"ByRef",5)==0||memicmp(pBuf+i,"ByVal",5)==0)&&
556 (pBuf[i+5]==' '||pBuf[i+5]=='\t')){
557 //ByRef/ByVal表記を飛び越す
558 i+=6;
559 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
560 }
561
562 for(i2=0;;i++,i2++){
563 if(!IsVariableChar(pBuf[i])){
564 temporary[i2]=0;
565 break;
566 }
567 temporary[i2]=pBuf[i];
568 }
569
570 if(lstrcmp(temporary,VarName)==0) break;
571
572 for(;;i++){
573 if(IsCommandDelimitation(pBuf,i)) break;
574 if(pBuf[i]==','){
575 i++;
576 break;
577 }
578 }
579
580 if(IsCommandDelimitation(pBuf,i)){
581 temporary[0]=0;
582 break;
583 }
584 }
585
586 *pbArray=0;
587 if(temporary[0]){
588 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
589 if(pBuf[i]=='['){
590 *pbArray=1;
591 for(i2=1,i++;;i++){
592 if(pBuf[i]=='\0') break;
593 if(pBuf[i]=='[') i2++;
594 if(pBuf[i]==']'){
595 i2--;
596 if(i2==0){
597 i++;
598 break;
599 }
600 }
601 }
602 }
603
604 //"As ~" を解析
605 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
606 if(memicmp(pBuf+i,"As",2)==0&&(pBuf[i+2]==' '||pBuf[i+2]=='\t')){
607 i+=3;
608 while(pBuf[i]==' '||pBuf[i]=='\t') i++;
609 for(i2=0;;i++,i2++){
610 if(!(IsVariableChar(pBuf[i])||pBuf[i]=='*')){
611 ClassName[i2]=0;
612 break;
613 }
614 ClassName[i2]=pBuf[i];
615 }
616 }
617 else ClassName[0]=0;
618
619 *piPos=i;
620 return 1;
621 }
622
623 *piPos=i;
624 return 0;
625}
626BOOL GetVariableClassName(char *pEditBuf,int iPos,char *VarName,char *ClassName,BOOL *pbArray){
627 //////////////////////////////////////////
628 // 変数宣言コードをもとに、クラス名を取得
629 //////////////////////////////////////////
630
631 extern char *pHeaderBuf;
632 extern char *pUserSource;
633 int i,i2;
634 char NowClass[VN_SIZE];
635
636
637 // キャレット位置のコード領域を判定(クラス/ローカル/グローバル)
638 int iProcPos;
639 GetCodeAreaType(pEditBuf,iPos,&iProcPos,NowClass);
640
641
642 //////////////////////////////////////////
643 // 変数宣言コードをもとに、クラス名を取得
644 //////////////////////////////////////////
645
646 if(iProcPos!=-1){
647 //ローカル領域
648 i=iProcPos;
649
650 //関数パラメータをサーチ
651 for(;;i++){
652 if(pEditBuf[i]=='('){
653 i++;
654 if(GetClassNameFromDim(pEditBuf,&i,VarName,ClassName,pbArray)) return 1;
655 }
656
657 i2=IsCommandDelimitation(pEditBuf,i);
658 if(i2){
659 if(pEditBuf[i]=='\0') break;
660 i+=i2;
661 break;
662 }
663 }
664
665 //関数内ソースコードをサーチ
666 for(;;i++){
667 while(pEditBuf[i]==' '||pEditBuf[i]=='\t') i++;
668
669 if(memicmp(pEditBuf+i,"End",3)==0){
670 i+=3;
671 while(pEditBuf[i]==' '||pEditBuf[i]=='\t') i++;
672
673 if(memicmp(pEditBuf+i,"Sub",3)==0&&(!IsVariableChar(pEditBuf[i+3]))||
674 memicmp(pEditBuf+i,"Function",8)==0&&(!IsVariableChar(pEditBuf[i+3]))){
675 break;
676 }
677 }
678 else if(memicmp(pEditBuf+i,"Dim",3)==0&&(pEditBuf[i+3]==' '||pEditBuf[i+3]=='\t')){
679 i+=3;
680
681 if(GetClassNameFromDim(pEditBuf,&i,VarName,ClassName,pbArray)) return 1;
682 }
683 for(;;i++){
684 i2=IsCommandDelimitation(pEditBuf,i);
685 if(i2){
686 if(i2==2) i++;
687 break;
688 }
689 }
690
691 if(pEditBuf[i]=='\0') break;
692 }
693 }
694
695 if(NowClass[0]&&iProcPos!=-1){
696 //クラスメンバ関数領域
697 DWORD dwClassType;
698 char *pBuf;
699 i=GetClassPos(pUserSource,NowClass,&dwClassType);
700 if(pUserSource[i]=='\0'){
701 i=GetClassPos(pHeaderBuf,NowClass,&dwClassType);
702 if(pHeaderBuf[i]=='\0') pBuf=0;
703 else pBuf=pHeaderBuf;
704 }
705 else pBuf=pUserSource;
706
707 if(pBuf){
708 i=GetClassNameFromClassMember(pBuf,i,VarName,ClassName,pbArray);
709 if(i) return 1;
710 }
711 }
712
713 //グローバル領域
714 for(i=0;;i++){
715 while(pUserSource[i]==' '||pUserSource[i]=='\t') i++;
716
717 if(memicmp(pUserSource+i,"Dim",3)==0&&(pUserSource[i+3]==' '||pUserSource[i+3]=='\t')){
718 i+=3;
719
720 if(GetClassNameFromDim(pUserSource,&i,VarName,ClassName,pbArray)) return 1;
721 }
722
723 else if(memicmp(pUserSource+i,"Sub",3)==0&&(pUserSource[i+3]==' '||pUserSource[i+3]=='\t')||
724 memicmp(pUserSource+i,"Function",8)==0&&(pUserSource[i+8]==' '||pUserSource[i+8]=='\t')){
725 //Sub ~ End Sub、Function ~ End Function間を飛び越す
726 while(1){
727 //次の行をサーチ
728 for(;;i++){
729 if(pUserSource[i]=='\0') break;
730 i2=IsCommandDelimitation(pUserSource,i);
731 if(i2){
732 i+=i2;
733 break;
734 }
735 }
736 JumpBlank(pUserSource,&i);
737
738 if(pUserSource[i]=='\0') break;
739
740 if(memicmp(pUserSource+i,"End",3)==0){
741 /* End Sub
742 End Function
743 の検出 */
744 i+=3;
745 while(pUserSource[i]==' '||pUserSource[i]=='\t') i++;
746
747 if(memicmp(pUserSource+i,"Sub",3)==0&&(!IsVariableChar(pUserSource[i+3]))||
748 memicmp(pUserSource+i,"Function",8)==0&&(!IsVariableChar(pUserSource[i+8]))) break;
749 }
750 }
751 }
752
753 //次の行をサーチ
754 for(;;i++){
755 i2=IsCommandDelimitation(pUserSource,i);
756 if(i2){
757 if(i2==2) i++;
758 break;
759 }
760 }
761
762 if(pUserSource[i]=='\0') break;
763 }
764
765 return 0;
766}
Note: See TracBrowser for help on using the repository browser.