[#1338] 1.8.0: possible socket problem with mswin32 builds — Jos Backus <jos@...>
Fyi: I tried the following command with two Ruby distributions on Windows 2003
5 messages
2003/08/05
[#1342] SEGV in GC under Linux — Dave Thomas <dave@...>
A while back I was getting double free()s reported on my MAC box when
5 messages
2003/08/05
[#1364] Broken REXML in Ruby 1.8 — Alexander Bokovoy <a.bokovoy@...>
Greetings!
1 message
2003/08/06
[#1378] differences between Module and Class ? — Mathieu Bouchard <matju@...>
25 messages
2003/08/11
[#1387] Re: differences between Module and Class ?
— matz@... (Yukihiro Matsumoto)
2003/08/12
Hi,
[#1442] Re: differences between Module and Class ?
— Mathieu Bouchard <matju@...>
2003/08/21
[#1452] Re: differences between Module and Class ?
— matz@... (Yukihiro Matsumoto)
2003/08/22
Hi,
[#1469] Re: differences between Module and Class ?
— Mathieu Bouchard <matju@...>
2003/08/23
[#1470] Re: differences between Module and Class ?
— matz@... (Yukihiro Matsumoto)
2003/08/24
Hi,
[#1472] Re: differences between Module and Class ?
— Mathieu Bouchard <matju@...>
2003/08/24
[#1444] Re: differences between Module and Class ?
— ts <decoux@...>
2003/08/21
>>>>> "M" == Mathieu Bouchard <matju@sympatico.ca> writes:
[#1381] proc/block with return — Mathieu Bouchard <matju@...>
9 messages
2003/08/11
[#1394] Std lib and updating PickAxe (was Re: proc/block with return) — "Gavin Sinclair" <gsinclair@...>
> [Dave wrote:]
5 messages
2003/08/13
[#1400] subclassing Structs — Eugene Scripnik <Eugene.Scripnik@...>
I'm trying to create class which behaves as struct (almost) and has some
5 messages
2003/08/13
[#1406] _id2ref bug? — Ryan Pavlik <rpav@...>
While debugging some caching code, I've come across a segfault related
22 messages
2003/08/14
[#1407] Re: _id2ref bug?
— matz@... (Yukihiro Matsumoto)
2003/08/14
Hi,
[#1413] Re: _id2ref bug? (REPRODUCED, short)
— Ryan Pavlik <rpav@...>
2003/08/14
On Fri, 15 Aug 2003 01:57:18 +0900
[#1415] Re: _id2ref bug? (REPRODUCED, short)
— matz@... (Yukihiro Matsumoto)
2003/08/15
Hi,
[#1416] Re: _id2ref bug? (another break)
— Ryan Pavlik <rpav@...>
2003/08/15
On Fri, 15 Aug 2003 09:21:39 +0900
[#1417] Re: _id2ref bug? (another break)
— nobu.nokada@...
2003/08/15
Hi,
[#1418] Re: _id2ref bug? (another break)
— Ryan Pavlik <rpav@...>
2003/08/15
On Fri, 15 Aug 2003 12:35:32 +0900
[#1424] Re: _id2ref bug? (another break)
— ts <decoux@...>
2003/08/15
>>>>> "n" == nobu nokada <nobu.nokada@softhome.net> writes:
[#1447] ruby-mode.el — Ryan Pavlik <rpav@...>
Attached is a patch for ruby-mode.el that adds font hilighting for
7 messages
2003/08/21
[#1450] Re: [PATCH] ruby-mode.el
— Ryan Pavlik <rpav@...>
2003/08/21
Crud, my mail has been slow, and I just got this back, but I realize I
[#1454] NODE_DSTR and NODE_EVSTR? — Robert Feldt <feldt@...>
How are "dynamic" strings represented internally?
7 messages
2003/08/22
%y{ ... } patch for 1.8.0
From:
why the lucky stiff <ruby-core@...>
Date:
2003-08-22 18:05:52 UTC
List:
ruby-core #1465
hey, y'alls.
this morning, i patched my 1.8.0 to use %y{ ... } for loading YAML strings:
invoice = %y{
---
id: 34843
date : 2001-01-23
bill-to: Chris Dumars
product:
- item : Super Hoop
quantity: 1
- item : Basketball
quantity: 4
- item : Big Shoes
quantity: 1
}
kinda fun.
here's a simple patch if anyone wants to play with it. i know i need to clean
up the yacc entry. this is just proof of concept. surprisingly,
YAML's awareness of indentation doesn't pose much of an issue.
_why
Attachments (1)
ruby-1.8.0-yamlstr.patch
(3.55 KB, text/x-diff)
diff -wur ruby-1.8.0/eval.c ruby-1.8.0-yamlstr/eval.c
--- ruby-1.8.0/eval.c Sun Aug 3 23:28:50 2003
+++ ruby-1.8.0-yamlstr/eval.c Fri Aug 22 11:24:46 2003
@@ -3399,6 +3399,11 @@
result = rb_funcall(self, '`', 1, node->nd_lit);
break;
+ case NODE_YAMLSTR:
+ rb_require("yaml");
+ result = rb_funcall(rb_const_get_at(rb_cObject, rb_intern("YAML")), rb_intern("load"), 1, node->nd_lit);
+ break;
+
case NODE_LIT:
result = node->nd_lit;
break;
diff -wur ruby-1.8.0/gc.c ruby-1.8.0-yamlstr/gc.c
--- ruby-1.8.0/gc.c Sat Aug 2 00:45:57 2003
+++ ruby-1.8.0-yamlstr/gc.c Fri Aug 22 11:28:31 2003
@@ -738,6 +738,7 @@
case NODE_LIT:
case NODE_STR:
case NODE_XSTR:
+ case NODE_YAMLSTR:
case NODE_DEFINED:
case NODE_MATCH:
case NODE_RETURN:
diff -wur ruby-1.8.0/node.h ruby-1.8.0-yamlstr/node.h
--- ruby-1.8.0/node.h Wed Jul 16 01:11:27 2003
+++ ruby-1.8.0-yamlstr/node.h Fri Aug 22 11:27:15 2003
@@ -125,6 +125,7 @@
NODE_IFUNC,
NODE_DSYM,
NODE_ATTRASGN,
+ NODE_YAMLSTR,
NODE_LAST
};
@@ -298,6 +299,7 @@
#define NEW_STR(s) NEW_NODE(NODE_STR,s,0,0)
#define NEW_DSTR(s) NEW_NODE(NODE_DSTR,s,0,0)
#define NEW_XSTR(s) NEW_NODE(NODE_XSTR,s,0,0)
+#define NEW_YAMLSTR(s) NEW_NODE(NODE_YAMLSTR,s,0,0)
#define NEW_DXSTR(s) NEW_NODE(NODE_DXSTR,s,0,0)
#define NEW_DSYM(s) NEW_NODE(NODE_DSYM,s,0,0)
#define NEW_EVSTR(n) NEW_NODE(NODE_EVSTR,0,(n),0)
diff -wur ruby-1.8.0/parse.y ruby-1.8.0-yamlstr/parse.y
--- ruby-1.8.0/parse.y Wed Jul 30 00:38:32 2003
+++ ruby-1.8.0-yamlstr/parse.y Fri Aug 22 11:29:24 2003
@@ -247,7 +247,7 @@
%token <node> tNTH_REF tBACK_REF
%token <num> tREGEXP_END
-%type <node> singleton strings string string1 xstring regexp
+%type <node> singleton strings string string1 xstring regexp yaml
%type <node> string_contents xstring_contents string_content
%type <node> words qwords word_list qword_list word
%type <node> literal numeric dsym cpath
@@ -290,7 +290,7 @@
%token tLBRACE_ARG /* { */
%token tSTAR /* * */
%token tAMPER /* & */
-%token tSYMBEG tSTRING_BEG tXSTRING_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG
+%token tSYMBEG tSTRING_BEG tXSTRING_BEG tYAML_BEG tREGEXP_BEG tWORDS_BEG tQWORDS_BEG
%token tSTRING_DBEG tSTRING_DVAR tSTRING_END
/*
@@ -1399,6 +1399,7 @@
primary : literal
| strings
| xstring
+ | yaml
| regexp
| words
| qwords
@@ -1922,6 +1923,30 @@
}
;
+yaml : tYAML_BEG xstring_contents tSTRING_END
+ {
+ NODE *node = $2;
+ rb_require("yaml");
+ if (!node) {
+ node = NEW_YAMLSTR(rb_str_new(0, 0));
+ }
+ else {
+ switch (nd_type(node)) {
+ case NODE_STR:
+ nd_set_type(node, NODE_YAMLSTR);
+ break;
+ case NODE_DSTR:
+ nd_set_type(node, NODE_YAMLSTR);
+ break;
+ default:
+ node = NEW_NODE(NODE_YAMLSTR, rb_str_new(0, 0), 1, NEW_LIST(node));
+ break;
+ }
+ }
+ $$ = node;
+ }
+ ;
+
regexp : tREGEXP_BEG xstring_contents tREGEXP_END
{
int options = $3;
@@ -2936,6 +2961,7 @@
str_squote = (0),
str_dquote = (STR_FUNC_EXPAND),
str_xquote = (STR_FUNC_ESCAPE|STR_FUNC_EXPAND),
+ str_yaml = (STR_FUNC_ESCAPE|STR_FUNC_EXPAND),
str_regexp = (STR_FUNC_REGEXP|STR_FUNC_ESCAPE|STR_FUNC_EXPAND),
str_sword = (STR_FUNC_QWORDS),
str_dword = (STR_FUNC_QWORDS|STR_FUNC_EXPAND),
@@ -4146,6 +4172,10 @@
case 'x':
lex_strterm = NEW_STRTERM(str_xquote, term, paren);
return tXSTRING_BEG;
+
+ case 'y':
+ lex_strterm = NEW_STRTERM(str_yaml, term, paren);
+ return tYAML_BEG;
case 'r':
lex_strterm = NEW_STRTERM(str_regexp, term, paren);