Re: [HACKERS] Postgres' lexer

From: Leon <leon(at)udmnet(dot)ru>
To: "Ansley, Michael" <Michael(dot)Ansley(at)intec(dot)co(dot)za>
Cc: hackers <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Postgres' lexer
Date: 1999-08-20 18:28:17
Message-ID: 37BD9E41.F9C95EBC@udmnet.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ansley, Michael wrote:
>
> Leon, if you manage to find a replacement for this, please let me know.
> I'll probably only pick it up after the weekend.
>
> I think that we need to find another way to tokenise the minus. First of
> all, though, how is the parser supposed to tell whether this:
> a -2
> means this:
> (a - 2)
> or this:
> a (-2)

I think that the current behavior is ok - it is what we would expect
from expressions like 'a -2'.

I have produced a patch to cleanup the code. It works due to the
fact that unary minus gets processed in doNegate() in parser anyway,
and it is by no way lexer's job to do grammatical parsing - i.e.
deciding if operator is to be treated as binary or unary.

I ran regression tests, everything seems to be ok. It is my first
diff/patch experience in *NIX, so take it with mercy :) But it
seems to be correct. It is to be applied against 6.5.0 (I have
not upgraded to 6.5.1 yet, but hope lexer hasn't changed since
then.) The patch mainly contains nuked code. The only thing added
is my short comment :)

Have I done some right thing? :)

--
Leon.
---------
"This may seem a bit weird, but that's okay, because it is weird." -
Perl manpage.

Attachment Content-Type Size
patch application/octet-stream 3.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hub.Org News Admin 1999-08-20 20:37:34
Previous Message G. Anthony Reina 1999-08-20 17:02:30 RE: [GENERAL] Error during 'vacuum analyze'