yaji 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/yaji/api/yajl_common.h +89 -0
- data/ext/yaji/api/yajl_gen.h +159 -0
- data/ext/yaji/api/yajl_parse.h +193 -0
- data/ext/yaji/api/yajl_version.h +23 -0
- data/ext/yaji/extconf.rb +1 -1
- data/ext/yaji/yajl.c +159 -0
- data/ext/yaji/yajl_alloc.c +65 -0
- data/ext/yaji/yajl_alloc.h +50 -0
- data/ext/yaji/yajl_buf.c +119 -0
- data/ext/yaji/yajl_buf.h +73 -0
- data/ext/yaji/yajl_bytestack.h +85 -0
- data/ext/yaji/yajl_encode.c +195 -0
- data/ext/yaji/yajl_encode.h +50 -0
- data/ext/yaji/yajl_gen.c +347 -0
- data/ext/yaji/yajl_lex.c +737 -0
- data/ext/yaji/yajl_lex.h +133 -0
- data/ext/yaji/yajl_parser.c +448 -0
- data/ext/yaji/yajl_parser.h +82 -0
- data/ext/yaji/yajl_version.c +7 -0
- data/lib/yaji/version.rb +1 -1
- metadata +28 -10
@@ -0,0 +1,82 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2010, Lloyd Hilaiel.
|
3
|
+
*
|
4
|
+
* Redistribution and use in source and binary forms, with or without
|
5
|
+
* modification, are permitted provided that the following conditions are
|
6
|
+
* met:
|
7
|
+
*
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
10
|
+
*
|
11
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in
|
13
|
+
* the documentation and/or other materials provided with the
|
14
|
+
* distribution.
|
15
|
+
*
|
16
|
+
* 3. Neither the name of Lloyd Hilaiel nor the names of its
|
17
|
+
* contributors may be used to endorse or promote products derived
|
18
|
+
* from this software without specific prior written permission.
|
19
|
+
*
|
20
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
21
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
22
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
|
24
|
+
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
25
|
+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
27
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
28
|
+
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
29
|
+
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30
|
+
* POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*/
|
32
|
+
|
33
|
+
#ifndef __YAJL_PARSER_H__
|
34
|
+
#define __YAJL_PARSER_H__
|
35
|
+
|
36
|
+
#include "api/yajl_parse.h"
|
37
|
+
#include "yajl_bytestack.h"
|
38
|
+
#include "yajl_buf.h"
|
39
|
+
|
40
|
+
|
41
|
+
typedef enum {
|
42
|
+
yajl_state_start = 0,
|
43
|
+
yajl_state_parse_complete,
|
44
|
+
yajl_state_parse_error,
|
45
|
+
yajl_state_lexical_error,
|
46
|
+
yajl_state_map_start,
|
47
|
+
yajl_state_map_sep,
|
48
|
+
yajl_state_map_need_val,
|
49
|
+
yajl_state_map_got_val,
|
50
|
+
yajl_state_map_need_key,
|
51
|
+
yajl_state_array_start,
|
52
|
+
yajl_state_array_got_val,
|
53
|
+
yajl_state_array_need_val
|
54
|
+
} yajl_state;
|
55
|
+
|
56
|
+
struct yajl_handle_t {
|
57
|
+
const yajl_callbacks * callbacks;
|
58
|
+
void * ctx;
|
59
|
+
yajl_lexer lexer;
|
60
|
+
const char * parseError;
|
61
|
+
/* the number of bytes consumed from the last client buffer,
|
62
|
+
* in the case of an error this will be an error offset, in the
|
63
|
+
* case of an error this can be used as the error offset */
|
64
|
+
unsigned int bytesConsumed;
|
65
|
+
/* temporary storage for decoded strings */
|
66
|
+
yajl_buf decodeBuf;
|
67
|
+
/* a stack of states. access with yajl_state_XXX routines */
|
68
|
+
yajl_bytestack stateStack;
|
69
|
+
/* memory allocation routines */
|
70
|
+
yajl_alloc_funcs alloc;
|
71
|
+
};
|
72
|
+
|
73
|
+
yajl_status
|
74
|
+
yajl_do_parse(yajl_handle handle, const unsigned char * jsonText,
|
75
|
+
unsigned int jsonTextLen);
|
76
|
+
|
77
|
+
unsigned char *
|
78
|
+
yajl_render_error_string(yajl_handle hand, const unsigned char * jsonText,
|
79
|
+
unsigned int jsonTextLen, int verbose);
|
80
|
+
|
81
|
+
|
82
|
+
#endif
|
data/lib/yaji/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaji
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-24 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
16
|
-
requirement: &
|
16
|
+
requirement: &22310600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *22310600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: minitest
|
27
|
-
requirement: &
|
27
|
+
requirement: &22309980 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *22309980
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: curb
|
38
|
-
requirement: &
|
38
|
+
requirement: &22309280 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *22309280
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: ruby-debug19
|
49
|
-
requirement: &
|
49
|
+
requirement: &22308700 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *22308700
|
58
58
|
description: YAJI is a ruby wrapper to YAJL providing iterator interface to streaming
|
59
59
|
JSON parser
|
60
60
|
email: info@couchbase.com
|
@@ -69,9 +69,27 @@ files:
|
|
69
69
|
- LICENSE
|
70
70
|
- README.markdown
|
71
71
|
- Rakefile
|
72
|
+
- ext/yaji/api/yajl_common.h
|
73
|
+
- ext/yaji/api/yajl_gen.h
|
74
|
+
- ext/yaji/api/yajl_parse.h
|
75
|
+
- ext/yaji/api/yajl_version.h
|
72
76
|
- ext/yaji/extconf.rb
|
73
77
|
- ext/yaji/parser_ext.c
|
74
78
|
- ext/yaji/parser_ext.h
|
79
|
+
- ext/yaji/yajl.c
|
80
|
+
- ext/yaji/yajl_alloc.c
|
81
|
+
- ext/yaji/yajl_alloc.h
|
82
|
+
- ext/yaji/yajl_buf.c
|
83
|
+
- ext/yaji/yajl_buf.h
|
84
|
+
- ext/yaji/yajl_bytestack.h
|
85
|
+
- ext/yaji/yajl_encode.c
|
86
|
+
- ext/yaji/yajl_encode.h
|
87
|
+
- ext/yaji/yajl_gen.c
|
88
|
+
- ext/yaji/yajl_lex.c
|
89
|
+
- ext/yaji/yajl_lex.h
|
90
|
+
- ext/yaji/yajl_parser.c
|
91
|
+
- ext/yaji/yajl_parser.h
|
92
|
+
- ext/yaji/yajl_version.c
|
75
93
|
- lib/yaji.rb
|
76
94
|
- lib/yaji/version.rb
|
77
95
|
- tasks/compile.rake
|