lineparser 0.1.18 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99c7a1a673c54f40e7fce4973c30108fa467b7f7
4
- data.tar.gz: f2bf79f82e85a2dc1661813f9fcdfc8c3888c9e8
3
+ metadata.gz: 26d86d9aefef101369b87b0c27585a77db31e97c
4
+ data.tar.gz: d008c9537387e4c5dd8fa5d98670526fb46bd21d
5
5
  SHA512:
6
- metadata.gz: dbb11c33d434c7984697b1316f5ed5455ce074f451e1d0525afc0617b6e0ff8c1c2e5cc120708a55a373e7f2f0d1d5bb47ff5da6e84ab3bfd3cf87650e7a83b1
7
- data.tar.gz: 695e6899bbb79f833fb6ec219ee515d29f164b30c73d99e36e4ba890eb7ed5bda05edf58853995257e40f9d6ac3d5441deb55f704f8a381cc93934d16de3aa84
6
+ metadata.gz: d89adecd25a597dfcb516f4635919cce3af2458da8f7094ef566ec799ac3b2e6c8bb08807f0456852be45e77d154428c3dde70014c733ce27c1312925bd24bdb
7
+ data.tar.gz: 57e5d7d3302d0e7b9150107251a79d04a4fb6df19398d86d6538fd24dce7a871eac7ec6550661d24cc9212f0e90c871a8283f3fe7187ddc23f0aae3367d01dbf
Binary file
data.tar.gz.sig CHANGED
@@ -1,2 +1,2 @@
1
- $�/�1�BxB�f[]yj3�B�LSdz��D����h|b���,C�Qg)������
2
- �5�K'�� ��i�@��p �� 0�[�5��}
1
+ 5�.x�
2
+ ��wA�������3휵h,a= ْ�M��gj¼�:��\ȃ�'̾9R ��9O�f�Ϲ FI������'� �[�o��j󍙈�wO�I���;�9�����H�74'��<
@@ -51,10 +51,11 @@ class LineParser
51
51
  end
52
52
 
53
53
  def parse(s)
54
-
55
- @a = scan @tree_patterns, LineTree.new(s, ignore_blank_lines: @ibl).to_a
56
- @h = build_hash @a
57
- @a
54
+
55
+ puts 'inside parse()' if @debug
56
+ a = scan @tree_patterns, LineTree.new(s, ignore_blank_lines: @ibl).to_a
57
+ @h2 = build_hash a
58
+ @a = a
58
59
 
59
60
  end
60
61
 
@@ -63,7 +64,7 @@ class LineParser
63
64
  end
64
65
 
65
66
  def to_h()
66
- @h
67
+ @h2
67
68
  end
68
69
 
69
70
  def to_xml
@@ -88,6 +89,9 @@ class LineParser
88
89
 
89
90
  a2 = []
90
91
 
92
+ puts 'row: ' + row.inspect
93
+ puts 'row[3]: ' + row[3].inspect
94
+
91
95
  if row[3] and row[3].any? then
92
96
 
93
97
  puts 'row[3][0][1]: ' + row[3][0][1].inspect if @debug
@@ -104,7 +108,8 @@ class LineParser
104
108
  a2 = row[1].values.first
105
109
  end
106
110
 
107
- key = row[1].values.first
111
+ key = row[1].values.first
112
+ key ||= a2
108
113
  (key.empty? or key == a2) ? a2 : {key => a2}
109
114
 
110
115
  end
@@ -120,7 +125,7 @@ class LineParser
120
125
 
121
126
  filter(h3)
122
127
 
123
- end
128
+ end
124
129
 
125
130
  def join(lines, indent='')
126
131
  lines.map do |x|
@@ -129,6 +134,8 @@ class LineParser
129
134
  end
130
135
 
131
136
  def scan(xpatterns, items)
137
+
138
+ puts 'inside scan()' if @debug
132
139
 
133
140
  records = []
134
141
 
@@ -143,6 +150,8 @@ class LineParser
143
150
  found = @patterns.detect do |_, pattern|
144
151
  params = @h[pattern.class.to_s.to_sym].call x.first, pattern
145
152
  end
153
+
154
+ puts 'found: ' + found.inspect if @debug
146
155
 
147
156
  if found then
148
157
 
@@ -152,7 +161,11 @@ class LineParser
152
161
 
153
162
  else
154
163
 
164
+ puts 'xpatterns: ' + xpatterns.inspect if @debug
165
+
155
166
  found = xpatterns.detect do |_, pattern, id|
167
+
168
+ puts 'found2: ' + found.inspect if @debug
156
169
 
157
170
  if pattern == :root then
158
171
 
@@ -160,10 +173,19 @@ class LineParser
160
173
  params = @h[pattern2.class.to_s.to_sym].call x.first, pattern2
161
174
  context = id if params
162
175
  end
163
-
176
+
177
+ puts 'found3: ' + found.inspect if @debug
178
+
164
179
  else
165
180
 
181
+ if @debug then
182
+ puts '@h: ' + @h.inspect
183
+ puts 'pattern: ' + pattern.inspect
184
+ puts 'x.first: ' + x.first.inspect
185
+ end
186
+
166
187
  params = @h[pattern.class.to_s.to_sym].call x.first, pattern
188
+ puts 'params: ' + params.inspect if @debug
167
189
  context = id if params
168
190
  end
169
191
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lineparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -30,7 +30,7 @@ cert_chain:
30
30
  7CkP6/pzsGLnyfCNF6rkXny4G0mjMmALczbazUUCil4IJNYfvW28Nlm2cD1N6Y/t
31
31
  Uck=
32
32
  -----END CERTIFICATE-----
33
- date: 2018-06-27 00:00:00.000000000 Z
33
+ date: 2018-06-29 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: line-tree
metadata.gz.sig CHANGED
Binary file