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","."]
docstr: Expect a certain token name next, failing with a syntax error otherwise.
  
  The token is *not* read.
docstr_tok: ["Expect","a","certain","token","name","next",",","failing","with","a","syntax","error","otherwise",".","The","token","is","*","not","*","read","."]
code: def expect(self, name: str, *, expected: str) -> Token:
      """Expect a certain token name next, failing with a syntax error otherwise.
  
      The token is *not* read.
      """
      if not self.check(name):
          raise self.raise_syntax_error(f"Expected {expected}")
      return 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 4 for calling the Tokenizer obj's underlying member method code with example usage: obj.expect(name) and returns: self