[augeas-devel] Re: Multiline values in INI Files
Benjamin Pierce
bcpierce at cis.upenn.edu
Fri Aug 29 13:30:35 UTC 2008
> Just saw another reason for not introducing indent in inifile.aug :
> some
> inifiles use indentation for multi-line values, like
>
> key = this is a long
> text that belongs
> to the same field
>
> This kind of entries are very tricky to deal with (this is why I
> haven't put
> my hands on it yet) because ideally we would like to get
>
> { "key" = "this is a long\ntext that belongs\nto the same field" }
>
> but all I can think of getting is
>
> { "key"
> { "1" = "this is a long" }
> { "2" = "text that belongs" }
> { "3" = "to the same field" } }
>
> or
>
> { "key" = "this is a long\n text taht belongs\n to the same
> field" }
In developing Boomerang, we've found that you really need to extend
the foundations of the language to deal with such examples
effectively -- in principle, they can be handled using just plain
lenses, but in practice the details become too horrible. Our paper
on Quotient Lenses to be presented at the International Conference on
Functional Programming in a few weeks, and available off the
Boomerang home page
http://www.seas.upenn.edu/~harmony/
gives details of our design. I suspect that it could be adapted to
Augeas pretty easily.
Best,
- Benjamin
------------------------
On Aug 29, 2008, at 7:50 AM, augeas-devel-request at redhat.com wrote:
> Date: Fri, 29 Aug 2008 13:42:05 +0200
> From: " Rapha?l Pinson " <raphink at gmail.com>
> Subject: [augeas-devel] Multiline values in INI Files (Was: Prefix for
> IniFile entries)
> To: "Free Ekanayaka" <free at 64studio.com>
> Cc: augeas-devel at redhat.com
> Message-ID:
> <8ce271500808290442g11b3e188u68306539e4f4bdeb at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On Wed, Aug 27, 2008 at 5:59 PM, Free Ekanayaka <free at 64studio.com>
> wrote:
>
>> Hi Raphaël,
>>
>> |--==> On Wed, 27 Aug 2008 12:41:38 +0200, "Raphaël Pinson" <
>> raphink at gmail.com> said:
>>
>> RP> I think we could add it to inifile.aug. Making it optional is
>> another
>> story.
>> RP> Options in augeas lenses are not easy to deal with since you
>> cannot
>> have
>> RP> optional arguments to functions nor default values for
>> parameters in
>> RP> functions. That's why inifile.aug ended up with pretty big
>> calls for
>> entry,
>> RP> record and lns, and additionnal record_noempty and
>> lns_noempty to deal
>> with
>> RP> files that don't accept empty lines. All the same, there
>> would be a
>> need for
>> RP> entry_noindent, record_noindent and record_noempty_noindent
>> calls,
>> which
>> RP> makes it a bit ugly to my taste. Ideas on this are welcome.
>>
>> If introducing ugly _noindent declarations is the only viable way at
>> the moment, but it makes inifile.aug enough flexible to deal with all
>> kind of INI files, then I would go for it. Of course Better
>> alternatives are welcome.
>>
>
>
> Just saw another reason for not introducing indent in inifile.aug :
> some
> inifiles use indentation for multi-line values, like
>
>
>
> key = this is a long
> text that belongs
> to the same field
>
>
> This kind of entries are very tricky to deal with (this is why I
> haven't put
> my hands on it yet) because ideally we would like to get
>
> { "key" = "this is a long\ntext that belongs\nto the same field" }
>
>
> but all I can think of getting is
>
> { "key"
> { "1" = "this is a long" }
> { "2" = "text that belongs" }
> { "3" = "to the same field" } }
>
> or
>
> { "key" = "this is a long\n text taht belongs\n to the same
> field" }
>
>
> which forces users to indent their value in a not very useful way.
> Furthermore, I believe adding a line to such a field should use the
> same
> indentation as the previous lines, which is currently not possible in
> augeas.
>
>
>
>
> Raphaël
More information about the augeas-devel
mailing list