source: dev/trunk/abdev/BasicCompiler_Common/Compile.cpp@ 224

Last change on this file since 224 was 206, checked in by dai_9181, 17 years ago

コード全体のリファクタリングを実施

File size: 17.6 KB
Line 
1#include "stdafx.h"
2
3#include <jenga/include/smoothie/Smoothie.h>
4#include <jenga/include/smoothie/LexicalAnalysis.h>
5#include <jenga/include/smoothie/SmoothieException.h>
6
7#include <LexicalScopingImpl.h>
8#include <CodeGenerator.h>
9#include <Compiler.h>
10#include <NamespaceSupporter.h>
11
12#include "../BasicCompiler_Common/common.h"
13
14#ifdef _AMD64_
15#include "../BasicCompiler64/opcode.h"
16#else
17#include "../BasicCompiler32/opcode.h"
18#endif
19
20#include <Exception.h>
21
22//ラベルアドレス
23LABEL *pLabelNames;
24int MaxLabelNum;
25
26//Continueアドレス
27DWORD dwContinueAddress;
28
29//Caseスケジュール
30DWORD *pCaseSchedule;
31int CaseScheduleNum;
32int NowCaseSchedule;
33
34//プロシージャ抜け出しスケジュール(Exit Sub/Function)
35DWORD *pExitSubSchedule;
36int ExitSubScheduleNum;
37
38//Goto未知ラベル スケジュール
39GOTOLABELSCHEDULE *pGotoLabelSchedule;
40int GotoLabelScheduleNum;
41
42//グローバル変数初期バッファ
43BYTE *initGlobalBuf;
44
45//With情報
46WITHINFO WithInfo;
47
48
49
50///////////////////////////////////////////////////
51// トークンを取得
52///////////////////////////////////////////////////
53void GetIdentifierToken( char *token, const char *source, int &pos ){
54 for( int i=0; ; i++, pos++ ){
55 if( ! IsVariableChar( source[pos] ) ){
56 token[i] = 0;
57 break;
58 }
59 token[i] = source[pos];
60 }
61}
62
63
64///////////////////////////////////////////////////
65// 対になっているステートメントを飛び越す
66// ※グローバル領域用
67///////////////////////////////////////////////////
68int JumpStatement(const char *source, int &pos){
69 if( source[pos] != 1 ) return 0;
70
71 if( ! IsCommandDelimitation( source[pos - 1] ) ){
72 //直前がコマンド区切りではない場合
73 return 0;
74 }
75
76 char cStatement = source[pos + 1];
77
78 char cEnd = GetEndXXXCommand( cStatement );
79 if( cEnd == 0 ) return 0;
80
81 pos += 2;
82 while( ! ( source[pos] == 1 && source[pos + 1] == cEnd ) ){
83
84 if( source[pos] == '\0' ){
85 char temporary[64];
86 GetDefaultNameFromES( cStatement, temporary );
87 SetError( 22, temporary, pos );
88 return -1;
89 }
90
91 pos++;
92 }
93 if( ! ( source[pos] == '\0' || source[pos + 2] == '\0' ) ){
94 pos += 2;
95 }
96
97 return 1;
98}
99
100
101void NextLine(void){
102 extern HANDLE hHeap;
103 extern int MaxLineInfoNum;
104 extern LINEINFO *pLineInfo;
105 if(MaxLineInfoNum){
106 if(pLineInfo[MaxLineInfoNum-1].TopObp==obp){
107 pLineInfo[MaxLineInfoNum-1].TopCp=cp;
108 return;
109 }
110 }
111 pLineInfo=(LINEINFO *)HeapReAlloc(hHeap,0,pLineInfo,(MaxLineInfoNum+1)*sizeof(LINEINFO));
112 pLineInfo[MaxLineInfoNum].TopCp=cp;
113 pLineInfo[MaxLineInfoNum].TopObp=obp;
114
115 extern BOOL bDebugSupportProc;
116 extern BOOL bSystemProc;
117 pLineInfo[MaxLineInfoNum].dwCodeType=0;
118 if(bDebugSupportProc)
119 pLineInfo[MaxLineInfoNum].dwCodeType|=CODETYPE_DEBUGPROC;
120 if(bSystemProc)
121 pLineInfo[MaxLineInfoNum].dwCodeType|=CODETYPE_SYSTEMPROC;
122
123 MaxLineInfoNum++;
124}
125
126void ChangeOpcode(char *Command){
127 extern HANDLE hHeap;
128 int i,i2;
129
130 if(Command[0]=='\0')
131 {
132 return;
133 }
134
135 trace_for_sourcecodestep( FormatEscapeSequenceStringToDefaultString(Command) );
136
137 if(Command[0]=='*'&&IsVariableTopChar(Command[1])){
138 //Goto先ラベル
139 pLabelNames=(LABEL *)HeapReAlloc(hHeap,0,pLabelNames,(MaxLabelNum+1)*sizeof(LABEL));
140 pLabelNames[MaxLabelNum].pName=(char *)HeapAlloc(hHeap,0,lstrlen(Command+1)+1);
141 lstrcpy(pLabelNames[MaxLabelNum].pName,Command+1);
142 pLabelNames[MaxLabelNum].address=obp;
143 MaxLabelNum++;
144
145 //書き込みスケジュール
146 for(i=0;i<GotoLabelScheduleNum;i++){
147 if(lstrcmp(pGotoLabelSchedule[i].pName,Command+1)==0){
148 *((long *)(OpBuffer+pGotoLabelSchedule[i].pos))=obp-(pGotoLabelSchedule[i].pos+sizeof(long));
149
150 HeapDefaultFree(pGotoLabelSchedule[i].pName);
151
152 //詰める
153 GotoLabelScheduleNum--;
154 for(i2=i;i2<GotoLabelScheduleNum;i2++){
155 pGotoLabelSchedule[i2].pName=pGotoLabelSchedule[i2+1].pName;
156 pGotoLabelSchedule[i2].line=pGotoLabelSchedule[i2+1].line;
157 pGotoLabelSchedule[i2].pos=pGotoLabelSchedule[i2+1].pos;
158 }
159 i--;
160 continue;
161 }
162 }
163 return;
164 }
165 if(Command[0]==1){
166 switch(Command[1]){
167 case ESC_CONST:
168 OpcodeDim(Command+2, DIMFLAG_CONST);
169 break;
170
171 case ESC_TYPEDEF:
172 if( UserProc::IsLocalAreaCompiling() ){
173 // ローカル領域をコンパイルしているとき
174 SetError(65,"TypeDef",cp );
175 }
176
177 //既に収集済み
178 break;
179
180 case ESC_STATIC:
181 OpcodeDim(Command+2,DIMFLAG_STATIC);
182 break;
183
184 case ESC_IF:
185 OpcodeIf(Command+2);
186 break;
187 case ESC_EXITWHILE:
188 {
189 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_WHILE );
190 if( !pScope ){
191 SetError(12,"Exit While",cp);
192 return;
193 }
194 pScope->Break();
195 }
196 break;
197 case ESC_EXITFOR:
198 {
199 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_FOR );
200 if( !pScope ){
201 SetError(12,"Exit For",cp);
202 return;
203 }
204 pScope->Break();
205 }
206 break;
207 case ESC_EXITDO:
208 {
209 CScope *pScope = GetLexicalScopes().SearchScope( SCOPE_TYPE_DO );
210 if( !pScope ){
211 SetError(12,"Exit Do",cp);
212 return;
213 }
214 pScope->Break();
215 }
216 break;
217 case ESC_CONTINUE:
218 OpcodeContinue();
219 break;
220
221 case ESC_EXITSUB:
222 case ESC_EXITFUNCTION:
223 case ESC_EXITMACRO:
224 OpcodeExitSub();
225 break;
226
227 case ESC_SELECTCASE:
228 OpcodeSelect(Command+2);
229 break;
230 case ESC_CASE:
231 case ESC_CASEELSE:
232 OpcodeCase(Command+2);
233 break;
234
235 case ESC_WITH:
236 extern WITHINFO WithInfo;
237
238 WithInfo.ppName=(char **)HeapReAlloc(hHeap,0,WithInfo.ppName,(WithInfo.num+1)*sizeof(char **));
239 WithInfo.ppName[WithInfo.num]=(char *)HeapAlloc(hHeap,0,lstrlen(Command+2)+1);
240 lstrcpy(WithInfo.ppName[WithInfo.num],Command+2);
241
242 WithInfo.pWithCp=(int *)HeapReAlloc(hHeap,0,WithInfo.pWithCp,(WithInfo.num+1)*sizeof(int));
243 WithInfo.pWithCp[WithInfo.num]=cp;
244
245 WithInfo.num++;
246 break;
247 case ESC_ENDWITH:
248 if(WithInfo.num<=0){
249 SetError(12,"End With",cp);
250 return;
251 }
252 WithInfo.num--;
253 HeapDefaultFree(WithInfo.ppName[WithInfo.num]);
254 break;
255 case ESC_DECLARE:
256 if( UserProc::IsLocalAreaCompiling() ){
257 // ローカル領域をコンパイルしているとき
258 SetError(65,"Declare",cp );
259 }
260 break;
261
262 case ESC_NAMESPACE:
263 compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().push_back( Command + 2 );
264 break;
265 case ESC_ENDNAMESPACE:
266 if( compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().size() <= 0 ){
267 SetError(12,"End Namespace",cp);
268 }
269 compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().pop_back();
270 break;
271 case ESC_IMPORTS:
272 compiler.GetNamespaceSupporter().ImportsNamespace( Command + 2 );
273 break;
274 case ESC_CLEARNAMESPACEIMPORTED:
275 compiler.GetNamespaceSupporter().GetImportedNamespaces().clear();
276 break;
277
278 //Tryによる例外処理
279 case ESC_TRY:
280 Exception::TryCommand();
281 break;
282 case ESC_CATCH:
283 Exception::CatchCommand();
284 break;
285 case ESC_FINALLY:
286 Exception::FinallyCommand();
287 break;
288 case ESC_ENDTRY:
289 Exception::EndTryCommand();
290 break;
291 case ESC_THROW:
292 Exception::ThrowCommand( Command + 2 );
293 break;
294
295 default:
296 char temporary[64];
297 GetDefaultNameFromES(Command[1],temporary);
298 SetError(30,temporary,cp);
299 break;
300 }
301 return;
302 }
303 switch(MAKEWORD(Command[1],Command[0])){
304 case COM_DIM:
305 OpcodeDim(Command+2,0);
306 break;
307 case COM_DELETE:
308 OpcodeDelete(Command+2, false);
309 break;
310 case COM_SWEEPINGDELETE:
311 OpcodeDelete(Command+2, true);
312 break;
313
314 case COM_GOTO:
315 OpcodeGoto(Command+2);
316 break;
317 case COM_WHILE:
318 OpcodeWhile(Command+2);
319 break;
320 case COM_FOR:
321 OpcodeFor(Command+2);
322 break;
323 case COM_DO:
324 OpcodeDo(Command+2);
325 break;
326
327 case COM_GOSUB:
328 OpcodeGosub(Command+2);
329 break;
330 case COM_RETURN:
331 OpcodeReturn(Command+2);
332 break;
333
334 case COM_SETDOUBLE:
335 OpcodeSetPtrData(Command+2,DEF_DOUBLE);
336 break;
337 case COM_SETSINGLE:
338 OpcodeSetPtrData(Command+2,DEF_SINGLE);
339 break;
340 case COM_SETQWORD:
341 OpcodeSetPtrData(Command+2,DEF_QWORD);
342 break;
343 case COM_SETDWORD:
344 OpcodeSetPtrData(Command+2,DEF_DWORD);
345 break;
346 case COM_SETWORD:
347 OpcodeSetPtrData(Command+2,DEF_WORD);
348 break;
349 case COM_SETBYTE:
350 OpcodeSetPtrData(Command+2,DEF_BYTE);
351 break;
352
353 case COM_DEBUG:
354 extern BOOL bDebugCompile;
355 //int 3
356 if(bDebugCompile) OpBuffer[obp++]=(char)0xCC;
357#if defined(_DEBUG)
358 else OpBuffer[obp++]=(char)0xCC;
359#endif
360 break;
361
362 case COM_LET:
363 OpcodeCalc(Command+2);
364 break;
365 default:
366 OpcodeOthers(Command);
367 break;
368 }
369}
370
371void GetGlobalDataForDll(void){
372 extern char *basbuf;
373 extern HANDLE hHeap;
374 int i2,BufferSize;
375 char *Command;
376 DWORD dwRetCode;
377
378 dwRetCode=0;
379 BufferSize=128;
380 Command=(char *)HeapAlloc(hHeap,0,BufferSize);
381 for(cp++,i2=0;;cp++,i2++){
382 if(i2>=BufferSize){
383 //バッファ領域が足りなくなった場合はバッファを増量する
384 BufferSize+=128;
385 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
386 }
387 if(basbuf[cp]=='\"'){
388 Command[i2]=basbuf[cp];
389 for(cp++,i2++;;cp++,i2++){
390 if(i2>=BufferSize){
391 //バッファ領域が足りなくなった場合はバッファを増量する
392 BufferSize+=128;
393 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
394 }
395 Command[i2]=basbuf[cp];
396 if(basbuf[cp]=='\"') break;
397 }
398 continue;
399 }
400 if(IsCommandDelimitation(basbuf[cp])){
401 Command[i2]=0;
402
403 if(Command[0]==1&&Command[1]==ESC_SUB){
404 i2=cp;
405 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDSUB)){
406 if(basbuf[cp]=='\0'){
407 SetError(22,"Sub",i2);
408 break;
409 }
410 cp++;
411 }
412 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
413 cp+=2;
414 i2=-1;
415 continue;
416 }
417 if(Command[0]==1&&Command[1]==ESC_FUNCTION){
418 i2=cp;
419 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDFUNCTION)){
420 if(basbuf[cp]=='\0'){
421 SetError(22,"Function",i2);
422 break;
423 }
424 cp++;
425 }
426 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
427 cp+=2;
428 i2=-1;
429 continue;
430 }
431 if(Command[0]==1&&Command[1]==ESC_MACRO){
432 i2=cp;
433 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDMACRO)){
434 if(basbuf[cp]=='\0'){
435 SetError(22,"Macro",i2);
436 break;
437 }
438 cp++;
439 }
440 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
441 cp+=2;
442 i2=-1;
443 continue;
444 }
445 if(Command[0]==1&&Command[1]==ESC_TYPE){
446 i2=cp;
447 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDTYPE)){
448 if(basbuf[cp]=='\0'){
449 SetError(22,"Type",i2);
450 break;
451 }
452 cp++;
453 }
454 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
455 cp+=2;
456 i2=-1;
457 continue;
458 }
459 if(Command[0]==1&&Command[1]==ESC_CLASS){
460 i2=cp;
461 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDCLASS)){
462 if(basbuf[cp]=='\0'){
463 SetError(22,"Class",i2);
464 break;
465 }
466 cp++;
467 }
468 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
469 cp+=2;
470 i2=-1;
471 continue;
472 }
473 if(Command[0]==1&&Command[1]==ESC_INTERFACE){
474 i2=cp;
475 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDINTERFACE)){
476 if(basbuf[cp]=='\0'){
477 SetError(22,"Interface",i2);
478 break;
479 }
480 cp++;
481 }
482 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
483 cp+=2;
484 i2=-1;
485 continue;
486 }
487
488 //DLLのグローバルデータに必要なコマンドだけ
489 if(MAKEWORD(Command[1],Command[0])==COM_DIM)
490 OpcodeDim(Command+2,0);
491
492 // ネイティブコードバッファの再確保
493 ReallocNativeCodeBuffer();
494
495 if(basbuf[cp]=='\0') break;
496 i2=-1;
497 continue;
498 }
499 Command[i2]=basbuf[cp];
500 }
501 HeapDefaultFree(Command);
502}
503DWORD CompileBuffer(char Return_Sequence,WORD Return_Command){
504 extern char *basbuf;
505 extern HANDLE hHeap;
506 int i,i2,i3,i4,BufferSize,ScopeStart;
507 char *Command,temporary[VN_SIZE],*temp2,temp3[32];
508 DWORD dwRetCode;
509
510 ScopeStart=cp;
511
512 dwRetCode=0;
513 BufferSize=128;
514 Command=(char *)HeapAlloc(hHeap,0,BufferSize);
515
516 for(cp++,i2=0;;cp++,i2++){
517 if(i2>=BufferSize){
518 //バッファ領域が足りなくなった場合はバッファを増量する
519 BufferSize+=128;
520 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
521 }
522 if(basbuf[cp]=='\"'){
523 Command[i2]=basbuf[cp];
524 for(cp++,i2++;;cp++,i2++){
525 if(i2>=BufferSize){
526 //バッファ領域が足りなくなった場合はバッファを増量する
527 BufferSize+=128;
528 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
529 }
530 Command[i2]=basbuf[cp];
531 if(basbuf[cp]=='\"') break;
532 }
533 continue;
534 }
535 if(IsCommandDelimitation(basbuf[cp])){
536 Command[i2]=0;
537
538 if(Command[0]==1&&Command[1]==ESC_LINENUM){
539 for(i=2,i2=0;;i++,i2++){
540 if(Command[i]==','){
541 temporary[i2]=0;
542 break;
543 }
544 temporary[i2]=Command[i];
545 }
546 i3=atoi(temporary);
547 i4=i+1;
548
549 //Goto先ラベル
550 pLabelNames=(LABEL *)HeapReAlloc(hHeap,0,pLabelNames,(MaxLabelNum+1)*sizeof(LABEL));
551 pLabelNames[MaxLabelNum].pName=0;
552 pLabelNames[MaxLabelNum].line=i3;
553 pLabelNames[MaxLabelNum].address=obp;
554 MaxLabelNum++;
555
556 //書き込みスケジュール
557 for(i=0;i<GotoLabelScheduleNum;i++){
558 if(pGotoLabelSchedule[i].pName==0&&
559 pGotoLabelSchedule[i].line==i3){
560 *((long *)(OpBuffer+pGotoLabelSchedule[i].pos))=obp-(pGotoLabelSchedule[i].pos+sizeof(long));
561
562 //詰める
563 GotoLabelScheduleNum--;
564 for(i2=i;i2<GotoLabelScheduleNum;i2++){
565 pGotoLabelSchedule[i2].pName=pGotoLabelSchedule[i2+1].pName;
566 pGotoLabelSchedule[i2].line=pGotoLabelSchedule[i2+1].line;
567 pGotoLabelSchedule[i2].pos=pGotoLabelSchedule[i2+1].pos;
568 }
569 i--;
570 }
571 }
572
573 temp2=(char *)HeapAlloc(hHeap,0,lstrlen(Command+i4)+1);
574 lstrcpy(temp2,Command+i4);
575 lstrcpy(Command,temp2);
576 HeapDefaultFree(temp2);
577 }
578
579 if(Command[0]==1&&
580 (((Command[1]==ESC_VIRTUAL||Command[1]==ESC_OVERRIDE)&&Command[2]==1&&(Command[3]==ESC_SUB||Command[3]==ESC_FUNCTION))||
581 Command[1]==ESC_SUB||
582 Command[1]==ESC_FUNCTION||
583 Command[1]==ESC_MACRO||
584 Command[1]==ESC_TYPE||
585 Command[1]==ESC_CLASS||
586 Command[1]==ESC_INTERFACE||
587 Command[1]==ESC_ENUM||
588 (Command[1]==ESC_CONST&&Command[2]==1&&Command[3]==ESC_ENUM)
589 )
590 ){
591 if(Command[1]==ESC_VIRTUAL||Command[1]==ESC_OVERRIDE||Command[1]==ESC_CONST){
592 GetDefaultNameFromES(Command[3],temporary);
593 }
594 else{
595 GetDefaultNameFromES(Command[1],temporary);
596 }
597 if(Return_Sequence){
598 SetError(12,temporary,cp);
599 break;
600 }
601
602 if(Command[1]==ESC_CONST) i3=GetEndXXXCommand(Command[3]);
603 else i3=GetEndXXXCommand(Command[1]);
604 for(i2=cp;;cp++){
605 if(basbuf[cp]==1){
606 if(basbuf[cp+1]==i3) break;
607 if(Command[1]==ESC_CLASS||Command[1]==ESC_INTERFACE){
608 //クラス、インターフェイスではSub、Functionの定義を可能にしておく
609 if(basbuf[cp+1]==ESC_MACRO||
610 basbuf[cp+1]==ESC_TYPE||
611 basbuf[cp+1]==ESC_CLASS||
612 basbuf[cp+1]==ESC_INTERFACE||
613 basbuf[cp+1]==ESC_ENUM){
614 GetDefaultNameFromES(basbuf[cp+1],temp3);
615 SetError(12,temp3,cp);
616 }
617 }
618 else{
619 if(basbuf[cp-1]!='*'&&(
620 basbuf[cp+1]==ESC_VIRTUAL||
621 basbuf[cp+1]==ESC_OVERRIDE||
622 basbuf[cp+1]==ESC_SUB||
623 basbuf[cp+1]==ESC_FUNCTION||
624 basbuf[cp+1]==ESC_MACRO||
625 basbuf[cp+1]==ESC_TYPE||
626 basbuf[cp+1]==ESC_CLASS||
627 basbuf[cp+1]==ESC_INTERFACE||
628 basbuf[cp+1]==ESC_ENUM)){
629 GetDefaultNameFromES(basbuf[cp+1],temp3);
630 SetError(12,temp3,cp);
631 }
632 }
633 }
634 if(basbuf[cp]=='\0'){
635 //error
636 //既にエラー発行済みのため、何もせずに抜ける
637 break;
638 }
639 }
640 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
641 cp+=2;
642 i2=-1;
643 continue;
644 }
645
646 if(Command[0]==0x10||Command[0]==0x11){
647 //Wend、Next、Loopなど
648 if(Return_Command==MAKEWORD(Command[1],Command[0])){
649 if(Return_Command==COM_NEXT){
650 //Nextの場合は、パラメータ(省略化)の整合性を判断する必要がある(OpcodeFor関数を参照)
651 extern char szNextVariable[VN_SIZE];
652 if(Command[2]) lstrcpy(szNextVariable,Command+2);
653 else szNextVariable[0]=0;
654 }
655 break;
656 }
657 }
658
659 NextLine();
660
661 if(Command[0]==1){
662 if(Return_Sequence==ESC_ENDIF&&Command[1]==ESC_ELSE){
663 dwRetCode=ESC_ELSE;
664 break;
665 }
666
667 if(Command[1]==Return_Sequence){
668 dwRetCode=Command[1];
669 break;
670 }
671 }
672
673 try
674 {
675 ChangeOpcode(Command);
676 }
677 catch( const SmoothieException &smoothieException )
678 {
679 SetError(
680 smoothieException.GetErrorCode(),
681 smoothieException.GetKeyword(),
682 smoothieException.GetNowLine()
683 );
684 }
685
686#ifdef _DEBUG
687 epi_check();
688#endif
689
690 //コンパイルを中断するとき
691 extern BOOL bStopCompile;
692 if(bStopCompile) return 0;
693
694 ReallocNativeCodeBuffer();
695
696 if(basbuf[cp]=='\0'){
697 switch(Return_Command){
698 case COM_WEND:
699 SetError(4,"\"While\" - \"Wend\" ",ScopeStart);
700 break;
701 case COM_NEXT:
702 SetError(4,"\"For\" - \"Next\" ",ScopeStart);
703 break;
704 case COM_LOOP:
705 SetError(4,"\"Do\" - \"Loop\" ",ScopeStart);
706 break;
707 }
708 switch(Return_Sequence){
709 case ESC_ENDSUB:
710 SetError(4,"\"Sub\" - \"End Sub\" ",ScopeStart);
711 break;
712 case ESC_ENDFUNCTION:
713 SetError(4,"\"Function\" - \"End Function\" ",ScopeStart);
714 break;
715 case ESC_ENDMACRO:
716 SetError(4,"\"Macro\" - \"End Macro\" ",ScopeStart);
717 break;
718 case ESC_ENDIF:
719 SetError(22,"If",ScopeStart);
720 break;
721 }
722 break;
723 }
724 i2=-1;
725 continue;
726 }
727 Command[i2]=basbuf[cp];
728 }
729 HeapDefaultFree(Command);
730
731 return dwRetCode;
732}
Note: See TracBrowser for help on using the repository browser.