source: dev/trunk/ab5.0/abdev/BasicCompiler_Common/Compile.cpp@ 688

Last change on this file since 688 was 684, checked in by dai_9181, 16 years ago

・WithInfo周りをリファクタリング。

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