Hi Roger,

> BareFeet wrote:
>> At the moment I am resorting to developing regular expressions to do the 
>> parsing. They work, but it seems to be re-inventing the wheel.
> 
> You won't be able to do parsing completely with regular expressions.  Create 
> statements let you specify default values for a column and that can be any 
> arbitrary SQL expression.

Yes, bracketed and quoted expressions, along with comments complicate the regex 
parsing. So, as I mentioned:

>> I have to allow for quoted identifiers (eg "Family ID"), comments and nested 
>> brackets by tokenizing the string and substituting 
>> quoted/bracketed/commented sections with word placeholders before applying 
>> the regex.

I do this by tokenizing the SQL string, then replacing any bracketed, quoted or 
commented tokens with a placeholder that survives the regex expression "\w+" 
(without quotes).

Please send me an example of any complex create table statement so I can try my 
method on it.

Thanks,
Tom
BareFeet

 --
Comparison of SQLite GUI tools:
http://www.tandb.com.au/sqlite/compare/?ml

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to