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

Last change on this file since 389 was 381, checked in by dai_9181, 17 years ago

Foreach文のパラメータをInで区切るようにした。

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