@@ -29,7 +29,7 @@ namespace nodepp { class json_t {
2929
3030protected:
3131
32- long get_next_sec ( ulong _pos, const string_t & str ) const {
32+ long get_next_sec ( ulong _pos, const string_t & str ) const noexcept {
3333 uchar k=0 ; while ( _pos < str.size () ){
3434 switch ( str[_pos] ){
3535 case ' :' : k += 6 ; break ; case ' ,' : k -= 6 ; break ;
@@ -42,7 +42,7 @@ namespace nodepp { class json_t {
4242 } return _pos >= str.size () ? -1 : _pos;
4343 }
4444
45- long get_next_key ( ulong _pos, const string_t & str ) const {
45+ long get_next_key ( ulong _pos, const string_t & str ) const noexcept {
4646 bool x=1 ; uchar k=0 ; while ( _pos < str.size () ){
4747 switch ( str[_pos] ){
4848 case ' [' : k += 1 ; break ; case ' ]' : k -= 1 ; break ;
@@ -51,19 +51,21 @@ namespace nodepp { class json_t {
5151 if ( x ){ k+=5 ; x=!x; }
5252 else { k-=5 ; x=!x; }
5353 break ;
54- }
55- if ( k == 0 ){ break ; } ++_pos;
54+ } if ( k == 0 ){ break ; } ++_pos;
5655 } return _pos >= str.size () ? -1 : _pos;
5756 }
5857
59- object_t get_data ( const string_t & data ) const {
58+ object_t get_data ( const string_t & data ) const noexcept {
59+
6060 static regex_t reg1 = regex_t ( " [a-z]" );
6161 static regex_t reg2 = regex_t ( " [.]\\ d+" );
6262 static regex_t reg3 = regex_t ( " \\ d+" );
6363
6464 ulong x=0 ; while ( x < data.size () && data[x]==' ' ){ ++x; }
65- if ( data.empty () || data[x] == ' ,' ) /* ---*/ { return nullptr ; }
66- elif ( data[x] == ' "' ) /* ---------------*/ { return data.slice (1 ,-1 ); }
65+
66+ if ( data.empty () || data[x] == ' ,' ) /* ---*/ { return nullptr ; }
67+ elif ( data[x] == ' "' ) /* ---------------*/ {
68+ return data.slice ( x+1 , get_next_sec ( x, data ) ); }
6769 elif ( data[x] == ' {' ) /* ---------------*/ { return parse ( data ); }
6870 elif ( data[x] == ' [' ) /* ---------------*/ { return parse ( data ); }
6971 elif ( data.find (" false" ) ) /* ---------------*/ { return (bool ) 0 ; }
@@ -75,7 +77,7 @@ namespace nodepp { class json_t {
7577 else /* ---------------------------------*/ { return string::to_float (data); }
7678 } elif ( reg3.match (data).size ()>9 ) /* ----*/ { return string::to_long (data); }
7779 else /* ---------------------------------*/ { return string::to_int (data); }
78-
80+
7981 }
8082
8183 object_t get_object ( ulong x, ulong y, const string_t & str ) const {
@@ -279,10 +281,10 @@ namespace nodepp { namespace json {
279281namespace nodepp { namespace json {
280282 template < class ... T >
281283 string_t stringify ( const T&... args ){
282- return format ( args... );
284+ return format ( args... );
283285 }
284286}}
285287
286288/* ────────────────────────────────────────────────────────────────────────────*/
287289
288- #endif
290+ #endif
0 commit comments