b4n left a comment (geany/geany#4303)

> I was also considering the subset/superset thing but I'm not sure if it would 
> do the right thing for all kinds of languages. […]

Fair enough, I could indeed see e.g. markup language embedding another one, 
itself embedding the first.  It's a bit unlikely, but still.

Though, as the issue is basically anything that *starts* at the same point (as 
it should basically result in either duplicates (if the end range is 
different), or worse, infinite recursion (if it includes whatever triggered the 
initial one), it's probably safe to just drop those: e.g. only check if the 
initial position is already in some promise for the same language, drop it.

The only case I see then where dropping a promise could be problematic would be 
if the host parser could define specific guest parser options that would alter 
its behavior (meaning calling the same parser on the same range could generate 
different results and promises).  Yet, not only it seems fairly unlikely (not 
sure it's even supported), but it also probably should rather be done another 
way as again it would require a tight and bug-free cooperation with both 
parsers for it not to blow up.

> I was also wondering whether I should compare `sourceLineOffset` but since 
> you don't do it either, it must be the right thing :-).

You're giving me more credit than I'm due :)  I had the same questioning, but 
the values seemed more or less OK without, and other code didn't seem to use it 
for calculating ranges, so… but no, I just knew what @masatake just mentioned, 
of course :grin: (thanks for the explanation BTW)

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/4303#issuecomment-2972662255
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/4303/[email protected]>

Reply via email to