libconf-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libconf-dev] [chl <address@hidden>] [ Task #2129] solve the indent


From: dams
Subject: Re: [Libconf-dev] [chl <address@hidden>] [ Task #2129] solve the indentation problem
Date: 20 May 2003 20:04:04 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

chl <address@hidden> said:


[...]

> 
> > - we add an atom in a section where there are already original atoms 
> > (should be
> >   trivial, we look at the /^\s+/ of the other atoms
> 
> To keep it simple, we can assume that the indentation is the same
> for each atom in the current section. (Assumption 1)
> 
> > - we add an atom in a section where there are no original atoms (maybe we
> >   should look at the other section, and find out what is the indentation?)
> 
> To keep it simple, we can assume that the indentation is the same
> for each section in the current file. (Assumption 2)
> 
> At this point we only need a global variable for one template
> (like $INDENT_SPACES) that could be correctly setted at the
> parsing of the conf file.
> 
> > - we build the file from scratch, but with section and atoms. which 
> > indentation
> >   do we choose?
> 
> If we build the file from scratch, there is two alternatives :
> 1) the $INDENT_SPACES variable is not set, so we don't indent.
> 2) the $INDENT_SPACES variable is set to and the template use it
> to generate a file with indentation.
> 
> This is the easiest way to implement indentation in libconf, IMHO.

Agreed, let's do it like this :)

> If we only do like this libconf don't respect the md5sum
> constraint. Do we really need to fully respect the md5sum
> constraint ? That's the real question :)

I'd say : no, we don't need to respect the md5sum :) If we can keep the
indentation and resolve the comment issue, this will be enough.

> 
> Libconf could implement the above method for indentation, or if
> we want to fully respect the md5sum constraint, use some of the
> following ideas :
> 
> 1/ Libconf could print warnings, if the conf file have strange
> indentation that brakes libconf assumptions about indentation.
> (like different indentation in the same section, or between two
> sections of the same level).
> 
> 2/ I think it's possible to respect the md5sum constraint. In that
> case, we will need to store the indentation for each atom for
> each line. IMO, this is the worst solution, we must avoid it.
> 
> 3/ Maybe an hybrid solution is the best : use $INDENT_SPACES
> everywhere it's possible, and only store the atom's indentation
> where it brakes the libconf assumptions about indentation.

agreed, good idea


-- 
dams




reply via email to

[Prev in Thread] Current Thread [Next in Thread]