borela / naomi

Sublime Text enhanced syntax highlighting for JavaScript ES6/ES7/ES2015/ES2016/ES2017+, Babel, FlowType, React JSX, Styled Components, HTML5, SCSS3, PHP 7, phpDoc, PHPUnit, MQL4. Basic: Git config files.
Other
558 stars 18 forks source link

Regex w/ dollar-sign ($) anchor breaks PHP highlighting #202

Open MichaelK-DM opened 5 years ago

MichaelK-DM commented 5 years ago

Regex strings that end with the '$' anchor break syntax highlighting for the remainder of the document. My guess is that this is clashing with rules for variables in double quotes.

screenshot of sublime text 3 with broken syntax highlighting

Here's the code in my example:

<?php

// Highlighting before bug:
function noBug() {
    $regex = "/.*abc/";
    $foo = "foo";
    $bar = "bar";
}

noBug();

// Highlighting including bug
function withBug() {
    $regex = "/.*abc$/";
    $foo = "foo";
    $bar = "bar";
}

$doesItPersistPastThatFunction = "Yes, it does.";

withBug();

function evenIntoAnotherFunction() {
    return "Sure does.";
}

$wouldAnotherValidRegexFixItIt = "/^sadly, no/";

withBug();