git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: b18464f) | patch
plpgsql: pure parser and reentrant scanner
Wed, 8 Jan 2025 08:20:01 +0000 (09:20 +0100)
Wed, 8 Jan 2025 08:22:57 +0000 (09:22 +0100)
commit 7b27f5fd36cb3270e8ac25aefd73b552663d1392
plpgsql: pure parser and reentrant scanner

The plpgsql scanner is a wrapper around the core scanner, which
already uses the flex %option reentrant. This patch only pushes up a
few levels the place where the scanner handle is allocated. Before,
it was allocated in pl_scanner.c in a global variable, so to the
outside the scanner was not reentrant. Now, it is allocated in
pl_comp.c and is passed as an argument to yyparse(), similar to how it
is handled in other reentrant scanners.

Also use flex yyextra to handle context information, instead of global
variables. Again, this uses the existing yyextra support in the core
scanner. This complements the other changes to make the scanner
reentrant.

The bison option %pure-parser is used to make the generated parser
pure. This happens in the usual way, since plpgsql has its own bison
parser definition.

Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/eb6faeac-2a8a-4b69-9189-c33c520e5b7b@eisentraut.org
src/pl/plpgsql/src/nls.mk diff | blob | blame | history
src/pl/plpgsql/src/pl_comp.c diff | blob | blame | history
src/pl/plpgsql/src/pl_gram.y diff | blob | blame | history
src/pl/plpgsql/src/pl_scanner.c diff | blob | blame | history
src/pl/plpgsql/src/plpgsql.h diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /