Changeset 16 in dev for BasicCompiler_Common/Compile.cpp


Ignore:
Timestamp:
Dec 12, 2006, 4:11:11 AM (17 years ago)
Author:
dai_9181
Message:

グローバル領域外のConst定義を初期段階で収集しないようにしました。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler_Common/Compile.cpp

    r15 r16  
    4848//With情報
    4949WITHINFO WithInfo;
     50
     51
     52///////////////////////////////////////////////////
     53// 対になっているステートメントを飛び越す
     54// ※グローバル領域用
     55///////////////////////////////////////////////////
     56int JumpStatement(const char *source, int &pos){
     57    if( source[pos] != 1 ) return 0;
     58
     59    if( ! IsCommandDelimitation( source[pos - 1] ) ){
     60        //直前がコマンド区切りではない場合
     61        return 0;
     62    }
     63
     64    char cStatement = source[pos + 1];
     65
     66    char cEnd = GetEndXXXCommand( cStatement );
     67    if( cEnd == 0 ) return 0;
     68
     69    pos += 2;
     70    while( ! ( source[pos] == 1 && source[pos + 1] == cEnd ) ){
     71
     72        if( source[pos] == '\0' ){
     73            char temporary[64];
     74            GetDefaultNameFromES( cStatement, temporary );
     75            SetError( 22, temporary, pos );
     76            return -1;
     77        }
     78
     79        pos++;
     80    }
     81    if( ! ( source[pos] == '\0' || source[pos + 2] == '\0' ) ){
     82        pos += 2;
     83    }
     84
     85    return 1;
     86}
    5087
    5188
     
    392429    BufferSize=128;
    393430    Command=(char *)HeapAlloc(hHeap,0,BufferSize);
    394 /*
    395     i = CSource::obj.GetTokenIndex(cp);
    396     CToken *ptoken;
    397     do{
    398         //次のトークン
    399         ptoken = CSource::obj.GetToken(i++);
    400 
    401         //ステップ区切り(改行またはコロン)の場合
    402         while(ptoken->GetType() == TOKEN_DELIMITATION){
    403             ptoken = CSource::obj.GetToken(i++);
    404             continue;
    405         }
    406 
    407         if(ptoken->GetType() == TOKEN_ESCAPESEQUENCE){
    408             ////////////////////////////
    409             // 特殊記号
    410             ////////////////////////////
    411 
    412             if(ptoken->GetExtended() == ESC_LINENUM){
    413 
    414                 //行番号
    415                 ptoken = CSource::obj.GetToken(i++);
    416 
    417                 i3=atoi(ptoken->ToString());
    418                 i4=i+1;
    419 
    420                 //Goto先ラベル
    421                 pLabelNames=(LABEL *)HeapReAlloc(hHeap,0,pLabelNames,(MaxLabelNum+1)*sizeof(LABEL));
    422                 pLabelNames[MaxLabelNum].pName=0;
    423                 pLabelNames[MaxLabelNum].line=i3;
    424                 pLabelNames[MaxLabelNum].address=obp;
    425                 MaxLabelNum++;
    426 
    427                 //書き込みスケジュール
    428                 for(i=0;i<GotoLabelScheduleNum;i++){
    429                     if(pGotoLabelSchedule[i].pName==0&&
    430                         pGotoLabelSchedule[i].line==i3){
    431                         *((long *)(OpBuffer+pGotoLabelSchedule[i].pos))=obp-(pGotoLabelSchedule[i].pos+sizeof(long));
    432 
    433                         //詰める
    434                         GotoLabelScheduleNum--;
    435                         for(i2=i;i2<GotoLabelScheduleNum;i2++){
    436                             pGotoLabelSchedule[i2].pName=pGotoLabelSchedule[i2+1].pName;
    437                             pGotoLabelSchedule[i2].line=pGotoLabelSchedule[i2+1].line;
    438                             pGotoLabelSchedule[i2].pos=pGotoLabelSchedule[i2+1].pos;
    439                         }
    440                         i--;
    441                     }
    442                 }
    443 
    444                 //カンマ
    445                 i++;
    446 
    447                 //次のトークン
    448                 ptoken = CSource::obj.GetToken(i++);
    449             }
    450         }
    451     }while(ptoken->GetType() == TOKEN_EOF);
    452 */
     431
    453432    for(cp++,i2=0;;cp++,i2++){
    454433        if(i2>=BufferSize){
Note: See TracChangeset for help on using the changeset viewer.