Corey Huinker <corey.huin...@gmail.com> writes: > Ok, I've got some time now and I'm starting to dig into this. I'd like to > restate what I *think* my feedback is, in case I missed or misunderstood > something. > ... > 3. Change command scans to scan the whole boolean expression, not just > OT_NORMAL. > There's a couple ways to go about this. My gut reaction is to create a new > scan type OT_BOOL_EXPR, which for the time being is the same as > OT_WHOLE_LINE, but could one day be something different.
OT_WHOLE_LINE is not what you want because that results in verbatim copying, without variable expansion or anything. My vote would be to repeatedly do OT_NORMAL until you get a NULL, thereby consuming as many regular arguments as the backslash command has. (After which, if it wasn't exactly one argument, complain, for the moment. But this leaves the door open for something like "\if :foo = :bar".) Note that this implies that "\if some-expression \someothercommand" will be allowed, but I think that's fine, as I see no reason to allow backslashes in whatever if-expression syntax we invent later. OT_WHOLE_LINE is a bit of a bastard child and I'd just as soon not define it as being the lexing behavior of any new commands. > 5. Allow contextually-correct invalid boolean expressions to map to false. > Out-of-context \endif, \else, and \elif commands remain as errors to be > ignored, invalid expressions in an \if or legallyl-placed \elif are just > treated as false. WFM. regards, tom lane -- Sent via pgsql-hackers mailing list (email@example.com) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers