toastyapps-excelsior 0.0.2 → 0.0.3

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/Rakefile CHANGED
@@ -8,7 +8,7 @@ PKG_FILES = %w(Rakefile) +
8
8
 
9
9
  gem_spec = Gem::Specification.new do |gem_spec|
10
10
  gem_spec.name = 'excelsior'
11
- gem_spec.version = '0.0.2'
11
+ gem_spec.version = '0.0.3'
12
12
  gem_spec.summary = 'A Ruby gem that uses C bindings to read CSV files superfast. I\'m totally serial!'
13
13
  gem_spec.description = 'A Ruby gem that uses C bindings to read CSV files superfast. I\'m totally serial!'
14
14
  gem_spec.email = 'matt@toastyapps.com'
@@ -17,77 +17,72 @@ VALUE e_parse(VALUE self, VALUE data) {
17
17
  int has_found = 0;
18
18
 
19
19
 
20
- #line 34 "excelsior_reader.rl"
20
+ #line 32 "excelsior_reader.rl"
21
21
 
22
22
 
23
23
 
24
24
  #line 25 "excelsior_reader.c"
25
25
  static const char _excelsior_scan_actions[] = {
26
- 0, 1, 0, 1, 1, 1, 2, 1,
27
- 3, 1, 4, 1, 5, 1, 6, 1,
28
- 7, 1, 8, 1, 9
26
+ 0, 1, 2, 1, 7, 1, 8, 1,
27
+ 9, 1, 10, 1, 11, 2, 0, 1,
28
+ 2, 3, 4, 2, 3, 5, 2, 3,
29
+ 6
29
30
  };
30
31
 
31
32
  static const char _excelsior_scan_key_offsets[] = {
32
- 0, 6, 7, 8, 16, 22
33
+ 0, 0, 1, 8, 12, 13
33
34
  };
34
35
 
35
36
  static const char _excelsior_scan_trans_keys[] = {
36
- 32, 34, 39, 44, 9, 13, 34, 39,
37
- 10, 13, 32, 34, 39, 44, 9, 12,
38
- 32, 34, 39, 44, 9, 13, 10, 0
37
+ 34, 10, 13, 32, 34, 44, 9, 12,
38
+ 10, 13, 34, 44, 10, 34, 0
39
39
  };
40
40
 
41
41
  static const char _excelsior_scan_single_lengths[] = {
42
- 4, 1, 1, 6, 4, 1
42
+ 0, 1, 5, 4, 1, 1
43
43
  };
44
44
 
45
45
  static const char _excelsior_scan_range_lengths[] = {
46
- 1, 0, 0, 1, 1, 0
46
+ 0, 0, 1, 0, 0, 0
47
47
  };
48
48
 
49
49
  static const char _excelsior_scan_index_offsets[] = {
50
- 0, 6, 8, 10, 18, 24
51
- };
52
-
53
- static const char _excelsior_scan_indicies[] = {
54
- 2, 0, 0, 0, 0, 1, 4, 3,
55
- 4, 5, 7, 8, 6, 3, 5, 9,
56
- 6, 1, 2, 10, 10, 10, 10, 1,
57
- 7, 11, 0
50
+ 0, 0, 2, 9, 14, 16
58
51
  };
59
52
 
60
53
  static const char _excelsior_scan_trans_targs[] = {
61
- 3, 4, 0, 1, 3, 2, 3, 3,
62
- 5, 3, 3, 3
54
+ 5, 1, 2, 4, 3, 1, 2, 3,
55
+ 3, 2, 2, 2, 2, 3, 2, 2,
56
+ 1, 2, 2, 2, 2, 2, 0
63
57
  };
64
58
 
65
59
  static const char _excelsior_scan_trans_actions[] = {
66
- 19, 5, 0, 0, 11, 0, 9, 7,
67
- 0, 13, 17, 15
60
+ 22, 0, 3, 0, 16, 0, 5, 16,
61
+ 19, 11, 11, 11, 11, 19, 3, 7,
62
+ 0, 9, 11, 11, 7, 9, 0
68
63
  };
69
64
 
70
65
  static const char _excelsior_scan_to_state_actions[] = {
71
- 0, 0, 0, 1, 0, 0
66
+ 0, 0, 13, 0, 0, 0
72
67
  };
73
68
 
74
69
  static const char _excelsior_scan_from_state_actions[] = {
75
- 0, 0, 0, 3, 0, 0
70
+ 0, 0, 1, 0, 0, 0
76
71
  };
77
72
 
78
73
  static const char _excelsior_scan_eof_trans[] = {
79
- 1, 0, 0, 0, 11, 12
74
+ 0, 20, 0, 20, 21, 22
80
75
  };
81
76
 
82
- static const int excelsior_scan_start = 3;
83
- static const int excelsior_scan_error = -1;
77
+ static const int excelsior_scan_start = 2;
78
+ static const int excelsior_scan_error = 0;
84
79
 
85
- static const int excelsior_scan_en_main = 3;
80
+ static const int excelsior_scan_en_main = 2;
86
81
 
87
82
 
88
- #line 37 "excelsior_reader.rl"
83
+ #line 35 "excelsior_reader.rl"
89
84
 
90
- #line 91 "excelsior_reader.c"
85
+ #line 86 "excelsior_reader.c"
91
86
  {
92
87
  cs = excelsior_scan_start;
93
88
  ts = 0;
@@ -95,9 +90,9 @@ static const int excelsior_scan_en_main = 3;
95
90
  act = 0;
96
91
  }
97
92
 
98
- #line 38 "excelsior_reader.rl"
93
+ #line 36 "excelsior_reader.rl"
99
94
 
100
- #line 101 "excelsior_reader.c"
95
+ #line 96 "excelsior_reader.c"
101
96
  {
102
97
  int _klen;
103
98
  unsigned int _trans;
@@ -107,16 +102,18 @@ static const int excelsior_scan_en_main = 3;
107
102
 
108
103
  if ( p == pe )
109
104
  goto _test_eof;
105
+ if ( cs == 0 )
106
+ goto _out;
110
107
  _resume:
111
108
  _acts = _excelsior_scan_actions + _excelsior_scan_from_state_actions[cs];
112
109
  _nacts = (unsigned int) *_acts++;
113
110
  while ( _nacts-- > 0 ) {
114
111
  switch ( *_acts++ ) {
115
- case 1:
112
+ case 2:
116
113
  #line 1 "excelsior_reader.rl"
117
114
  {ts = p;}
118
115
  break;
119
- #line 120 "excelsior_reader.c"
116
+ #line 117 "excelsior_reader.c"
120
117
  }
121
118
  }
122
119
 
@@ -169,7 +166,6 @@ _resume:
169
166
  }
170
167
 
171
168
  _match:
172
- _trans = _excelsior_scan_indicies[_trans];
173
169
  _eof_trans:
174
170
  cs = _excelsior_scan_trans_targs[_trans];
175
171
 
@@ -182,39 +178,57 @@ _eof_trans:
182
178
  {
183
179
  switch ( *_acts++ )
184
180
  {
185
- case 2:
181
+ case 3:
186
182
  #line 1 "excelsior_reader.rl"
187
183
  {te = p+1;}
188
184
  break;
189
- case 3:
190
- #line 28 "excelsior_reader.rl"
191
- {te = p+1;{ rb_ary_push(rows, arr); arr = rb_ary_new(); }}
192
- break;
193
185
  case 4:
194
- #line 29 "excelsior_reader.rl"
195
- {te = p+1;}
186
+ #line 27 "excelsior_reader.rl"
187
+ {act = 2;}
196
188
  break;
197
189
  case 5:
198
- #line 31 "excelsior_reader.rl"
199
- {te = p+1;{ rb_ary_push(arr, rb_str_new(ts + 1, te - ts - 2)); has_found = 1;}}
190
+ #line 28 "excelsior_reader.rl"
191
+ {act = 3;}
200
192
  break;
201
193
  case 6:
202
- #line 32 "excelsior_reader.rl"
203
- {te = p+1;{ if(has_found == 0) rb_ary_push(arr, Qnil); has_found = 0;}}
194
+ #line 29 "excelsior_reader.rl"
195
+ {act = 4;}
204
196
  break;
205
197
  case 7:
206
- #line 28 "excelsior_reader.rl"
207
- {te = p;p--;{ rb_ary_push(rows, arr); arr = rb_ary_new(); }}
198
+ #line 26 "excelsior_reader.rl"
199
+ {te = p+1;{ rb_ary_push(rows, arr); arr = rb_ary_new(); }}
208
200
  break;
209
201
  case 8:
210
202
  #line 30 "excelsior_reader.rl"
211
- {te = p;p--;{ rb_ary_push(arr, rb_str_new(ts, te - ts)); has_found = 1;}}
203
+ {te = p+1;{ if(has_found == 0) rb_ary_push(arr, Qnil); has_found = 0;}}
212
204
  break;
213
205
  case 9:
214
- #line 30 "excelsior_reader.rl"
215
- {{p = ((te))-1;}{ rb_ary_push(arr, rb_str_new(ts, te - ts)); has_found = 1;}}
206
+ #line 26 "excelsior_reader.rl"
207
+ {te = p;p--;{ rb_ary_push(rows, arr); arr = rb_ary_new(); }}
208
+ break;
209
+ case 10:
210
+ #line 29 "excelsior_reader.rl"
211
+ {te = p;p--;{ rb_ary_push(arr, rb_str_new(ts + 1, te - ts - 2)); has_found = 1;}}
212
+ break;
213
+ case 11:
214
+ #line 1 "excelsior_reader.rl"
215
+ { switch( act ) {
216
+ case 0:
217
+ {{cs = 0; goto _again;}}
218
+ break;
219
+ case 3:
220
+ {{p = ((te))-1;} rb_ary_push(arr, rb_str_new(ts, te - ts)); has_found = 1;}
216
221
  break;
217
- #line 218 "excelsior_reader.c"
222
+ case 4:
223
+ {{p = ((te))-1;} rb_ary_push(arr, rb_str_new(ts + 1, te - ts - 2)); has_found = 1;}
224
+ break;
225
+ default:
226
+ {{p = ((te))-1;}}
227
+ break;
228
+ }
229
+ }
230
+ break;
231
+ #line 232 "excelsior_reader.c"
218
232
  }
219
233
  }
220
234
 
@@ -227,10 +241,16 @@ _again:
227
241
  #line 1 "excelsior_reader.rl"
228
242
  {ts = 0;}
229
243
  break;
230
- #line 231 "excelsior_reader.c"
244
+ case 1:
245
+ #line 1 "excelsior_reader.rl"
246
+ {act = 0;}
247
+ break;
248
+ #line 249 "excelsior_reader.c"
231
249
  }
