lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Feb 1, 2008 12:03 PM, Petite Abeille <petite.abeille@gmail.com> wrote:
> Perhaps one could simply ignore the null altogether... as unquoted
> null will resolve to nil in loadstring...

Good point. But I take back what I said about the first three being
'easy enough'. :)

You need to tokenize the input so you can determine what's in a string
and what's not. For instance, there's nothing that says a key or value
couldn't be the string "{\"items": [ {\"[{,null\": \"null},\\,\"},
null, {\",null\": \",{ = null,\"}]".

Lexing that would be simple. Parsing it with a regular expression...
not so much.