The problem is, all 6 of these rules are applied to a block of text in the order above …
the idea being numbers would get an attribute, but then if those numbers are inside of QUOTE they would become a string , and lastly if a comment marker was found, the rest of the line would be colored as a comment regardless of the rest
…
But the String and Comment rules are not working
Note : the \ are doubled as a Swift requirement (escaped) ,
TEST is a test keyword, which should be blue when NOT in a string or comment
the entire first line should be PURPLE including the word TEST
the entire 2nd line should be RED , comment is not going to EOL
same with 3rd line comments are either // or ’
on the 4th line, the 1234 and test should be orange and blue, except for the ones following the // those should be red
"quoted test string"
this is a // comment "string"
this is a "string "" with a string" and something after
' this is the other comment
and this is a ' comment as well for the last half
had to modify the string one (unless you want to permit newline and carriage returns in a string ?)
string : “([^”\n\r]|”")*"
" followed by anything just not an embedded newline , carriage return and " has to be doubled up and then "