MCPcopy Create free account
hub / github.com/dolthub/doltgresql / parseElement

Method parseElement

postgres/parser/sem/tree/parse_array.go:127–162  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

125}
126
127func (p *parseState) parseElement() error {
128 var next string
129 var err error
130 r := p.peek()
131 switch r {
132 case '{':
133 return nestedArraysNotSupportedError
134 case '"':
135 p.advance()
136 next, err = p.parseQuotedString()
137 if err != nil {
138 return err
139 }
140 p.advance()
141 default:
142 if !isElementChar(r) {
143 return malformedError
144 }
145 next, err = p.parseUnquotedString()
146 if err != nil {
147 return err
148 }
149 if strings.EqualFold(next, "null") {
150 return p.result.Append(DNull)
151 }
152 }
153
154 d, dependsOnContext, err := ParseAndRequireString(p.t, next, p.ctx)
155 if err != nil {
156 return err
157 }
158 if dependsOnContext {
159 p.dependsOnContext = true
160 }
161 return p.result.Append(d)
162}
163
164// ParseDArrayFromString parses the string-form of constructing arrays, handling
165// cases such as `'{1,2,3}'::INT[]`. The input type t is the type of the

Callers 1

doParseDArrayFromStringFunction · 0.95

Calls 6

peekMethod · 0.95
advanceMethod · 0.95
parseQuotedStringMethod · 0.95
parseUnquotedStringMethod · 0.95
ParseAndRequireStringFunction · 0.85
AppendMethod · 0.45

Tested by

no test coverage detected