Re: Standalone Parser for PL/pgSQL
От | Alvaro Herrera |
---|---|
Тема | Re: Standalone Parser for PL/pgSQL |
Дата | |
Msg-id | 20050713210434.GA6201@alvh.no-ip.org обсуждение исходный текст |
Ответ на | Standalone Parser for PL/pgSQL (Matt Miller <mattm@epx.com>) |
Ответы |
Re: Standalone Parser for PL/pgSQL
Re: Standalone Parser for PL/pgSQL |
Список | pgsql-general |
On Wed, Jul 13, 2005 at 08:33:59PM +0000, Matt Miller wrote: > I'd like (to find or make) a utility that inputs the code of a Pl/pgSQL > function (e.g. from a text file or from STDIN, and then parses the > function definition, building a complete symbol table. I would then > write C code that walks that symbol table and does stuff. As a starting > point I'd be happy if I could just visit each node in the symbol table > and dump that node out to another file. > > I'm thinking that the code in src/pl/plpgsql/src is where to start, but > I need some guidance sorting through that stuff. I understand (in > theory, anyway) how flex and bison work, so maybe I just need a bit of > hand-holding to get a simple standalone PL/pgSQL parser up and running. I don't think you can use just plpgsql's parser. The problem is that it relies on the main backend parser to figure out anything it doesn't understand. So you'd have to mix both parsers somehow. The only thought that comes to my mind is start with the backend's parser and add productions for PL/pgSQL's constructs. The main parser depends (at least) on the List handling and memory handling. So your "simple standalone parser" will have to contain both things at least. See src/backend/parser/README. -- Alvaro Herrera (<alvherre[a]alvh.no-ip.org>) A male gynecologist is like an auto mechanic who never owned a car. (Carrie Snow)
В списке pgsql-general по дате отправления: