Re: Making tab-complete.c easier to maintain - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: Making tab-complete.c easier to maintain
Date
Msg-id 20151126.144512.10228250.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Re: Making tab-complete.c easier to maintain  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Responses Re: Making tab-complete.c easier to maintain  (Michael Paquier <michael.paquier@gmail.com>)
List pgsql-hackers
Hello, the attached are a patchset to introduce a special
matching expression which simplifies matching descriptions. The
result looks as if the comments in the previous implement run
as-is.

0001-Allow-regex-module-to-be-used-outside-server.patch
 A small patch to allow pg_regex to be used outside backend. The same with the previous one.

0002-Simplify-the-usages-of-COMPLETE_WITH_QUERY.patch
 This is also the same with the previous one.

0003-Replace-previous-matching-rule-with-regexps-take-2.patch
 Modifies to use this matching minilang. No bare regular expression is seen for every matching. The difference from the
previousone is that sources for other than regcomp.o are no longer symlinked to psql's directory. Compiled regular
expressionsare cached until psql ends. The function patcomp is the central of the messy of this patchset.
 
 This cannot be compiled on Windows, I think.

0004-Remove-less-informative-comments.patch
 Remove comments that no longer has reason to be placed there.

0005-Merge-mergable-completions.patch
 Merge some of the matchings that are simply mergable by using this minilang.

What do you think about this solution?


At Tue, 17 Nov 2015 19:25:24 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote in
<20151117.192524.95155716.horiguchi.kyotaro@lab.ntt.co.jp>
> Hello, I tried to implement the mini-language, which is a
> simplified reglar expression for this specific use.
> 
> As a ultra-POC, the attached patch has very ad-hoc preprocess
> function and does on-the-fly preprocessing, compilation then
> execution of regular expression. And it is applied to only the
> first ten or so matchings in psql_completion().
> 
> The first attachment is the same with that of previous patchset.
> 
> Every matching line looks like the following,
> 
> > else if (RM("ALTER {AGGREGATE|FUNCTION} [#id](.."))
> >     COMPLETE_WITH_FUNCTION_ARG(CAPTURE(1));

-- 
Kyotaro Horiguchi
NTT Open Source Software Center

pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: [Proposal] Table partition + join pushdown
Next
From: Michael Paquier
Date:
Subject: Re: COPY (INSERT/UPDATE/DELETE .. RETURNING ..)