code: public static boolean symbolNeedsQuoting(CharSequence symbol,
                                               boolean      quoteOperators)
      {
          int length = symbol.length();
  
          // If the symbol's text matches an Ion keyword or it's an empty symbol, we must quote it.
          // Eg, the symbol 'false' and '' must be rendered quoted.
          if(length == 0 || isIdentifierKeyword(symbol))
          {
              return true;
          }
  
          char c = symbol.charAt(0);
  
          // Surrogates are neither identifierStart nor operatorPart, so the
          // first one we hit will fall through and return true.
          // TODO test that
  
          if (!quoteOperators && isOperatorPart(c))
          {
              for (int ii = 0; ii < length; ii++) {
                  c = symbol.charAt(ii);
                  // We don't need to look for escapes since all
                  // operator characters are ASCII.
                  if (!isOperatorPart(c)) {
                      return true;
                  }
              }
              return false;
          }
          else if (isIdentifierStart(c))
          {
              for (int ii = 0; ii < length; ii++) {
                  c = symbol.charAt(ii);
                  if ((c == '\'' || c < 32 || c > 126)
                      || !isIdentifierPart(c))
                  {
                      return true;
                  }
              }
              return false;
          }
  
          // quote by default
          return true;
      }
docs: Determines whether the text of a symbol requires (single) quotes.
  
  @param symbol must be a non-empty string.
  @param quoteOperators indicates whether the caller wants operators to be
  quoted; if <code>true</code> then operator symbols like <code>!=</code>
  will return <code>true</code>.
  has looser quoting requirements than other containers.
  @return <code>true</code> if the given symbol requires quoting.
  
  @throws NullPointerException
  if <code>symbol</code> is <code>null</code>.