Re: [HACKERS] Postgres' lexer - Mailing list pgsql-hackers

From Thomas Lockhart
Subject Re: [HACKERS] Postgres' lexer
Date
Msg-id 37CB5581.517CBD91@alumni.caltech.edu
Whole thread Raw
In response to Re: [HACKERS] Postgres' lexer  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] Postgres' lexer
List pgsql-hackers
> But it'd be good to get an opinion from the other tgl first ;-).

Sadly, the former "tgl" ;)

Sorry, I was away on vacation. I've waded through ~300 mail messages
already, but have ~700 to go, so I apologize if I've missed some more
developments.

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...

There are several cases which need to be handled (I'm doing this from
memory, so may miss a few):

o Positive and negative numbers as standalone arguments, with and
without spaces between the "-" and the digits.

o Positive and negative numbers as first arguments to binary
operators, with and without spaces at all possible places.

o Positive and negative numbers as second arguments to binary
operators, or as arguments to unary operators.

o Positive and negative numbers in the presence of operators
containing minus signs, including a trailing minus sign where
possible.

'taint easy to do it completely right. Perhaps trying to do less in
the scanner is the right thing to do, but istm that it may put
restrictions on the grammar which are not currently there. Not a good
trade for a longer query length...
                   - Thomas

-- 
Thomas Lockhart                lockhart@alumni.caltech.edu
South Pasadena, California


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: libpq drops error messages received just before backend crash
Next
From: "Hiroshi Inoue"
Date:
Subject: RE: [HACKERS] File descriptor leakage?