Syntax highlighting parsing for long strings (java, groovy, etc.) fails


I have observed that in Java, Groovy, Fantom, (i.e. any language with strings that allow character escaping) - long strings with many escape sequences in them will fail syntax parsing at a certain length and the rest of the line appears to be ignored.

This causes the rest of the file to be treated as a string until another double-quote to terminate the string is found on another line.

In Java

// This string parses correctly for syntax highlighting
String s = "\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a"

// Add one more \' to the end and it fails and the rest of the file is treated as a String
String sBad  = "\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'a\'"

// Everything is highlighted as string from here on out until another double-quote.


I think you’re facing the issue described in this post:


I think you are right. At least it’s a known issue. Thanks!


Closing in favor of the other topic.