code: def p_len(p):
      
      arg = p[2]
      if arg is None:
          p[0] = None
      elif isinstance(arg, symbols.VAR) and arg.class_ == CLASS.array:
          p[0] = make_number(len(arg.bounds), lineno=p.lineno(1))  # Do constant folding
      elif arg.type_ != TYPE.string:
          api.errmsg.syntax_error_expected_string(p.lineno(1), TYPE.to_string(arg.type_))
          p[0] = None
      elif is_string(arg):  # Constant string?
          p[0] = make_number(len(arg.value), lineno=p.lineno(1))  # Do constant folding
      else:
          p[0] = make_builtin(p.lineno(1), 'LEN', arg, type_=TYPE.uinteger)
docs: bexpr : LEN bexpr %prec UMINUS