This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Checking variable scope
Daniel Jacobowitz <drow@false.org> writes:
> On Wed, Nov 29, 2006 at 10:44:33AM -0800, Jim Blandy wrote:
>> I'm suggesting that you extend the grammar even further, by allowing
>> one to say things like this (assume there is no binding for 'a' in
>> scope, but there is a binding for 'b' in scope):
>>
>> (gdb) print $in_scope(a)
>> $1 = 0
>> (gdb) print $in_scope(b)
>> $1 = 1
>> (gdb)
>
> Is extending the grammar really necessary? That will already parse;
> it's the same as you'd use for a convenience variable named in_scope
> holding a function pointer.
I think so, because you need to prevent the reference to 'a' from
producing an error when you parse the expression.