make comments not confuse the c++ parser
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>
Thu, 1 Aug 2013 09:04:48 +0000 (11:04 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 6 Aug 2013 07:30:33 +0000 (09:30 +0200)
commit9577e0134f6999f7e4f569344982f071e9cc37ff
tree08aadb08abeb63f9a9a224896e08286cf1ef14b2
parent6ada735ac09c4e07adc9f9b40ece76c59713390e
make comments not confuse the c++ parser

comments can appear pretty much everywhere. consequently, handling them
as proper tokens is rather tedious (and was of course not done
consistently, leading to numerous bugs).

so take them out of the token stream and handle magic comments "in the
background".

this necessitates that we use match() a bit more sparingly, as we must
not call getToken() after a "tr()-terminating" token too early, as it
might erroneously collect subsequent magic comments too early otherwise.

Task-number: QTBUG-21876
Change-Id: I3d2168f019dfc06b0778142bcd5eb619b61e6b2d
Reviewed-by: hjk <hjk121@nokiamail.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
src/linguist/lupdate/cpp.cpp