Autor: Simon Hobson Data: Para: dng Assunto: Re: [DNG] Studying C as told. (For help)
Peter Olson <peabo@???> wrote:
> What happens with
>
> a = b((7, c[3)])
Unless it's a really strange syntax, IMO that should throw up an error when it hits the ")" after the "3".
Taking a step back a few messages, under what conditions would it not work to recurse down each time an opening tag is found and step back up one level each time a matching closing tag is found ? If "((" is a distinct tag rather than two nested "(" tags, then you'd need to look ahead to differentiate that.
Taking the above, I'd expect it to parse like :
b( - recurse new parser instance, do we impose any restrictions based on context - eg are we expecting a particular type of result ? > ( - recurse new parser instance
>> 7
>> c[ - recurse new parser instance
>>> 3
>>> ) - syntax error, expecting "]"
Or if "((" is a tag, then :
b(( - recurse new parser instance > 7
> c[ - recurse new parser instance
>> 3
>> ) - syntax error, expecting "]"
Of course, rather than true recursion, you could be using a stack or ...