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

[augeas-devel] httpd.conf and beyond

This series of patches adds support for context-free lenses, which means
that Augeas can now process funky stuff like the Apache config.

The last patch in the series has a (not quite complete) lens for httpd.conf
- I'd appreciate any help on getting the lens into shape. The two main
things that need to change about the Apache lens are (1) make sure we cover
all directives and (2) make sure the directives it knows about wind up in a
tree structure that is useful.

Patch 15/16 contains a generic lens for JSON[1] files, which is a very
pleasant file format.

The support for processing context-free file formats comes in the form of
'recursive lenses'; the syntax for that is

  let rec lns = expression involving lns

I am not entirely convinced that this is the best syntax, and might change
that. The 'let rec' syntax should be considered experimental, so make sure
any lenses you write using it are in the Augeas repo; I will adapt them if
and when I change the syntax. As an example, the Apache lens looks
something like

  let rec lns = directives | sec1 "Directory" lns

where directives is a regular lens that matches all the plain Apache
directives, and sec1 matches the enclosing <Directory ..> ... </Directory>
tags and then uses lns to process the contents of the tag.

An alternative syntax would be the named expressions that Boomerang uses,
and could look something like

  let lns = body : (directives | sec1 "Directory" body)

I'd appreciate input on what syntax people think is the most readable and
understandable. There's a million variants that could be played on the
above syntax, for example

  let lns = use body in (directives | sec1 "Directory" body)

Strictly speaking, recursive lenses only support context-free languages in
the get direction, i.e. the string -> tree direction. The put direction
from tree to string is still based on regular trees - the tree language is
expressive enough that it didn't seem to warrant an extension.

The downside of recursive lenses is that there are currently no typechecks
for the context-free part of the lens; it is therefore possible to write
down fairly nonsensical constructs and have Augeas choke on it. Ambiguities
will be detected only when an actual string is parsed, not ahead of time as
is the case for regular lenses.


[1] http://www.json.org/

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