Lothar Scholz
<scholz-qqUfbLNYxjJCkLs28/[EMAIL PROTECTED]> wrote:
I have to write an sqlite syntax highligher for an editor
and at the moment i use the following token BNF syntax.
ident := '_' | letter ( letter | '_' | digit )*
I believe dollar sign is allowed in the middle (as the first character,
it denotes a named parameter).
In addition to that, in SQL any string enclosed in double quotes is also
an identifier. E.g. these are valid statements:
create table "Hi there!" (a int, b int);
select * from "Hi there!";
Further, SQLite also interprets strings enclosed in square brackets as
identifiers (for compatibility with MS Access, I believe):
create table [Hi there!] (a int, b int);
-- quotes and brackets are interchangeable
select * from "Hi there!";
To make matters even more complicated, SQLite allows string literals to
be enclosed in double quotes (this is an extension: standard SQL
requires string literals to be enclosed in single quotes). When
encountering a string in double quotes, SQLite tries to resolve it as an
identifier. If it can't, then it treats it as a string literal. E.g.
create table X(a);
select "a", "b" from [X];
-- same as
select X.a, 'b' from X;
Igor Tandetnik
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------