Ruby  2.0.0p645(2015-04-13revision50299)
Functions | Variables
parser.c File Reference
#include "../fbuffer/fbuffer.h"
#include "parser.h"

Go to the source code of this file.

Functions

static UTF32 unescape_unicode (const unsigned char *p)
 
static int convert_UTF32_to_UTF8 (char *buf, UTF32 ch)
 
static char * JSON_parse_object (JSON_Parser *json, char *p, char *pe, VALUE *result)
 
static char * JSON_parse_value (JSON_Parser *json, char *p, char *pe, VALUE *result)
 
static char * JSON_parse_integer (JSON_Parser *json, char *p, char *pe, VALUE *result)
 
static char * JSON_parse_float (JSON_Parser *json, char *p, char *pe, VALUE *result)
 
static char * JSON_parse_array (JSON_Parser *json, char *p, char *pe, VALUE *result)
 
static VALUE json_string_unescape (VALUE result, char *string, char *stringEnd)
 
static int match_i (VALUE regexp, VALUE klass, VALUE memo)
 
static char * JSON_parse_string (JSON_Parser *json, char *p, char *pe, VALUE *result)
 
static VALUE convert_encoding (VALUE source)
 
static VALUE cParser_initialize (int argc, VALUE *argv, VALUE self)
 
static VALUE cParser_parse_strict (VALUE self)
 
static VALUE cParser_parse_quirks_mode (VALUE self)
 
static VALUE cParser_parse (VALUE self)
 
static JSON_ParserJSON_allocate ()
 
static void JSON_mark (JSON_Parser *json)
 
static void JSON_free (JSON_Parser *json)
 
static VALUE cJSON_parser_s_allocate (VALUE klass)
 
static VALUE cParser_source (VALUE self)
 
static VALUE cParser_quirks_mode_p (VALUE self)
 
void Init_parser ()
 

Variables

static const char digit_values [256]
 
static VALUE CEncoding_ASCII_8BIT
 
static VALUE CEncoding_UTF_8
 
static VALUE CEncoding_UTF_16BE
 
static VALUE CEncoding_UTF_16LE
 
static VALUE CEncoding_UTF_32BE
 
static VALUE CEncoding_UTF_32LE
 
static ID i_encoding
 
static ID i_encode
 
static VALUE mJSON
 
static VALUE mExt
 
static VALUE cParser
 
static VALUE eParserError
 
static VALUE eNestingError
 
static VALUE CNaN
 
static VALUE CInfinity
 
static VALUE CMinusInfinity
 
static ID i_json_creatable_p
 
static ID i_json_create
 
static ID i_create_id
 
static ID i_create_additions
 
static ID i_chr
 
static ID i_max_nesting
 
static ID i_allow_nan
 
static ID i_symbolize_names
 
static ID i_quirks_mode
 
static ID i_object_class
 
static ID i_array_class
 
static ID i_key_p
 
static ID i_deep_const_get
 
static ID i_match
 
static ID i_match_string
 
static ID i_aset
 
static ID i_aref
 
static ID i_leftshift
 
static const int JSON_object_start = 1
 
static const int JSON_object_first_final = 27
 
static const int JSON_object_error = 0
 
static const int JSON_object_en_main = 1
 
static const int JSON_value_start = 1
 
static const int JSON_value_first_final = 21
 
static const int JSON_value_error = 0
 
static const int JSON_value_en_main = 1
 
static const int JSON_integer_start = 1
 
static const int JSON_integer_first_final = 3
 
static const int JSON_integer_error = 0
 
static const int JSON_integer_en_main = 1
 
static const int JSON_float_start = 1
 
static const int JSON_float_first_final = 8
 
static const int JSON_float_error = 0
 
static const int JSON_float_en_main = 1
 
static const int JSON_array_start = 1
 
static const int JSON_array_first_final = 17
 
static const int JSON_array_error = 0
 
static const int JSON_array_en_main = 1
 
static const int JSON_string_start = 1
 
static const int JSON_string_first_final = 8
 
static const int JSON_string_error = 0
 
static const int JSON_string_en_main = 1
 
static const int JSON_start = 1
 
static const int JSON_first_final = 10
 
static const int JSON_error = 0
 
static const int JSON_en_main = 1
 
static const int JSON_quirks_mode_start = 1
 
static const int JSON_quirks_mode_first_final = 10
 
static const int JSON_quirks_mode_error = 0
 
static const int JSON_quirks_mode_en_main = 1
 

Function Documentation

static VALUE cJSON_parser_s_allocate ( VALUE  klass)
static

Definition at line 2118 of file parser.c.

References Data_Wrap_Struct(), JSON_allocate(), JSON_free(), and JSON_mark().

Referenced by Init_parser().

static VALUE convert_encoding ( VALUE  source)
static
static int convert_UTF32_to_UTF8 ( char *  buf,
UTF32  ch 
)
static

