[#39810] 2.0 feature questionnaire — SASADA Koichi <ko1@...>

I made a questionnaire "What do you want to introduce in 2.0?" in my

59 messages 2011/10/01
[#39822] Re: 2.0 feature questionnaire — Jeremy Kemper <jeremy@...> 2011/10/02

2011/10/1 SASADA Koichi <ko1@atdot.net>:

[#39827] Re: 2.0 feature questionnaire — Yukihiro Matsumoto <matz@...> 2011/10/02

Hi,

[#40324] Re: 2.0 feature questionnaire — Charles Oliver Nutter <headius@...> 2011/10/25

2011/10/1 SASADA Koichi <ko1@atdot.net>:

[#39823] Discussion results — SASADA Koichi <ko1@...>

Hi,

34 messages 2011/10/02
[#39840] Re: Discussion results — Intransition <transfire@...> 2011/10/02

I did not have the fortune of attending the discussion, but I would

[#39844] Re: Discussion results — Yukihiro Matsumoto <matz@...> 2011/10/02

Hi,

[#39851] Re: Discussion results (here documents with indents) — "Martin J. Dürst" <duerst@...> 2011/10/03

Hello Matz,

[#39862] Re: Discussion results (here documents with indents) — Yusuke Endoh <mame@...> 2011/10/03

Hello,

[#39874] Re: Discussion results (here documents with indents) — Trans <transfire@...> 2011/10/03

On Mon, Oct 3, 2011 at 8:16 AM, Yusuke Endoh <mame@tsg.ne.jp> wrote:

[#39915] [Ruby 1.9 - Feature #5400][Open] Remove flip-flops in 2.0 — Magnus Holm <judofyr@...>

29 messages 2011/10/04

[#39957] [Ruby 1.9 - Bug #5407][Open] Cannot build ruby-1.9.3-rc1 with TDM-GCC 4.6.1 on Windows XP SP3 — Heesob Park <phasis@...>

11 messages 2011/10/05

[#39993] [Ruby 1.9 - Feature #2348] RBTree Should be Added to the Standard Library — David Graham <david.malcom.graham@...>

10 messages 2011/10/06

[#40037] [Ruby 1.9 - Bug #5422][Open] File.fnmatch != Dir.glob # {no,sets} — Suraj Kurapati <sunaku@...>

14 messages 2011/10/07

[#40073] [Ruby 1.9 - Feature #5427][Open] Not complex patch to improve `require` time (load.c) — Yura Sokolov <funny.falcon@...>

31 messages 2011/10/09

[#40090] [Ruby 1.9 - Bug #5433][Open] PTY.spawn Kernel panic on macos lion — Gamaliel Toro <argami@...>

14 messages 2011/10/10

[#40188] [Ruby 2.0 - Feature #5454] keyword arguments — Yukihiro Matsumoto <matz@...>

16 messages 2011/10/17
[#40189] Re: [Ruby 2.0 - Feature #5454] keyword arguments — Evan Phoenix <evan@...> 2011/10/17

This looks very interesting=21 Would someone be willing to translate to e=

[#40191] Re: [Ruby 2.0 - Feature #5454] keyword arguments — Yutaka Hara <yutaka.hara@...> 2011/10/18

Hi,

[#40192] Re: [Ruby 2.0 - Feature #5454] keyword arguments — Yukihiro Matsumoto <matz@...> 2011/10/18

Hi,

[#40259] Counseling — Perry Smith <pedzsan@...>

Ruby and I are back in counseling... Its always the same thing with =

21 messages 2011/10/21
[#40263] Re: Counseling — "Haase, Konstantin" <Konstantin.Haase@...> 2011/10/21

What's your $LC_CTYPE? What OS are you on?

[#40264] Re: Counseling — Gon軋lo Silva <goncalossilva@...> 2011/10/21

Hi all,

[#40266] Re: Counseling — Bill Kelly <billk@...> 2011/10/21

Gon軋lo Silva wrote:

[#40271] Can rubygems save us from "binary-compatibility hell"? — Yusuke Endoh <mame@...>

Hello, rubygems developers --

17 messages 2011/10/22

[#40290] [ruby-trunk - Feature #5474][Assigned] keyword argument — Yusuke Endoh <mame@...>

36 messages 2011/10/23
[#40298] Re: [ruby-trunk - Feature #5474][Assigned] keyword argument — Yukihiro Matsumoto <matz@...> 2011/10/24

Hi,

[#40414] Re: [ruby-trunk - Feature #5474][Assigned] keyword argument — Charles Oliver Nutter <headius@...> 2011/10/26

More refinement below. I think we're on a good path here.

[#40416] Re: [ruby-trunk - Feature #5474][Assigned] keyword argument — Yukihiro Matsumoto <matz@...> 2011/10/26

Hi,

[#40418] Re: [ruby-trunk - Feature #5474][Assigned] keyword argument — Joshua Ballanco <jballanc@...> 2011/10/26

On Wed, Oct 26, 2011 at 2:08 PM, Yukihiro Matsumoto <matz@ruby-lang.org>wrote:

[#40425] Re: [ruby-trunk - Feature #5474][Assigned] keyword argument — Yukihiro Matsumoto <matz@...> 2011/10/27

Hi,

[#40311] [ruby-trunk - Feature #5478][Open] import Set into core, add syntax — Konstantin Haase <Konstantin.Haase@...>

33 messages 2011/10/24

[#40312] [ruby-trunk - Feature #5479][Open] import StringIO into core, add String#to_io — Konstantin Haase <Konstantin.Haase@...>

9 messages 2011/10/24

[#40316] [ruby-trunk - Feature #5481][Open] Gemifying Ruby standard library — Hiroshi Nakamura <nakahiro@...>

86 messages 2011/10/24
[#40334] [ruby-trunk - Feature #5481] Gemifying Ruby standard library — Lucas Nussbaum <lucas@...> 2011/10/25

[#40322] [ruby-trunk - Feature #5482][Open] Rubinius as basis for Ruby 2.0 — Thomas Sawyer <transfire@...>

19 messages 2011/10/25

[#40356] JIT development for MRI — Carter Cheng <cartercheng@...>

Hello,

25 messages 2011/10/25
[#40390] Re: JIT development for MRI — SASADA Koichi <ko1@...> 2011/10/26

Hi,

[#40394] Re: JIT development for MRI — Carter Cheng <cartercheng@...> 2011/10/26

Dear Koichi SASADA,

[#40395] Re: JIT development for MRI — Carter Cheng <cartercheng@...> 2011/10/26

I noticed that you used context threading in YARV. Do you have some analysis

[#40417] Re: JIT development for MRI — SASADA Koichi <ko1@...> 2011/10/26

Thanks for reference.

[#40423] Re: JIT development for MRI — Carter Cheng <cartercheng@...> 2011/10/26

Thanks Koichi.

[#40412] [ruby-trunk - Bug #5486][Open] rb_stat() doesn’t respect input encoding — Nikolai Weibull <now@...>

15 messages 2011/10/26

[#40462] [ruby-trunk - Bug #5492][Open] MinGW Installation with Ruby 1.9.3rc1 Broken — Charlie Savage <cfis@...>

14 messages 2011/10/27

[#40573] [ruby-trunk - Bug #5530][Open] SEEK_SET malfunctions when used with 'append' File.open mode — "Joshua J. Drake" <ruby-lang.jdrake@...>

17 messages 2011/10/31

[#40586] [ruby-trunk - Feature #5531][Open] deep_value for dealing with nested hashes — Kyle Peyton <kylepeyton@...>

19 messages 2011/10/31

[ruby-core:40153] PATCH: Allow floating point literals with leading decimal points

From: Brent Roman <brent@...>
Date: 2011-10-14 22:11:19 UTC
List: ruby-core #40153
This patch to 1.8.7 allows for the parsing of floating point literals 
that start with a decimal point.
(Just as it was possible in the bad old days of MRI 1.6.x :-)
These numbers are flagged with a (normally suppressed) warning to allow 
one to check compatibility with unpatched Rubies.

Background:
We use a variant of IRB as an command interpreter.  Users are not 
programmers.  They expect .1 and the like to be accepted as valid 
floating point values.  I'm in the process of moving our app from 1.6.8 
to 1.8.7

===========================

diff --git a/parse.y b/parse.y
index df19699..3d7af5e 100644
--- a/parse.y
+++ b/parse.y
@@ -7,6 +7,7 @@
    created at: Fri May 28 18:02:42 JST 1993

    Copyright (C) 1993-2003 Yukihiro Matsumoto
+  Revised:  Oct 13, 2011 brent@mbari.org -- accept leading dot in float 
literal

  **********************************************************************/

@@ -144,7 +145,6 @@ static NODE *block_append();
  static NODE *list_append();
  static NODE *list_concat();
  static NODE *arg_concat();
-static NODE *arg_prepend();
  static NODE *literal_concat();
  static NODE *new_evstr();
  static NODE *evstr2dstr();
@@ -3251,6 +3251,99 @@ parse_string(quote)
      return tSTRING_CONTENT;
  }

+
+static void
+trailing_uc(int nondigit)
+{
+   char tmp[30];
+   sprintf(tmp, "trailing `%c' in number", nondigit);
+   yyerror(tmp);
+}
+
+static int
+parse_decimal(int c, int nondigit)
+{
+    int is_float, seen_point, seen_e;
+
+    is_float = seen_point = seen_e = 0;
+    for (;;) {
+    switch (c) {
+      case '0': case '1': case '2': case '3': case '4':
+      case '5': case '6': case '7': case '8': case '9':
+        nondigit = 0;
+        tokadd(c);
+        break;
+
+      case '.':
+        if (nondigit)
+              trailing_uc(nondigit);
+        if (seen_point || seen_e) {
+        goto decode_num;
+        }
+        else {
+        int c0 = nextc();
+        if (!ISDIGIT(c0)) {
+            pushback(c0);
+            goto decode_num;
+        }
+        c = c0;
+        }
+        tokadd('.');
+        tokadd(c);
+        is_float++;
+        seen_point++;
+        nondigit = 0;
+        break;
+
+      case 'e':
+      case 'E':
+        if (nondigit) {
+        pushback(c);
+        c = nondigit;
+        goto decode_num;
+        }
+        if (seen_e) {
+        goto decode_num;
+        }
+        tokadd(c);
+        seen_e++;
+        is_float++;
+        nondigit = c;
+        c = nextc();
+        if (c != '-' && c != '+') continue;
+        tokadd(c);
+        nondigit = c;
+        break;
+
+      case '_':    /* `_' in number just ignored */
+        if (nondigit) goto decode_num;
+        nondigit = c;
+        break;
+
+      default:
+        goto decode_num;
+    }
+    c = nextc();
+    }
+
+  decode_num:
+    pushback(c);
+    tokfix();
+    if (nondigit)
+      trailing_uc(nondigit);
+    if (is_float) {
+    double d = strtod(tok(), 0);
+    if (errno == ERANGE) {
+        rb_warn("Float %s out of range", tok());
+        errno = 0;
+    }
+    yylval.node = NEW_LIT(rb_float_new(d));
+    return tFLOAT;
+    }
+    yylval.node = NEW_LIT(rb_cstr_to_inum(tok(), 10, Qfalse));
+    return tINTEGER;
+}
+
  static int
  heredoc_identifier()
  {
@@ -3848,8 +3941,8 @@ yylex()
      return '-';

        case '.':
-    lex_state = EXPR_BEG;
      if ((c = nextc()) == '.') {
+        lex_state = EXPR_BEG;
          if ((c = nextc()) == '.') {
          return tDOT3;
          }
@@ -3858,7 +3951,10 @@ yylex()
      }
      pushback(c);
      if (ISDIGIT(c)) {
-        yyerror("no .<digit> floating literal anymore; put 0 before dot");
+            rb_warning (".<digit> floating literal; put 0 before dot");
+        newtok();
+            lex_state = EXPR_END;
+            return parse_decimal('.', 0);
      }
      lex_state = EXPR_DOT;
      return '.';
@@ -3867,9 +3963,8 @@ yylex()
        case '0': case '1': case '2': case '3': case '4':
        case '5': case '6': case '7': case '8': case '9':
      {
-        int is_float, seen_point, seen_e, nondigit;
+        int nondigit = 0;

-        is_float = seen_point = seen_e = nondigit = 0;
          lex_state = EXPR_END;
          newtok();
          if (c == '-' || c == '+') {
@@ -3899,7 +3994,8 @@ yylex()
              if (toklen() == start) {
              yyerror("numeric literal without digits");
              }
-            else if (nondigit) goto trailing_uc;
+            else if (nondigit)
+                      trailing_uc(nondigit);
              yylval.node = NEW_LIT(rb_cstr_to_inum(tok(), 16, Qfalse));
              return tINTEGER;
          }
@@ -3923,7 +4019,8 @@ yylex()
              if (toklen() == start) {
              yyerror("numeric literal without digits");
              }
-            else if (nondigit) goto trailing_uc;
+            else if (nondigit)
+                      trailing_uc(nondigit);
              yylval.node = NEW_LIT(rb_cstr_to_inum(tok(), 2, Qfalse));
              return tINTEGER;
          }
@@ -3947,7 +4044,8 @@ yylex()
              if (toklen() == start) {
              yyerror("numeric literal without digits");
              }
-            else if (nondigit) goto trailing_uc;
+            else if (nondigit)
+                      trailing_uc(nondigit);
              yylval.node = NEW_LIT(rb_cstr_to_inum(tok(), 10, Qfalse));
              return tINTEGER;
          }
@@ -3979,13 +4077,14 @@ yylex()
              if (toklen() > start) {
              pushback(c);
              tokfix();
-            if (nondigit) goto trailing_uc;
+            if (nondigit)
+                          trailing_uc(nondigit);
              yylval.node = NEW_LIT(rb_cstr_to_inum(tok(), 8, Qfalse));
              return tINTEGER;
              }
              if (nondigit) {
              pushback(c);
-            goto trailing_uc;
+            trailing_uc(nondigit);
              }
          }
          if (c > '7' && c <= '9') {
@@ -4001,87 +4100,8 @@ yylex()
              return tINTEGER;
          }
          }
-
-        for (;;) {
-        switch (c) {
-          case '0': case '1': case '2': case '3': case '4':
-          case '5': case '6': case '7': case '8': case '9':
-            nondigit = 0;
-            tokadd(c);
-            break;
-
-          case '.':
-            if (nondigit) goto trailing_uc;
-            if (seen_point || seen_e) {
-            goto decode_num;
-            }
-            else {
-            int c0 = nextc();
-            if (!ISDIGIT(c0)) {
-                pushback(c0);
-                goto decode_num;
-            }
-            c = c0;
-            }
-            tokadd('.');
-            tokadd(c);
-            is_float++;
-            seen_point++;
-            nondigit = 0;
-            break;
-
-          case 'e':
-          case 'E':
-            if (nondigit) {
-            pushback(c);
-            c = nondigit;
-            goto decode_num;
-            }
-            if (seen_e) {
-            goto decode_num;
-            }
-            tokadd(c);
-            seen_e++;
-            is_float++;
-            nondigit = c;
-            c = nextc();
-            if (c != '-' && c != '+') continue;
-            tokadd(c);
-            nondigit = c;
-            break;
-
-          case '_':    /* `_' in number just ignored */
-            if (nondigit) goto decode_num;
-            nondigit = c;
-            break;
-
-          default:
-            goto decode_num;
-        }
-        c = nextc();
-        }
-
-      decode_num:
-        pushback(c);
-        tokfix();
-        if (nondigit) {
-        char tmp[30];
-          trailing_uc:
-        sprintf(tmp, "trailing `%c' in number", nondigit);
-        yyerror(tmp);
-        }
-        if (is_float) {
-        double d = strtod(tok(), 0);
-        if (errno == ERANGE) {
-            rb_warn("Float %s out of range", tok());
-            errno = 0;
-        }
-        yylval.node = NEW_LIT(rb_float_new(d));
-        return tFLOAT;
-        }
-        yylval.node = NEW_LIT(rb_cstr_to_inum(tok(), 10, Qfalse));
-        return tINTEGER;
-    }
+            return parse_decimal(c, nondigit);
+         }

        case ']':
        case '}':
@@ -5646,27 +5666,6 @@ arg_blk_pass(node1, node2)
  }

  static NODE*
-arg_prepend(node1, node2)
-    NODE *node1, *node2;
-{
-    switch (nd_type(node2)) {
-      case NODE_ARRAY:
-    return list_concat(NEW_LIST(node1), node2);
-
-      case NODE_SPLAT:
-    return arg_concat(node1, node2->nd_head);
-
-      case NODE_BLOCK_PASS:
-    node2->nd_body = arg_prepend(node1, node2->nd_body);
-    return node2;
-
-      default:
-    rb_bug("unknown nodetype(%d) for arg_prepend", nd_type(node2));
-    }
-    return 0;            /* not reached */
-}
-
-static NODE*
  new_call(r,m,a)
      NODE *r;
      ID m;


In This Thread

Prev Next