class_docstr: Context-sensitive token parsing.
  
  Provides methods to examine the input stream to check whether the next token
  matches.
class_docstr_tok: ["Context-sensitive","token","parsing",".","Provides","methods","to","examine","the","input","stream","to","check","whether","the","next","token","matches","."]
code: def enclosing_tokens(
      self, open_token: str, close_token: str, *, around: str
  ) -> Iterator[None]:
      if self.check(open_token):
          open_position = self.position
          self.read()
      else:
          open_position = None
  
      yield
  
      if open_position is None:
          return
  
      if not self.check(close_token):
          self.raise_syntax_error(
              f"Expected matching {close_token} for {open_token}, after {around}",
              span_start=open_position,
          )
  
      self.read()
  
file_path: py-packaging/src/packaging/_tokenizer.py
imports: import contextlib
  import re
  from dataclasses import dataclass
  from typing import Dict, Iterator, NoReturn, Optional, Tuple, Union
  from .specifiers import Specifier
label_desc: Use image node_id 7 for calling the Tokenizer obj's underlying member method code with example usage: obj.enclosing_tokens(open_token, close_token) without return types