Skip to Content.
Sympa Menu

devel - Re: [sympa-developpers] ListDef parser

Subject: Developers of Sympa

List archive

Chronological Thread  
  • From: IKEDA Soji <address@concealed>
  • To: address@concealed
  • Subject: Re: [sympa-developpers] ListDef parser
  • Date: Thu, 20 Mar 2014 21:26:49 +0900

Hi,

On Wed, 19 Mar 2014 14:01:51 +0100
Marc Chantreux <address@concealed> wrote:

> Hi Soji,
>
> Any advice about the way to write my parser ?

Though I worry I misunderstand that you brought, since ListDef
format is less structured, I suppose:
- It doesn't require high order context-free grammer provided by
such as Pegex.
- It merely need not sequencial tokenization by such as m//gc.

They look slightly heavy axes to slice cheese for me.

A point of improvement to current code I can indicate is to use
paragraph mode:

local $/ = '';
while ($paragraph = <$config_fh>) {
# parse paragraph
}

> On Wed, Mar 19, 2014 at 09:22:44PM +0900, IKEDA Soji wrote:
> > I become depressed thinking that we must maintain current parser
> > of Conf and List modules in the future.
>
> don't: the format is *very* simple to parse (the current parser doesn't
> reflect this simplicity though).
>
> > I remember past discussion about format of config files.
> > I prefer to some other general format such as YAML, JSON, ...
>
> this would remove some lines of code from sympa but we will lose
> something important: unix friendlyness.
>
> the current format make it very easy to loop on lines to extract
> informations from C, seq, awk … and this make sympa very friendly for
> sysops!
>
> consider:
>
> awk '
> /^editor/,/^$/ {
> if ($1 ~ /email/) {print $2}
> }
> ' config
>
> this will work without extra tool.

I feel same. I love line-oriented plain text formats, too. OTOH,
I feel dissatisfied with its less expressiveness. It cannot
represent list, set, map and so on.

> so if removing the old format is planned, providing a tool to query the
> config file will be mandatory.
>
> > They are disadvantageous when users want to edit manually,
>
> i really think config files would be easier to edit if stored in the
> YAML format. this is an example
>
> editors:
> address@concealed:
> reception: mail
> visibility: noconceal
> gecos: Sylvie
> address@concealed:
> reception: mail
> visibility: noconceal
> shared_doc: { d_edit: owner, d_read: private }
> clean_delay_queuemod: 15
>
> or even
>
> editors:
> address@concealed: {reception: mail, visibility: noconceal,
> gecos: Sylvie }
> address@concealed: { reception: mail visibility: noconceal
> }
> shared_doc: { d_edit: owner, d_read: private }
> clean_delay_queuemod: 15
>
> is currently (with the sympa format) written as:
>
> shared_doc
> d_edit owner
> d_read private
>
> clean_delay_queuemod 15
>
> editor
> reception mail
> email address@concealed
> visibility noconceal
> gecos Sylvie
>
> editor
> reception mail
> email address@concealed
> visibility noconceal
> gecos Frédéric
>
> so i really think we need to support both.

Current format cannot represent multi-level structure such as nested
lists and/or maps, for additional example, I wish to write:

shared_doc:
enabled: yes
privileges:
d_edit: owner
d_read: private

So I guess both formats cannot stand in row: we may keep current
format or may through it away.


Regards,

--- Soji


> regards
>
>
> --
> Marc Chantreux
> Université de Strasbourg, Direction Informatique
> 14 Rue René Descartes,
> 67084 STRASBOURG CEDEX
> ☎: 03.68.85.57.40
> http://unistra.fr
> "Don't believe everything you read on the Internet"
> -- Abraham Lincoln


--
株式会社 コンバージョン セキュリティ&OSSソリューション部 池田荘児
〒231-0004 神奈川県横浜市中区元浜町3-21-2 ヘリオス関内ビル7F
e-mail address@concealed TEL 045-640-3550
http://www.conversion.co.jp/




Archive powered by MHonArc 2.6.19+.

Top of Page