public static function consume()

in src/inlines/BackslashEscape.php [19:38]


  public static function consume(
    Context $_,
    string $string,
    int $offset,
  ): ?(Inline, int) {
    if ($string[$offset] !== "\\") {
      return null;
    }

    if ($offset === Str\length($string) - 1) {
      return null;
    }

    $next = $string[$offset + 1];
    if (C\contains_key(ASCII_PUNCTUATION, $next)) {
      return tuple(new self($next), $offset + 2);
    }

    return tuple(new self('\\'), $offset + 1);
  }