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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/yaml 5af0cd7c55 122/124: Fix octal/hex parsing (#54)


From: ELPA Syncer
Subject: [elpa] externals/yaml 5af0cd7c55 122/124: Fix octal/hex parsing (#54)
Date: Fri, 29 Nov 2024 16:00:11 -0500 (EST)

branch: externals/yaml
commit 5af0cd7c553c2ec93b35d81a7759224c9bd68fae
Author: Zachary Romero <zacromero@posteo.net>
Commit: Zachary Romero <zacromero@posteo.net>

    Fix octal/hex parsing (#54)
---
 yaml-tests.el | 6 +++++-
 yaml.el       | 4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/yaml-tests.el b/yaml-tests.el
index acf56e5176..bfa70f3ac7 100644
--- a/yaml-tests.el
+++ b/yaml-tests.el
@@ -419,7 +419,11 @@ ship-to:
                  "this is text"))
   (should (equal (yaml-parse-string "top: |1\n  this is text"
                                     :object-type 'alist)
-                 '((top . " this is text\n")))))
+                 '((top . " this is text\n"))))
+  (should (equal (yaml-parse-string "top: 0x10" :object-type 'alist)
+                 '((top . 16))))
+  (should (equal (yaml-parse-string "top: 0o10" :object-type 'alist)
+                 '((top . 8)))))
 
 (ert-deftest yaml-parsing-completes ()
   "Tests that the yaml parses."
diff --git a/yaml.el b/yaml.el
index 4b450434d6..bfa93cbdb0 100644
--- a/yaml.el
+++ b/yaml.el
@@ -305,9 +305,9 @@ This flag is intended for development purposes.")
    ((string-match "^[-+]?[0-9]+$" scalar)
     (string-to-number scalar))
    ((string-match "^0o[0-7]+$" scalar)
-    (string-to-number scalar 8))
+    (string-to-number (substring scalar 2) 8))
    ((string-match "^0x[0-9a-fA-F]+$" scalar)
-    (string-to-number scalar 16))
+    (string-to-number (substring scalar 2) 16))
    ;; tag:yaml.org,2002:float
    ((string-match
      "^[-+]?\\(\\.[0-9]+\\|[0-9]+\\(\\.[0-9]*\\)?\\)\\([eE][-+]?[0-9]+\\)?$"



reply via email to

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