erbal 1.0.rc3 → 1.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,7 +4,7 @@
4
4
  #include "parser.h"
5
5
 
6
6
 
7
- #line 15 "parser.rl"
7
+ #line 16 "parser.rl"
8
8
 
9
9
 
10
10
 
@@ -16,7 +16,7 @@ static const int erbal_parser_error = -1;
16
16
  static const int erbal_parser_en_main = 1;
17
17
 
18
18
 
19
- #line 18 "parser.rl"
19
+ #line 19 "parser.rl"
20
20
 
21
21
  static char *ts, *te, *p, *pe, *eof;
22
22
  static int act, cs;
@@ -37,6 +37,11 @@ inline void erbal_parser_tag_open(erbal_parser *parser) {
37
37
  parser->state = TAG_OPEN;
38
38
  }
39
39
 
40
+ inline void erbal_parser_tag_open_with_dash(erbal_parser *parser) {
41
+ erbal_parser_tag_open_common(parser, -2);
42
+ parser->state = TAG_OPEN;
43
+ }
44
+
40
45
  inline void erbal_parser_tag_open_for_output(erbal_parser *parser) {
41
46
  erbal_parser_tag_open_common(parser, -2);
42
47
  parser->state = TAG_OPEN_FOR_OUTPUT;
@@ -171,7 +176,7 @@ void erbal_parser_init(erbal_parser *parser) {
171
176
  parser->src = rb_str_dup(parser->buffer_name);
172
177
  rb_str_buf_cat(parser->src, " = '';", 6);
173
178
 
174
- #line 175 "parser.c"
179
+ #line 180 "parser.c"
175
180
  {
176
181
  cs = erbal_parser_start;
177
182
  ts = 0;
@@ -179,37 +184,37 @@ void erbal_parser_init(erbal_parser *parser) {
179
184
  act = 0;
180
185
  }
181
186
 
182
- #line 172 "parser.rl"
187
+ #line 178 "parser.rl"
183
188
  }
184
189
 
185
190
  void erbal_parser_exec(erbal_parser *parser) {
186
191
  p = RSTRING(parser->str)->ptr;
187
192
  pe = p + strlen(p);
188
193
 
189
- #line 190 "parser.c"
194
+ #line 195 "parser.c"
190
195
  {
191
196
  if ( p == pe )
192
197
  goto _test_eof;
193
198
  switch ( cs )
194
199
  {
195
200
  tr0:
196
- #line 13 "parser.rl"
201
+ #line 14 "parser.rl"
197
202
  {{p = ((te))-1;}{ erbal_parser_non_tag(parser); }}
198
203
  goto st1;
199
204
  tr1:
200
- #line 11 "parser.rl"
205
+ #line 12 "parser.rl"
201
206
  {te = p+1;{ erbal_parser_tag_close_with_trim(parser); }}
202
207
  goto st1;
203
208
  tr2:
204
- #line 13 "parser.rl"
209
+ #line 14 "parser.rl"
205
210
  {te = p+1;{ erbal_parser_non_tag(parser); }}
206
211
  goto st1;
207
212
  tr6:
208
- #line 13 "parser.rl"
213
+ #line 14 "parser.rl"
209
214
  {te = p;p--;{ erbal_parser_non_tag(parser); }}
210
215
  goto st1;
211
216
  tr7:
212
- #line 12 "parser.rl"
217
+ #line 13 "parser.rl"
213
218
  {te = p+1;{ erbal_parser_tag_close(parser); }}
214
219
  goto st1;
215
220
  tr10:
@@ -217,11 +222,15 @@ tr10:
217
222
  {te = p;p--;{ erbal_parser_tag_open(parser); }}
218
223
  goto st1;
219
224
  tr11:
220
- #line 9 "parser.rl"
225
+ #line 10 "parser.rl"
221
226
  {te = p+1;{ erbal_parser_tag_open_for_comment(parser); }}
222
227
  goto st1;
223
228
  tr12:
224
- #line 10 "parser.rl"
229
+ #line 9 "parser.rl"
230
+ {te = p+1;{ erbal_parser_tag_open_with_dash(parser); }}
231
+ goto st1;
232
+ tr13:
233
+ #line 11 "parser.rl"
225
234
  {te = p+1;{ erbal_parser_tag_open_for_output(parser); }}
226
235
  goto st1;
227
236
  st1:
@@ -232,7 +241,7 @@ st1:
232
241
  case 1:
233
242
  #line 1 "NONE"
234
243
  {ts = p;}
235
- #line 236 "parser.c"
244
+ #line 245 "parser.c"
236
245
  switch( (*p) ) {
237
246
  case 37: goto st2;
238
247
  case 45: goto tr4;
@@ -254,7 +263,7 @@ st3:
254
263
  if ( ++p == pe )
255
264
  goto _test_eof3;
256
265
  case 3:
257
- #line 258 "parser.c"
266
+ #line 267 "parser.c"
258
267
  if ( (*p) == 37 )
259
268
  goto st0;
260
269
  goto tr6;
@@ -278,7 +287,8 @@ st5:
278
287
  case 5:
279
288
  switch( (*p) ) {
280
289
  case 35: goto tr11;
281
- case 61: goto tr12;
290
+ case 45: goto tr12;
291
+ case 61: goto tr13;
282
292
  }
283
293
  goto tr10;
284
294
  }
@@ -303,6 +313,6 @@ case 5:
303
313
 
304
314
  }
305
315
 
306
- #line 178 "parser.rl"
316
+ #line 184 "parser.rl"
307
317
  erbal_parser_finish(parser);
308
318
  }
@@ -9,6 +9,7 @@ typedef struct erbal_parser {
9
9
  } erbal_parser;
10
10
 
11
11
  inline void erbal_parser_tag_open(erbal_parser*);
12
+ inline void erbal_parser_tag_open_with_dash(erbal_parser*);
12
13
  inline void erbal_parser_tag_open_for_comment(erbal_parser*);
13
14
  inline void erbal_parser_tag_open_for_output(erbal_parser*);
14
15
  inline void erbal_parser_non_tag(erbal_parser*);
@@ -6,6 +6,7 @@
6
6
 
7
7
  main := |*
8
8
  '<%' => { erbal_parser_tag_open(parser); };
9
+ '<%-' => { erbal_parser_tag_open_with_dash(parser); };
9
10
  '<%#' => { erbal_parser_tag_open_for_comment(parser); };
10
11
  '<%=' => { erbal_parser_tag_open_for_output(parser); };
11
12
  '-%>' => { erbal_parser_tag_close_with_trim(parser); };
@@ -35,6 +36,11 @@ inline void erbal_parser_tag_open(erbal_parser *parser) {
35
36
  parser->state = TAG_OPEN;
36
37
  }
37
38
 
39
+ inline void erbal_parser_tag_open_with_dash(erbal_parser *parser) {
40
+ erbal_parser_tag_open_common(parser, -2);
41
+ parser->state = TAG_OPEN;
42
+ }
43
+
38
44
  inline void erbal_parser_tag_open_for_output(erbal_parser *parser) {
39
45
  erbal_parser_tag_open_common(parser, -2);
40
46
  parser->state = TAG_OPEN_FOR_OUTPUT;
@@ -27,6 +27,10 @@ describe Erbal do
27
27
  erbal_parse("<% 1 + 1 %>").should == "@out = ''; 1 + 1 ;\n@out"
28
28
  end
29
29
 
30
+ it "should parse the <%- tag" do
31
+ erbal_parse("1 + 1 is <%- 1 + 1 %>").should == "@out = '';@out << %Q`1 + 1 is `; 1 + 1 ;\n@out"
32
+ end
33
+
30
34
  it "should add a line break after <% %> tags incase the tags ended with a comment" do
31
35
  erbal_parse("<% 1 + 1 # eeek comment! %> hi mom").should == "@out = ''; 1 + 1 # eeek comment! ;\n@out << %Q` hi mom`;@out"
32
36
  end
@@ -2,7 +2,7 @@ require 'rake/gempackagetask'
2
2
  require 'yaml'
3
3
 
4
4
  WIN_SUFFIX = ENV['WIN_SUFFIX'] || 'i386-mswin32'
5
- ERBAL_VERSION = '1.0.rc3'
5
+ ERBAL_VERSION = '1.0.rc4'
6
6
 
7
7
  task :clean => :clobber_package
8
8
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: erbal
3
3
  version: !ruby/object:Gem::Version
4
- hash: 977940500
4
+ hash: 977940501
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - rc3
10
- version: 1.0.rc3
9
+ - rc4
10
+ version: 1.0.rc4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ian Leitch