232
250
  }
233
251
 
252
+ if ( cs == 0 )
253
+ goto _out;
234
254
  if ( ++p != pe )
235
255
  goto _resume;
236
256
  _test_eof: {}
@@ -242,9 +262,10 @@ _again:
242
262
  }
243
263
  }
244
264
 
265
+ _out: {}
245
266
  }
246
267
 
247
- #line 39 "excelsior_reader.rl"
268
+ #line 37 "excelsior_reader.rl"
248
269
  if(RARRAY_LEN(arr) > 0) {
249
270
  rb_ary_push(rows, arr);
250
271
  }
@@ -18,12 +18,10 @@ VALUE e_parse(VALUE self, VALUE data) {
18
18
  machine excelsior_scan;
19
19
  delimeter = ",";
20
20
  newline = "\r"? "\n" | "\r" | "\n";
21
- schar1 = any - '"';
22
- schar2 = any - "'";
23
- letter = any - delimeter - space - '"' - "'";
24
- string = '"' schar1* '"' | "'" schar2* "'";
25
- word = letter+;
26
- value = word (" "+ word)*;
21
+ schar = any - '"';
22
+ letter = any - delimeter - '"' - newline;
23
+ string = '"' (schar | '""')* '"' ;
24
+ value = letter+;
27
25
  main := |*
28
26
  newline { rb_ary_push(rows, arr); arr = rb_ary_new(); };
29
27
  space;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toastyapps-excelsior
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Mongeau
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-16 21:00:00 -07:00
12
+ date: 2009-08-17 21:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15