sqlite3 test.db 'CREATE TABLE [Customer List]([First name] TEXT, [Last name] TEXT, id INTEGERPRIMARY KEY AUTOINCREMENT, status TEXT DEFAULT \"Current\")'
with delimiter = space, quotePairList = "" ''
gives:
{"sqlite3", "test.db", "CREATE TABLE [Customer List]([First name] TEXT, [Last name] TEXT, id INTEGER AUTOINCREMENT PRIMARY KEY, status TEXT DEFAULT \"Current\")"}
And further on, using the field definitions to parse again:
set textBlock to "[First name] TEXT, [Last name] TEXT, id INTEGERPRIMARY KEY AUTOINCREMENT , status TEXT DEFAULT \"Current\""
set delimiter to ","
set quotePairList to {} -- ie none
set doTrimSpace to true -- ie remove white space (spaces and tabs) surrounding each parsed item
set columnDefList to ParseQuotedText of textBlock between delimiter out of quotePairList with doTrimSpace
set delimiter to " "
set quotePairList to {{quote, quote}, {"'", "'"}, {"[", "]"}}
set doTrimSpace to true
set tableDefList to {}
repeat with columnDef in columnDefList
set end in tableDefList to ParseQuotedText of columnDef between delimiter out of quotePairList with doTrimSpace
end repeat
return tableDefList
I hope this gives a thorough background. Thanks for your input. It seems like a common requirement, to parse with this level of flexibility. Has no-one else come across such a need? I'll post my own solution soon, if anyone else would like it.