Easy, readable and fast text based format for Rev?

Jim Ault JimAultWins at yahoo.com
Tue Jun 12 11:27:18 EDT 2007


The Rev filter command is very fast and I would recommend considering it.
The one caution is to replace null with empty, if this is a possible
character.

I often use
replace delim with cr & delim in textBlock
filter textBlock with "*"&tab & "wordToKeep" & tab & "*"

I use tab most frequently, but charToNum(3) works for an invisible char.
Visible chars I use numToChar(160), (161) for nesting.

In my case, some of the content text can have "<" or "/" or ">" in the body,
so I avoid those.  You seem to have control of your content, so it will not
be problem for you.

Arrays are very fast and can remove duplicates.
Also think of compound keys for the arrays, which I use for forward+reverse
lookups in the same array.

Moving data around, consider built-in
compress(var)
decomprerss(var)

Fun stuff

Jim Ault
Las Vegas





On 6/12/07 7:54 AM, "David Bovill" <david at openpartnership.net> wrote:

> Based on the simple but fast philosophy of JSON - I'm looking at defining a
> text based format which is readable, non binary and as fast as possible for
> Rev to parse. I want like JSON to throw away all those pesky XML tags.
> 
> Now I can't remember the details but JSON and YAML I think use a simple
> "name [delim] value" type notation - but keeping things completely flat (no
> nesting). At the moment (see below) I am using a tab character for the
> delimiter - I tried others but this seems to work for readability and
> flexibility.
> 
> The notation i am thinking of therefore are simple lines like the following
> (think of " [tab] " as just a single tab character):
> 
> name [tab] david
>> height [tab] 6ft 2inches
>> biography [tab] <sport>football</sports><interests>whatever</interests>
>> notes [tab] flattened htmltext
>> photo [tab] base64ofAnImage
>> 
> 
> I've been using this format for some things for a while - but thinking of
> going with it for a large project. The idea is for XML to strip out any
> white space - flatten it into one line - here are some of the (hoped for)
> advantages:
> 
>    - for htmltext that means just "replace CR" - setting it does not
>    require the CR so its fast.
>    - It also means you can split and combine the format into arrays for
>    fast processing.
>    - Sending the data around, as messages, over socket / the wire is fine
>    - As a text format I can use subversion to keep incremental backups
>    - I seem to be able to nest it indefinitley by using base64 encoding
>    of an entire chunk
>    - It is fast to convert to XML, JSON or other formats
> 
> I am not sure about using [tab] - but it just seems to work. Comments
> appreciated.





More information about the use-livecode mailing list