jsonpath scanner: reentrant scanner
Peter Eisentraut <peter@eisentraut.org>
jsonpath scanner: reentrant scanner Use the flex %option reentrant to make the generated scanner reentrant and thread-safe. Note: The parser was already pure. Simplify flex scan buffer management: Instead of constructing the buffer from pieces and then using yy_scan_buffer(), we can just use yy_scan_string(), which does the same thing internally. (Actually, we use yy_scan_bytes() here because we already have the length.) Use flex yyextra to handle context information, instead of global variables. This complements the other changes to make the scanner reentrant. Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> Reviewed-by: Andreas Karlsson <andreas@proxel.se> Discussion: https://www.postgresql.org/message-id/flat/eb6faeac-2a8a-4b69-9189-c33c520e5b7b@eisentraut.org
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/nls.mk | modified | +1 −1 |
| src/backend/utils/adt/jsonpath_gram.y | modified | +2 −0 |
| src/backend/utils/adt/jsonpath_internal.h | modified | +10 −2 |
| src/backend/utils/adt/jsonpath_scan.l | modified | +132 −151 |
Discussion
- pure parsers and reentrant scanners 25 messages · 2024-12-02 → 2025-01-24