[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yaml 891e158930 008/124: Got parser mostly working.
From: |
ELPA Syncer |
Subject: |
[elpa] externals/yaml 891e158930 008/124: Got parser mostly working. |
Date: |
Fri, 29 Nov 2024 15:59:52 -0500 (EST) |
branch: externals/yaml
commit 891e1589301e6ff3b4f0d5a025b30d9ff978735a
Author: Zachary Romero <zacromero@posteo.net>
Commit: Zachary Romero <zacromero@posteo.net>
Got parser mostly working.
---
yaml-tests.el | 25 ++++++++++++++++++++-----
yaml.el | 9 +++++++--
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/yaml-tests.el b/yaml-tests.el
index 74111c176a..62dc20a257 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -270,11 +270,26 @@
(ert-deftest yaml-parsing-yaml ()
"Tests YAML parsing."
(should (yaml--hash-table-equal
+ (yaml-parse-string "key: value")
(let ((ht (make-hash-table :test 'equal)))
- (puthash "test" 3 ht))
- (yaml-parse-string "key: value"))))
-(yaml-parse-string "value")
+ (prog1 ht
+ (puthash "key" "value" ht)))))
+ (should (equal (yaml-parse-string "value")
+ "value"))
+ (should (equal (yaml-parse-string "[abc, def, ghi]")
+ '("abc" "def" "ghi")))
+ (should (equal (yaml-parse-string "- abc\n- def\n- ghi")
+ '("abc" "def" "ghi")))
+ (should (equal (yaml-parse-string "- abc\n- def\n- ghi")
+ '("abc" "def" "ghi")))
+ (should (equal (yaml-parse-string "- [abc, def, ghi]\n- [jkl, mno, pqr]\n-
[stu, vwx, yz]")
+ '(("abc" "def" "ghi") ("jkl" "mno" "pqr") ("stu" "vwx"
"yz"))))
+;; (should (equal (yaml-parse-string "%YAML 1.2
+;; ---
+;; !!map {
+;; ? !!str foo : !!seq [ !!str \"abc\", !!str \"def\"],
+;; ? !!str xzy : !!str zyx
+;; }")))
+ )
(provide 'yaml-tests)
-
-;;; yaml-tests.el ends here
diff --git a/yaml.el b/yaml.el
index a4d6c5a323..7966cfe55a 100644
--- a/yaml.el
+++ b/yaml.el
@@ -233,6 +233,9 @@
(defun yaml--check-document-start () t)
(defun yaml--check-document-end () t)
+(defun yaml--revers-at-list ()
+ (setcar yaml--object-stack (reverse (car yaml--object-stack))))
+
(defconst yaml--grammar-events-in
'(("l-yaml-stream" . (lambda ()
(yaml--add-event (yaml--stream-start-event))
@@ -275,12 +278,13 @@
(setq yaml--document-end-explicit t))
(yaml--check-document-end)))
("c-flow-mapping" . (lambda (text)
- (yaml--add-event (yaml--mapping-end-event t))))
+ (yaml--add-event (yaml--mapping-end-event))))
("c-flow-sequence" . (lambda (text)
(yaml--add-event (yaml--sequence-end-event ))))
("l+block-mapping" . (lambda (text)
(yaml--add-event (yaml--mapping-end-event))))
("l+block-sequence" . (lambda (text)
+ (yaml--revers-at-list)
(yaml--add-event (yaml--sequence-end-event))))
("ns-l-compact-mapping" . (lambda (text)
(yaml--add-event (yaml--mapping-end-event))))
@@ -381,7 +385,8 @@
("c-ns-anchor-property" . (lambda (text)
(setq yaml--anchor (substring text 1))))
("c-ns-tag-property" . (lambda (text)
- (error "not implemented")))
+ ;; (error "not implemented: %s" text)
+ ))
("c-ns-alias-node" . (lambda (text)
(yaml--add-event (yaml--alias-event (substring text
1)))))))
- [elpa] branch externals/yaml created (now 70c4fcead9), ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 57254d464a 002/124: update schema, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml b33b2ba412 003/124: Add test file, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 891e158930 008/124: Got parser mostly working.,
ELPA Syncer <=
- [elpa] externals/yaml 04aae95584 043/124: Fix/add pcase usages, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 67d4b64d15 022/124: Bug fixes, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 95283d460f 034/124: Add emacs 25.1 CI test, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 67e8b5f3dc 096/124: Fix off-by-one bug for storing position, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml a47f5a8274 054/124: indent buffer, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 164cd43d6e 087/124: Merge pull request #34 from zkry/fix-bad-anchor-map->list-conversion, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml e711e774b1 074/124: Allow parsing false and/or null as nil, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 50a3a00cb8 061/124: FIX insert symbol name when not equal to :null or :false, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml ee9001e091 063/124: Fix the escape character in parser (after /), ELPA Syncer, 2024/11/29
- [elpa] externals/yaml ee86566af1 114/124: Merge pull request #47 from tarsiiformes/typos, ELPA Syncer, 2024/11/29