DRev 0.0.1 → 0.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/DRev/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DRev
2
- VERSION = '0.0.1'.freeze
2
+ VERSION = '0.0.1.1'.freeze
3
3
  end
data/lib/error.rb CHANGED
@@ -74,6 +74,19 @@ module DRev
74
74
  log << path
75
75
  log
76
76
  end
77
+
78
+ def W_205(path, line, _exp = nil, _act = nil)
79
+ log = []
80
+ log << 2
81
+ log << 205
82
+ log << 2
83
+ log << 'Extra Line'
84
+ log << 'Unexpected Empty Line'
85
+ log << ''
86
+ log << line
87
+ log << path
88
+ log
89
+ end
77
90
  end
78
91
  end
79
92
  # rubocop: enable Naming/MethodName
data/lib/log.rb CHANGED
@@ -36,7 +36,7 @@ module DRev
36
36
  @error_list += "#{log[3]} "
37
37
  @error_list += "Error:[#{log[1]}]\n".red.bold if log[0] == 1
38
38
  @error_list += "Warnning:[#{log[1]}]\n".yellow.bold if log[0] == 2
39
- @error_list += " #{log[7]}/Line #{log[6]}: ".cyan
39
+ @error_list += " #{log[7]} Line #{log[6]}: ".cyan
40
40
  @error_list += "#{log[4]}\n"
41
41
  @error_list += "\n".red if log[5].split.empty?
42
42
  @error_list += "#{log[5]}\n\n".red unless log[5].split.empty?
data/lib/scanner.rb CHANGED
@@ -20,22 +20,32 @@ module DRev
20
20
  @line = 1
21
21
  end
22
22
 
23
- def indentation_fun(line)
23
+ # rubocop: disable Metrics/CyclomaticComplexity
24
+ # rubocop: disable Metrics/PerceivedComplexity
25
+ def indentation_fun(line, index)
24
26
  if @idnt != @cnt && line.split.empty? == false
25
27
  @log.log("W_201 #{@path} #{@line} #{@cnt} #{@idnt}")
26
- elsif @idnt != @cnt && line.split.empty? == true
27
- @log.log("W_204 #{@path} #{@line} #{@cnt} #{@idnt}")
28
+
29
+ elsif line.split.empty? == true
30
+
31
+ return if @file.line_num - 1 == index
32
+
33
+ return if @lines[index + 1].match(/{/)
34
+
35
+ return if @lines[index + 1].match(/,/)
36
+
37
+ @log.log("W_205 #{@path} #{@line} #{@cnt} #{@idnt}")
28
38
  end
29
39
  end
30
40
 
31
41
  def indentation
32
42
  reset
33
- @lines.each do |line|
43
+ @lines.each_with_index do |line, index|
34
44
  @idnt = line[/\A */].size
35
45
  @cnt -= 2 if line.match(/}/)
36
46
  break if indent_error_opening(@cnt)
37
47
 
38
- indentation_fun(line)
48
+ indentation_fun(line, index)
39
49
  @cnt += 2 if line.match(/{/)
40
50
  @line += 1
41
51
  end
@@ -54,8 +64,6 @@ module DRev
54
64
  def indent_error_closing(indent, counter)
55
65
  bool = false
56
66
  if indent < counter
57
- # @log.error('Missing Bracked', 101, 'EoF', temp, 'Indentation')
58
-
59
67
  @log.log("E_101 #{@path} 'EoF'")
60
68
  bool = true
61
69
  end
@@ -63,38 +71,43 @@ module DRev
63
71
  end
64
72
 
65
73
  def line_after_block
74
+ cnt = 0
66
75
  @lines.each_with_index do |line, index|
67
76
  return 1 if index > @lines.length - 2
68
77
 
78
+ cnt += 1 if line.match(/{/)
79
+ cnt -= 1 if line.match(/}/)
69
80
  next unless line.match(/}/)
70
81
 
71
- next if @lines[index + 1].strip.empty?
82
+ next if @lines[index + 1].strip.empty? || @lines[index + 1].match(/}/)
72
83
 
