unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25120: Invalid read syntax (#x) should err
@ 2016-12-05 20:10 Devon Sean McCullough
  2016-12-10 14:39 ` Philipp Stephani
  0 siblings, 1 reply; 4+ messages in thread
From: Devon Sean McCullough @ 2016-12-05 20:10 UTC (permalink / raw)
  To: 25120

Should all err
#b => nil
#o => nil
#x => nil
#  ?? (invalid-read-syntax "#")

	Peace
		—Devon






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#25120: Invalid read syntax (#x) should err
  2016-12-05 20:10 bug#25120: Invalid read syntax (#x) should err Devon Sean McCullough
@ 2016-12-10 14:39 ` Philipp Stephani
  2016-12-18 20:40   ` Philipp Stephani
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Stephani @ 2016-12-10 14:39 UTC (permalink / raw)
  To: Devon Sean McCullough, 25120


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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* bug#25120: Invalid read syntax (#x) should err
  2016-12-10 14:39 ` Philipp Stephani
@ 2016-12-18 20:40   ` Philipp Stephani
  2016-12-23 12:22     ` Philipp Stephani
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Stephani @ 2016-12-18 20:40 UTC (permalink / raw)
  To: Devon Sean McCullough, 25120

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am Sa., 10. Dez. 2016 um
15:39 Uhr:

> 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.
>
>
>
>
If there are no complaints within the next few days, I'll push this patch
to master.

[-- Attachment #2: Type: text/html, Size: 1456 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#25120: Invalid read syntax (#x) should err
  2016-12-18 20:40   ` Philipp Stephani
@ 2016-12-23 12:22     ` Philipp Stephani
  0 siblings, 0 replies; 4+ messages in thread
From: Philipp Stephani @ 2016-12-23 12:22 UTC (permalink / raw)
  To: Devon Sean McCullough, 25120-done

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 18. Dez. 2016 um
21:40 Uhr:

> Philipp Stephani <p.stephani2@gmail.com> schrieb am Sa., 10. Dez. 2016 um
> 15:39 Uhr:
>
> 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.
>
>
>
>
> If there are no complaints within the next few days, I'll push this patch
> to master.
>

Pushed as 6eaadcc7c821b7a8c75ce6d1d56cd7f50898f809.

[-- Attachment #2: Type: text/html, Size: 2133 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-23 12:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-05 20:10 bug#25120: Invalid read syntax (#x) should err Devon Sean McCullough
2016-12-10 14:39 ` Philipp Stephani
2016-12-18 20:40   ` Philipp Stephani
2016-12-23 12:22     ` Philipp Stephani

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).