webidl 0.0.7 → 0.0.8
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/lib/webidl/parser/idl.rb +34 -4
- data/lib/webidl/parser/idl.treetop +1 -1
- data/lib/webidl/version.rb +1 -1
- data/spec/parser_spec.rb +4 -1
- metadata +1 -1
data/lib/webidl/parser/idl.rb
CHANGED
@@ -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
|
-
|
4201
|
-
|
4202
|
-
|
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
|
-
|
4234
|
+
@index = i1
|
4205
4235
|
r1 = nil
|
4206
4236
|
end
|
4207
4237
|
if r1
|
data/lib/webidl/version.rb
CHANGED
data/spec/parser_spec.rb
CHANGED
@@ -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 {
|
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
|