Subject: Accurate list of Keywords / Datatypes?

From: Robins Tharakan <[email-masked]>
Date: Sun, 8 May 2016 07:23:10 +0530

Hi,

While creating a Syntax Highlighting XML for Notepad++ (something like a
PLSQL one here http://goo.gl/UBbHdt ), I was looking for a list of Keywords
(& separately list of Datatypes) that Postgres uses in a given version (Say
DEVEL branch).

I did find the Reserved Keyword list (
http://www.postgresql.org/docs/devel/static/sql-keywords-appendix.html) but
it doesn't look like what I need, because:

1. The ones marked as 'Reserved' isn't all the words I am interested in
(since these are just 'Reserved')
2. The entire list seems like an overkill (since it has words such as K
and ROUTINE_CATALOG, which aren't really what I'd like highlighted when I
am working on an SQL file in NPP)

Should I be looking somewhere else? Parse keywords from Git Source file (if
so where)? Parse PG Documentation?

I tried ( https://goo.gl/OYeYuE ) parsing HTML Tags (such as VARNAME /
TOKEN / LITERAL / COMMAND) in PG Documentation but is there's a simpler
(more accurate) way for this?

Any pointers would be great!
-
​thanks
robins

---

From: Euler Taveira <[email-masked]>
Date: Sat, 7 May 2016 23:08:46 -0300

On 07-05-2016 22:53, Robins Tharakan wrote:
> Should I be looking somewhere else? Parse keywords from Git Source file
> (if so where)? Parse PG Documentation?
> 
src/include/parser/kwlist.h

-- 
   Euler Taveira                   Timbira - http://www.timbira.com.br/
   PostgreSQL: Consultoria, Desenvolvimento, Suporte 24x7 e Treinamento

-- 
Sent via pgsql-hackers mailing list ([email-masked])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

---

From: "David G. Johnston" <[email-masked]>
Date: Tue, 10 May 2016 18:22:14 -0700

http://www.postgresql.org/docs/9.5/interactive/functions-info.html

SELECT * FROM pg_get_keywords();

I don't know how the docs, this function, and the source code relate to
each other.

David J.

---

From: Michael Paquier <[email-masked]>
Date: Wed, 11 May 2016 11:50:05 +0900

On Wed, May 11, 2016 at 10:22 AM, David G. Johnston
<[email-masked]> wrote:
> I don't know how the docs, this function, and the source code relate to each
> other.

ScanKeywords is fed directly from kwlist.h, have for example a look at
the top of src/common/keywords.c. Then NumScanKeywords is calculated
from the list generated. pg_get_keywords is at the end making use of
those structures generated.
-- 
Michael

---

From: Euler Taveira <[email-masked]>
Date: Tue, 10 May 2016 23:51:44 -0300

> I don't know how the docs, this function, and the source code relate to
Function is built around ScanKeywords structure which in turn is built
using parser/kwlist.h.

---

From: Robins Tharakan <[email-masked]>
Date: Wed, 11 May 2016 09:06:07 +0530

> src/include/parser/kwlist.h

​Thanks Everyone.

Kwlist.h got me going as to where to look, but I had to improvise (quite) a
bit. Any and all advice about any other authoritative lists (like kwlist.h)
would be a big help, since currently much is kludgy.

Created a GitHub Repo in case someone's interested (
https://github.com/robins/npp-lang-plpgsql).

​For PLPGSQL, (src/pl/plpgsql/src/pl_scanner.c)​

For DataTypes, (src/interfaces/ecpg/preproc/c_keywords.c
; src/backend/bootstrap/bootstrap.c) as well as parse all HTML pages under
http://www.postgresql.org/docs/devel/static/datatype.html.

For Config Parameters (recovery.sample.conf ; postgresql.sample.conf) as
well as parse all HTML pages under
http://www.postgresql.org/docs/devel/static/runtime-config.html ;
http://www.postgresql.org/docs/devel/static/libpq-connect.html

For Extensions (Parse HTML:
http://www.postgresql.org/docs/devel/static/contrib.html)

-
robins