FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

new import syntax

 
Post new topic   Reply to topic     Forum Index -> Build
View previous topic :: View next topic  
Author Message
hasan



Joined: 02 May 2005
Posts: 58

PostPosted: Fri Aug 04, 2006 12:25 am    Post subject: new import syntax Reply with quote

I took a stab at it and made a little modification to the source code of build, namely the function doImport in file source.d line 1163:

Code:

    void doImport (in char[] pFileText, inout int pPos)
    {
        char[] lCurrentToken;
        char[] lModName;
        int lSavedPos;

        while ((lSavedPos = pPos,
                lCurrentToken = GetNextToken (pFileText, pPos)) !is null
                   && (lCurrentToken != ";"))
        {
            if ( (lCurrentToken == ",") && (lModName.length > 0)) {
                mReferencedImports ~= ModuleToFilename(lModName);
                lModName = "";
            }
            else if ( (lCurrentToken == "=") && (lModName.length > 0))
            {
                lModName = "";
            }
            else if( (lCurrentToken == ":") )
            {
                break;
            }
            else {
                lModName ~= lCurrentToken;
            }
        }
        // Don't forget the last one!
        if (lModName.length > 0) {
            mReferencedImports ~= ModuleToFilename(lModName);
        }
        if (lCurrentToken == ";")
            pPos = lSavedPos;
    }


Compiled and tested it on a couple of files and it seems to work.
Back to top
View user's profile Send private message
Derek Parnell



Joined: 22 Apr 2004
Posts: 408
Location: Melbourne, Australia

PostPosted: Fri Aug 04, 2006 2:00 am    Post subject: Re: new import syntax Reply with quote

hasan wrote:
I took a stab at it and made a little modification to the source code of build, namely the function doImport in file source.d line 1163:
...

Compiled and tested it on a couple of files and it seems to work.


Thanks. Very Happy
I was planning to work on this tonight so I can release the next version this weekend. You have saved me some valuable time.
_________________
--
Derek
skype name: derek.j.parnell
Back to top
View user's profile Send private message
hasan



Joined: 02 May 2005
Posts: 58

PostPosted: Fri Aug 04, 2006 2:25 am    Post subject: Re: new import syntax Reply with quote

Derek Parnell wrote:
hasan wrote:
I took a stab at it and made a little modification to the source code of build, namely the function doImport in file source.d line 1163:
...

Compiled and tested it on a couple of files and it seems to work.


Thanks. Very Happy
I was planning to work on this tonight so I can release the next version this weekend. You have saved me some valuable time.

You're welcome!
But please be aware that I didn't test it very much .. so you still have to waste time testing it Razz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Build All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group