73
84
  @log.log("W_202 #{@path} #{index + 1} \t \t")
74
85
  end
75
86
  end
87
+ # rubocop: enable Metrics/CyclomaticComplexity
88
+ # rubocop: enable Metrics/PerceivedComplexity
76
89
 
77
90
  def end_ln
78
91
  temp = @lines[@file.line_num - 1]
79
- temp2 = @lines[@file.line_num - 2]
80
- end_ln_b(temp, temp2)
81
- end_ln_a(temp)
92
+ temp1 = @lines[@file.line_num]
93
+ end_ln_b(temp, temp1)
94
+ end_ln_a(temp, temp1)
82
95
  end
83
96
 
84
- def end_ln_b(temp, temp2)
85
- return unless temp.nil? || temp.strip.empty?
97
+ def end_ln_b(temp, temp1)
98
+ return if temp.nil? || temp.strip.empty?
86
99
 
87
- return unless temp2.nil? || temp2.strip.empty?
100
+ return if temp1.nil? || temp1.strip.empty?
88
101
 
89
- @log.log("W_203 #{@path} #{@lines.length + 1} \t \t")
102
+ @log.log("W_204 #{@path} #{@lines.length + 1} \t \t")
90
103
  end
91
104
 
92
- def end_ln_a(temp)
93
- return if temp.nil? || temp.strip.empty?
105
+ def end_ln_a(temp, temp1)
106
+ return unless temp.nil? || temp.strip.empty?
94
107
 
95
- return unless @lines[@file.line_num - 1].match(/}/)
108
+ return unless temp1.nil? || temp1.strip.empty?
96
109
 
97
- @log.log("W_204 #{@path} #{@lines.length} \t \t")
110
+ @log.log("W_203 #{@path} #{@lines.length} \t \t")
98
111
  end
99
112
 
100
113
  def scn
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: DRev
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dandush03
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-01 00:00:00.000000000 Z
11
+ date: 2020-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,7 +74,6 @@ files:
74
74
  - bin/DRev
75
75
  - bin/console
76
76
  - bin/setup
77
- - bin/test/1.css
78
77
  - bin/test/style.css
79
78
  - lib/DRev/version.rb
80
79
  - lib/buffer.rb
