bare-quoted-string = DQUOTE *([FWS] qcontent) [FWS] DQUOTE

    A quoted-string without the leading or trailing white space.  Its
    value is the text between the quote marks, with whitespace
    preserved and quoted pairs decoded.
778745
def get_bare_quoted_string(value):
    
    if value[0] != '"':
        raise errors.HeaderParseError(
            "expected '\"' but found '{}'".format(value))
    bare_quoted_string = BareQuotedString()
    value = value[1:]
    while value and value[0] != '"':
        if value[0] in WSP:
            token, value = get_fws(value)
        else:
            token, value = get_qcontent(value)
        bare_quoted_string.append(token)
    if not value:
        bare_quoted_string.defects.append(errors.InvalidHeaderDefect(
            "end of header inside quoted string"))
        return bare_quoted_string, value
    return bare_quoted_string, value[1:]
526201
public final String quoted_string() throws RecognitionException {
        String value = null;


        Token STRING_WITH_QUOTE_DOUBLE6=null;
        Token STRING_WITH_QUOTE7=null;

        try {
            // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:96:3: ( STRING_WITH_QUOTE_DOUBLE | STRING_WITH_QUOTE )
            int alt7=2;
            int LA7_0 = input.LA(1);

            if ( (LA7_0==STRING_WITH_QUOTE_DOUBLE) ) {
                alt7=1;
            }
            else if ( (LA7_0==STRING_WITH_QUOTE) ) {
                alt7=2;
            }
            else {
                NoViableAltException nvae =
                    new NoViableAltException("", 7, 0, input);

                throw nvae;

            }
            switch (alt7) {
                case 1 :
                    // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:96:5: STRING_WITH_QUOTE_DOUBLE
                    {
                    STRING_WITH_QUOTE_DOUBLE6=(Token)match(input,STRING_WITH_QUOTE_DOUBLE,FOLLOW_STRING_WITH_QUOTE_DOUBLE_in_quoted_string288); 


                          String str = (STRING_WITH_QUOTE_DOUBLE6!=null?STRING_WITH_QUOTE_DOUBLE6.getText():null);
                          str = str.substring(1, str.length()-1);
                          value = str.trim();
                        

                    }
                    break;
                case 2 :
                    // C:\\Project\\Obdalib\\obdalib-parent\\obdalib-core\\src\\main\\java\\it\\unibz\\inf\\obda\\gui\\swing\\utils\\MappingFilter.g:101:5: STRING_WITH_QUOTE
                    {
                    STRING_WITH_QUOTE7=(Token)match(input,STRING_WITH_QUOTE,FOLLOW_STRING_WITH_QUOTE_in_quoted_string296); 


                          String str = (STRING_WITH_QUOTE7!=null?STRING_WITH_QUOTE7.getText():null);
                          str = str.substring(1, str.length()-1);
                          value = str.trim();
                        

                    }
                    break;

            }
        }
        catch (RecognitionException re) {
            reportError(re);
            recover(input,re);
        }

        finally {
        	// do for sure before leaving
        }
        return value;
    }
1009940
def quoted(s):
    
    # strip any existing quotes
    s = s.strip(u'"')
    # don't add quotes for minus or leading space
    if s[0] in (u'-', u' '):
        return s
    if u' ' in s or u'/' in s:
        return u'"%s"' % s
    else:
        return s
77629
def encode(self, string):
        
        if isinstance(string, unicode):
            string = string.encode("utf-8")
        return quote(string, safe="~")
1041824
private static String unquote(String s) {
        while (s.startsWith("\"") || s.startsWith("'")) {
            s = s.substring(1);
        }
        while (s.endsWith("\"") || s.endsWith("'")) {
            s = s.substring(0, s.length() - 1);
        }
        return s;
    }
800395
def _parse_and_return_unquoted_string(self):
        
        begin = self.pos
        for end in my_xrange(self.pos, self.end):
            if self.text[end] in self.spaces_and_special_chars:
                break
        else:
            end = self.end
        if begin == end:
            self.error('Expected a scalar here.')
        return self.text[begin:end], False, end
565414
function _stripQuotes(str) {
  const unescaped = str.replace(/\\"/g, '"').replace(/\\'/g, '\'');
  const lastIndex = unescaped.length - 1;
  const first = unescaped.charAt(0);
  const last = unescaped.charAt(lastIndex);

  if (first === last && QUOTES.indexOf(first) >= 0) {
    return unescaped.substring(1, lastIndex);
  }

  return unescaped;
}
1126023
function quotedPair() {
        var qp = wrap('quoted-pair',
        or(
            and(literal('\\'), or(vchar, wsp)),
            obsQP
        )());
        if (qp === null) { return null; }
        // a quoted pair will be two characters, and the "\" character
        // should be semantically "invisible" (RFC 5322 3.2.1)
        qp.semantic = qp.semantic[1];
        return qp;
    }
