Escaping delimiters does not work with UDL.
-
I have a customized UDL set up for ActionScript 3, wherein I use double quote (") as delimiters for Strings. I have also included the escape character (
\). However, when my code contains Regular Expressions like!/^\/[^\"]*$/, the escape character does not escape the double quote and the entire code after this is styled with the String styler.In
userDefineLang.xmlit appears as<Keywords name="Delimiters">00" 01\ 02" 03' 04\ 05' 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23</Keywords>which seems correct to me.Can anyone help me figure this out? Thanks.
-
Based on your description, I assume you are seeing something akin to

… where the regex starts looking like a quote starts inside.In that example, I also showed examples of how the escape is actually intentended to work: the “Escape” character escapes the various open/close symbols _when embedded between open/close symbols. So
"In \" quotes", it properly treats the\"as being inside the string, not ending the string, and similarly for the single-quote example.Since, based on your
<Keywords...>line, you don’t have regex defined as delimiters, the parser is not in a mode where it knows it needs to escape them.If you define regex wrappers as delimiters as well, like:

… then you can get it to treat the regex as a string:

The reason the quote isn’t starting a string inside the regex is because, by default, UDL doesn’t allow nesting of delimiters, unless you tell it to in the Stylers. This is more obvious if I do the same regex, but with the quotes not escaped:

The quotes are still not treated as string-starters, because the regex delimiters were not defined to allow nesting of the string delimiters.
On the other hand, if you define Delimiter 5 to be
[and\and]and then in the Styler definition you also allow nesting of Delimiters 1 and 2:

… then you can get another example, which shows quotes embedded in brackets, and escaped brackets:

If you escape the quotes when inside brackets, they will not be recognized as embedded quotes anymore:

So I believe these are the kinds of setups you will want. Defining the regex wrappers as delimiters as well should go a long way to giving you what you want, I think.