summaryrefslogtreecommitdiff
path: root/ext/json/parser
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-01 16:26:13 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-01 16:26:13 +0000
commit4a84c27e3ee50c4989591fcde2b7a10c5ccc0395 (patch)
tree4d741784865b00fcd418be81775eb256abb9d6ac /ext/json/parser
parentb60cc77902972047e6b1dcaf22f90d19448b0510 (diff)
* ext/json: Update github/flori/json from 1.4.2+ to
e22b2f2bdfe6a9b0. this fixes some bugs. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/json/parser')
-rw-r--r--ext/json/parser/extconf.rb11
-rw-r--r--ext/json/parser/parser.c30
-rw-r--r--ext/json/parser/parser.rl30
3 files changed, 41 insertions, 30 deletions
diff --git a/ext/json/parser/extconf.rb b/ext/json/parser/extconf.rb
index f378479875..f61fc94660 100644
--- a/ext/json/parser/extconf.rb
+++ b/ext/json/parser/extconf.rb
@@ -1,4 +1,15 @@
require 'mkmf'
require 'rbconfig'
+unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O3')
+ $CFLAGS << ' -O3'
+end
+if CONFIG['CC'] =~ /gcc/
+ $CFLAGS << ' -Wall'
+ #unless $CFLAGS.gsub!(/ -O[\dsz]?/, ' -O0 -ggdb')
+ # $CFLAGS << ' -O0 -ggdb'
+ #end
+end
+
+have_header("re.h")
create_makefile 'json/ext/parser'
diff --git a/ext/json/parser/parser.c b/ext/json/parser/parser.c
index cf4bbfa531..a2f4601bc1 100644
--- a/ext/json/parser/parser.c
+++ b/ext/json/parser/parser.c
@@ -4,7 +4,7 @@
/* unicode */
-static const char digit_values[256] = {
+static const char digit_values[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1,
@@ -40,7 +40,7 @@ static UTF32 unescape_unicode(const unsigned char *p)
return result;
}
-static int convert_UTF32_to_UTF8(char *buf, UTF32 ch)
+static int convert_UTF32_to_UTF8(char *buf, UTF32 ch)
{
int len = 1;
if (ch <= 0x7F) {
@@ -228,7 +228,7 @@ tr11:
#line 116 "parser.rl"
{
VALUE v = Qnil;
- char *np = JSON_parse_value(json, p, pe, &v);
+ char *np = JSON_parse_value(json, p, pe, &v);
if (np == NULL) {
p--; {p++; cs = 9; goto _out;}
} else {
@@ -530,7 +530,7 @@ tr2:
goto st21;
tr5:
#line 229 "parser.rl"
- {
+ {
char *np;
json->current_nesting++;
np = JSON_parse_array(json, p, pe, result);
@@ -540,7 +540,7 @@ tr5:
goto st21;
tr9:
#line 237 "parser.rl"
- {
+ {
char *np;
json->current_nesting++;
np = JSON_parse_object(json, p, pe, result);
@@ -1093,7 +1093,7 @@ tr2:
#line 339 "parser.rl"
{
VALUE v = Qnil;
- char *np = JSON_parse_value(json, p, pe, &v);
+ char *np = JSON_parse_value(json, p, pe, &v);
if (np == NULL) {
p--; {p++; cs = 3; goto _out;}
} else {
@@ -1312,7 +1312,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
unescape = (char *) "\f";
break;
case 'u':
- if (pe > stringEnd - 4) {
+ if (pe > stringEnd - 4) {
return Qnil;
} else {
char buf[4];
@@ -1404,13 +1404,13 @@ tr2:
{
*result = json_string_unescape(*result, json->memo + 1, p);
if (NIL_P(*result)) {
- p--;
- {p++; cs = 8; goto _out;}
- } else {
- FORCE_UTF8(*result);
- {p = (( p + 1))-1;}
- }
- }
+ p--;
+ {p++; cs = 8; goto _out;}
+ } else {
+ FORCE_UTF8(*result);
+ {p = (( p + 1))-1;}
+ }
+ }
#line 468 "parser.rl"
{ p--; {p++; cs = 8; goto _out;} }
goto st8;
@@ -1519,7 +1519,7 @@ static const int JSON_en_main = 1;
#line 518 "parser.rl"
-/*
+/*
* Document-class: JSON::Ext::Parser
*
* This is the JSON parser implemented as a C extension. It can be configured
diff --git a/ext/json/parser/parser.rl b/ext/json/parser/parser.rl
index 05b4890366..dd07485f3a 100644
--- a/ext/json/parser/parser.rl
+++ b/ext/json/parser/parser.rl
@@ -2,7 +2,7 @@
/* unicode */
-static const char digit_values[256] = {
+static const char digit_values[256] = {
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1,
@@ -38,7 +38,7 @@ static UTF32 unescape_unicode(const unsigned char *p)
return result;
}
-static int convert_UTF32_to_UTF8(char *buf, UTF32 ch)
+static int convert_UTF32_to_UTF8(char *buf, UTF32 ch)
{
int len = 1;
if (ch <= 0x7F) {
@@ -115,7 +115,7 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
action parse_value {
VALUE v = Qnil;
- char *np = JSON_parse_value(json, fpc, pe, &v);
+ char *np = JSON_parse_value(json, fpc, pe, &v);
if (np == NULL) {
fhold; fbreak;
} else {
@@ -226,7 +226,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
fhold; fbreak;
}
- action parse_array {
+ action parse_array {
char *np;
json->current_nesting++;
np = JSON_parse_array(json, fpc, pe, result);
@@ -234,7 +234,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
if (np == NULL) { fhold; fbreak; } else fexec np;
}
- action parse_object {
+ action parse_object {
char *np;
json->current_nesting++;
np = JSON_parse_object(json, fpc, pe, result);
@@ -338,7 +338,7 @@ static char *JSON_parse_float(JSON_Parser *json, char *p, char *pe, VALUE *resul
action parse_value {
VALUE v = Qnil;
- char *np = JSON_parse_value(json, fpc, pe, &v);
+ char *np = JSON_parse_value(json, fpc, pe, &v);
if (np == NULL) {
fhold; fbreak;
} else {
@@ -411,7 +411,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
unescape = (char *) "\f";
break;
case 'u':
- if (pe > stringEnd - 4) {
+ if (pe > stringEnd - 4) {
return Qnil;
} else {
char buf[4];
@@ -457,13 +457,13 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
action parse_string {
*result = json_string_unescape(*result, json->memo + 1, p);
if (NIL_P(*result)) {
- fhold;
- fbreak;
- } else {
- FORCE_UTF8(*result);
- fexec p + 1;
- }
- }
+ fhold;
+ fbreak;
+ } else {
+ FORCE_UTF8(*result);
+ fexec p + 1;
+ }
+ }
action exit { fhold; fbreak; }
@@ -517,7 +517,7 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
) ignore*;
}%%
-/*
+/*
* Document-class: JSON::Ext::Parser
*
* This is the JSON parser implemented as a C extension. It can be configured