Rearrange plpgsql parsing to simplify and speed it up a bit.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 7 Nov 2009 00:52:26 +0000 (00:52 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 7 Nov 2009 00:52:26 +0000 (00:52 +0000)
commitf2b7692e7532dde046b70d0761302356cae9af2b
tree8e8caa0d39c5c4601f2cc26e206454df33887079
parentb79f49c780ac35907392916138475452191412c6
Rearrange plpgsql parsing to simplify and speed it up a bit.

* Pull the responsibility for %TYPE and %ROWTYPE out of the scanner,
letting read_datatype manage it instead.

* Avoid unnecessary scanner-driven lookups of plpgsql variables in
places where it's not needed, which is actually most of the time;
we do not need it in DECLARE sections nor in text that is a SQL
query or expression.

* Rationalize the set of token types returned by the scanner:
distinguishing T_SCALAR, T_RECORD, T_ROW seems to complicate the grammar
in more places than it simplifies it, so merge these into one
token type T_DATUM; but split T_ERROR into T_DBLWORD and T_TRIPWORD
for clarity and simplicity of later processing.

Some of this will need to be revisited again when we try to make
plpgsql use the core scanner, but this patch gets some of the bigger
stumbling blocks out of the way.
src/pl/plpgsql/src/gram.y
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_funcs.c
src/pl/plpgsql/src/plpgsql.h
src/pl/plpgsql/src/scan.l