19019
function makeDoubleQuoted( literal ) {
	if ( ! literal || literal.length < 2 ) {
		return undefined;
	}

	// double-quoted string
	if ( literal.charAt( 0 ) === '"' ) {
		return literal.replace( /(\\)/g, '\\$1' );
	}

	// single-quoted string
	if ( literal.charAt( 0 ) === '\'' ) {
		return '"' + literal.substring( 1, literal.length - 1 ).replace( /\\'/g, '\'' ).replace( /(\\|")/g, '\\$1' ) + '"';
	}

	// ES6 string
	if ( literal.charAt( 0 ) === '`' ) {
		return '"' + literal.substring( 1, literal.length - 1 ).replace( /`/g, '\`' ).replace( /(\\|")/g, '\\$1' ) + '"';
	}

	return "";
}
1029501
function Q_STR(quote) {
        if ('string' != typeof (quote) || 1 != quote.length) {
            throw 'Invalid quote for Q_STR';
        }
        var _parser = SEQ(quote, REPEAT(OR('\\' + quote, '\\\\', '\\/', '\\b', '\\f', '\\n', '\\r', '\\t', '\\u' + REPEAT(HEX_DIGIT(), 4, 4), NOT_IN(quote + '\\'))), quote);
        return _make_alias('Q_STR(' + quote + ')', paka.P.Q_STR, _parser);
    }
110210
private String value(int to){
        while(to>index && Character.isWhitespace(string.charAt(to-1)))
            --to;

        if(string.charAt(index)=='"' && matchingQuote(index)==to-1)
            return quotedString();
        else
            return string.substring(index, to);
    }
1162199
public static String getQuotedString(String st) {
    Preconditions.checkNotNull(st);
    String quotedString = "";
    if (!st.startsWith(SINGLE_QUOTE)) {
      quotedString += SINGLE_QUOTE;
    }
    quotedString += st;
    if (!st.endsWith(SINGLE_QUOTE)) {
      quotedString += SINGLE_QUOTE;
    }
    return quotedString;
  }
1023075
function makeQuotedStringMatcher ( okQuote ) {
  	return function ( parser ) {
  		var literal = '"';
  		var done = false;
  		var next;

  		while ( !done ) {
  			next = ( parser.matchPattern( stringMiddlePattern ) || parser.matchPattern( escapeSequencePattern ) ||
  				parser.matchString( okQuote ) );
  			if ( next ) {
  				if ( next === ("\"") ) {
  					literal += "\\\"";
  				} else if ( next === ("\\'") ) {
  					literal += "'";
  				} else {
  					literal += next;
  				}
  			} else {
  				next = parser.matchPattern( lineContinuationPattern );
  				if ( next ) {
  					// convert \(newline-like) into a \u escape, which is allowed in JSON
  					literal += '\\u' + ( '000' + next.charCodeAt(1).toString(16) ).slice( -4 );
  				} else {
  					done = true;
  				}
  			}
  		}

  		literal += '"';

  		// use JSON.parse to interpret escapes
  		return JSON.parse( literal );
  	};
  }
976881
function(string) {
            // If the string contains no control characters, no quote characters, and no
            // backslash characters, then we can simply slap some quotes around it.
            // Otherwise we must also replace the offending characters with safe
            // sequences.    
            var m = {
                '\b': '\\b',
                '\t': '\\t',
                '\n': '\\n',
                '\f': '\\f',
                '\r': '\\r',
                '"' : '\\"',
                '\\': '\\\\'
            };
            if(/["\\\x00-\x1f]/.test(string)) {
                return '"' + string.replace(/([\x00-\x1f\\"])/g, function(a, b) {
                    var c = m[b];
                    if(c) {
                        return c;
                    }
                    c = b.charCodeAt();
                    return '\\u00' +
                        Math.floor(c / 16).toString(16) +
                        (c % 16).toString(16);
                }) + '"';
            }
            return '"' + string + '"';
        }
412796
def quote_token( str )
      if str.respond_to?(:force_encoding)
        original_encoding = str.encoding
        ascii_str = str.to_s.dup.force_encoding('ASCII-8BIT')
        if token_safe?( ascii_str )
          str
        else
          dquote(ascii_str).force_encoding(original_encoding)
        end
      else
        token_safe?( str ) ? str : dquote(str)
      end
    end
786235
def quote(text):
  ''

  # Convert to unicode.
  if not isinstance(text, unicode):
    text = text.decode('utf-8')

  # Look for quote characters. Keep the text as is if it's already quoted.
  for qp in QUOTEPAIRS:
    if text[0] == qp[0] and text[-1] == qp[-1] and len(text) >= 2:
      return text

  # If it's not quoted, try quoting
  for qp in QUOTEPAIRS:
    if qp[1] not in text:
      return qp[0] + text + qp[1]

  #Darn
  raise ValueError(u'The value "%s" is not quoted and contains too many quote characters to quote' % text)
808203
private String readQuote( char quote ) {
        StringBuilder builder = cachesBuilder;
        builder.setLength( 0 );
        readQuote( quote, builder );
        String str = builder.toString();
        builder.setLength( 0 );
        return str;
    }