|
@@ -7,7 +7,8 @@
|
|
|
:cl)
|
|
|
(:import-from #:parse-number
|
|
|
#:parse-number)
|
|
|
- (:export open-configuration-file))
|
|
|
+ (:export open-configuration-file
|
|
|
+ get-config-drive))
|
|
|
|
|
|
(in-package #:config-parser)
|
|
|
|
|
@@ -65,24 +66,24 @@
|
|
|
(and identifier (? space) "=" (? space) (or string number ident-path) (? #\Newline))
|
|
|
(:destructure (identifier sp1 eq sp2 value nl)
|
|
|
(declare (ignore sp1 eq sp2 nl))
|
|
|
- (list identifier value)))
|
|
|
+ (cons identifier value)))
|
|
|
|
|
|
(defrule block-contents
|
|
|
(* variable-expression)
|
|
|
(:lambda (expressions)
|
|
|
(loop for expression in expressions
|
|
|
- append expression)))
|
|
|
+ collect expression)))
|
|
|
|
|
|
(defrule block
|
|
|
(and block-title block-contents)
|
|
|
(:destructure (title contents)
|
|
|
- (list title contents)))
|
|
|
+ (cons title contents)))
|
|
|
|
|
|
(defrule file
|
|
|
(* block)
|
|
|
(:lambda (blocks)
|
|
|
(loop for block in blocks
|
|
|
- append block)))
|
|
|
+ collect block)))
|
|
|
|
|
|
(defun open-configuration-file (filename)
|
|
|
(parse 'file
|
|
@@ -92,3 +93,5 @@
|
|
|
until (eq char 'foo)
|
|
|
collect char)))))
|
|
|
|
|
|
+(defun get-config-drive (section ident config)
|
|
|
+ (cdr (assoc ident (cdr (assoc section config)))))
|