compileHighlightPattern function
Compiles a highlighting pattern. If the source uses a regex feature Dart's engine rejects, returns a never-matching pattern so a single bad rule disables itself instead of breaking the whole language.
Implementation
RegExp compileHighlightPattern(
String source, {
bool caseSensitive = true,
bool multiLine = false,
bool dotAll = false,
bool unicode = false,
}) {
try {
return RegExp(
source,
caseSensitive: caseSensitive,
multiLine: multiLine,
dotAll: dotAll,
unicode: unicode,
);
} on FormatException {
return _never;
}
}