all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Devon Sean McCullough <Emacs-Hacker2016@jovi.net>, 25120@debbugs.gnu.org
Subject: bug#25120: Invalid read syntax (#x) should err
Date: Sat, 10 Dec 2016 14:39:43 +0000	[thread overview]
Message-ID: <CAArVCkSgP_c39yaOS1AAknC-S=mSz2NSw3-fG9d7T61VQ1DHCw@mail.gmail.com> (raw)
In-Reply-To: <0f906a68e6b49a881647ebe4777468e9.squirrel@leaf.websitewelcome.com>


[-- Attachment #1.1: Type: text/plain, Size: 201 bytes --]

Devon Sean McCullough <Emacs-Hacker2016@jovi.net> schrieb am Mo., 5. Dez.
2016 um 21:22 Uhr:

> Should all err
> #b => nil
> #o => nil
> #x => nil
> #  ?? (invalid-read-syntax "#")
>
>
Here's a patch.

[-- Attachment #1.2: Type: text/html, Size: 688 bytes --]

[-- Attachment #2: 0001-Treat-incomplete-integer-literals-as-errors.txt --]
[-- Type: text/plain, Size: 1567 bytes --]

From 2055147b4de79503f387fdb65d3559f99249353b Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Sat, 10 Dec 2016 15:36:11 +0100
Subject: [PATCH 1/1] Treat incomplete integer literals as errors

See Bug#25120.

* src/lread.c (read_integer): Treat incomplete integer literals as errors.
* test/src/lread-tests.el (lread-empty-int-literal): New unit test for
incomplete integer literals.
---
 src/lread.c             | 2 +-
 test/src/lread-tests.el | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/lread.c b/src/lread.c
index 157a392..5e1c61c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2536,7 +2536,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
       *p = '\0';
     }
 
-  if (! valid)
+  if (valid != 1)
     {
       sprintf (buf, "integer, radix %"pI"d", radix);
       invalid_syntax (buf);
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index 1a82d13..609f82e 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -104,4 +104,12 @@
 (ert-deftest lread-string-char-name ()
   (should (equal (read "\"a\\N{SYLOTI NAGRI  LETTER DHO}b\"") "a\uA817b")))
 
+(ert-deftest lread-empty-int-literal ()
+  "Check that Bug#25120 is fixed."
+  (should-error (read "#b") :type 'invalid-read-syntax)
+  (should-error (read "#o") :type 'invalid-read-syntax)
+  (should-error (read "#x") :type 'invalid-read-syntax)
+  (should-error (read "#24r") :type 'invalid-read-syntax)
+  (should-error (read "#") :type 'invalid-read-syntax))
+
 ;;; lread-tests.el ends here
-- 
2.10.2


  reply	other threads:[~2016-12-10 14:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 20:10 bug#25120: Invalid read syntax (#x) should err Devon Sean McCullough
2016-12-10 14:39 ` Philipp Stephani [this message]
2016-12-18 20:40   ` Philipp Stephani
2016-12-23 12:22     ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAArVCkSgP_c39yaOS1AAknC-S=mSz2NSw3-fG9d7T61VQ1DHCw@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=25120@debbugs.gnu.org \
    --cc=Emacs-Hacker2016@jovi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.