Hello, At Mon, 16 Nov 2015 12:19:23 -0300, Alvaro Herrera <alvhe...@2ndquadrant.com> wrote in <20151116151923.GX614468@alvherre.pgsql> > Thomas Munro wrote: > > New version attached, merging recent changes. > > I wonder about the TailMatches and Matches macros --- wouldn't it be > better to have a single one, renaming TailMatches to Matches and > replacing the current Matches() with an initial token that corresponds > to anchoring to start of command? Just wondering, not terribly attached > to the idea.
Does it looks like this? > if (Match(BOL, "ALTER", "TABLE", EOL)) ... It would be doable giving special meaning to word_matches(BOL/EOL, *_wd). And I give +1 to that than having so many similar macros. The following is my delusion.. It could develop to some mini-laguages like the following, which is a kind of subset of regular expressions, that is powerful than current mechanism but not meesier than regular expressions by narrowing its functionarity. Addition to that the custom minilang could have specilized functionarity for matching SQL statements. > if (Match("^ALTER TABLE \id$"))... It would be nice to have tokens to match to optional words. > if (Match("^ALTER TABLE(IF EXISTS) \id$"))... > if (Match("CREATE(OR REPLACE)FUNCTION \id (\CSL)$") Mmm. this might be another kind of complexity? This is also accomplished by multiple matching descriptions. > if (Match("^,ALTER,TABLE,\id,$") || > Match("^,ALTER,TABLE,IF,EXISTS,\id,$"))... Interpreting this kind of mini-language into regular expressions could be doable.. regards, -- Kyotaro Horiguchi NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers