Simplify test parser
This commit is contained in:
parent
26e35f4227
commit
bdc0815218
20
origami.el
20
origami.el
@ -396,8 +396,9 @@ recursion. We fail if we don't consume something."
|
||||
(origami-run-parser (origami-parser-item) content))))
|
||||
|
||||
(defun origami-parser-paired (start children end create)
|
||||
"CHILDREN should be a zero-arg lambda returning a parser to
|
||||
allow for recursive nesting."
|
||||
;; TODO: make this a macro so I don't have to pass in the thunk?
|
||||
"CHILDREN should be a zero-arg lambda -- a thunk -- returning a
|
||||
parser to allow for recursive nesting of a parser."
|
||||
(origami-do (begin <- start)
|
||||
(children <- (funcall children))
|
||||
(end <- end)
|
||||
@ -433,18 +434,15 @@ allow for recursive nesting."
|
||||
origami-fold-root-node)))))
|
||||
|
||||
(defun origami-test-parser (create)
|
||||
(origami-parser-0+ (origami-parser-conj
|
||||
(origami-do
|
||||
(origami-parser-drop-until-regex "[{}]")
|
||||
(origami-parser-1?
|
||||
(origami-parser-paired (origami-parser-char "{")
|
||||
(let ((pair (origami-parser-paired (origami-parser-char "{")
|
||||
(lambda () (origami-test-parser create))
|
||||
(origami-parser-char "}")
|
||||
create)))
|
||||
(origami-parser-paired (origami-parser-char "{")
|
||||
(lambda () (origami-test-parser create))
|
||||
(origami-parser-char "}")
|
||||
create))))
|
||||
(origami-parser-0+ (origami-parser-conj
|
||||
(origami-do
|
||||
(origami-parser-drop-until-regex "[{}]")
|
||||
(origami-parser-1? pair))
|
||||
pair))))
|
||||
|
||||
(defun origami-get-parser (buffer)
|
||||
;; TODO: remove hardcoding!
|
||||
|
Loading…
Reference in New Issue
Block a user