Re: JSYNC

Ingy dot Net <[email protected]>
Newsgroups gmane.text.yaml.general
Message-ID <[email protected]>
On Sat, May 1, 2010 at 8:39 PM, Brad Baxter <[email protected]> wrote:

> On Fri, Apr 30, 2010 at 2:36 PM, Ingy dot Net <[email protected]> wrote:
> >
> > On Sat, May 1, 2010 at 12:21 AM, William Spitzak <[email protected]>
> wrote:
> >>
> >> Brad Baxter wrote:
> >>>
> >>> I, for one, would welcome this.
> >>>
> >>> Forgive me for spotting trivia, but the lines
> >>> below don't seem to match.  Is that just a typo,
> >>> or is there something significant I'm missing.
> >>>
> >>> "notes": ".!!! Awesome !!!",
> >>> "notes": ".... add note here ...",
> >>>
> >>> notes: '!!! Awesome !!!'
> >>> notes: ... add note here ...
> >>
> >> He is using a leading dot to quote the next character. Otherwise it
> would
> >> be impossible to make a tag that starts with '!' or '&'.
> >>
>
> I suspect my understanding is shallow and logic flawed, but
> I'm not sure why the string would need escaping if yaml would
> understand it.
>
> For example, the above ought to be just
>
> "notes": "'!!! Awesome !!!'",
> "notes": "... add note here ...",
>

The base encoding is not yaml, it's json. I need to repurpose strings that
begin with a ! & or *. So in the rare case that an actual json string begins
with one of those, I need to escape it. I do that by putting a '.' in front.
Then I make the rule that in JSYNC, a '.' at the start of a string is
removed. Therefore I need to encode the string '...' as "....". That's a
simple rule. I could make things more complicated by saying I only remove a
leading '.' if it comes before a ! & or *, but that seems a little too
precious to me.

Make sense?


> because yaml would understand them, and ...
>
> > Note that the escape char is the leading char, *after* extra syntax is
> > removed.
> >
> > [ "!type .&content" ]
> >
> > is:
> >
> > --- !type '&content'
>
> ... the above could be
>
> [ "!type '&content'" ]
>
> I suppose this could also work
>
> [ "!type \"&content\"" ]
>
> but I'm not sure it would ever be needed if
> JSON's character notations (vs. YAML's
> double-quoted ones) are sufficient.
>

Single quotes are an option, but I would only add them at the start, like in
"'!!!" and "!type '&content".

Hmm, I don't like the ' next to ". Very hard to read. ".!!!" and "!type
.&content" read better.


>
> As an escape mechanism, I would find
> single quotes much easier to spot.
>
> See original caveat.  :-)
>
> --
> Brad
>

------------------------------------------------------------------------------

_______________________________________________
Yaml-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/yaml-core
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.