mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/json/parser/parser.rl: add local variables for emacs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bf794afbf9
commit
bc1e4b4e2a
2 changed files with 32 additions and 18 deletions
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
/* unicode */
|
/* 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, -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,
|
-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;
|
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;
|
int len = 1;
|
||||||
if (ch <= 0x7F) {
|
if (ch <= 0x7F) {
|
||||||
|
@ -228,7 +228,7 @@ tr11:
|
||||||
#line 116 "parser.rl"
|
#line 116 "parser.rl"
|
||||||
{
|
{
|
||||||
VALUE v = Qnil;
|
VALUE v = Qnil;
|
||||||
char *np = JSON_parse_value(json, p, pe, &v);
|
char *np = JSON_parse_value(json, p, pe, &v);
|
||||||
if (np == NULL) {
|
if (np == NULL) {
|
||||||
p--; {p++; cs = 9; goto _out;}
|
p--; {p++; cs = 9; goto _out;}
|
||||||
} else {
|
} else {
|
||||||
|
@ -530,7 +530,7 @@ tr2:
|
||||||
goto st21;
|
goto st21;
|
||||||
tr5:
|
tr5:
|
||||||
#line 229 "parser.rl"
|
#line 229 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np;
|
char *np;
|
||||||
json->current_nesting++;
|
json->current_nesting++;
|
||||||
np = JSON_parse_array(json, p, pe, result);
|
np = JSON_parse_array(json, p, pe, result);
|
||||||
|
@ -540,7 +540,7 @@ tr5:
|
||||||
goto st21;
|
goto st21;
|
||||||
tr9:
|
tr9:
|
||||||
#line 237 "parser.rl"
|
#line 237 "parser.rl"
|
||||||
{
|
{
|
||||||
char *np;
|
char *np;
|
||||||
json->current_nesting++;
|
json->current_nesting++;
|
||||||
np = JSON_parse_object(json, p, pe, result);
|
np = JSON_parse_object(json, p, pe, result);
|
||||||
|
@ -1093,7 +1093,7 @@ tr2:
|
||||||
#line 339 "parser.rl"
|
#line 339 "parser.rl"
|
||||||
{
|
{
|
||||||
VALUE v = Qnil;
|
VALUE v = Qnil;
|
||||||
char *np = JSON_parse_value(json, p, pe, &v);
|
char *np = JSON_parse_value(json, p, pe, &v);
|
||||||
if (np == NULL) {
|
if (np == NULL) {
|
||||||
p--; {p++; cs = 3; goto _out;}
|
p--; {p++; cs = 3; goto _out;}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1312,7 +1312,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
|
||||||
unescape = (char *) "\f";
|
unescape = (char *) "\f";
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
if (pe > stringEnd - 4) {
|
if (pe > stringEnd - 4) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
} else {
|
} else {
|
||||||
char buf[4];
|
char buf[4];
|
||||||
|
@ -1519,7 +1519,7 @@ static const int JSON_en_main = 1;
|
||||||
#line 518 "parser.rl"
|
#line 518 "parser.rl"
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Document-class: JSON::Ext::Parser
|
* Document-class: JSON::Ext::Parser
|
||||||
*
|
*
|
||||||
* This is the JSON parser implemented as a C extension. It can be configured
|
* This is the JSON parser implemented as a C extension. It can be configured
|
||||||
|
@ -1933,3 +1933,10 @@ void Init_parser()
|
||||||
i_iconv = rb_intern("iconv");
|
i_iconv = rb_intern("iconv");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local variables:
|
||||||
|
* mode: c
|
||||||
|
* c-file-style: ruby
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
/* unicode */
|
/* 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, -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,
|
-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;
|
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;
|
int len = 1;
|
||||||
if (ch <= 0x7F) {
|
if (ch <= 0x7F) {
|
||||||
|
@ -97,7 +97,7 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
||||||
VNaN = 'NaN';
|
VNaN = 'NaN';
|
||||||
VInfinity = 'Infinity';
|
VInfinity = 'Infinity';
|
||||||
VMinusInfinity = '-Infinity';
|
VMinusInfinity = '-Infinity';
|
||||||
begin_value = [nft"\-[{NI] | digit;
|
begin_value = [nft\"\-\[\{NI] | digit;
|
||||||
begin_object = '{';
|
begin_object = '{';
|
||||||
end_object = '}';
|
end_object = '}';
|
||||||
begin_array = '[';
|
begin_array = '[';
|
||||||
|
@ -115,7 +115,7 @@ static ID i_json_creatable_p, i_json_create, i_create_id, i_create_additions,
|
||||||
|
|
||||||
action parse_value {
|
action parse_value {
|
||||||
VALUE v = Qnil;
|
VALUE v = Qnil;
|
||||||
char *np = JSON_parse_value(json, fpc, pe, &v);
|
char *np = JSON_parse_value(json, fpc, pe, &v);
|
||||||
if (np == NULL) {
|
if (np == NULL) {
|
||||||
fhold; fbreak;
|
fhold; fbreak;
|
||||||
} else {
|
} else {
|
||||||
|
@ -226,7 +226,7 @@ static char *JSON_parse_object(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
||||||
fhold; fbreak;
|
fhold; fbreak;
|
||||||
}
|
}
|
||||||
|
|
||||||
action parse_array {
|
action parse_array {
|
||||||
char *np;
|
char *np;
|
||||||
json->current_nesting++;
|
json->current_nesting++;
|
||||||
np = JSON_parse_array(json, fpc, pe, result);
|
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;
|
if (np == NULL) { fhold; fbreak; } else fexec np;
|
||||||
}
|
}
|
||||||
|
|
||||||
action parse_object {
|
action parse_object {
|
||||||
char *np;
|
char *np;
|
||||||
json->current_nesting++;
|
json->current_nesting++;
|
||||||
np = JSON_parse_object(json, fpc, pe, result);
|
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 {
|
action parse_value {
|
||||||
VALUE v = Qnil;
|
VALUE v = Qnil;
|
||||||
char *np = JSON_parse_value(json, fpc, pe, &v);
|
char *np = JSON_parse_value(json, fpc, pe, &v);
|
||||||
if (np == NULL) {
|
if (np == NULL) {
|
||||||
fhold; fbreak;
|
fhold; fbreak;
|
||||||
} else {
|
} else {
|
||||||
|
@ -411,7 +411,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
|
||||||
unescape = (char *) "\f";
|
unescape = (char *) "\f";
|
||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
if (pe > stringEnd - 4) {
|
if (pe > stringEnd - 4) {
|
||||||
return Qnil;
|
return Qnil;
|
||||||
} else {
|
} else {
|
||||||
char buf[4];
|
char buf[4];
|
||||||
|
@ -467,7 +467,7 @@ static VALUE json_string_unescape(VALUE result, char *string, char *stringEnd)
|
||||||
|
|
||||||
action exit { fhold; fbreak; }
|
action exit { fhold; fbreak; }
|
||||||
|
|
||||||
main := '"' ((^(["\\] | 0..0x1f) | '\\'["\\/bfnrt] | '\\u'[0-9a-fA-F]{4} | '\\'^(["\\/bfnrtu]|0..0x1f))* %parse_string) '"' @exit;
|
main := '"' ((^([\"\\] | 0..0x1f) | '\\'[\"\\/bfnrt] | '\\u'[0-9a-fA-F]{4} | '\\'^([\"\\/bfnrtu]|0..0x1f))* %parse_string) '"' @exit;
|
||||||
}%%
|
}%%
|
||||||
|
|
||||||
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *result)
|
||||||
|
@ -517,7 +517,7 @@ static char *JSON_parse_string(JSON_Parser *json, char *p, char *pe, VALUE *resu
|
||||||
) ignore*;
|
) ignore*;
|
||||||
}%%
|
}%%
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Document-class: JSON::Ext::Parser
|
* Document-class: JSON::Ext::Parser
|
||||||
*
|
*
|
||||||
* This is the JSON parser implemented as a C extension. It can be configured
|
* This is the JSON parser implemented as a C extension. It can be configured
|
||||||
|
@ -790,3 +790,10 @@ void Init_parser()
|
||||||
i_iconv = rb_intern("iconv");
|
i_iconv = rb_intern("iconv");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local variables:
|
||||||
|
* mode: c
|
||||||
|
* c-file-style: ruby
|
||||||
|
* End:
|
||||||
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue