MadcapJake / language-perl6fe

»ö« Atom Perl 6 Support - Forgotten Edition »ö«
https://github.com/perl6/atom-language-perl6
Other
16 stars 3 forks source link

P5 regexes blow up all highlighting #8

Closed zoffixznet closed 8 years ago

zoffixznet commented 8 years ago

Hey,

Perl 6 allows use of Perl 5 regexes by using m:P5 modifier. Unfortunately, the highlighter still attempts to parse them as P6 regexes, with some rather dramatic consequences. In the picture below, you can see how the single quote inside the regex makes all the code that follows the regex to be mis-highlighted.

I suspect making the highlighter correctly highlight Perl 5 regexes might be a lot of work, so I think making it NOT highlight m:P5 regexes as Perl 6 regexes would be a good-enough fix, since at least nothing would be broken.

Here's the picture:

bug1

And here's the actual code:

my $ATTR_RE = m:P5/(?s:(["'])(.*?)\g{-2}|([^>\s]*))/x;

my $horribly-mishighlighted-code = ':(';
MadcapJake commented 8 years ago

Yeah I think the best solution for this might be to just print it as regular text. Is it always the last/only adverb?

zoffixznet commented 8 years ago

Not sure, but probably the answer is yes, since some adverbs don't make sence in P5 regexes.

MadcapJake commented 8 years ago

I'm almost finished with this, but it won't support the /x as I am getting errors in the repl that this is unsupported. So I will need to allow other adverbs then.

zoffixznet commented 8 years ago

Oh, right, the /x is just left over bogus code, sorry.

MadcapJake commented 8 years ago

No problem! Almost done!

MadcapJake commented 8 years ago

Fixed in v1.4.0