Raku / atom-language

Atom/Github Raku Syntax Highlighting Support 🦋
Other
24 stars 11 forks source link

Regex with braces as delimiters do not properly begin and end #60

Closed zoffixznet closed 7 years ago

zoffixznet commented 7 years ago

I'm using 1.8.0

Example Code

    if $parent {
        while $path ~~ s:g { [^ | <?after '\\'>] <!before '..\\'> <-[\\]>+ '\\..' ['\\' | $ ] } = '' { };
    }
    $path ~~ s/^ '\\'+ //;        # \xx --> xx  NOTE: this is *not* root

Picture [optional]

untitled

Leave this in. For internal use.

zoffixznet commented 7 years ago

After playing with code, the something is the braces on s:g//, changing them to some other delimiter fixes the issue

zoffixznet commented 7 years ago

Oops. I was wrong. It only unbreaks when using something like ♥, but that makes invalid code since we need matching braces in the s{...} = 'something' form

zoffixznet commented 7 years ago

I think I found it now, something to do with all the backslashes. This isn't broken:

        if $parent {
            while $path ~~ s:g { [^ | <?after ï½¢\ï½£>] <!before ï½¢..\ï½£> <-[\\]>+ '\\..' ['\\' | $ ] } = '' { };
        }
samcv commented 7 years ago

This is a duplicate of https://github.com/perl6/atom-language-perl6/issues/56 but i'm going to keep this one open and close the other one.

The problem is that s:g{ } is not highlighting as regex period, and so this wrecks things when it doesn't know it's inside a regex. IF you change them to s:g / / then it all is fine.

samcv commented 7 years ago

Fixed in 1.15.0 which has just been released. :heavy_check_mark: