source: dev/trunk/ab5.0/abdev/ProjectEditor/analysis.cpp@ 477

Last change on this file since 477 was 475, checked in by dai_9181, 17 years ago

構成管理を変更中・・・(いったんコミット)

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