emacs-elpa-diffs
[Top][All Lists]
Advanced

[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 ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]