On Thu, Aug 28, 2008 at 02:24, Tony Balinski <[EMAIL PROTECTED]> wrote:
> Quoting Bert Wesarg <[EMAIL PROTECTED]>:
>
>> This removes the ugly parsing of the "define" keyword. It solves this by
>> saving and restoring the state of the program accumulation. This solves
>> a long standing problam, that parts between "define" definition aren't
>> in the same scope, i.e. this works now:
>>
>> a = 0
>>
>> define t {
>> }
>>
>> t_print(a "\n")
>>
>>
> ...
> Wow! Well done!
>
> Just to nit-pick: I'd have used a name like ParserContext instead of
> AccumulatorData to store, well, the parser context...
Hmm, I thought about this too, but you don't store the parser context,
the parser still runs with the same context, only the accumulated
program is stored, therefore i haven't named it that way.
I think I found a flaw in my current implementation:
if (bla) {
define t {
}
}
should really throw an error, shouldn't it?
>
> Anyway, this looks pretty cool - I'll have to give it a try. BTW, I think we
> should forbid "define"ing a function that has the same name as a built-in
> function (or a macro-callable action routine, for that matter). Currently you
> can
> define replace_in_string {
> s = ""
> for (i = 1; i <= $n_args; ++i)
> s = s $args[i] "\n"
> dialog(s)
> }
> and so break loads of useful stuff!
That should be easy to fix.
Bert
>
> Tony
--
NEdit Develop mailing list - [email protected]
http://www.nedit.org/mailman/listinfo/develop