class_docstr: Synchronize by starting at a line that matches the given regex pattern.
class_docstr_tok: ["Synchronize","by","starting","at","a","line","that","matches","the","given","regex","pattern","."]
docstr: Create a :class:`.RegexSync` instance for this Pygments lexer class.
docstr_tok: ["Create","a",":","class",":","`",".RegexSync","`","instance","for","this","Pygments","lexer","class","."]
code: def from_pygments_lexer_cls(
      cls, lexer_cls: PygmentsLexerCls
  ) -> RegexSync:
      """
      Create a :class:`.RegexSync` instance for this Pygments lexer class.
      """
      patterns = {
          # For Python, start highlighting at any class/def block.
          "Python": r"^\s*(class|def)\s+",
          "Python 3": r"^\s*(class|def)\s+",
          # For HTML, start at any open/close tag definition.
          "HTML": r"<[/a-zA-Z]",
          # For javascript, start at a function.
          "JavaScript": r"\bfunction\b",
          # TODO: Add definitions for other languages.
          #       By default, we start at every possible line.
      }
      p = patterns.get(lexer_cls.name, "^")
      return cls(p)
  
imports: from __future__ import annotations
  import re
  from abc import ABCMeta, abstractmethod
  from typing import TYPE_CHECKING, Callable, Dict, Generator, Iterable, Tuple
  from prompt_toolkit.document import Document
  from prompt_toolkit.filters import FilterOrBool, to_filter
  from prompt_toolkit.formatted_text.base import StyleAndTextTuples
  from prompt_toolkit.formatted_text.utils import split_lines
  from prompt_toolkit.styles.pygments import pygments_token_to_classname
  from .base import Lexer, SimpleLexer
label_desc: Use image node_id 3 for calling the RegexSync obj's underlying member method code with example usage: obj.from_pygments_lexer_cls(cls, lexer_cls) and returns: cls