@@ -1806,8 +1806,15 @@ static VALUE convert_encoding(VALUE source)
1806
1806
* * *create_additions*: If set to false, the Parser doesn't create
1807
1807
* additions even if a matching class and create_id was found. This option
1808
1808
* defaults to false.
1809
- * * *object_class*: Defaults to Hash
1810
- * * *array_class*: Defaults to Array
1809
+ * * *object_class*: Defaults to Hash. If another type is provided, it will be used
1810
+ * instead of Hash to represent JSON objects. The type must respond to
1811
+ * +new+ without arguments, and return an object that respond to +[]=+.
1812
+ * * *array_class*: Defaults to Array If another type is provided, it will be used
1813
+ * instead of Hash to represent JSON arrays. The type must respond to
1814
+ * +new+ without arguments, and return an object that respond to +<<+.
1815
+ * * *decimal_class*: Specifies which class to use instead of the default
1816
+ * (Float) when parsing decimal numbers. This class must accept a single
1817
+ * string argument in its constructor.
1811
1818
*/
1812
1819
static VALUE cParser_initialize (int argc , VALUE * argv , VALUE self )
1813
1820
{
@@ -1909,15 +1916,15 @@ static VALUE cParser_initialize(int argc, VALUE *argv, VALUE self)
1909
1916
}
1910
1917
1911
1918
1912
- #line 1913 "parser.c"
1919
+ #line 1920 "parser.c"
1913
1920
enum {JSON_start = 1 };
1914
1921
enum {JSON_first_final = 10 };
1915
1922
enum {JSON_error = 0 };
1916
1923
1917
1924
enum {JSON_en_main = 1 };
1918
1925
1919
1926
1920
- #line 821 "parser.rl"
1927
+ #line 828 "parser.rl"
1921
1928
1922
1929
1923
1930
/*
@@ -1935,16 +1942,16 @@ static VALUE cParser_parse(VALUE self)
1935
1942
GET_PARSER ;
1936
1943
1937
1944
1938
- #line 1939 "parser.c"
1945
+ #line 1946 "parser.c"
1939
1946
{
1940
1947
cs = JSON_start ;
1941
1948
}
1942
1949
1943
- #line 838 "parser.rl"
1950
+ #line 845 "parser.rl"
1944
1951
p = json -> source ;
1945
1952
pe = p + json -> len ;
1946
1953
1947
- #line 1948 "parser.c"
1954
+ #line 1955 "parser.c"
1948
1955
{
1949
1956
if ( p == pe )
1950
1957
goto _test_eof ;
@@ -1978,7 +1985,7 @@ case 1:
1978
1985
cs = 0 ;
1979
1986
goto _out ;
1980
1987
tr2 :
1981
- #line 813 "parser.rl"
1988
+ #line 820 "parser.rl"
1982
1989
{
1983
1990
char * np = JSON_parse_value (json , p , pe , & result , 0 );
1984
1991
if (np == NULL ) { p -- ; {p ++ ; cs = 10 ; goto _out ;} } else {p = (( np ))- 1 ;}
@@ -1988,7 +1995,7 @@ cs = 0;
1988
1995
if ( ++ p == pe )
1989
1996
goto _test_eof10 ;
1990
1997
case 10 :
1991
- #line 1992 "parser.c"
1998
+ #line 1999 "parser.c"
1992
1999
switch ( (* p ) ) {
1993
2000
case 13 : goto st10 ;
1994
2001
case 32 : goto st10 ;
@@ -2077,7 +2084,7 @@ case 9:
2077
2084
_out : {}
2078
2085
}
2079
2086
2080
- #line 841 "parser.rl"
2087
+ #line 848 "parser.rl"
2081
2088
2082
2089
if (cs >= JSON_first_final && p == pe ) {
2083
2090
return result ;
0 commit comments