Skip to main content

parsable

Function parsable 

Source
pub fn parsable(lang: Lang, src: &str) -> Cow<'_, str>
Expand description

The text handed to the parser in place of src: always the same length, byte for byte, so every range found in it is a range in src too.

It papers over constructs tree-sitter-swift 0.7 cannot parse, each of which leaves an error that can swallow the rest of a function:

  • the empty tuple () used as a value (.success(()), resume(returning: ()), value ?? ()) becomes the empty array literal [], which parses there;
  • await opening an if/while/guard condition (if await a != b) is blanked;
  • nonisolated(unsafe) loses its (unsafe).

None of these touch a comment, an import or a logging call’s extent.