Re: Making tab-complete.c easier to maintain
От | Michael Paquier |
---|---|
Тема | Re: Making tab-complete.c easier to maintain |
Дата | |
Msg-id | CAB7nPqSggjPA8U1WV7ivW44xzboC8pci_Etmffr+ZEzxSX_ahA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Making tab-complete.c easier to maintain (Thomas Munro <thomas.munro@enterprisedb.com>) |
Ответы |
Re: Making tab-complete.c easier to maintain
|
Список | pgsql-hackers |
On Mon, Dec 14, 2015 at 8:10 AM, Thomas Munro <thomas.munro@enterprisedb.com> wrote: > I've also add (very) primitive negative pattern support and used it in > 5 places. Improvement? Examples: > > /* ALTER TABLE xxx RENAME yyy */ > - else if (TailMatches5("ALTER", "TABLE", MatchAny, "RENAME", MatchAny) && > - !TailMatches1("CONSTRAINT|TO")) > + else if (TailMatches5("ALTER", "TABLE", MatchAny, "RENAME", > "!CONSTRAINT|TO")) > COMPLETE_WITH_CONST("TO"); > > /* If we have CLUSTER <sth>, then add "USING" */ > - else if (TailMatches2("CLUSTER", MatchAny) && > !TailMatches1("VERBOSE|ON")) > + else if (TailMatches2("CLUSTER", "!VERBOSE|ON")) > COMPLETE_WITH_CONST("USING"); + /* Handle negated patterns. */ + if (*pattern == '!') + return !word_matches(pattern + 1, word); Yeah, I guess that's an improvement for those cases, and there is no immediate need for a per-keyword NOT operator in our cases to allow things of the type (foo1 OR NOT foo2). Still, in the case of this patch !foo1|foo2 actually means (NOT foo1 AND NOT foo2). It does not seem that much intuitive. Reading straight this expression it seems that !foo1|foo2 means actually (NOT foo1 OR foo2) because the lack of parenthesis. Thoughts? -- Michael
В списке pgsql-hackers по дате отправления: