MCPcopy Create free account
hub / github.com/apache/cloudberry / plpgsql_yylex

Function plpgsql_yylex

src/pl/plpgsql/src/pl_scanner.c:148–302  ·  view source on GitHub ↗

* This is the yylex routine called from the PL/pgSQL grammar. * It is a wrapper around the core lexer, with the ability to recognize * PL/pgSQL variables and return them as special T_DATUM tokens. If a * word or compound word does not match any variable name, or if matching * is turned off by plpgsql_IdentifierLookup, it is returned as * T_WORD or T_CWORD respectively, or as an unreserved ke

Source from the content-addressed store, hash-verified

146 * matches one of those.
147 */
148int
149plpgsql_yylex(void)
150{
151 int tok1;
152 TokenAuxData aux1;
153 int kwnum;
154
155 tok1 = internal_yylex(&aux1);
156 if (tok1 == IDENT || tok1 == PARAM)
157 {
158 int tok2;
159 TokenAuxData aux2;
160
161 tok2 = internal_yylex(&aux2);
162 if (tok2 == '.')
163 {
164 int tok3;
165 TokenAuxData aux3;
166
167 tok3 = internal_yylex(&aux3);
168 if (tok3 == IDENT)
169 {
170 int tok4;
171 TokenAuxData aux4;
172
173 tok4 = internal_yylex(&aux4);
174 if (tok4 == '.')
175 {
176 int tok5;
177 TokenAuxData aux5;
178
179 tok5 = internal_yylex(&aux5);
180 if (tok5 == IDENT)
181 {
182 if (plpgsql_parse_tripword(aux1.lval.str,
183 aux3.lval.str,
184 aux5.lval.str,
185 &aux1.lval.wdatum,
186 &aux1.lval.cword))
187 tok1 = T_DATUM;
188 else
189 tok1 = T_CWORD;
190 }
191 else
192 {
193 /* not A.B.C, so just process A.B */
194 push_back_token(tok5, &aux5);
195 push_back_token(tok4, &aux4);
196 if (plpgsql_parse_dblword(aux1.lval.str,
197 aux3.lval.str,
198 &aux1.lval.wdatum,
199 &aux1.lval.cword))
200 tok1 = T_DATUM;
201 else
202 tok1 = T_CWORD;
203 }
204 }
205 else

Callers

nothing calls this directly

Calls 7

internal_yylexFunction · 0.85
plpgsql_parse_tripwordFunction · 0.85
push_back_tokenFunction · 0.85
plpgsql_parse_dblwordFunction · 0.85
plpgsql_parse_wordFunction · 0.85
ScanKeywordLookupFunction · 0.85
GetScanKeywordFunction · 0.85

Tested by

no test coverage detected