This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: syntax errors
- From: Daniel Marjamäki <daniel dot marjamaki at gmail dot com>
- To: David Malcolm <dmalcolm at redhat dot com>, gcc at gcc dot gnu dot org
- Date: Thu, 3 Jan 2019 18:03:12 +0100
- Subject: Re: syntax errors
Thank you for the quick reply.
> how about "stray %qs token"?
I will change.
> I wonder how much we want to special-case this. Are you thinking about
> the case where there's a stray symbol in the code (perhaps due to a
> stray keypress, or unfinished manual edits)?
At the moment I only think about ) } ]
I would like to focus on only those 3 to start with. but it sounds
good to prepare for more stray tokens later.
> if (c_parser_next_token_is_meaningless_p (parser))
> complain_about_stray_token (parser);
> else
> ...
sure!
> It might make sense to emit a fix-it hint suggesting the removal of the
> stray token.
It is 50% chance that the closing paranthesis should be removed. Maybe
there is a missing "(".
Maybe the error message should indicate that.. something like "either
there is missing "(" or this ")" is a stray token".
Best regards,
Daniel Marjamäki