lector 0.0.6 → 0.0.7
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/Gemfile.lock +1 -1
- data/lib/lector/reader.citrus +7 -6
- data/lib/lector/version.rb +1 -1
- data/spec/lector/reader_spec.rb +8 -0
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/lector/reader.citrus
CHANGED
@@ -83,12 +83,13 @@ grammar Lector::RubyParse
|
|
83
83
|
|
84
84
|
rule hash
|
85
85
|
#TODO: Spurious commas should be parse errors.
|
86
|
-
('{'
|
87
|
-
(
|
88
|
-
|
89
|
-
|
90
|
-
(space* form '
|
91
|
-
|
86
|
+
(('{' space* '}') |
|
87
|
+
('{'
|
88
|
+
(((space* form space* '=>' space* form space* ',') |
|
89
|
+
(space* form ':' space* form space* ','))*
|
90
|
+
((space* form space* '=>' space* form space*) |
|
91
|
+
(space* form ':' space* form space*)))
|
92
|
+
'}')) <Lector::Types::Hash>
|
92
93
|
end
|
93
94
|
|
94
95
|
rule hashkey
|
data/lib/lector/version.rb
CHANGED
data/spec/lector/reader_spec.rb
CHANGED
@@ -100,6 +100,10 @@ Rns::using(Lector => [:read_s, :read_file]) do
|
|
100
100
|
read_s("[ 42 ]").should == [42]
|
101
101
|
end
|
102
102
|
|
103
|
+
it 'parses empty arrays' do
|
104
|
+
read_s("[]").should == []
|
105
|
+
end
|
106
|
+
|
103
107
|
it 'parses arrays of multiple elements' do
|
104
108
|
read_s("[42, -1]").should == [42, -1]
|
105
109
|
end
|
@@ -119,6 +123,10 @@ Rns::using(Lector => [:read_s, :read_file]) do
|
|
119
123
|
read_s("{:a => 7, b: 6}").should == {:a => 7, :b => 6}
|
120
124
|
end
|
121
125
|
|
126
|
+
it 'parses empty hashes' do
|
127
|
+
read_s("{}").should == {}
|
128
|
+
end
|
129
|
+
|
122
130
|
it 'parses nested collections' do
|
123
131
|
read_s("[[1,2], 3, 4]").should == [[1, 2], 3, 4]
|
124
132
|
end
|