Thread

  1. Re: [HACKERS] Postgres' lexer

    Leon <leon@udmnet.ru> — 1999-08-20T18:28:17Z

    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.