webidl 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -4186,6 +4186,13 @@ module WebIDL
4186
4186
  r0
4187
4187
  end
4188
4188
 
4189
+ module Array0
4190
+ def ws
4191
+ elements[1]
4192
+ end
4193
+
4194
+ end
4195
+
4189
4196
  def _nt_Array
4190
4197
  start_index = index
4191
4198
  if node_cache[:Array].has_key?(index)
@@ -4197,11 +4204,34 @@ module WebIDL
4197
4204
  return cached
4198
4205
  end
4199
4206
 
4200
- if has_terminal?("[]", false, index)
4201
- r1 = instantiate_node(SyntaxNode,input, index...(index + 2))
4202
- @index += 2
4207
+ i1, s1 = index, []
4208
+ if has_terminal?("[", false, index)
4209
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
4210
+ @index += 1
4211
+ else
4212
+ terminal_parse_failure("[")
4213
+ r2 = nil
4214
+ end
4215
+ s1 << r2
4216
+ if r2
4217
+ r3 = _nt_ws
4218
+ s1 << r3
4219
+ if r3
4220
+ if has_terminal?("]", false, index)
4221
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
4222
+ @index += 1
4223
+ else
4224
+ terminal_parse_failure("]")
4225
+ r4 = nil
4226
+ end
4227
+ s1 << r4
4228
+ end
4229
+ end
4230
+ if s1.last
4231
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
4232
+ r1.extend(Array0)
4203
4233
  else
4204
- terminal_parse_failure("[]")
4234
+ @index = i1
4205
4235
  r1 = nil
4206
4236
  end
4207
4237
  if r1
@@ -314,7 +314,7 @@ module WebIDL
314
314
  end
315
315
 
316
316
  rule Array
317
- "[]"?
317
+ ("[" ws "]")?
318
318
  end
319
319
 
320
320
  rule NonSpace
@@ -1,3 +1,3 @@
1
1
  module WebIDL
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -54,7 +54,10 @@ describe WebIDL::Parser::IDLParser do
54
54
 
55
55
  it "parses array types" do
56
56
  str = <<-IDL
57
- interface Bar { readonly attribute short[] foo; };
57
+ interface Bar {
58
+ readonly attribute short[] foo;
59
+ readonly attribute short[ ] bar;
60
+ };
58
61
  IDL
59
62
 
60
63
  parse(str).should_not be_nil
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: webidl
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.7
5
+ version: 0.0.8
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jari Bakken