[augeas-devel] augeas: master - Shellvars: allow backticks as quote characters
David Lutterkort
lutter at fedoraproject.org
Wed Jul 8 19:55:09 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=4ecca5de2f590182bbad6814a57ac00551e85586
Commit: 4ecca5de2f590182bbad6814a57ac00551e85586
Parent: 09062845ba20fe14380e681b16cf59892abb7af8
Author: David Lutterkort <lutter at redhat.com>
AuthorDate: Wed Jul 8 12:53:28 2009 -0700
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Wed Jul 8 12:53:28 2009 -0700
Shellvars: allow backticks as quote characters
* lenses/shellvars.aug (simple_value): allow backticks as quotes
* lenses/tests/test_shellvars.aug: add tests
Fixes bug #74 reported by Micah
---
lenses/shellvars.aug | 3 ++-
lenses/tests/test_shellvars.aug | 3 +++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
index 845c8eb..ec8518c 100644
--- a/lenses/shellvars.aug
+++ b/lenses/shellvars.aug
@@ -13,6 +13,7 @@ module Shellvars =
let char = /[^() '"\t\n]|\\\\"/
let dquot = /"([^"\\\n]|\\\\.)*"/ (* " Emacs, relax *)
let squot = /'[^'\n]*'/
+ let bquot = /`[^`\n]*`/
(* Array values of the form '(val1 val2 val3)'. We do not handle empty *)
(* arrays here because of typechecking headaches. Instead, they are *)
@@ -28,7 +29,7 @@ module Shellvars =
(* but fairly close. *)
let simple_value =
let empty_array = /\([ \t]*\)/ in
- store (char* | dquot | squot | empty_array)
+ store (char* | dquot | squot | bquot | empty_array)
let export = [ key "export" . Util.del_ws_spc ]
let kv = [ export? . key key_re . eq . (simple_value | array) . eol ]
diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
index 9c584d0..d161b4f 100644
--- a/lenses/tests/test_shellvars.aug
+++ b/lenses/tests/test_shellvars.aug
@@ -72,6 +72,9 @@ unset ONBOOT
test Shellvars.lns get "var=ab#c\n" =
{ "var" = "ab#c" }
+ test Shellvars.lns get "var=`grep nameserver /etc/resolv.conf | head -1`\n" =
+ { "var" = "`grep nameserver /etc/resolv.conf | head -1`" }
+
(* We don't handle comments at the end of a line yet *)
test Shellvars.lns get "var=ab #c\n" = *
More information about the augeas-devel
mailing list