code: def match_trailer(self, tokens, item):
          
          internal_assert(len(tokens) > 1 and len(tokens) % 2 == 1, "invalid trailer match tokens", tokens)
          match, trailers = tokens[0], tokens[1:]
          for i in range(0, len(trailers), 2):
              op, arg = trailers[i], trailers[i + 1]
              if op == "is":
                  self.add_check("_coconut.isinstance(" + item + ", " + arg + ")")
              elif op == "as":
                  if arg in self.names:
                      self.add_check(self.names[arg] + " == " + item)
                  elif arg != wildcard:
                      self.add_def(arg + " = " + item)
                      self.names[arg] = item
              else:
                  raise CoconutInternalException("invalid trailer match operation", op)
          self.match(match, item)
docs: Matches typedefs and as patterns.