[augeas-devel] [PATCH] Interfaces: map bond-slaves and bridge-ports options to arrays
Kaarle Ritvanen
kaarle.ritvanen at datakunkku.fi
Fri Nov 1 12:52:33 UTC 2013
---
lenses/interfaces.aug | 24 ++++++++++++++++++------
1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/lenses/interfaces.aug b/lenses/interfaces.aug
index 3495981..2051213 100644
--- a/lenses/interfaces.aug
+++ b/lenses/interfaces.aug
@@ -36,21 +36,27 @@ let empty = Util.empty
let stanza_id (t:string) = key t . sep_spc . sto_to_spc
let stanza_param (l:string) = [ sep_spc . label l . sto_to_spc ]
-(* Define reseverved words *)
-let stanza_word = /(source|iface|auto|allow-[a-z-]+|mapping)/
+(* Define reseverved words and multi-value options*)
+let stanza_word =
+ /(source|iface|auto|allow-[a-z-]+|mapping|bond-slaves|bridge-ports)/
+
+(* Define stanza option indentation *)
+let stanza_indent = del /[ \t]*/ " "
(* Define additional lines for multi-line stanzas *)
-let stanza_option = [ del /[ \t]*/ " "
+let stanza_option = [ stanza_indent
. key ( /[a-z0-9_-]+/ - stanza_word )
. sep_spc
. sto_to_eol ]
+(* Define space-separated array *)
+let array (r:regexp) (t:string) = del r t . label t . counter t
+ . [ sep_spc . seq t . sto_to_spc ]+
+
(************************************************************************
* AUTO
*************************************************************************)
-let array (r:regexp) (t:string) = del r t . label t . counter t
- . [ sep_spc . seq t . sto_to_spc ]+
let auto = [ array /(allow-)?auto/ "auto" . eol ]
(************************************************************************
@@ -74,12 +80,18 @@ let mapping = [ stanza_id "mapping"
* IFACE
*************************************************************************)
+let multi_option (t:string) = [ stanza_indent . array t t . eol ]
+
let iface = [ Util.indent
. stanza_id "iface"
. stanza_param "family"
. stanza_param "method"
. eol
- . (stanza_option|comment|empty)* ]
+ . ( stanza_option
+ | multi_option "bond-slaves"
+ | multi_option "bridge-ports"
+ | comment
+ | empty )* ]
(************************************************************************
* SOURCE
--
1.8.1.4
More information about the augeas-devel
mailing list