Re: [HACKERS] Postgres' lexer
От | Brook Milligan |
---|---|
Тема | Re: [HACKERS] Postgres' lexer |
Дата | |
Msg-id | 199908201457.IAA11086@biology.nmsu.edu обсуждение исходный текст |
Ответ на | RE: [HACKERS] Postgres' lexer ("Ansley, Michael" <Michael.Ansley@intec.co.za>) |
Ответы |
Re: [HACKERS] Postgres' lexer
|
Список | pgsql-hackers |
I think that we need to find another way to tokenise the minus. First of all, though, how is the parser supposed totell whether this: a -2 means this: (a - 2) or this: a (-2) i.e.: does the unary - operator take precedence over the binary - operator or not? Is there even a difference. If theparser runs into this: 'a -2', perhaps we could replace it with 'a + (-2)' instead. How does a C compiler tokenize this? Or some other standard SQL parser? For the C compiler a -2 can only mean (a - 2); a (-2) must explicitly be a function call and isn't generated by the compiler from a -2. I think the question for SQL is, does the language allow an ambiguity here? If not, wouldn't it be much smarter to keep the minus sign as its own token and deal with the semantics in the parser? Cheers, Brook
В списке pgsql-hackers по дате отправления: