Changeset 381 in dev for trunk/abdev/BasicCompiler_Common


Ignore:
Timestamp:
Dec 19, 2007, 3:31:03 AM (16 years ago)
Author:
dai_9181
Message:

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

Location:
trunk/abdev/BasicCompiler_Common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/Compile.cpp

    r372 r381  
    4949        }
    5050        token[i] = source[pos];
     51    }
     52}
     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        }
     73
     74        token[i] = source[pos];
     75
     76        if( source[pos] == '\0' )
     77        {
     78            break;
     79        }
    5180    }
    5281}
  • trunk/abdev/BasicCompiler_Common/Intermediate_Step2.cpp

    r372 r381  
    451451        ComNum=COM_FOR;
    452452    }
    453     else if(lstrcmpi(com,"Foreach")==0){
    454         KillSpaces(Command+i,pam);
     453    else if(lstrcmpi(com,"Foreach")==0)
     454    {
     455        for(i2=0,IsStr=0;;i++,i2++)
     456        {
     457            while(Command[i]==' '||Command[i]=='\t') i++;
     458            if(Command[i]=='\"') IsStr^=1;
     459            if((Command[i-1]==' '||Command[i-1]=='\t')&&(Command[i]=='i'||Command[i]=='I')&&(Command[i+1]=='n'||Command[i+1]=='N')&&(Command[i+2]==' '||Command[i+2]=='\t')&&IsStr==0){
     460                pam[i2++] = 1;
     461                pam[i2] = ESC_IN;
     462                break;
     463            }
     464            pam[i2]=Command[i];
     465            if(Command[i]=='\0') break;
     466        }
     467        if(Command[i])
     468        {
     469            lstrcpy( pam + i2 + 1, Command + i + 3 );
     470        }
    455471        ComNum=COM_FOREACH;
    456472    }
  • trunk/abdev/BasicCompiler_Common/common.h

    r350 r381  
    377377void GetIdentifierToken( char *token, const char *source, int &pos );
    378378void GetCommandToken( char *token, const char *source, int &pos );
     379void GetCustomToken( char *token, const char *source, int &pos, char delimitation, bool isEscapeSequence );
    379380void SplitGenericClassInstance( const char *fullName, char *className, Jenga::Common::Strings &typeParameters );
    380381int JumpStatement(const char *source, int &pos);
Note: See TracChangeset for help on using the changeset viewer.