Closed ShineyDev closed 5 years ago
The "
-> \'
is a very good catch, thank you.
I question the ?
added to the end of the regex - the point of the regex is only to match comments. This will now match all lines. Is this intended?
as far as i'm aware this regex is the only thing that determines whether a line contains a comment. if this is correct, and a #
is found in the line as anything other than a comment, then this will still be matched as a comment.
if this is intended behavior then i can edit the patch to exclude the optional comment.
@ShineyDev No it's used to color the comment when doing the syntax highlighting, so it should only match if the comment exists.
alright, i've removed the optional comment, is there anything else you'd like me to change?
Nope, this is a great catch :) Thanks for the PR!
i noticed a couple of bugs in the regular expression while testing.
the first bug is found when a line doesn't have a comment but has
#
in a string. the matcher seems to forcefully fetch the#
from inside of the string. proof. to fix this i have made the comment optional.the second bug was introduced because a
"
was put where a'
should have been. this causes a'
delimited string containing a"
to be matched incorrectly. proof. to fix this i have replaced the"
with\'