[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tomelr e2b313ca3b 52/84: feat: Implement everything pla
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tomelr e2b313ca3b 52/84: feat: Implement everything planned in the initial spec |
Date: |
Tue, 3 May 2022 09:58:13 -0400 (EDT) |
branch: externals/tomelr
commit e2b313ca3b3e4c98c18749671ac59bc1fe319c52
Author: Kaushal Modi <kaushal.modi@gmail.com>
Commit: Kaushal Modi <kaushal.modi@gmail.com>
feat: Implement everything planned in the initial spec
Fix converting of array of TOML tables represented by S-exp vectors.
---
README.org | 9 ++++-----
test/tinternal.el | 3 +++
test/tplist.el | 22 +++++++++++-----------
tomelr.el | 22 +++++++++++++---------
4 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/README.org b/README.org
index 7a03d4bd7d..5240692b1c 100644
--- a/README.org
+++ b/README.org
@@ -5,8 +5,6 @@
#+property: header-args :eval never-export
-*NOTE*: This library is in a severe beta stage. It is not ready for any use!!
:poop:
-
[[https://github.com/kaushalmodi/tomelr/actions][https://github.com/kaushalmodi/tomelr/actions/workflows/test.yml/badge.svg]]
[[https://www.gnu.org/licenses/gpl-3.0][https://img.shields.io/badge/License-GPL%20v3-blue.svg]]
* Installation
@@ -18,7 +16,7 @@ the Emacs core library
[[https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/j
It will then be gradually refactored so that it meets the
specification defined below.
-* Library Completion Status [6/7]
+* Library Completion Status [7/7]
- [X] Scalar
- [X] Boolean
- [X] Integer
@@ -35,7 +33,7 @@ specification defined below.
- [X] Array of Tables
- [X] Basic Array of Tables
- [X] Nested Array of Tables
-- [ ] Property Lists
+- [X] Property Lists
* Specification and Conversion Examples
[[https://scripter.co/defining-tomelr/][Companion blog post]]
@@ -954,7 +952,8 @@ contributors = [
]
}
#+end_example
-** TODO P-lists
+** DONE P-lists
+CLOSED: [2022-04-30 Sat 01:55]
**** S-expression
#+begin_src emacs-lisp :eval no :noweb-ref p-list
'(:int 123
diff --git a/test/tinternal.el b/test/tinternal.el
index 63e58a7fab..187b5dbe3e 100644
--- a/test/tinternal.el
+++ b/test/tinternal.el
@@ -66,6 +66,9 @@
;; TTA with 1 table nesting another TTA
(((a . (((b . 2))))))
((:a ((:b 2))))
+ ;; TTA with vector notation
+ [(:a 100 :b "foo")
+ (:a 200 :b "bar")]
)))
(dolist (el inp)
(should (equal t (tomelr--toml-table-array-p el))))))
diff --git a/test/tplist.el b/test/tplist.el
index 2191d305f9..b49196ec6d 100644
--- a/test/tplist.el
+++ b/test/tplist.el
@@ -40,10 +40,10 @@
:list_of_lists [(1 2) (3 4 5)]
:map (:key1 123
:key2 "xyz")
- ;; :list_of_maps [(:key1 123
- ;; :key2 "xyz")
- ;; (:key1 567
- ;; :key2 "klm")]
+ :list_of_maps [(:key1 123
+ :key2 "xyz")
+ (:key1 567
+ :key2 "klm")]
)))
(ref '("int = 123
str = \"abc\"
@@ -55,13 +55,13 @@ bool_list = [ true, false, true, false ]
list_of_lists = [ [ 1, 2 ], [ 3, 4, 5 ] ]
[map]
key1 = 123
- key2 = \"xyz\""))
- ;; [[list_of_maps]]
- ;; key1 = 123
- ;; key2 = \"xyz\"
- ;; [[list_of_maps]]
- ;; key1 = 567
- ;; key2 = \"klm\""))
+ key2 = \"xyz\"
+[[list_of_maps]]
+ key1 = 123
+ key2 = \"xyz\"
+[[list_of_maps]]
+ key1 = 567
+ key2 = \"klm\""))
out)
(dolist (el inp)
(push (tomelr-encode el) out))
diff --git a/tomelr.el b/tomelr.el
index 4611a92b31..1ef27faaa9 100644
--- a/tomelr.el
+++ b/tomelr.el
@@ -393,7 +393,8 @@ Definition of a TOML Table Array (TTA):
TOML Table (TT)."
(let (ttap)
(when (and (not (tomelr--toml-table-p object))
- (listp object))
+ (or (listp object)
+ (vectorp object)))
;; (message "[tomelr--toml-table-array-p DBG] object = %S, type = %S,
len = %d"
;; object (type-of object) (safe-length object))
(setq ttap (cond
@@ -404,18 +405,21 @@ Definition of a TOML Table Array (TTA):
;; (when (listp elem)
;; (message " [tomelr--toml-table-array-p DBG]
sub-elem 0 = %S, type = %S, len = %d"
;; (car elem) (type-of (car elem))
(safe-length (car elem))))
- (tomelr--toml-table-p elem))
+ (or
+ (tomelr--toml-table-p elem)
+ ;; Handling the case of a nested TTA.
+ ;; Example: (((a . (((b . 2))))))
+ (and (listp elem) ; ((a . (((b . 2)))))
+ (listp (car elem)) ; (a . (((b . 2))))
+ (symbolp (car (car elem))) ; a <- symbol
+ ;; --(((b . 2)))- <--
This will be a TTA.
+ (tomelr--toml-table-array-p (cdr (car elem))))))
object)
t)
- ;; Handling the case of a nested TTA.
- ;; Example: (((a . (((b .
2))))))
- ((and (listp (car object)) ; ((a . (((b .
2)))))
- (listp (car (car object))) ; (a . (((b .
2))))
- (symbolp (car (car (car object))))) ; a <- symbol
- ;; ------(((b . 2)))----- <--
This will be a TTA.
- (tomelr--toml-table-array-p (cdr (car (car object)))))
(t
nil))))
+ ;; (message "[tomelr--toml-table-array-p DBG] ttap = %S" ttap)
+ ;; (message "=====")
ttap))
(defun tomelr--print-tta-key ()
- [elpa] externals/tomelr 2810504e84 32/84: feat: Add basic support for S-exp plists -> TOML conversion, (continued)
- [elpa] externals/tomelr 2810504e84 32/84: feat: Add basic support for S-exp plists -> TOML conversion, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 0f4e7b4f2c 47/84: fix: Better detection of nested TTA, but still wip, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr cff1f8aa89 38/84: fix: Support TOML tables arrays specified as plist vector, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 4c419bcee2 37/84: fix: Support TOML tables specified as plists, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr baf81228bc 45/84: fix: Correct the spec for nested array of tables, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 4dda8e6be3 46/84: chore: Style edits in a test, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 5959b90ffa 44/84: fix: Don't let TOML tables be recognized as TOML tables arrays, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr b64eb07e99 49/84: fix: Detect TT with sub-tables correctly, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 4386d99a85 65/84: refactor(minor): Use `tomelr--toml-table-p`, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 26f1fc2f3c 55/84: doc: Update the medley example, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr e2b313ca3b 52/84: feat: Implement everything planned in the initial spec,
ELPA Syncer <=
- [elpa] externals/tomelr 4434ccc64b 70/84: chore: Bump version, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 10a1994aed 51/84: feat: Support (lightly tested) nested TOML Table Arrays, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr df0e73334f 59/84: Revert "doc: Update the medley example", ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr ec381fd723 79/84: fix: Auto-stringify and auto-quote symbol values, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr a25d952a17 77/84: feat: Auto-coerce string to integers, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr b2ba4c46b5 82/84: refactor: Minor code reorg, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr d86fd721ce 63/84: fix: Compatibility for emacs 26.3, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr a1fa47379e 84/84: chore: Add CHANGELOG generated using git cliff tool, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr ae983711be 78/84: fix: Auto-stringify symbols like 1.10.1, ELPA Syncer, 2022/05/03
- [elpa] externals/tomelr 61397410af 01/84: Initial empty commit, ELPA Syncer, 2022/05/03