Definition at line 44 of file parser.c.

References len.

Referenced by json_string_unescape().

static VALUE cParser_initialize ( int  argc,
VALUE argv,
VALUE  self 
)
static
static VALUE cParser_parse ( VALUE  self)
static

Definition at line 2083 of file parser.c.

References cParser_parse_quirks_mode(), cParser_parse_strict(), and GET_PARSER.

Referenced by Init_parser().

static VALUE cParser_parse_quirks_mode ( VALUE  self)
static
static VALUE cParser_parse_strict ( VALUE  self)
static
static VALUE cParser_quirks_mode_p ( VALUE  self)
static

Definition at line 2141 of file parser.c.

References GET_PARSER, Qfalse, and Qtrue.

Referenced by Init_parser().

static VALUE cParser_source ( VALUE  self)
static

Definition at line 2130 of file parser.c.

References GET_PARSER, and rb_str_dup().

Referenced by Init_parser().

void Init_parser ( )
static JSON_Parser* JSON_allocate ( )
static

Definition at line 2095 of file parser.c.

References ALLOC, JSON_ParserStruct::fbuffer, fbuffer_alloc(), and MEMZERO.

Referenced by cJSON_parser_s_allocate().

static void JSON_free ( JSON_Parser json)
static

Definition at line 2112 of file parser.c.

References JSON_ParserStruct::fbuffer, fbuffer_free(), and ruby_xfree().

Referenced by cJSON_parser_s_allocate().

static void JSON_mark ( JSON_Parser json)
static
static char* JSON_parse_array ( JSON_Parser json,
char *  p,
char *  pe,
VALUE result 
)
static
static char* JSON_parse_float ( JSON_Parser json,
char *  p,
char *  pe,
VALUE result 
)
static
static char* JSON_parse_integer ( JSON_Parser json,
char *  p,
char *  pe,
VALUE result 
)
static
static char* JSON_parse_object ( JSON_Parser json,
char *  p,
char *  pe,
VALUE result 
)
static
static char* JSON_parse_string ( JSON_Parser json,
char *  p,
char *  pe,
VALUE result 
)
static
static char* JSON_parse_value ( JSON_Parser json,
char *  p,
char *  pe,
VALUE result 
)
static
static VALUE json_string_unescape ( VALUE  result,
char *  string,
char *  stringEnd 
)
static
static int match_i ( VALUE  regexp,
VALUE  klass,
VALUE  memo 
)
static
static UTF32 unescape_unicode ( const unsigned char *  p)
static

Definition at line 25 of file parser.c.

References b, digit_values, result, and UNI_REPLACEMENT_CHAR.

Referenced by json_string_unescape().

Variable Documentation

VALUE CEncoding_ASCII_8BIT
static

Definition at line 71 of file parser.c.

Referenced by convert_encoding(), and Init_parser().

VALUE CEncoding_UTF_16BE
static

Definition at line 71 of file parser.c.

Referenced by convert_encoding(), and Init_parser().

VALUE CEncoding_UTF_16LE
static

Definition at line 71 of file parser.c.

Referenced by convert_encoding(), and Init_parser().

VALUE CEncoding_UTF_32BE
static

Definition at line 71 of file parser.c.

Referenced by convert_encoding(), and Init_parser().

VALUE CEncoding_UTF_32LE
static

Definition at line 71 of file parser.c.

Referenced by convert_encoding(), and Init_parser().

VALUE CEncoding_UTF_8
static

Definition at line 71 of file parser.c.

Referenced by convert_encoding(), and Init_parser().

VALUE CInfinity
static

Definition at line 79 of file parser.c.

Referenced by Init_parser(), and JSON_parse_value().

VALUE CMinusInfinity
static

Definition at line 79 of file parser.c.

Referenced by Init_parser(), and JSON_parse_value().

VALUE CNaN
static

Definition at line 79 of file parser.c.

Referenced by Init_parser(), and JSON_parse_value().

VALUE cParser
static

Definition at line 78 of file parser.c.

Referenced by Init_parser().

const char digit_values[256]
static
Initial value:
= {
-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, 10, 11, 12, 13, 14, 15, -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,
10, 11, 12, 13, 14, 15, -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, -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
}

Definition at line 8 of file parser.c.

Referenced by unescape_unicode().

VALUE eNestingError
static

Definition at line 78 of file parser.c.

Referenced by Init_parser(), JSON_parse_array(), and JSON_parse_object().

VALUE eParserError
static
ID i_allow_nan
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

ID i_aref
static

Definition at line 81 of file parser.c.

Referenced by Init_parser(), and JSON_parse_object().

ID i_array_class
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

ID i_aset
static

Definition at line 81 of file parser.c.

Referenced by Init_parser(), and JSON_parse_object().

ID i_chr
static

Definition at line 81 of file parser.c.

Referenced by Init_parser().

