ipynbdiff 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ipynb_symbol_map.rb +24 -5
- data/lib/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f26544b121fc120490029ee5e708efbd1e90ad085e5bf973fbb29214a04d7c8
|
4
|
+
data.tar.gz: cbcfa68cdf53ce539374c3053b95d7ebb4e27e57d09bf77b23b1f1297bced097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 897ddec211a46b69ab9cdd8a0ecddc946c67f1a51557f7205a305ae1ce35a32890120a1cb640082b4f3d7e8739c2172e56085d2987badfa32775adc48ca87b1d
|
7
|
+
data.tar.gz: 7516f6c3b5ac3d2a38f3ea78c54f293b49643260321f4ca452d46d4adc11e6d9447de4938cc5cb9de2c6b9d9b71abebf407de7252edffe3df51e997c919622fe
|
data/lib/ipynb_symbol_map.rb
CHANGED
@@ -27,6 +27,8 @@ module IpynbDiff
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def parse(prefix = '.')
|
30
|
+
raise_if_file_ended
|
31
|
+
|
30
32
|
skip_whitespaces
|
31
33
|
|
32
34
|
if (c = current_char) == '"'
|
@@ -50,6 +52,8 @@ module IpynbDiff
|
|
50
52
|
current_should_be '['
|
51
53
|
|
52
54
|
loop do
|
55
|
+
raise_if_file_ended
|
56
|
+
|
53
57
|
break if skip_beginning(']')
|
54
58
|
|
55
59
|
new_prefix = "#{prefix}.#{i}"
|
@@ -68,6 +72,8 @@ module IpynbDiff
|
|
68
72
|
current_should_be '{'
|
69
73
|
|
70
74
|
loop do
|
75
|
+
raise_if_file_ended
|
76
|
+
|
71
77
|
break if skip_beginning('}')
|
72
78
|
|
73
79
|
prop_name = parse_string(return_value: true)
|
@@ -97,9 +103,9 @@ module IpynbDiff
|
|
97
103
|
loop do
|
98
104
|
increment_char_index
|
99
105
|
|
100
|
-
|
106
|
+
raise_if_file_ended
|
101
107
|
|
102
|
-
if current_char == '"' &&
|
108
|
+
if current_char == '"' && !prev_backslash?
|
103
109
|
init_idx += 1
|
104
110
|
break
|
105
111
|
end
|
@@ -113,11 +119,12 @@ module IpynbDiff
|
|
113
119
|
end
|
114
120
|
|
115
121
|
def parse_value
|
116
|
-
increment_char_index until VALUE_STOPPERS.include?(current_char)
|
122
|
+
increment_char_index until raise_if_file_ended || VALUE_STOPPERS.include?(current_char)
|
117
123
|
end
|
118
124
|
|
119
125
|
def skip_whitespaces
|
120
126
|
while WHITESPACE_CHARS.include?(current_char)
|
127
|
+
raise_if_file_ended
|
121
128
|
check_for_new_line
|
122
129
|
increment_char_index
|
123
130
|
end
|
@@ -133,11 +140,13 @@ module IpynbDiff
|
|
133
140
|
end
|
134
141
|
|
135
142
|
def current_char
|
143
|
+
raise_if_file_ended
|
144
|
+
|
136
145
|
@chars[@char_idx]
|
137
146
|
end
|
138
147
|
|
139
|
-
def
|
140
|
-
@chars[@char_idx - 1]
|
148
|
+
def prev_backslash?
|
149
|
+
@chars[@char_idx - 1] == '\\' && @chars[@char_idx - 2] != '\\'
|
141
150
|
end
|
142
151
|
|
143
152
|
def current_should_be(another_char)
|
@@ -148,7 +157,13 @@ module IpynbDiff
|
|
148
157
|
@current_line += 1 if current_char == "\n"
|
149
158
|
end
|
150
159
|
|
160
|
+
def raise_if_file_ended
|
161
|
+
@char_idx >= @chars.size && raise(InvalidTokenError)
|
162
|
+
end
|
163
|
+
|
151
164
|
def skip
|
165
|
+
raise_if_file_ended
|
166
|
+
|
152
167
|
skip_whitespaces
|
153
168
|
|
154
169
|
if (c = current_char) == '"'
|
@@ -164,6 +179,8 @@ module IpynbDiff
|
|
164
179
|
|
165
180
|
def skip_array
|
166
181
|
loop do
|
182
|
+
raise_if_file_ended
|
183
|
+
|
167
184
|
break if skip_beginning(']')
|
168
185
|
|
169
186
|
skip
|
@@ -173,6 +190,8 @@ module IpynbDiff
|
|
173
190
|
def skip_object
|
174
191
|
|
175
192
|
loop do
|
193
|
+
raise_if_file_ended
|
194
|
+
|
176
195
|
break if skip_beginning('}')
|
177
196
|
|
178
197
|
parse_string
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ipynbdiff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Bonet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|