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

Last change on this file since 542 was 537, checked in by dai_9181, 17 years ago

UserProcクラスによるコンパイル中関数管理用メソッドを除去(すべてCompilerクラス内で処理するようにした)。

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