[macruby-changes] [3766] MacRuby/trunk/parse.y
source_changes at macosforge.org
source_changes at macosforge.org
Mon Mar 15 19:03:59 PDT 2010
Revision: 3766
http://trac.macosforge.org/projects/ruby/changeset/3766
Author: lsansonetti at apple.com
Date: 2010-03-15 19:03:57 -0700 (Mon, 15 Mar 2010)
Log Message:
-----------
support unicode code points via \u{}
Modified Paths:
--------------
MacRuby/trunk/parse.y
Modified: MacRuby/trunk/parse.y
===================================================================
--- MacRuby/trunk/parse.y 2010-03-15 22:01:12 UTC (rev 3765)
+++ MacRuby/trunk/parse.y 2010-03-16 02:03:57 UTC (rev 3766)
@@ -5508,13 +5508,20 @@
}
}
+#include <unicode/utf8.h>
+
static void
parser_tokaddmbc(struct parser_params *parser, int c, rb_encoding *enc)
{
#if WITH_OBJC
- /* FIXME */
- char *buf = tokspace(1);
- *(buf) = c;
+ const int bytelen = U8_LENGTH(c);
+ uint8_t *buf = (uint8_t *)tokspace(bytelen);
+ UBool error = false;
+ int offset = 0;
+ U8_APPEND(buf, offset, bytelen, c, error);
+ if (error) {
+ rb_raise(rb_eArgError, "invalid unicode point U+%d", c);
+ }
#else
int len = rb_enc_codelen(c, enc);
rb_enc_mbcput(c, tokspace(len), enc);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100315/6a7fc302/attachment-0001.html>
More information about the macruby-changes
mailing list