all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: don@donarmstrong.com (Emacs bug Tracking System)
To: Chong Yidong <cyd@stupidchicken.com>
Subject: bug#679: marked as done (23.0.60; Function json-read-number does  not handle complete Javascript spec)
Date: Thu, 28 Aug 2008 13:30:04 -0700	[thread overview]
Message-ID: <handler.679.D679.12199548161983.ackdone@emacsbugs.donarmstrong.com> (raw)
In-Reply-To: 20080809070528.26869.qmail@priss.frightenedpiglet.com

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


Your message dated Thu, 28 Aug 2008 16:22:08 -0400
with message-id <87sksoc2kv.fsf@cyd.mit.edu>
and subject line Re: 23.0.60; Function json-read-number does not handle complete Javascript spec
has caused the Emacs bug report #679,
regarding 23.0.60; Function json-read-number does not handle complete Javascript spec
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
679: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=679
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 5304 bytes --]

From: sand@blarg.net
To: emacs-pretest-bug@gnu.org
Cc: rfrancoise@debian.org
Subject: 23.0.60; Function json-read-number does not handle complete Javascript spec
Date: 9 Aug 2008 07:05:28 -0000
Message-ID: <20080809070528.26869.qmail@priss.frightenedpiglet.com>

----

In json.el, the 'json-read-number' function is intended to read the
textual representation of Javascript numbers.

(defun json-read-number ()
  "Read the JSON number following point.
N.B.: Only numbers which can fit in Emacs Lisp's native number
representation will be parsed correctly."
  (if (char-equal (json-peek) ?-)
      (progn
        (json-advance)
        (- 0 (json-read-number)))
    (if (looking-at "[0-9]+\\([.][0-9]+\\)?\\([eE][+-]?[0-9]+\\)?")
        (progn
          (goto-char (match-end 0))
          (string-to-number (match-string 0)))
      (signal 'json-number-format (list (point))))))

The Javascript spec
(http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Literals#Floating-Point_Literals)
says the following about floating-point numbers:

| A floating-point literal can have the following parts:
| 
|     * A decimal integer which can be signed (preceded by "+" or "-"),
|     * A decimal point ("."),
|     * A fraction (another decimal number),
|     * An exponent. 
| 
| The exponent part is an "e" or "E" followed by an integer, which can
| be signed (preceded by "+" or "-"). A floating-point literal must have
| at least one digit and either a decimal point or "e" (or "E"). 

This means that

  1.

is a valid floating point-literal per the spec, but the regular
expression above does not match the complete text---the regular
expression requires digits after the decimal point.  This ends up
matched as a simple integer, leaving the decimal point in the input
stream and causing a later syntax error.  Similarly

  .1

is a valid floating point-literal illegal that Emacs rejects, because
the regular expression requires digits before the decimal point.
Testing with the error console in Firefox confirms that the two
examples above are valid syntax.

The parser function needs to be fixed to handle the complete syntax.

----


In GNU Emacs 23.0.60.1 (i486-pc-linux-gnu, GTK+ Version 2.12.11)
 of 2008-07-27 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20080727-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure  '--build' 'i486-linux-gnu' '--host' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.0.60/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.60/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=i486-linux-gnu' 'host_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: POSIX
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: VM

Minor modes in effect:
  shell-dirtrack-mode: t
  auto-image-file-mode: t
  show-paren-mode: t
  icomplete-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t



[-- Attachment #3: Type: message/rfc822, Size: 1076 bytes --]

From: Chong Yidong <cyd@stupidchicken.com>
To: "Edward O'Connor" <hober0@gmail.com>
Cc: 679-done@emacsbugs.donarmstrong.com
Subject: Re: 23.0.60; Function json-read-number does not handle complete Javascript spec
Date: Thu, 28 Aug 2008 16:22:08 -0400
Message-ID: <87sksoc2kv.fsf@cyd.mit.edu>

> I've attached a modified version, which disallows octal & hexadecimal.

Checked in, thanks.


      parent reply	other threads:[~2008-08-28 20:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87sksoc2kv.fsf@cyd.mit.edu>
2008-08-09  7:05 ` bug#679: 23.0.60; Function json-read-number does not handle complete Javascript spec sand
2008-08-09 10:57   ` OFFICE ZERO
     [not found]     ` <handler.679.B679.12182794784103.ackinfo@emacsbugs.donarmstrong.com>
2008-08-09 12:13       ` bug#679: Info received (bug#679: 23.0.60; Function json-read-number does not handle complete Javascript spec) OFFICE ZERO
     [not found]         ` <handler.679.B679.121828398627739.ackinfo@emacsbugs.donarmstrong.com>
2008-08-09 13:17           ` bug#679: Info received (bug#679: Info received (bug#679: 23.0.60; Function json-read-number does not handle complete Javascript spec)) OFFICE ZERO
2008-08-09 14:14   ` bug#679: 23.0.60; Function json-read-number does not handle complete Javascript spec OFFICE ZERO
2008-08-13  3:11   ` Kevin Rodgers
2008-08-28 20:30   ` Emacs bug Tracking System [this message]

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=handler.679.D679.12199548161983.ackdone@emacsbugs.donarmstrong.com \
    --to=don@donarmstrong.com \
    --cc=cyd@stupidchicken.com \
    /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.