code: def parse_type_reference(lexer: Lexer) -> TypeNode:
      
      start = lexer.token
      if expect_optional_token(lexer, TokenKind.BRACKET_L):
          type_ = parse_type_reference(lexer)
          expect_token(lexer, TokenKind.BRACKET_R)
          type_ = ListTypeNode(type=type_, loc=loc(lexer, start))
      else:
          type_ = parse_named_type(lexer)
      if expect_optional_token(lexer, TokenKind.BANG):
          return NonNullTypeNode(type=type_, loc=loc(lexer, start))
      return type_
docs: Type: NamedType or ListType or NonNullType