PostgreSQL Source Code: src/bin/psql/psqlscanslash.l File Reference (original) (raw)

116 {

117

120

121

122

123

124

125

126

127

129%}

130

131

132

133

134

135

136{other}|\n { ECHO; }

137

138

139

140

141

142{

143

144

145{space}|"\\" {

146 yyless(0);

149 }

150

151{other} { ECHO; }

152

153}

154

155{

156

157

158

159

160

161

162{space}+ { }

163

164"|" {

166 {

167

169 BEGIN(xslashwholeline);

170 }

171 else

172 {

173

174 yyless(0);

175 BEGIN(xslasharg);

176 }

177 }

178

179{other} {

180 yyless(0);

181 BEGIN(xslasharg);

182 }

183

184}

185

186{

187

188

189

190

191

192

193

194

195{space}|"\\" {

196

197

198

199

200

201

202

203

204

205 yyless(0);

206 cur_state->start_state = YY_START;

208 }

209

210{quote} {

213 BEGIN(xslashquote);

214 }

215

216"`" {

220 BEGIN(xslashbackquote);

221 }

222

223{dquote} {

227 BEGIN(xslashdquote);

228 }

229

230:{variable_char}+ {

231

232 if (cur_state->callbacks->get_variable == NULL)

234 else

235 {

236 char *varname;

238

240 yytext + 1,

242 value = cur_state->callbacks->get_variable(varname,

244 cur_state->cb_passthrough);

245 free(varname);

char * psqlscan_extract_substring(PsqlScanState state, const char *txt, int len)

246

247

248

249

250

251

252

253

255 {

258 }

259 else

void appendPQExpBufferStr(PQExpBuffer str, const char *data)

261

263 }

265 }

266

267:'{variable_char}+' {

272 }

void psqlscan_escape_variable(PsqlScanState state, const char *txt, int len, PsqlScanQuoteType quote)

273

274

275:\"{variable_char}+\" {

280 }

281

282:\{\?{variable_char}+\} {

284 }

void psqlscan_test_variable(PsqlScanState state, const char *txt, int len)

285

286:'{variable_char}* {

287

288 yyless(1);

291 }

292

293:\"{variable_char}* {

294

295 yyless(1);

298 }

299

300:\{\?{variable_char}* {

301

302 yyless(1);

305 }

306

307:\{ {

308

309 yyless(1);

312 }

313

314{other} {

317 }

318

319}

320

321{

322

323

324

325

326

327{quote} { BEGIN(xslasharg); }

328

329{xqdouble} { appendPQExpBufferChar(output_buf, '\''); }

330

331"\\n" { appendPQExpBufferChar(output_buf, '\n'); }

332"\\t" { appendPQExpBufferChar(output_buf, '\t'); }

333"\\b" { appendPQExpBufferChar(output_buf, '\b'); }

334"\\r" { appendPQExpBufferChar(output_buf, '\r'); }

335"\\f" { appendPQExpBufferChar(output_buf, '\f'); }

336

337{xeoctesc} {

338

340 (char) strtol(yytext + 1, NULL, 8));

341 }

void appendPQExpBufferChar(PQExpBuffer str, char ch)

342

343{xehexesc} {

344

346 (char) strtol(yytext + 2, NULL, 16));

347 }

348

349"\\". { psqlscan_emit(cur_state, yytext + 1, 1); }

350

351{other}|\n { ECHO; }

352

353}

354

355{

356

357

358

359

360

361"`" {

362

363 if (cur_state->cb_passthrough == NULL ||

366 BEGIN(xslasharg);

367 }

bool conditional_active(ConditionalStack cstack)

static void evaluate_backtick(PsqlScanState state)

368

369:{variable_char}+ {

370

371 if (cur_state->callbacks->get_variable == NULL)

373 else

374 {

375 char *varname;

377

379 yytext + 1,

381 value = cur_state->callbacks->get_variable(varname,

383 cur_state->cb_passthrough);

384 free(varname);

385

387 {

390 }

391 else

393 }

394 }

395

396:'{variable_char}+' {

399 }

400

401:'{variable_char}* {

402

403 yyless(1);

405 }

406

407{other}|\n { ECHO; }

408

409}

410

411{

412

413

414{dquote} {

416 BEGIN(xslasharg);

417 }

418

419{other}|\n { ECHO; }

420

421}

422

423{

424

425

426

427{space}+ {

428 if (output_buf->len > 0)

430 }

431

432{other} { ECHO; }

433

434}

435

436{

437

438

439"\\\\" {

440 cur_state->start_state = YY_START;

442 }

443

444{other}|\n {

445 yyless(0);

446 cur_state->start_state = YY_START;

448 }

449

450}

451

452<> {

453 if (cur_state->buffer_stack == NULL)

454 {

455 cur_state->start_state = YY_START;

456 return LEXRES_EOL;

457 }

458

459

460

461

462

465 }

void psqlscan_select_top_buffer(PsqlScanState state)

void psqlscan_pop_buffer_stack(PsqlScanState state)

466

467%%