emacsorphanage / dart-mode

An Emacs mode for the Dart language
GNU General Public License v3.0
15 stars 2 forks source link

Back slashes in raw strings should not be treated as escape characters #99

Closed bradyt closed 5 years ago

bradyt commented 5 years ago

Currently, dart-mode treats back slashes in strings as escape characters. This is incorrect, and causing string syntax highlighting past end of string.

Example from https://github.com/dart-lang/sdk/blob/master/sdk/lib/core/uri.dart.

    if (path.startsWith(r"\\?\")) {
      if (path.startsWith(r"UNC\", 4)) {
        path = path.replaceRange(0, 7, r'\');
      } else {
        path = path.substring(4);
        if (path.length < 3 ||
            path.codeUnitAt(1) != _COLON ||
            path.codeUnitAt(2) != _BACKSLASH) {
          throw new ArgumentError(
              r"Windows paths with \\?\ prefix must be absolute");
        }
      }
    }
bradyt commented 5 years ago

Presumably fixed in https://github.com/bradyt/dart-mode/commit/591b6fee1fbbe58450ab96c2ad17540d503c4abf.