ID i_create_additions
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

ID i_create_id
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

ID i_deep_const_get
static

Definition at line 81 of file parser.c.

Referenced by Init_parser(), and JSON_parse_object().

ID i_encode
static

Definition at line 73 of file parser.c.

Referenced by convert_encoding(), and Init_parser().

ID i_encoding
static

Definition at line 73 of file parser.c.

Referenced by convert_encoding(), and Init_parser().

ID i_json_creatable_p
static

Definition at line 81 of file parser.c.

Referenced by Init_parser(), JSON_parse_object(), and match_i().

ID i_json_create
static

Definition at line 81 of file parser.c.

Referenced by Init_parser(), JSON_parse_object(), and JSON_parse_string().

ID i_key_p
static

Definition at line 81 of file parser.c.

Referenced by Init_parser().

ID i_leftshift
static

Definition at line 81 of file parser.c.

Referenced by Init_parser(), and JSON_parse_array().

ID i_match
static

Definition at line 81 of file parser.c.

Referenced by Init_parser(), and match_i().

ID i_match_string
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

ID i_max_nesting
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

ID i_object_class
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

ID i_quirks_mode
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

ID i_symbolize_names
static

Definition at line 81 of file parser.c.

Referenced by cParser_initialize(), and Init_parser().

const int JSON_array_en_main = 1
static

Definition at line 1048 of file parser.c.

const int JSON_array_error = 0
static

Definition at line 1046 of file parser.c.

const int JSON_array_first_final = 17
static

Definition at line 1045 of file parser.c.

Referenced by JSON_parse_array().

const int JSON_array_start = 1
static

Definition at line 1044 of file parser.c.

Referenced by JSON_parse_array().

const int JSON_en_main = 1
static

Definition at line 1737 of file parser.c.

const int JSON_error = 0
static

Definition at line 1735 of file parser.c.

const int JSON_first_final = 10
static

Definition at line 1734 of file parser.c.

Referenced by cParser_parse_strict().

const int JSON_float_en_main = 1
static

Definition at line 882 of file parser.c.

const int JSON_float_error = 0
static

Definition at line 880 of file parser.c.

const int JSON_float_first_final = 8
static

Definition at line 879 of file parser.c.

Referenced by JSON_parse_float().

const int JSON_float_start = 1
static

Definition at line 878 of file parser.c.

Referenced by JSON_parse_float().

const int JSON_integer_en_main = 1
static

Definition at line 783 of file parser.c.

const int JSON_integer_error = 0
static

Definition at line 781 of file parser.c.

const int JSON_integer_first_final = 3
static

Definition at line 780 of file parser.c.

Referenced by JSON_parse_integer().

const int JSON_integer_start = 1
static

Definition at line 779 of file parser.c.

Referenced by JSON_parse_integer().

const int JSON_object_en_main = 1
static

Definition at line 96 of file parser.c.

const int JSON_object_error = 0
static

Definition at line 94 of file parser.c.

const int JSON_object_first_final = 27
static

Definition at line 93 of file parser.c.

Referenced by JSON_parse_object().

const int JSON_object_start = 1
static

Definition at line 92 of file parser.c.

Referenced by JSON_parse_object().

const int JSON_quirks_mode_en_main = 1
static

Definition at line 1911 of file parser.c.

const int JSON_quirks_mode_error = 0
static

Definition at line 1909 of file parser.c.

const int JSON_quirks_mode_first_final = 10
static

Definition at line 1908 of file parser.c.

Referenced by cParser_parse_quirks_mode().

const int JSON_quirks_mode_start = 1
static

Definition at line 1907 of file parser.c.

Referenced by cParser_parse_quirks_mode().

const int JSON_start = 1
static

Definition at line 1733 of file parser.c.

Referenced by cParser_parse_strict().

const int JSON_string_en_main = 1
static

Definition at line 1380 of file parser.c.

const int JSON_string_error = 0
static

Definition at line 1378 of file parser.c.

const int JSON_string_first_final = 8
static

Definition at line 1377 of file parser.c.

Referenced by JSON_parse_string().

const int JSON_string_start = 1
static

Definition at line 1376 of file parser.c.

Referenced by JSON_parse_string().

const int JSON_value_en_main = 1
static

Definition at line 474 of file parser.c.

const int JSON_value_error = 0
static

Definition at line 472 of file parser.c.

const int JSON_value_first_final = 21
static

Definition at line 471 of file parser.c.

Referenced by JSON_parse_value().

const int JSON_value_start = 1
static

Definition at line 470 of file parser.c.

Referenced by JSON_parse_value().

VALUE mExt
static

Definition at line 78 of file parser.c.

Referenced by Init_parser().

VALUE mJSON
static

Definition at line 78 of file parser.c.

Referenced by convert_encoding(), cParser_initialize(), Init_parser(), and JSON_parse_object().