data/bin/test/1.css DELETED
@@ -1,350 +0,0 @@
1
- body {
2
- background-color: rgb(236, 238, 241);
3
- font-family: AvenirNext, Avenir, Helvetica Neue, Helvetica, Arial, sans-serif;
4
- }
5
-
6
- .main-grid {
7
- display: grid;
8
- grid-template-rows: 10% fit-content(35px) fit-content(35px) fit-content(700px) 13%;
9
- }
10
-
11
- .main-frm p {
12
- margin: 0;
13
- margin-bottom: 24px;
14
- padding: 0;
15
- padding-top: 6px;
16
- font-size: 10px;
17
- color: #444;
18
- }
19
-
20
- .sign-in-left {
21
- display: grid;
22
- grid-template-columns: 67% 33%;
23
- float: right;
24
- width: 350px;
25
- }
26
-
27
- .sign-in-left div {
28
- margin-right: 3px;
29
- }
30
-
31
- .sign-in-label {
32
- width: 100%;
33
- }
34
-
35
- .sign-in-label p {
36
- color: rgb(80, 80, 80);
37
- line-height: 18px;
38
- font-size: 12px;
39
- font-weight: 400;
40
- margin: 0;
41
- padding: 0;
42
- text-align: right;
43
- }
44
-
45
- .sign-in-label a {
46
- text-decoration: none;
47
- }
48
-
49
- .btn-style {
50
- background-image: url(https://plugin.intuitcdn.net/identity-authn-core-ui/images/icon-whitelock@3x-76f33cec.png);
51
- background-size: 10px auto;
52
- background-repeat: no-repeat;
53
- background-position-y: center;
54
- cursor: pointer;
55
- background-color: rgb(0, 119, 197);
56
- color: whitesmoke;
57
- border-radius: 5px;
58
- border: solid 0.5px #585858;
59
- text-align: center;
60
- }
61
-
62
- .sign-in-button button {
63
- background-position-x: 20px;
64
- font-size: 13.5px;
65
- font-weight: 400;
66
- height: 34px;
67
- width: 103px;
68
- margin: 0 0 0 8px;
69
- padding-left: 20px;
70
- }
71
-
72
- .logo {
73
- text-align: center;
74
- }
75
-
76
- .logo img {
77
- width: 118px;
78
- height: 35px;
79
- object-fit: none;
80
- object-position: 0 0;
81
- }
82
-
83
- .icons {
84
- margin-top: 20px;
85
- align-items: center;
86
- display: grid;
87
- justify-content: center;
88
- }
89
-
90
- .icons ul {
91
- margin: 0;
92
- padding: 0;
93
- display: inline;
94
- }
95
-
96
- .icons li {
97
- display: inline;
98
- }
99
-
100
- .mint-favicon {
101
- background-repeat: no-repeat;
102
- }
103
-
104
- .icon-1 button {
105
- background-image: url("https://plugin.intuitcdn.net/identity-authn-core-ui/images/mint-favicon-4accf8f4.svg");
106
- width: 23px;
107
- height: 23px;
108
- background-color: transparent;
109
- border: none;
110
- background-repeat: no-repeat;
111
- }
112
-
113
- .mint-favicon button {
114
- margin-right: 4px;
115
- width: 23px;
116
- height: 23px;
117
- background-color: transparent;
118
- border: none;
119
- background-repeat: no-repeat;
120
- }
121
-
122
- .icon-2 button {
123
- background-image: url("https://plugin.intuitcdn.net/identity-authn-core-ui/images/quickbooks-favicon@2x-c89488e8.svg");
124
- }
125
-
126
- .icon-3 button {
127
- background-image: url("https://plugin.intuitcdn.net/identity-authn-core-ui/images/tt-favicon@2x-fbd64ab8.svg");
128
- }
129
-
130
- .mint-text button {
131
- background-color: transparent;
132
- border: none;
133
- background-repeat: no-repeat;
134
- margin-right: 9px;
135
- }
136
-
137
- .text-1 button {
138
- background-image: url("https://plugin.intuitcdn.net/identity-authn-core-ui/images/mint-text-0fa36974.svg");
139
- width: 37px;
140
- height: 20px;
141
- }
142
-
143
- .text-2 button {
144
- background-image: url("https://plugin.intuitcdn.net/identity-authn-core-ui/images/quick-books-text-db6c72bf.svg");
145
- width: 98px;
146
- height: 22px;
147
- }
148
-
149
- .text-3 button {
150
- background-image: url("https://plugin.intuitcdn.net/identity-authn-core-ui/images/turbo-tax-text-9bc025c5.svg");
151
- width: 74px;
152
- height: 22px;
153
- }
154
-
155
- .frm {
156
- justify-content: center;
157
- display: grid;
158
- }
159
-
160
- .frm-container {
161
- text-align: center;
162
- background-color: white;
163
- padding: 30px;
164
- margin-top: 20px;
165
- border-color: rgb(199, 199, 199);
166
- border-style: solid;
167
- border-width: 1px;
168
- border-radius: 2px;
169
- border-bottom: none;
170
- }
171
-
172
- .frm-header h1 {
173
- color: rgb(76, 76, 76);
174
- font-size: 24px;
175
- font-weight: 400;
176
- margin: 0;
177
- padding: 0;
178
- }
179
-
180
- .frm-header h2 {
181
- color: rgb(76, 76, 76);
182
- font-size: 14px;
183
- font-weight: 300;
184
- margin: 0;
185
- padding: 0;
186
- }
187
-
188
- .frm-header a {
189
- color: rgb(0, 119, 197);
190
- font-size: 12px;
191
- font-weight: 300;
192
- margin: 0;
193
- padding: 0;
194
- text-decoration: none;
195
- }
196
-
197
- .frm-header div {
198
- padding-top: 20px;
199
- }
200
-
201
- .main-frm {
202
- display: grid;
203
- }
204
-
205
- .main-frm label {
206
- color: rgb(64, 64, 64);
207
- font-size: 14px;
208
- font-weight: 400px;
209
- padding-bottom: 6px;
210
- line-height: 25px;
211
- text-align: left;
212
- }
213
-
214
- .main-frm input {
215
- font-family: AvenirNext, Avenir, "Helvetica Neue", Helvetica, Arial, sans-serif;
216
- height: 34px;
217
- font-size: 16.8px;
218
- font-weight: 400px;
219
- padding-left: 8px;
220
- border-color: rgb(193, 197, 200);
221
- border-style: solid;
222
- border-width: 1px;
223
- border-radius: 3px;
224
- }
225
-
226
- .main-frm div {
227
- display: grid;
228
- text-align: left !important;
229
- }
230
-
231
- .pwd input {
232
- background-image: url(https://plugin.intuitcdn.net/identity-authn-core-ui/images/lock-left-grey@3x-a1ab5bd1.png);
233
- background-repeat: no-repeat;
234
- background-size: 20px auto;
235
- background-position-x: 96%;
236
- background-position-y: center;
237
- }
238
-
239
- .frm-btn button {
240
- background-position-x: 32%;
241
- font-size: 15.75px;
242
- font-weight: 400px;
243
- height: 44px;
244
- width: 100%;
245
- padding-left: 10%;
246
- background-size: 12px auto;
247
- margin-bottom: 30px;
248
- }
249
-
250
- .frm-footer {
251
- margin-top: 20px;
252
- }
253
-
254
- .frm-footer p {
255
- font-size: 12px;
256
- color: rgb(117, 117, 117);
257
- font-style: italic;
258
- line-height: 18px;
259
- margin: 5px;
260
- }
261
-
262
- .frm-footer a {
263
- text-decoration: none;
264
- color: rgb(0, 119, 197);
265
- }
266
-
267
- .re-captcha {
268
- border-color: rgb(199, 199, 199);
269
- border-style: solid;
270
- border-width: 1px;
271
- border-radius: 2px;
272
- border-top: none;
273
- padding: 20px;
274
- text-align: center;
275
- }
276
-
277
- .re-captcha p {
278
- color: rgb(141, 144, 150);
279
- font-size: 10px;
280
- font-weight: 400px;
281
- margin: 0;
282
- padding: 0;
283
- }
284
-
285
- .re-captcha a {
286
- text-decoration: none;
287
- color: rgb(0, 119, 197);
288
- }
289
-
290
- .page-footer {
291
- text-align: center;
292
- margin: 30px;
293
- }
294
-
295
- .page-footer ul {
296
- margin: 0;
297
- padding: 0;
298
- }
299
-
300
- .page-footer li {
301
- display: inline;
302
- padding-right: 10px;
303
- }
304
-
305
- .page-footer a {
306
- color: rgb(80, 80, 80);
307
- font-size: 12px;
308
- line-height: 18px;
309
- font-weight: 400px;
310
- padding: 0;
311
- margin: 0;
312
- text-decoration: none;
313
- }
314
-
315
- .page-footer p {
316
- color: rgb(80, 80, 80);
317
- font-size: 12px;
318
- line-height: 18px;
319
- font-weight: 400px;
320
- padding: 0;
321
- margin: 0;
322
- text-decoration: none;
323
- }
324
-
325
- .fixed-button button {
326
- position: fixed;
327
- right: 5%;
328
- bottom: 0;
329
- color: whitesmoke;
330
- background-color: rgb(107, 108, 114);
331
- border-radius: 6px;
332
- font-size: 14px;
333
- font-weight: 400px;
334
- line-height: 21px;
335
- padding: 10px 12px;
336
- border-style: solid;
337
- border: solid;
338
- }
339
-
340
- .sign-in-label a p {
341
- color: rgb(0, 119, 197);
342
- line-height: 18px;
343
- font-size: 12px;
344
- font-weight: 400;
345
- margin: 0;
346
- padding: 0;
347
- text-align: right;
348
- width: 100%;
349
- }
350
-