Re: [HACKERS] Postgres' lexer

From: Leon <leon(at)udmnet(dot)ru>
To: hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Postgres' lexer
Date: 1999-09-02 14:38:43
Message-ID: 37CE8BF3.AE1E29C6@udmnet.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ansley, Michael wrote:

> If a construct is ambiguous, then the behaviour should be undefined (i.e.:
> we can do what we like, within reason). If the user wants something
> predictable, then she should use brackets ;-)
>
> If 3+-2 presents an ambiguity (which it does) then make sure that you do
> this: 3+(-2). If you have an operator +- then you should do this (3)+-(2).
> However, if you have 3+-2 without brackets, then, because this is ambiguous
> (assuming no +- operator), this is undefined, and we can do pretty much
> whatever we feel like with it. Unless there is an operator +- defined,
> because then the behaviour is no longer ambiguous. The longest possible
> identifier is always matched, and this means that the +- will be identified.
>
> Especially with the unary minus, my feeling is that it should be placed in
> brackets if correct behaviour is desired.

When I first read that, I thought "can sign every word of that".
But suddenly realized that there are more buggy situations here:
consider a>-2. It is parsed as (a) >- (2). Even in original
Thomas Lockhart's version there is a bug: it parses a>-b as (a) >- (b).
So I decided to simply forbid long operators to end with minus. If you
think that it is right, here is the patch (today is my patch bomb
day :). It is to be applied *instead* my earlier today's patch.

Seems that it is the only more or less clean way to deal with
big operator/unary minus conflict.
--
Leon.

Attachment Content-Type Size
right.patch application/octet-stream 630 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-09-02 14:43:33 Re: [HACKERS] md.c is feeling much better now, thank you
Previous Message Michael Simms 1999-09-02 14:19:17 vacuum analyze