Scanner/Parser question - what does _P imply?

Started by Nonamealmost 19 years ago5 messages
#1Noname
korryd@enterprisedb.com

I can't find an authoritative answer to this question.

Many of the keywords listed in keywords.c are defined with symbolic
names that end in '_P' (underscore P).

What differentiates those keywords from the other keywords? What does
the 'P' stand for?

Are those PostgreSQL-specific keywords (i.e. keywords not defined by the
SQL standard)?

Thanks.

-- Korry

--
Korry Douglas korryd@enterprisedb.com
EnterpriseDB http://www.enterprisedb.com

#2Noname
korryd@enterprisedb.com
In reply to: Noname (#1)
Re: Scanner/Parser question - what does _P imply?

P = Parser. The reason for the _P is just to avoid conflicts with
other definitions of the macro name, either in our own code or various
platforms' header files. We haven't been totally consistent about it,
but roughly speaking we've stuck _P on when it was either known or
seemed likely that there might be a conflict.

Some years ago there was discussion of consistently P-ifying *all* those
macros, but it didn't get done; I think Thomas or somebody objected that
it would make gram.y needlessly harder to read.

Ahhh... now it's clear.

Thanks.

-- Korry

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Noname (#1)
Re: Scanner/Parser question - what does _P imply?

<korryd@enterprisedb.com> writes:

Many of the keywords listed in keywords.c are defined with symbolic
names that end in '_P' (underscore P).
What differentiates those keywords from the other keywords? What does
the 'P' stand for?

P = Parser. The reason for the _P is just to avoid conflicts with
other definitions of the macro name, either in our own code or various
platforms' header files. We haven't been totally consistent about it,
but roughly speaking we've stuck _P on when it was either known or
seemed likely that there might be a conflict.

Some years ago there was discussion of consistently P-ifying *all* those
macros, but it didn't get done; I think Thomas or somebody objected that
it would make gram.y needlessly harder to read.

regards, tom lane

#4Jan Wieck
JanWieck@Yahoo.com
In reply to: Tom Lane (#3)
Re: Scanner/Parser question - what does _P imply?

On 1/18/2007 10:35 AM, Tom Lane wrote:

<korryd@enterprisedb.com> writes:

Many of the keywords listed in keywords.c are defined with symbolic
names that end in '_P' (underscore P).
What differentiates those keywords from the other keywords? What does
the 'P' stand for?

P = Parser. The reason for the _P is just to avoid conflicts with
other definitions of the macro name, either in our own code or various
platforms' header files. We haven't been totally consistent about it,
but roughly speaking we've stuck _P on when it was either known or
seemed likely that there might be a conflict.

Some years ago there was discussion of consistently P-ifying *all* those
macros, but it didn't get done; I think Thomas or somebody objected that
it would make gram.y needlessly harder to read.

Are there many people who read gram.y on a regular base?

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #

#5Noname
korryd@enterprisedb.com
In reply to: Jan Wieck (#4)
Re: Scanner/Parser question - what does _P imply?

Some years ago there was discussion of consistently P-ifying *all* those
macros, but it didn't get done; I think Thomas or somebody objected that
it would make gram.y needlessly harder to read.

Are there many people who read gram.y on a regular base?

I can't seem to put it down :-)

From the back cover:

A rollercoaster ride of passion, heart-stopping adventures, and
gut-wrenching laughs ... every bit as thrilling as copyfuncs.c,
more of a tearjerker than bufmgr.c, and as deliciously naughty
as MySQL's item.cc.

Get gram.y, in stores now (or order at Amazon.com, delivered in a plain
brown wrapper).

-- Korry