[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/yaml d0abc17e3d 060/124: Merge pull request #18 from co
From: |
ELPA Syncer |
Subject: |
[elpa] externals/yaml d0abc17e3d 060/124: Merge pull request #18 from conao3/alist-symbol |
Date: |
Fri, 29 Nov 2024 16:00:01 -0500 (EST) |
branch: externals/yaml
commit d0abc17e3ddf42624d87fa6d2d3e1ba1dd175035
Merge: 7f055d207c d82bfb523e
Author: Zachary Romero <zacromero@posteo.net>
Commit: GitHub <noreply@github.com>
Merge pull request #18 from conao3/alist-symbol
Return alist key as a symbol
---
yaml-tests.el | 54 +++++++++++++++++++++++++++---------------------------
yaml.el | 8 ++++----
2 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/yaml-tests.el b/yaml-tests.el
index 7df19c9663..17233262ac 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -93,7 +93,7 @@
(yaml-parse-string "key: value")
(let ((ht (make-hash-table :test 'equal)))
(prog1 ht
- (puthash "key" "value" ht)))))
+ (puthash 'key "value" ht)))))
(should (equal (yaml-parse-string "value")
"value"))
(should (equal (yaml-parse-string "[abc, def, ghi]")
@@ -139,7 +139,7 @@ strip: |-
\s\s
# Clip
# comments:" :object-type 'alist)
- '(("strip" . "# text"))))
+ '((strip . "# text"))))
(should (equal (yaml-parse-string ">
@@ -167,7 +167,7 @@ strip: |-
- one
- two : three
" :object-type 'alist)
- '(("block sequence" . ["one" (("two" . "three"))]))))
+ `((,(intern "block sequence") . ["one" ((two . "three"))]))))
;; Example 8.15. Block Sequence Entry Types
(should (equal (yaml-parse-string "- # Empty
@@ -176,13 +176,13 @@ strip: |-
- - one # Compact
- two # sequence
- one: two # Compact mapping" :object-type 'alist)
- [:null "block node\n" ["one" "two"] (("one" . "two"))]))
+ [:null "block node\n" ["one" "two"] ((one . "two"))]))
;; Example 8.16. Block mapping
(should (equal (yaml-parse-string "block mapping:
key: value
" :object-type 'alist)
- '(("block mapping" . (("key" . "value"))))))
+ `((,(intern "block mapping") . ((key . "value"))))))
;; Example 8.17. Explicit Block Mapping Entries
@@ -192,8 +192,8 @@ strip: |-
: - one # Explicit compact
- two # block value
" :object-type 'alist)
- '(("explicit key" . :null)
- ("block key\n" . ["one" "two"]))))
+ `((,(intern "explicit key") . :null)
+ (,(intern "block key\n") . ["one" "two"]))))
;; Example 8.18. Implicit Block Mapping Entries
(should (equal (yaml-parse-string "plain key: in-line value
@@ -201,9 +201,9 @@ strip: |-
\"quoted key\":
- entry
" :object-type 'alist)
- '(("plain key" . "in-line value")
+ `((,(intern "plain key") . "in-line value")
(:null . :null)
- ("quoted key" . ["entry"]))))
+ (,(intern "quoted key") . ["entry"]))))
;; Example 8.19. Compact Block Mappings
@@ -211,7 +211,7 @@ strip: |-
- ? earth: blue
: moon: white
" :object-type 'alist)
- [(("sun" . "yellow")) (((("earth" . "blue")) . (("moon" .
"white"))))]))
+ [((sun . "yellow")) ((((earth . "blue")) . ((moon .
"white"))))]))
;; Example 8.20. Block Node Types
(should (equal (yaml-parse-string "-
@@ -221,7 +221,7 @@ strip: |-
- !!map # Block collection
foo : bar
" :object-type 'alist)
- ["flow in block" "Block scalar\n" (("foo" . "bar"))]))
+ ["flow in block" "Block scalar\n" ((foo . "bar"))]))
;; Example 8.21. Block Scalar Nodes
;; TODO: The document has no new line after the literal and folded
@@ -233,7 +233,7 @@ folded:
!foo
>1
value" :object-type 'alist)
- '(("literal" . "value\n") ("folded" . "value\n"))))
+ '((literal . "value\n") (folded . "value\n"))))
(should (equal (yaml-parse-string "sequence: !!seq
- entry
@@ -241,8 +241,8 @@ folded:
- nested
mapping: !!map
foo: bar" :object-type 'alist)
- '(("sequence" . ["entry" ["nested"]])
- ("mapping" . (("foo" . "bar"))))))
+ '((sequence . ["entry" ["nested"]])
+ (mapping . ((foo . "bar"))))))
;; Example 9.2. Document Markers
(should (equal (yaml-parse-string "%YAML 1.2
@@ -270,18 +270,18 @@ Document
{ matches
% : 20 }
..." :object-type 'alist)
- '(("matches %" . 20))))
+ `((,(intern "matches %") . 20))))
(should (equal (yaml-parse-string "strip: |-
beep
# text" :object-type 'alist)
- '(("strip" . "beep"))))
+ '((strip . "beep"))))
(should (equal (yaml-parse-string "
- one: |
hey
- two" :object-type 'alist)
- [(("one" . "hey\n"))
+ [((one . "hey\n"))
"two"]))
(should (equal (yaml-parse-string "
@@ -289,8 +289,8 @@ one:
note: |-
this is a note
two: three" :object-type 'alist)
- '(("one" . (("note" . "this is a note")
- ("two" . "three"))))))
+ '((one . ((note . "this is a note")
+ (two . "three"))))))
(should (equal (yaml-parse-string "key: |-
# not
@@ -300,7 +300,7 @@ one:
# are
# all
# comments" :object-type 'alist)
- '(("key" . "# not\n# a\n# comment"))))
+ '((key . "# not\n# a\n# comment"))))
(should (equal (yaml-parse-string "
abc:
key-1: |-
@@ -316,9 +316,9 @@ abc:
# are
# all
# comments" :object-type 'alist)
- '(("abc" ("key-1" . "# not
+ '((abc (key-1 . "# not
# a
-# comment") ("key-2" . [1 2 "three"]) ("key-3" . ["deeply" "nested
+# comment") (key-2 . [1 2 "three"]) (key-3 . ["deeply" "nested
"])))))
(should (equal (yaml-parse-string "
@@ -329,8 +329,8 @@ key-2: |2-
---
---"
:object-type 'alist)
- '(("key-1" . " ---\n ---")
- ("key-2" . " ---\n ---"))))
+ '((key-1 . " ---\n ---")
+ (key-2 . " ---\n ---"))))
(should (equal (yaml-parse-string "
key-1: |-2
---
@@ -338,10 +338,10 @@ key-1: |-2
key-2: |2-
---
---"
- :object-key-type 'symbol
+ :object-key-type 'string
:object-type 'alist)
- '((key-1 . " ---\n ---")
- (key-2 . " ---\n ---")))))
+ '(("key-1" . " ---\n ---")
+ ("key-2" . " ---\n ---")))))
(ert-deftest yaml-parsing-completes ()
diff --git a/yaml.el b/yaml.el
index 55dcef819e..9e385d1382 100644
--- a/yaml.el
+++ b/yaml.el
@@ -969,12 +969,12 @@ value. It defaults to the symbol :false."
(t (error "Invalid object-type. object-type must be hash-table, alist,
or plist")))
(cond
((or (not object-key-type)
- (equal 'string object-key-type))
+ (equal 'symbol object-key-type))
(if (equal 'plist yaml--parsing-object-type)
(setq yaml--parsing-object-key-type 'keyword)
- (setq yaml--parsing-object-key-type 'string)))
- ((equal 'symbol object-key-type)
- (setq yaml--parsing-object-key-type 'symbol))
+ (setq yaml--parsing-object-key-type 'symbol)))
+ ((equal 'string object-key-type)
+ (setq yaml--parsing-object-key-type 'string))
((equal 'keyword object-key-type)
(setq yaml--parsing-object-key-type 'keyword))
(t (error "Invalid object-key-type. object-key-type must be string,
keyword, or symbol")))
- [elpa] externals/yaml 10af746dad 050/124: Add option to convert string keys to symbols, (continued)
- [elpa] externals/yaml 10af746dad 050/124: Add option to convert string keys to symbols, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 96d3e51aeb 048/124: Add yaml-encode feature, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 51023c4551 049/124: Merge pull request #7 from zkry/add-yaml-encode, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 8903b6c7e4 055/124: return plist key as a keyword as a default, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml ed108ab526 084/124: add option for skipping processing of scalars, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml a2ed8f1fd6 072/124: Fix empty single quote string bug, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 419e85fbce 094/124: fix folding block parsing error, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 0bf6a1b686 088/124: YAML anchor should match exactly how it was defined, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 2aa5a6faf7 056/124: Merge pull request #16 from conao3/indent, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 5b352258f5 067/124: Merge pull request #24 from j-shilling/fix-alist-to-hash, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml d0abc17e3d 060/124: Merge pull request #18 from conao3/alist-symbol,
ELPA Syncer <=
- [elpa] externals/yaml e32ef2f5e5 092/124: add note to yaml-parse-string-with-pos function, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml c56d47254d 091/124: add unit test, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 69c699a15a 071/124: Minor code formatting fixes, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 1f15c0b33a 062/124: Merge pull request #20 from j-shilling/fix-encoding-symbols, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml adb3e52a21 081/124: Merge pull request #32 from zkry/fix-encoding-deeply-nested-lists, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 2500074ebf 097/124: Merge pull request #39 from zkry/fix-obob-for-storing-position, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml f9fbe392e3 065/124: Merge pull request #22 from zkry/fix-escape-char-literals, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml fdc65922c9 099/124: fix zero-column indent problems; add more unit tests, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml c81f87f0fd 080/124: fix unit test, ELPA Syncer, 2024/11/29
- [elpa] externals/yaml 7783d802b0 102/124: Don't remove all properties, just yaml-n, ELPA Syncer, 2024/11/29