[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yaml 164cd43d6e 087/124: Merge pull request #34 from zk
From: |
ELPA Syncer |
Subject: |
[elpa] externals/yaml 164cd43d6e 087/124: Merge pull request #34 from zkry/fix-bad-anchor-map->list-conversion |
Date: |
Fri, 29 Nov 2024 16:00:05 -0500 (EST) |
branch: externals/yaml
commit 164cd43d6ecba9a49714127511ecf7dcc9725bff
Merge: f8803066ae 37c176fc5c
Author: Zachary Romero <zacromero@posteo.net>
Commit: GitHub <noreply@github.com>
Merge pull request #34 from zkry/fix-bad-anchor-map->list-conversion
Fix the anchor parse event turning maps into lists
---
yaml-tests.el | 15 ++++++++++++++-
yaml.el | 28 ++++++++++++++--------------
2 files changed, 28 insertions(+), 15 deletions(-)
diff --git a/yaml-tests.el b/yaml-tests.el
index 9396dd7b32..efa21676ab 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -344,7 +344,20 @@ key-2: |2-
("key-2" . " ---\n ---"))))
(should (equal (yaml-parse-string "''") ""))
(should (equal (yaml-parse-string "foo: ''" :object-type 'alist)
- '((foo . "")))))
+ '((foo . ""))))
+ ;; anchor should produce same parse as without anchor
+ (should (equal (yaml-parse-string "bill-to: &id001
+ city: East Centerville
+ state: KS
+" :object-type 'alist
+ :object-key-type 'string
+ :string-values t)
+ (yaml-parse-string "bill-to:
+ city: East Centerville
+ state: KS
+" :object-type 'alist
+ :object-key-type 'string
+ :string-values t))))
(ert-deftest yaml-parsing-completes ()
diff --git a/yaml.el b/yaml.el
index c6daabe272..11965d3c3b 100644
--- a/yaml.el
+++ b/yaml.el
@@ -402,28 +402,28 @@ This flag is intended for development purposes.")
Note that VALUE may be a complex object here. STYLE is
currently unused."
(let ((top-state (car yaml--state-stack))
- (value (cond
- ((stringp value) (yaml--resolve-scalar-tag value))
- ((listp value) (yaml--format-list value))
- ((hash-table-p value) (yaml--format-object value))
- ((vectorp value) value)
- ((not value) nil))))
+ (value* (cond
+ ((stringp value) (yaml--resolve-scalar-tag value))
+ ((listp value) (yaml--format-list value))
+ ((hash-table-p value) (yaml--format-object value))
+ ((vectorp value) value)
+ ((not value) nil))))
(cond
((not top-state)
- (setq yaml--root value))
+ (setq yaml--root value*))
((equal top-state :anchor)
(let* ((anchor (pop yaml--object-stack))
(name (nth 1 anchor)))
- (puthash name value yaml--anchor-mappings)
+ (puthash name value* yaml--anchor-mappings)
(pop yaml--state-stack)
(yaml--scalar-event nil value)))
((equal top-state :sequence)
(let ((l (car yaml--object-stack)))
- (setcar yaml--object-stack (append l (list value)))))
+ (setcar yaml--object-stack (append l (list value*)))))
((equal top-state :mapping)
(progn
(push :mapping-value yaml--state-stack)
- (push value yaml--cache)))
+ (push value* yaml--cache)))
((equal top-state :mapping-value)
(progn
(let ((key (pop yaml--cache))
@@ -434,18 +434,18 @@ This flag is intended for development purposes.")
(setq key (intern key)))
((eql 'keyword yaml--parsing-object-key-type)
(setq key (intern (format ":%s" key))))))
- (puthash key value table))
+ (puthash key value* table))
(pop yaml--state-stack)))
((equal top-state :trail-comments)
(pop yaml--state-stack)
(let ((comment-text (pop yaml--object-stack)))
- (unless (stringp value)
+ (unless (stringp value*)
(error "Trail-comments can't be nested under non-string"))
(yaml--scalar-event
style
(replace-regexp-in-string (concat (regexp-quote comment-text)
"\n*\\'")
""
- value ))))
+ value*))))
((equal top-state nil))))
'(:scalar))
@@ -1092,7 +1092,7 @@ value. It defaults to the symbol :false."
(length yaml--parsing-input)))
(when yaml--parse-debug (message "Parsed data: %s" (pp-to-string res)))
(yaml--walk-events res)
- (if (zerop (hash-table-count yaml--anchor-mappings))
+ (if (hash-table-empty-p yaml--anchor-mappings)
yaml--root
;; Run event processing twice to resolve aliases.
(let ((yaml--root nil)
- [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, 2024/11/29
- [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 <=
- [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
- [elpa] externals/yaml a15b045399 010/124: Condense grammar functions to one, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0bb76de608 009/124: Add YAML scalar conversion and type conversion, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 840be1b2b2 012/124: | blocks parse, initial wip, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 64c117d084 052/124: Fix encoding issues for nil, false, and arrays, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 67d86e158e 033/124: Add code documentation; remove unused code, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 091521769e 019/124: Add readme file, ELPA Syncer, 2024/11/29