[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling an INCLUDE directive.

Will Hartung wrote:
> Nah, if you looked at the code, you'll note that this is done it getToken.

If you say so;-)

> Ok, I don't necessarily want you to go into depth here, but I don't clearly
> see the distinction between hanging an Object extra slot off of token and
> having the user maintain a lookup in HashTable.

It's a maintenance issue.  If you want to get rid of some extra info,
you simply drop the reference to the hashtable, instead of walking the
tree to free this info from every single node.  You can browse the
archive for a longer explanation.

> Either way, having the Token
> in the Exception would solve the problem. 

We agree on this.

> ...
> But I suppose if you're against extra information in the Token object,
> you'll probably be opposed to this as well.

You guessed right:-)

> Yeah, I guess we should extend the Lexer contrstuctor to pass it the file
> name.


> No, no...it's truly simple. While running through the token stream it looks
> for the TInclude token, and once in that state, it starts looking for a
> TStringLiteral, and finally a TSemicolon. If anything odd shows up, it just
> dumps them all back to token stream as if nothing happened.

OK.  So, the TInclude token is only visible to the lexer.  That's the
correct way to do it.

> One key thing about the way this Include is done is that it's NOT a
> pre-processor. The Includes are handled during the building of the parse
> tree, rather than before. It doesn't scan the file twice (or more) searching
> for Includes. Also, Includes can be nested to machine limits.


> Sourceforge seems to operating intermittently right now...

I know, but it's not so bad; statistics are wrong, but CVS, bugs,
patches, and mailing lists are working.  These the important things. 
Unless you're telling me that getting a new user ID doesn't work? (which
is possible, as they are changing the authentication process)

Etienne M. Gagnon, M.Sc.                     e-mail: egagnon@j-meg.com
Author of SableCC:                             http://www.sablecc.org/
and SableVM:                                   http://www.sablevm.org/