kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #27350
Re: Escapes in the s-expr format documentation
-
To:
kicad-developers@xxxxxxxxxxxxxxxxxxx
-
From:
Wayne Stambaugh <stambaughw@xxxxxxxxx>
-
Date:
Thu, 26 Jan 2017 08:31:49 -0500
-
In-reply-to:
<CAHBNN+PhVV=zbvS570Zs7LyogA7o7jTsXH9X_+9poR30PPdEQQ@mail.gmail.com>
-
User-agent:
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0
Both \ and " are escaped with \ in the output formatter. See
OUTPUT_FORMATTER::Quotes() in common/richio.cpp for all of the escaped
characters.
On 1/25/2017 5:02 PM, Cirilo Bernardo wrote:
> While we're on the subject of the s-expr formatting; can we ensure that
> all writers use quotes on literal strings rather than using the unnecessary
> 'no quotes are necessary if there is no space' rule? I haven't read the file
> format docs for a long time now - but does '\' escape " only, or both " and \,
> or does it have other meanings?
>
> - Cirilo
>
> On Wed, Jan 25, 2017 at 12:21 PM, Chris Pavlina <pavlina.chris@xxxxxxxxx> wrote:
>> In the file format specification at [1] via [2], we specify the
>> following for string escapes:
>>
>>> Here is a legal string with an embedded quote: leg"23
>>> Here is the same string quoted, and because it is quoted the internal
>>> quote must be duplicated: "leg""23"
>>
>> This is NOT how we are actually quoting strings: we are using \".
>>
>> I suggest updating the format document rather than the code, because:
>>
>> 1) This avoids changing any actual files we write
>> 2) Escaping quotes with "" is weird, especially considering we use
>> backslash escapes in other places - be consistent
>>
>> But no matter how we fix it, this should be fixed; people are using
>> these format documents to implement parsers (I just spoke to one).
>>
>> [1] http://bazaar.launchpad.net/~stambaughw/kicad/doc-read-only/download/head:/1115%4016bec504-3128-0410-b3e8-8e38c2123bca:trunk%252Fkicad-doc%252Fdoc%252Fhelp%252Ffile_formats%252Ffile_formats.pdf/file_formats.pdf
>> [2] http://kicad-pcb.org/help/file-formats/
>>
>> --
>> Chris
>>
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help : https://help.launchpad.net/ListHelp
>
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp
>
References