[augeas-devel] Inexpressible Language
Yclept Nemo
orbisvicis at gmail.com
Sun Jun 29 18:04:23 UTC 2014
> Could you provide an example of a string that does not parse with the
lens I provided, and the tree you expect the lens should produce from it?
Right, looks like I forget to reference the input case. Anyway, here it is
[2]. The tree structure is self-explanatory - identical to the previous
trees - the schema only changes what is considered a comment.
> That said, I personally prefer to map comments in the tree, if we're
going to parse them anyway.
Personally I prefer comments to be excluded, however the idea is to only
modify the comment function (del -> store) to toggle this behaviour.
Unfortunately actually handling comments is more difficult, below I have a
rough draft [1] (no comment function, no comment storing) but it produces
an error I don't understand:
[(first two lenses) and (third lens) in entry]:exception: overlapping
lenses in tree union.put
Example matched by both: { }
What does this mean? Literal braces ("{ }"), or two literal spaces (" "),
or just a null string ?
Regards,
[1] let option = key /[A-Z_]+/
let value = Sep.colon . Sep.opt_space . store /[^]
\t\n:]+/ . Sep.opt_space
let values = counter "value" . [ seq "value" . value ] +
let setting = Util.del_str "[" . option . values .
Util.del_str "]"
let entry =
let not_setting = Rx.space_in - ( lens_ctype setting . /.*/ )
(* doesn't start with a space - starts with setting
- doesn't match the empty string *)
in [ setting . del /.*/ "" . del /\n/ "\n" ] |
(* doesn't start with a space - doesn't start with setting
- doesn't match the empty string *)
[ del not_setting "s" . del /[ \t]*/ "" . del /\n/ "\n" ] |
(* starts with a space
- doesn't match the empty string *)
[ del /[ \t]/ " " . del /.*/ "" . del /\n/ "\n" ] |
(*
- matches the empty string *)
[ del /\n/ "\n" ]
let lns = entry *
[2] "
Change this to turn sound off.
[SOUND:YES]
[FONT:curses_640x300.png]
[RESIZABLE:YES]You may disable window resizing if you wish.
[PRINT_MODE:2D]
Mode examples:
[SINGLE_BUFFER:NO]
[EMBARK_RECTANGLE:4:4]
Change these numbers to set the default weights for traffic designations.
If you make the last numbers too large, pathfinding might lag.
The format is (PATH_COST:<high>:<normal>:<low>:<restricted>).
[PATH_COST:1:2:5:25][A_COMMENT:4:4]
[A_COMMENT: ]
[ANOTHER_COMMENT:10:1:5:50]
"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20140629/342535f0/attachment.htm>
More information about the augeas-devel
mailing list