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

Last change on this file since 752 was 743, checked in by dai, 16 years ago

oldSourceLinesを排除。

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