diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2024-12-24 23:42:41 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2024-12-24 23:42:41 +0100 |
commit | 2a7425d7eef9b4b848763fb920fefa23c3c43f31 (patch) | |
tree | a6f6954e2e63ec2ac63f0c2dab6b9f46e617c21f /src/backend/utils/adt/jsonpath_gram.y | |
parent | 9b254895c367a3b962bcdd3e35f8590005106e8a (diff) |
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
Diffstat (limited to 'src/backend/utils/adt/jsonpath_gram.y')
-rw-r--r-- | src/backend/utils/adt/jsonpath_gram.y | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/utils/adt/jsonpath_gram.y b/src/backend/utils/adt/jsonpath_gram.y index 8733a0eac66..de5a455c96d 100644 --- a/src/backend/utils/adt/jsonpath_gram.y +++ b/src/backend/utils/adt/jsonpath_gram.y @@ -60,8 +60,10 @@ static bool makeItemLikeRegex(JsonPathParseItem *expr, %name-prefix="jsonpath_yy" %parse-param {JsonPathParseResult **result} %parse-param {struct Node *escontext} +%parse-param {yyscan_t yyscanner} %lex-param {JsonPathParseResult **result} %lex-param {struct Node *escontext} +%lex-param {yyscan_t yyscanner} %union { |