This patch implements the property lexer.nim.raw.strings.highlight.ident
.
Saw this behaviour implemented in VS Code and thought it could be a useful for users who'd prefer to see generalized raw string identifiers given the same color as the string literal.
Code in the image:
# Standard raw string identifier:
let standardDoubleLitRawStr = R"A raw string\"
let standardTripleLitRawStr = R"""A triple-double raw string\""""
# The style of 'customIdent' is determined by the property state
# of lexer.nim.raw.strings.highlight.ident
let customDoubleLitRawStr = customIdent"A string\"
let customTripleLitRawStr = customIdent"""A triple-double raw string\""""
The patch calls the ctype.h function isalpha on sc.ch which may be out-of-bounds so may cause undefined behaviour. First check with IsASCII or a numeric range check.
Due to the potential for undefined behaviour with the functions declared in ctype.h, its best to avoid it completely.
Good to know. I added the ASCII numeric range check function
IsLetter(const int ch)
in response.The attached is a fresh patch for the feature.
The x.nim.styled looks wrong as there is a {3} at the start of the second comment line despite no intervening style change from the previous {3}. That then fails the check which is based on text equality.
With that fixed, committed as [1eeda6].
Related
Commit: [1eeda6]