Subject Re: [Firebird-Architect] Reserved keywords
Author Adriano dos Santos Fernandes
Jim Starkey wrote:

>When lex sees the word "primary", it must recognize it as a token and
>return the lexeme 401 to yacc/bison. Unless it knows more about
>context, it can't know whether to return "primary" as a known token or a
>potential identifier string. An identifier string won't match the token
>"PRIMARY" and the token 401 won't match an indentifier string.
>
>
This is not entirely true.
In some cases it's possible to a keyword be a symbol name too, for example:

valid_symbol_name : SYMBOL
| non_reserved_word
;

/* list of non-reserved words */

non_reserved_word :
KW_BREAK /* added in FB 1.0 */
| KW_DESCRIPTOR
| SUBSTRING
| COALESCE /* added in FB 1.5 */
...

And you can:
create table coalesce (n integer);

>The obvious trick is to make lex sensitive to the context, which is
>known in the industry as a hack. Too many hacks, and the structure
>crumbles.
>
>
Agreed.


Adriano