Lines Matching full:quoted

7 // Starlark quoted string utilities.
45 // unquote unquotes the quoted string, returning the actual
46 // string value, whether the original was triple-quoted,
48 func unquote(quoted string) (s string, triple, isByte bool, err error) {
51 if strings.HasPrefix(quoted, "r") {
53 quoted = quoted[1:]
56 if strings.HasPrefix(quoted, "b") {
58 quoted = quoted[1:]
61 if len(quoted) < 2 {
66 if quoted[0] != '"' && quoted[0] != '\'' || quoted[0] != quoted[len(quoted)-1] {
71 // Check for triple quoted string.
72 quote := quoted[0]
73 …if len(quoted) >= 6 && quoted[1] == quote && quoted[2] == quote && quoted[:3] == quoted[len(quoted
75 quoted = quoted[3 : len(quoted)-3]
77 quoted = quoted[1 : len(quoted)-1]
80 // Now quoted is the quoted data, but no quotes.
89 if !strings.ContainsAny(quoted, unquoteChars) {
90 s = quoted
94 // Otherwise process quoted string.
100 i := strings.IndexAny(quoted, unquoteChars)
102 i = len(quoted)
104 buf.WriteString(quoted[:i])
105 quoted = quoted[i:]
107 if len(quoted) == 0 {
112 if quoted[0] == '\r' {
114 if len(quoted) > 1 && quoted[1] == '\n' {
115 quoted = quoted[2:]
117 quoted = quoted[1:]
123 if len(quoted) == 1 {
128 switch quoted[1] {
133 err = fmt.Errorf("invalid escape sequence \\%c", quoted[1])
138 quoted = quoted[2:]
144 buf.WriteByte(unesc[quoted[1]])
145 quoted = quoted[2:]
149 n := int(quoted[1] - '0')
150 quoted = quoted[2:]
152 if len(quoted) == 0 || quoted[0] < '0' || '7' < quoted[0] {
155 n = n*8 + int(quoted[0]-'0')
156 quoted = quoted[1:]
173 if len(quoted) < 4 {
174 err = fmt.Errorf(`truncated escape sequence %s`, quoted)
177 n, err1 := strconv.ParseUint(quoted[2:4], 16, 0)
179 err = fmt.Errorf(`invalid escape sequence %s`, quoted[:4])
184 quoted[:4], n, n)
188 quoted = quoted[4:]
193 if quoted[1] == 'U' {
196 if len(quoted) < sz {
197 err = fmt.Errorf(`truncated escape sequence %s`, quoted)
200 n, err1 := strconv.ParseUint(quoted[2:sz], 16, 0)
202 err = fmt.Errorf(`invalid escape sequence %s`, quoted[:sz])
207 quoted[:sz], n)
216 quoted = quoted[sz:]