RE: [HACKERS] Postgres' lexer

Поиск
Список
Период
Сортировка
От Ansley, Michael
Тема RE: [HACKERS] Postgres' lexer
Дата
Msg-id 1BF7C7482189D211B03F00805F8527F748C037@S-NATH-EXCH2
обсуждение исходный текст
Ответы Re: [HACKERS] Postgres' lexer  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
>> "Ansley, Michael" <Michael.Ansley@intec.co.za> writes:
>> > I have a bit of a problem with reading this: a > -2 correctly,
>> > while not reading this: a>-2 correctly, because that implies that you
are
>> > using the space as a precedence operator.  This should be done by
braces.
>> 
>> Not at all: this is a strictly lexical issue (where do we divide the
>> input into tokens) and whitespace has been considered a reasonable
>> lexical separator for years.  Furthermore, SQL already depends on
>> whitespace to separate tokens that are made of letters and digits.
>> You can't spell "SELECT" as "SEL ECT", nor "SELECT f1" as "SELECTf1",
>> nor does "SELECT 1 2;" mean "SELECT 12;".  So it seems perfectly
>> reasonable to me to use whitespace to separate operator names when
>> there would otherwise be ambiguity about what's meant.
Point taken.  So, if the spaces are used, then a>-2 is not the same as a>-
2.  The latter should then generate an error, right?

<snip>

>> I think it would be a really bad idea for the lexical 
>> analysis to depend on whether or not particular operator names 
>> are defined, for the same reasons that lexical analysis of word 
>> tokens doesn't depend on whether
>> there are keywords/table names/field names that match those tokens.
>> You get into circularity problems very quickly if you do that.
>> Language designers learned not to do that in the sixties...
Yes.  Another point taken.

MikeA


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] SELECT BUG
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] SELECT BUG