CodeCrafter47 / TabOverlayCommon

GNU General Public License v3.0
1 stars 5 forks source link

Add possible fix for finding tokens in words #13

Closed Andre601 closed 8 months ago

Andre601 commented 8 months ago

The PatternTokenReader has a minor flaw where it can find a matching pattern inside a word, meaning that it isn't truly the pattern, but part of a word.

Giving an example with my username (Andre601), if I was to apply the different token readers on it would the "and" token reader return a success, since it found and inside my name.

With this PR, this hopefully should fix the issue by checking the text length and if the next character after the pattern matches a whitespace (or if the pattern is at the end of a string).

Not sure if my logic here is correct or if I made a mistake anywhere, so testing is recommended and apreciated.

CodeCrafter47 commented 8 months ago

I'm not sure this is something we want to "fix". The issue I see with the fix is that it will require whitespaces between tokens, which has not been required before. Something like ${...}<10 is perfectly fine. To avoid ambiguity, string constants can be put in quotes. I think our examples usually show string constants in quotes, so I don't think the unquoted string constants see a lot of use in the wild.

Andre601 commented 8 months ago

Understandable.