class_docstr: Lexer for the DOS/Windows Batch file format.
  
  .. versionadded:: 0.7
code: def _make_begin_state(
      compound,
      _core_token=_core_token,
      _core_token_compound=_core_token_compound,
      _keyword_terminator=_keyword_terminator,
      _nl=_nl,
      _punct=_punct,
      _string=_string,
      _space=_space,
      _start_label=_start_label,
      _stoken=_stoken,
      _token_terminator=_token_terminator,
      _variable=_variable,
      _ws=_ws,
  ):
      rest = '(?:%s|%s|[^"%%%s%s%s])*' % (
          _string,
          _variable,
          _nl,
          _punct,
          ")" if compound else "",
      )
      rest_of_line = r"(?:(?:[^%s^]|\^[%s]?[\w\W])*)" % (_nl, _nl)
      rest_of_line_compound = r"(?:(?:[^%s^)]|\^[%s]?[^)])*)" % (
          _nl,
          _nl,
      )
      set_space = r"((?:(?:\^[%s]?)?[^\S\n])*)" % _nl
      suffix = ""
      if compound:
          _keyword_terminator = r"(?:(?=\))|%s)" % _keyword_terminator
          _token_terminator = r"(?:(?=\))|%s)" % _token_terminator
          suffix = "/compound"
      return [
          (
              (r"\)", Punctuation, "#pop")
              if compound
              else (
                  r"\)((?=\()|%s)%s"
                  % (_token_terminator, rest_of_line),
                  Comment.Single,
              )
          ),
          (r"(?=%s)" % _start_label, Text, "follow%s" % suffix),
          (_space, using(this, state="text")),
          include("redirect%s" % suffix),
          (r"[%s]+" % _nl, Text),
          (r"\(", Punctuation, "root/compound"),
          (r"@+", Punctuation),
          (
              r"((?:for|if|rem)(?:(?=(?:\^[%s]?)?/)|(?:(?!\^)|"
              r"(?<=m))(?:(?=\()|%s)))(%s?%s?(?:\^[%s]?)?/(?:\^[%s]?)?\?)"
              % (
                  _nl,
                  _token_terminator,
                  _space,
                  _core_token_compound if compound else _core_token,
                  _nl,
                  _nl,
              ),
              bygroups(Keyword, using(this, state="text")),
              "follow%s" % suffix,
          ),
          (
              r"(goto%s)(%s(?:\^[%s]?)?/(?:\^[%s]?)?\?%s)"
              % (_keyword_terminator, rest, _nl, _nl, rest),
              bygroups(Keyword, using(this, state="text")),
              "follow%s" % suffix,
          ),
          (
              words(
                  (
                      "assoc",
                      "break",
                      "cd",
                      "chdir",
                      "cls",
                      "color",
                      "copy",
                      "date",
                      "del",
                      "dir",
                      "dpath",
                      "echo",
                      "endlocal",
                      "erase",
                      "exit",
                      "ftype",
                      "keys",
                      "md",
                      "mkdir",
                      "mklink",
                      "move",
                      "path",
                      "pause",
                      "popd",
                      "prompt",
                      "pushd",
                      "rd",
                      "ren",
                      "rename",
                      "rmdir",
                      "setlocal",
                      "shift",
                      "start",
                      "time",
                      "title",
                      "type",
                      "ver",
                      "verify",
                      "vol",
                  ),
                  suffix=_keyword_terminator,
              ),
              Keyword,
              "follow%s" % suffix,
          ),
          (
              r"(call)(%s?)(:)" % _space,
              bygroups(Keyword, using(this, state="text"), Punctuation),
              "call%s" % suffix,
          ),
          (r"call%s" % _keyword_terminator, Keyword),
          (
              r"(for%s(?!\^))(%s)(/f%s)"
              % (_token_terminator, _space, _token_terminator),
              bygroups(Keyword, using(this, state="text"), Keyword),
              ("for/f", "for"),
          ),
          (
              r"(for%s(?!\^))(%s)(/l%s)"
              % (_token_terminator, _space, _token_terminator),
              bygroups(Keyword, using(this, state="text"), Keyword),
              ("for/l", "for"),
          ),
          (
              r"for%s(?!\^)" % _token_terminator,
              Keyword,
              ("for2", "for"),
          ),
          (
              r"(goto%s)(%s?)(:?)" % (_keyword_terminator, _space),
              bygroups(Keyword, using(this, state="text"), Punctuation),
              "label%s" % suffix,
          ),
          (
              r"(if(?:(?=\()|%s)(?!\^))(%s?)((?:/i%s)?)(%s?)((?:not%s)?)(%s?)"
              % (
                  _token_terminator,
                  _space,
                  _token_terminator,
                  _space,
                  _token_terminator,
                  _space,
              ),
              bygroups(
                  Keyword,
                  using(this, state="text"),
                  Keyword,
                  using(this, state="text"),
                  Keyword,
                  using(this, state="text"),
              ),
              ("(?", "if"),
          ),
          (
              r"rem(((?=\()|%s)%s?%s?.*|%s%s)"
              % (
                  _token_terminator,
                  _space,
                  _stoken,
                  _keyword_terminator,
                  rest_of_line_compound if compound else rest_of_line,
              ),
              Comment.Single,
              "follow%s" % suffix,
          ),
          (
              r"(set%s)%s(/a)" % (_keyword_terminator, set_space),
              bygroups(Keyword, using(this, state="text"), Keyword),
              "arithmetic%s" % suffix,
          ),
          (
              r'(set%s)%s((?:/p)?)%s((?:(?:(?:\^[%s]?)?[^"%s%s^=%s]|'
              r'\^[%s]?[^"=])+)?)((?:(?:\^[%s]?)?=)?)'
              % (
                  _keyword_terminator,
                  set_space,
                  set_space,
                  _nl,
                  _nl,
                  _punct,
                  ")" if compound else "",
                  _nl,
                  _nl,
              ),
              bygroups(
                  Keyword,
                  using(this, state="text"),
                  Keyword,
                  using(this, state="text"),
                  using(this, state="variable"),
                  Punctuation,
              ),
              "follow%s" % suffix,
          ),
          default("follow%s" % suffix),
      ]
  
imports: import re
  from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, include, default, this, using, words, line_re
  from pygments.token import Punctuation, Whitespace, Text, Comment, Operator, Keyword, Name, String, Number, Generic
  from pygments.util import shebang_matches
label_desc: Use image node_id 1 for calling the BatchLexer obj's underlying member method code with example usage: obj._make_begin_state(compound, _core_token, _core_token_compound, _keyword_terminator, _nl, _punct, _string, _space, _start_label, _stoken, _token_terminator, _variable, _ws) and returns: list