[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yaml 37c176fc5c 086/124: Fix the anchor parse event tur
From: |
ELPA Syncer |
Subject: |
[elpa] externals/yaml 37c176fc5c 086/124: Fix the anchor parse event turning maps into lists |
Date: |
Fri, 29 Nov 2024 16:00:05 -0500 (EST) |
branch: externals/yaml
commit 37c176fc5cdcccfb1f846b9294b89a97e20a1178
Author: Zachary Romero <zacromero@posteo.net>
Commit: Zachary Romero <zacromero@posteo.net>
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] externals/yaml 64c117d084 052/124: Fix encoding issues for nil, false, and arrays, (continued)
- [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
- [elpa] externals/yaml 8a3303b59e 015/124: Fix indentation bug, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 9ebddb5523 047/124: Merge pull request #5 from zkry/improve-parsing-error-message, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0db4ab0a1e 046/124: Improve parsing error message, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml e2fe7e2e57 042/124: Merge pull request #3 from zkry/add-yaml-spec-json, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 6d52649383 076/124: Fix list encoding indentation #29, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml bda9a00090 058/124: return alist key as a symbol as a default, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 45aa819a4f 068/124: Add MELPA tag to README, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 37c176fc5c 086/124: Fix the anchor parse event turning maps into lists,
ELPA Syncer <=
- [elpa] externals/yaml f546dac2a8 082/124: Initial implementation of position storage, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml c07cc6d0f3 089/124: Merge pull request #35 from zkry/fix-yaml-anchor-match-definition, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 14e6e4bc3d 095/124: Merge pull request #37 from zkry/fix-folded-block-parsing-error, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0ac7f365bb 104/124: Merge pull request #41 from zkry/fix-property-prop-bug, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 900ca55584 119/124: Fix failing test for parsing scalars, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 964ef3b105 014/124: process literal and folded, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml a1d6e3211c 007/124: Initial working yaml-parser, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 5c52737f17 005/124: Start on event handling, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml aba7c19c47 020/124: Remove yaml spec, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 7c6c1e1abf 017/124: Rename names according to elisp standards, ELPA Syncer, 2024/11/29