Re: Support for "break *ADDRESS thread THREADNO"

Maciej W. Rozycki
2005-04-13T16:05:56Z

On Wed, 13 Apr 2005, Daniel Jacobowitz wrote:

> > > I assume so. It is parsed as an expression, not just an address; for
> > > instance "break *thread" would actually work if thread is a pointer to
> > > a function.
> >
> > I think the actual problem is the expression parser cannot be told to
> > stop successfully on an unparseable token as long as the expression
> > collected so far is valid and let the caller deal with that. AFAICS the
> > parser can only stop on a string terminator or optionally a comma,
> > otherwise it issues an error.
>
> And - can yacc do that?

No idea. With bison, according to documentation, the special "error"
token might be a way of implementing that. But I haven't done any real
lex/yacc coding for years, so I'd have to refresh my dusty memory.

> Are you sure that there's no C expression that's valid with and without
> a trailing identifier, by the way? I certainly find that believable,
> but I haven't thought about it too hard.

Well, with C it seems to be true -- I can't recall any expression where a
trailing identifier would be valid if not preceded by either a type cast,
which by itself is not a valid expression, or an operator that accepts a
right-side operand, which cannot be left dangling either. But I'd have to
have a look at the grammar spec to be sure I don't miss any obscure corner
case.

Maciej