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

Last change on this file since 497 was 485, checked in by dai_9181, 17 years ago

プロジェクトのリネームが完了

File size: 19.2 KB
Line 
1#include "stdafx.h"
2
3#include <LexicalScope.h>
4#include <CodeGenerator.h>
5#include <Compiler.h>
6#include <NamespaceSupporter.h>
7
8#include "../BasicCompiler_Common/common.h"
9
10#ifdef _AMD64_
11#include "../compiler_x64/opcode.h"
12#else
13#include "../compiler_x86/opcode.h"
14#endif
15
16#include <Exception.h>
17
18//With情報
19WITHINFO WithInfo;
20
21//デバッグ用行番号情報
22SourceLines oldSourceLines;
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( UserProc::IsLocalAreaCompiling() ){
248 // ローカル領域をコンパイルしているとき
249 compiler.errorMessenger.Output(65,"TypeDef",cp );
250 }
251
252 //既に収集済み
253 break;
254
255 case ESC_DELEGATE:
256 if( UserProc::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 extern WITHINFO WithInfo;
321
322 WithInfo.ppName=(char **)HeapReAlloc(hHeap,0,WithInfo.ppName,(WithInfo.num+1)*sizeof(char **));
323 WithInfo.ppName[WithInfo.num]=(char *)HeapAlloc(hHeap,0,lstrlen(Command+2)+1);
324 lstrcpy(WithInfo.ppName[WithInfo.num],Command+2);
325
326 WithInfo.pWithCp=(int *)HeapReAlloc(hHeap,0,WithInfo.pWithCp,(WithInfo.num+1)*sizeof(int));
327 WithInfo.pWithCp[WithInfo.num]=cp;
328
329 WithInfo.num++;
330 break;
331 case ESC_ENDWITH:
332 if(WithInfo.num<=0){
333 compiler.errorMessenger.Output(12,"End With",cp);
334 return;
335 }
336 WithInfo.num--;
337 HeapDefaultFree(WithInfo.ppName[WithInfo.num]);
338 break;
339 case ESC_DECLARE:
340 if( UserProc::IsLocalAreaCompiling() ){
341 // ローカル領域をコンパイルしているとき
342 compiler.errorMessenger.Output(65,"Declare",cp );
343 }
344 break;
345
346 case ESC_NAMESPACE:
347 compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().push_back( Command + 2 );
348 break;
349 case ESC_ENDNAMESPACE:
350 if( compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().size() <= 0 ){
351 compiler.errorMessenger.Output(12,"End Namespace",cp);
352 }
353 compiler.GetNamespaceSupporter().GetLivingNamespaceScopes().pop_back();
354 break;
355 case ESC_IMPORTS:
356 compiler.GetNamespaceSupporter().ImportsNamespace( Command + 2 );
357 break;
358 case ESC_CLEARNAMESPACEIMPORTED:
359 compiler.GetNamespaceSupporter().GetImportedNamespaces().clear();
360 break;
361
362 //Tryによる例外処理
363 case ESC_TRY:
364 Exception::TryCommand();
365 break;
366 case ESC_CATCH:
367 Exception::CatchCommand( Command + 2 );
368 break;
369 case ESC_FINALLY:
370 Exception::FinallyCommand();
371 break;
372 case ESC_ENDTRY:
373 Exception::EndTryCommand();
374 break;
375 case ESC_THROW:
376 Exception::ThrowCommand( Command + 2 );
377 break;
378
379 default:
380 char temporary[64];
381 GetDefaultNameFromES(Command[1],temporary);
382 compiler.errorMessenger.Output(30,temporary,cp);
383 break;
384 }
385 return;
386 }
387 switch(MAKEWORD(Command[1],Command[0])){
388 case COM_DIM:
389 OpcodeDim(Command+2,0);
390 break;
391 case COM_DELETE:
392 OpcodeDelete(Command+2, false);
393 break;
394 case COM_SWEEPINGDELETE:
395 OpcodeDelete(Command+2, true);
396 break;
397
398 case COM_GOTO:
399 OpcodeGoto(Command+2);
400 break;
401 case COM_WHILE:
402 OpcodeWhile(Command+2);
403 break;
404 case COM_FOR:
405 OpcodeFor(Command+2);
406 break;
407 case COM_FOREACH:
408 OpcodeForeach(Command+2);
409 break;
410 case COM_DO:
411 OpcodeDo(Command+2);
412 break;
413
414 case COM_GOSUB:
415 OpcodeGosub(Command+2);
416 break;
417 case COM_RETURN:
418 OpcodeReturn(Command+2);
419 break;
420
421 case COM_SETDOUBLE:
422 OpcodeSetPtrData(Command+2,DEF_DOUBLE);
423 break;
424 case COM_SETSINGLE:
425 OpcodeSetPtrData(Command+2,DEF_SINGLE);
426 break;
427 case COM_SETQWORD:
428 OpcodeSetPtrData(Command+2,DEF_QWORD);
429 break;
430 case COM_SETDWORD:
431 OpcodeSetPtrData(Command+2,DEF_DWORD);
432 break;
433 case COM_SETWORD:
434 OpcodeSetPtrData(Command+2,DEF_WORD);
435 break;
436 case COM_SETBYTE:
437 OpcodeSetPtrData(Command+2,DEF_BYTE);
438 break;
439
440 case COM_DEBUG:
441 //int 3
442 if( compiler.IsDebug() )
443 {
444 breakpoint;
445 }
446 else
447 {
448//#if defined(_DEBUG)
449 breakpoint;
450//#endif
451 }
452 break;
453
454 case COM_LET:
455 OpcodeCalc(Command+2);
456
457 break;
458 default:
459 OpcodeOthers(Command);
460
461 // コード生成過程で発生した構造体の一時メモリを破棄する
462 compiler.codeGenerator.op_FreeTempStructure();
463
464 break;
465 }
466}
467
468void GetGlobalDataForDll(void){
469 extern char *basbuf;
470 extern HANDLE hHeap;
471 int i2,BufferSize;
472 char *Command;
473 DWORD dwRetCode;
474
475 dwRetCode=0;
476 BufferSize=128;
477 Command=(char *)HeapAlloc(hHeap,0,BufferSize);
478 for(cp++,i2=0;;cp++,i2++){
479 if(i2>=BufferSize){
480 //バッファ領域が足りなくなった場合はバッファを増量する
481 BufferSize+=128;
482 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
483 }
484 if(basbuf[cp]=='\"'){
485 Command[i2]=basbuf[cp];
486 for(cp++,i2++;;cp++,i2++){
487 if(i2>=BufferSize){
488 //バッファ領域が足りなくなった場合はバッファを増量する
489 BufferSize+=128;
490 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
491 }
492 Command[i2]=basbuf[cp];
493 if(basbuf[cp]=='\"') break;
494 }
495 continue;
496 }
497 if(IsCommandDelimitation(basbuf[cp])){
498 Command[i2]=0;
499
500 if(Command[0]==1&&Command[1]==ESC_SUB){
501 i2=cp;
502 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDSUB)){
503 if(basbuf[cp]=='\0'){
504 compiler.errorMessenger.Output(22,"Sub",i2);
505 break;
506 }
507 cp++;
508 }
509 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
510 cp+=2;
511 i2=-1;
512 continue;
513 }
514 if(Command[0]==1&&Command[1]==ESC_FUNCTION){
515 i2=cp;
516 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDFUNCTION)){
517 if(basbuf[cp]=='\0'){
518 compiler.errorMessenger.Output(22,"Function",i2);
519 break;
520 }
521 cp++;
522 }
523 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
524 cp+=2;
525 i2=-1;
526 continue;
527 }
528 if(Command[0]==1&&Command[1]==ESC_MACRO){
529 i2=cp;
530 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDMACRO)){
531 if(basbuf[cp]=='\0'){
532 compiler.errorMessenger.Output(22,"Macro",i2);
533 break;
534 }
535 cp++;
536 }
537 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
538 cp+=2;
539 i2=-1;
540 continue;
541 }
542 if(Command[0]==1&&Command[1]==ESC_TYPE){
543 i2=cp;
544 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDTYPE)){
545 if(basbuf[cp]=='\0'){
546 compiler.errorMessenger.Output(22,"Type",i2);
547 break;
548 }
549 cp++;
550 }
551 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
552 cp+=2;
553 i2=-1;
554 continue;
555 }
556 if(Command[0]==1&&Command[1]==ESC_CLASS){
557 i2=cp;
558 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDCLASS)){
559 if(basbuf[cp]=='\0'){
560 compiler.errorMessenger.Output(22,"Class",i2);
561 break;
562 }
563 cp++;
564 }
565 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
566 cp+=2;
567 i2=-1;
568 continue;
569 }
570 if(Command[0]==1&&Command[1]==ESC_INTERFACE){
571 i2=cp;
572 while(!(basbuf[cp]==1&&basbuf[cp+1]==ESC_ENDINTERFACE)){
573 if(basbuf[cp]=='\0'){
574 compiler.errorMessenger.Output(22,"Interface",i2);
575 break;
576 }
577 cp++;
578 }
579 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
580 cp+=2;
581 i2=-1;
582 continue;
583 }
584
585 //DLLのグローバルデータに必要なコマンドだけ
586 if(MAKEWORD(Command[1],Command[0])==COM_DIM)
587 OpcodeDim(Command+2,0);
588
589 if(basbuf[cp]=='\0') break;
590 i2=-1;
591 continue;
592 }
593 Command[i2]=basbuf[cp];
594 }
595 HeapDefaultFree(Command);
596}
597DWORD CompileBuffer(char Return_Sequence,WORD Return_Command){
598 extern char *basbuf;
599 extern HANDLE hHeap;
600 int i,i2,i3,i4,BufferSize,ScopeStart;
601 char *Command,temporary[VN_SIZE],*temp2,temp3[32];
602 DWORD dwRetCode;
603
604 ScopeStart=cp;
605
606 dwRetCode=0;
607 BufferSize=128;
608 Command=(char *)HeapAlloc(hHeap,0,BufferSize);
609
610 for(cp++,i2=0;;cp++,i2++){
611 if(i2>=BufferSize){
612 //バッファ領域が足りなくなった場合はバッファを増量する
613 BufferSize+=128;
614 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
615 }
616 if(basbuf[cp]=='\"'){
617 Command[i2]=basbuf[cp];
618 for(cp++,i2++;;cp++,i2++){
619 if(i2>=BufferSize){
620 //バッファ領域が足りなくなった場合はバッファを増量する
621 BufferSize+=128;
622 Command=(char *)HeapReAlloc(hHeap,0,Command,BufferSize);
623 }
624 Command[i2]=basbuf[cp];
625 if(basbuf[cp]=='\"') break;
626 }
627 continue;
628 }
629 if(IsCommandDelimitation(basbuf[cp])){
630 Command[i2]=0;
631
632 if(Command[0]==1&&Command[1]==ESC_LINENUM){
633 for(i=2,i2=0;;i++,i2++){
634 if(Command[i]==','){
635 temporary[i2]=0;
636 break;
637 }
638 temporary[i2]=Command[i];
639 }
640 i3=atoi(temporary);
641 i4=i+1;
642
643 //Goto先ラベル
644 compiler.codeGenerator.gotoLabels.push_back( GotoLabel( (long)i3, compiler.codeGenerator.GetNativeCodeSize() ) );
645
646 //書き込みスケジュール
647 GotoLabelSchedules::iterator it = compiler.codeGenerator.gotoLabelSchedules.begin();
648 while( it != compiler.codeGenerator.gotoLabelSchedules.end() )
649 {
650 if( (*it)->GetName().size() == 0 && (*it)->GetLineNum() == i3 )
651 {
652 compiler.codeGenerator.opfix_JmpPertialSchedule( (*it) );
653
654 //詰める
655 it = compiler.codeGenerator.gotoLabelSchedules.erase( it );
656 }
657 else
658 {
659 it++;
660 }
661 }
662
663 temp2=(char *)HeapAlloc(hHeap,0,lstrlen(Command+i4)+1);
664 lstrcpy(temp2,Command+i4);
665 lstrcpy(Command,temp2);
666 HeapDefaultFree(temp2);
667 }
668
669 if(Command[0]==1&&
670 (((Command[1]==ESC_VIRTUAL||Command[1]==ESC_OVERRIDE)&&Command[2]==1&&(Command[3]==ESC_SUB||Command[3]==ESC_FUNCTION))||
671 Command[1]==ESC_SUB||
672 Command[1]==ESC_FUNCTION||
673 Command[1]==ESC_MACRO||
674 Command[1]==ESC_TYPE||
675 Command[1]==ESC_CLASS||
676 Command[1]==ESC_INTERFACE||
677 Command[1]==ESC_ENUM||
678 (Command[1]==ESC_CONST&&Command[2]==1&&Command[3]==ESC_ENUM)
679 )
680 ){
681 if(Command[1]==ESC_VIRTUAL||Command[1]==ESC_OVERRIDE||Command[1]==ESC_CONST){
682 GetDefaultNameFromES(Command[3],temporary);
683 }
684 else{
685 GetDefaultNameFromES(Command[1],temporary);
686 }
687 if(Return_Sequence){
688 compiler.errorMessenger.Output(12,temporary,cp);
689 break;
690 }
691
692 if(Command[1]==ESC_CONST) i3=GetEndXXXCommand(Command[3]);
693 else i3=GetEndXXXCommand(Command[1]);
694 for(i2=cp;;cp++){
695 if(basbuf[cp]==1){
696 if(basbuf[cp+1]==i3) break;
697 if(Command[1]==ESC_CLASS||Command[1]==ESC_INTERFACE){
698 //クラス、インターフェイスではSub、Functionの定義を可能にしておく
699 if(basbuf[cp+1]==ESC_MACRO||
700 basbuf[cp+1]==ESC_TYPE||
701 basbuf[cp+1]==ESC_CLASS||
702 basbuf[cp+1]==ESC_INTERFACE||
703 basbuf[cp+1]==ESC_ENUM){
704 GetDefaultNameFromES(basbuf[cp+1],temp3);
705 compiler.errorMessenger.Output(12,temp3,cp);
706 }
707 }
708 else{
709 if(basbuf[cp-1]!='*'&&(
710 basbuf[cp+1]==ESC_VIRTUAL||
711 basbuf[cp+1]==ESC_OVERRIDE||
712 basbuf[cp+1]==ESC_SUB||
713 basbuf[cp+1]==ESC_FUNCTION||
714 basbuf[cp+1]==ESC_MACRO||
715 basbuf[cp+1]==ESC_TYPE||
716 basbuf[cp+1]==ESC_CLASS||
717 basbuf[cp+1]==ESC_INTERFACE||
718 basbuf[cp+1]==ESC_ENUM)){
719 GetDefaultNameFromES(basbuf[cp+1],temp3);
720 compiler.errorMessenger.Output(12,temp3,cp);
721 }
722 }
723 }
724 if(basbuf[cp]=='\0'){
725 //error
726 //既にエラー発行済みのため、何もせずに抜ける
727 break;
728 }
729 }
730 if(basbuf[cp+2]=='\0'||basbuf[cp]=='\0') break;
731 cp+=2;
732 i2=-1;
733 continue;
734 }
735
736 if(Command[0]==0x10||Command[0]==0x11){
737 //Wend、Next、Loopなど
738 if(Return_Command==MAKEWORD(Command[1],Command[0])){
739 if(Return_Command==COM_NEXT){
740 //Nextの場合は、パラメータ(省略化)の整合性を判断する必要がある(OpcodeFor関数を参照)
741 extern char szNextVariable[VN_SIZE];
742 if(Command[2]) lstrcpy(szNextVariable,Command+2);
743 else szNextVariable[0]=0;
744 }
745 break;
746 }
747 }
748
749 compiler.codeGenerator.NextSourceLine();
750
751 if(Command[0]==1){
752 if(Return_Sequence==ESC_ENDIF&&Command[1]==ESC_ELSE){
753 dwRetCode=ESC_ELSE;
754 break;
755 }
756
757 if(Command[1]==Return_Sequence){
758 dwRetCode=Command[1];
759 break;
760 }
761 }
762
763 ChangeOpcode(Command);
764
765
766 epi_check();
767
768
769 //コンパイルを中断するとき
770 extern BOOL bStopCompile;
771 if(bStopCompile) return 0;
772
773 if(basbuf[cp]=='\0'){
774 switch(Return_Command){
775 case COM_WEND:
776 compiler.errorMessenger.Output(4,"\"While\" - \"Wend\" ",ScopeStart);
777 break;
778 case COM_NEXT:
779 compiler.errorMessenger.Output(4,"\"For\" - \"Next\" ",ScopeStart);
780 break;
781 case COM_LOOP:
782 compiler.errorMessenger.Output(4,"\"Do\" - \"Loop\" ",ScopeStart);
783 break;
784 }
785 switch(Return_Sequence){
786 case ESC_ENDSUB:
787 compiler.errorMessenger.Output(4,"\"Sub\" - \"End Sub\" ",ScopeStart);
788 break;
789 case ESC_ENDFUNCTION:
790 compiler.errorMessenger.Output(4,"\"Function\" - \"End Function\" ",ScopeStart);
791 break;
792 case ESC_ENDMACRO:
793 compiler.errorMessenger.Output(4,"\"Macro\" - \"End Macro\" ",ScopeStart);
794 break;
795 case ESC_ENDIF:
796 compiler.errorMessenger.Output(22,"If",ScopeStart);
797 break;
798 }
799 break;
800 }
801 i2=-1;
802 continue;
803 }
804 Command[i2]=basbuf[cp];
805 }
806 HeapDefaultFree(Command);
807
808 return dwRetCode;
809}
Note: See TracBrowser for help on using the repository browser.