From: | Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Brook Milligan <brook(at)biology(dot)nmsu(dot)edu>, Michael(dot)Ansley(at)intec(dot)co(dot)za, leon(at)udmnet(dot)ru, pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: [HACKERS] Postgres' lexer |
Date: | 1999-08-31 15:22:43 |
Message-ID: | 37CBF343.73A813DE@alumni.caltech.edu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > I added the <xm> exclusive state to accomodate the possibility of a
> > unary minus. The change was provoked by Vadim's addition of CREATE
> > SEQUENCE, which should allow negative numbers for some arguments. But
> > this just uncovered the tip of the general problem...
> It seems awfully hard and dangerous to try to identify unary minus in
> the lexer. The grammar at least has enough knowledge to recognize that
> a minus *is* unary and not binary. Looking into gram.y, I find that the
> CREATE SEQUENCE productions handle collapsing unary minus all by
> themselves! So in that particular case, there is still no need for the
> lexer to do it. AFAICT in a quick look through gram.y, there are no
> places where unary minus is recognized that gram.y won't try to collapse
> it.
> In short, I still think that the whole mess ought to come out of the
> lexer...
My recollection of the whole point is that, as you mention, *you can't
identify a unary minus in the lexer*. So the minus sign is kept
distinct, to be reconciled later as either a unary minus *or* an
operator *or* whatever. The problem was that before, things like (-2)
and (- 2) were handled differently just because the spacing was
different.
Anyway, I'll look at the defacto changes; perhaps they are just fine
but I'm worried that we've reverted the behavior...
- Thomas
--
Thomas Lockhart lockhart(at)alumni(dot)caltech(dot)edu
South Pasadena, California
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-08-31 15:49:32 | Re: [HACKERS] File descriptor leakage? |
Previous Message | The Hermit Hacker | 1999-08-31 15:22:31 | Re: [HACKERS] File descriptor leakage? |