[augeas-devel] [PATCH] Generic square lens
Raphaël Pinson
raphael.pinson at camptocamp.com
Tue Aug 7 08:06:56 UTC 2012
This looks great!
Here are other tests to add for square quotes:
(* Test quotes *)
let label_quotes =
let k = label "quote" in
let q = del /["']/ "\"" in
let s = store /.*/ in
[ k . square q s q ]
test label_quotes get "'value'" = { "quote" = "value" }
test label_quotes get "\"value\"" = { "quote" = "value" }
let square_quotes =
let k = key /[A-Za-z0-9]+/ . del /[ \t]*=[ \t]*/ " = " in
let q = del /["']/ "\"" in
let s = store /[A-Za-z0-9]+/ in
[ k . square q s q ]
test square_quotes get "key = \"value\"" = { "key" = "value" }
test square_quotes get "key = 'value'" = { "key" = "value" }
(* quote mismatch *)
test square_quotes get "key = \"value'" = *
I'm surprised that these don't cause ambiguities:
(* quotes in value *)
test square_quotes get "key = \"va'lue\"" = { "key" = "va'lue" }
test square_quotes get "key = 'va\"lue'" = { "key" = "va\"lue" }
especially these, which pass (should they?):
test square_quotes get "key = \"va\"lue\"" = { "key" = "va\"lue" }
test square_quotes get "key = 'va'lue'" = { "key" = "va'lue" }
I'm wondering now if it actually solves the problem with xml.aug's quotes,
because xml.aug has constructs like:
[ label "#literal" . sep_spc . sto_quote ]*
and this generates a concatenation ambiguity:
let iter_quotes = label_quotes*
--
Raphaël Pinson
Administrateur Systèmes & Réseaux
Camptocamp France
Savoie Technolac
BP 352
48, avenue du Lac du Bourget
73372 Le Bourget du Lac, Cedex
www.camptocamp.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20120807/828b4421/attachment.htm>
More information about the augeas-devel
mailing list