MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / doParseDArrayFromString

Function doParseDArrayFromString

pkg/sql/sem/tree/parse_array.go:159–200  ·  view source on GitHub ↗

doParseDArraryFromString does most of the work of ParseDArrayFromString, except the error it returns isn't prettified as a parsing error.

(ctx ParseTimeContext, s string, t *types.T)

Source from the content-addressed store, hash-verified

157// doParseDArraryFromString does most of the work of ParseDArrayFromString,
158// except the error it returns isn't prettified as a parsing error.
159func doParseDArrayFromString(ctx ParseTimeContext, s string, t *types.T) (*DArray, error) {
160 parser := parseState{
161 s: s,
162 ctx: ctx,
163 result: NewDArray(t),
164 t: t,
165 }
166
167 parser.eatWhitespace()
168 if parser.peek() != '{' {
169 return nil, enclosingError
170 }
171 parser.advance()
172 parser.eatWhitespace()
173 if parser.peek() != '}' {
174 if err := parser.parseElement(); err != nil {
175 return nil, err
176 }
177 parser.eatWhitespace()
178 for parser.peek() == ',' {
179 parser.advance()
180 parser.eatWhitespace()
181 if err := parser.parseElement(); err != nil {
182 return nil, err
183 }
184 }
185 }
186 parser.eatWhitespace()
187 if parser.eof() {
188 return nil, enclosingError
189 }
190 if parser.peek() != '}' {
191 return nil, malformedError
192 }
193 parser.advance()
194 parser.eatWhitespace()
195 if !parser.eof() {
196 return nil, extraTextError
197 }
198
199 return parser.result, nil
200}

Callers 1

ParseDArrayFromStringFunction · 0.85

Calls 6

eatWhitespaceMethod · 0.95
peekMethod · 0.95
advanceMethod · 0.95
parseElementMethod · 0.95
eofMethod · 0.95
NewDArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…