codearea question

BlitzMax Forums/MaxGUI Module/codearea question

dmaz(Posted 2006) [#1]
http://www.blitzbasic.com/Community/posts.php?topic=63829

ok, I haven't worked as much as wanted to on this the last couple of weeks for 2 reasons. Although I actually have done quite a bit in those 2 weeks I would have liked to have released this around now. the first reason is I was wondering just how far mark and simon went with the ide update that mark spoke of in recent bug threads... the second is I'm kinda a little stuck trying to come up with a way to store the "block" information. Basically, each token needs to know what block it is part of
- when I say block I mean "rem", "end rem" which would be a block that doesn't allow any other blocks. "method", "end method" which can't be outside of a type block, and so on.-

lets just talk about a rem block... if you type rem then any lines below you should be updated to be part of that block... so you mark all lines below until you find an (available) end rem. now if each token points to the block (in my case it points to the token that starts a block, so the "rem" token) that it's contained in. now of course, if when pointing those tokens to the rem block we overwrite the current block we will have a problem.

my solution is to just create a simple single linked list that would store all blocks it's part of in the proper defined order. then when a block is removed search down each list in each token removing the now non-existant block. this will work but it just seems to brute force for me....

anybody have any better ideas?


Mark Tiffany(Posted 2006) [#2]
dmaz, not sure if you solved this on your own already, and apologies for not answering sooner.

Is it really a problem to overwrite the current parent block? Surely the new "rem" will be linked to original parent block anyway?

You can then search from the current position down to find an appropriate end point (EndRem). But you should only update those items that you find are already pointing to the previous parent. If you get to the end of that parent block, and still haven't found an end point, then you know that you've got a duf block (one with a start but no end).

It's awkward to describe in words alone. Maybe an email conversation would work better - drop me an email if you want to talk further...


dmaz(Posted 2006) [#3]
Yeah, that was one of the methods I tried, I didn't really like the code had for that... I've since modified it and added a block type that helps a lot but I'm still not satisfied.