Thread: RE: [HACKERS] Postgres' lexer

RE: [HACKERS] Postgres' lexer

From
"Ansley, Michael"
Date:
>> Hi!
Hi, Leon

>> I'm currently fooling around with Postgres's parser, and I must admit
>> some things puzzle me completely. Please tell me what these things in
>> lexer stand for:
>> 
>> {operator}/-[\.0-9]    {
>>                     yylval.str = pstrdup((char*)yytext);
>>                     return Op;
>>                 }
>> Is it an operator followed by mandatory '-' and (dot or digit) ?
I think this is used to recognize an operator followed by a minus or any
single character (the period is escaped, the character can be used to denote
the base of the number) or a single digit.
But check this, I'm not totally sure.

>> And what this stands for:
>> 
>> {identifier}/{space}*-{number}
An identifier followed by any number of spaces, and then a minus, or a
number.  Again, double check this with a reference of some sorts.

>> 
>> What's the meaning of all these?
>> 
You really should get a reference that deals with regular expressions.  My
understanding is (anybody feel free to comment here) that flex uses normal
regular expressions to generate scanners.


Cheers...

MikeA


Re: [HACKERS] Postgres' lexer

From
Leon
Date:
Ansley, Michael wrote:
...
> >> And what this stands for:
> >>
> >> {identifier}/{space}*-{number}
> An identifier followed by any number of spaces, and then a minus, or a
> number.  Again, double check this with a reference of some sorts.

Well, I studied flex manpage from top to bottom, and almost everything
in Postgres's lexer makes sense. But these "followed by spaces and a
queer minused number" do not. Can someone tell me what do these 
minused single - digit numbers stand for?

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