ArtsiomCh / CMake

IntelliJ Platform plugin for CMake basic syntax highlight.
https://plugins.jetbrains.com/plugin/10089-cmake-simple-highlighter
GNU General Public License v3.0
44 stars 7 forks source link

string(REGEX) highlighting for character classes containing escaped characters #47

Closed jschwe closed 1 year ago

jschwe commented 1 year ago

When writing a CMake regex such as

string(REGEX MATCH
        "^([a-z0-9_\.]+)-somethingelse$"
        outvar
        "${input}"
        )

The highlighting stops at \ character, with the following message:

Unclosed character class
<literal>, VARIABLE_REFERENCE_START or literal expected, got '\'

My suggestion would to just allow \ in the character class, without checking if it is a valid escape or not, since:

Escaping a non-special character is unnecessary but allowed, e.g. \a matches a. (CMake documentation)

ArtsiomCh commented 1 year ago

Thanks for reporting! It's CLion parser bug (try with CMake Plus plugin disabled). Also seems to be related to CPP-30556 which is marked as solved in upcoming CLion 2023.2 EAP