Make the hack for finding attribute ranges more robust.

Authored by flherne on Nov 21 2016, 4:23 PM.

Description

Make the hack for finding attribute ranges more robust.

Previously, this would find an incorrect range if the attribute was
immediately followed by a comment containing its name.

e.g. foo.bar #bar would highlight the comment.

This patch ensures that we ignore comments in all cases.
Unfortunately, this introduces a new (much less likely) failure case.

If the expression we're getting the attribute from contains a dot, the
name of the attribute and a hash in that order (not necessarily
consecutive), and the hash is on the same line as the attribute name,
we wrongly interpret the hash as the start of a comment.

For example, foo["...barrier#"].bar will highlight part of the string.

This should be very unlikely to occur in practice.

Differential Revision: https://phabricator.kde.org/D3437

Details