sportdb-parser 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,214 +1,633 @@
1
- module SportDb
2
- class Parser
3
-
4
-
5
- ## transforms
6
- ##
7
- ## Netherlands 1-2 (1-1) England
8
- ## => text => team
9
- ## score|vs
10
- ## text => team
11
-
12
-
13
- ## token iter/find better name
14
- ## e.g. TokenBuffer/Scanner or such ??
15
- class Tokens
16
- def initialize( tokens )
17
- @tokens = tokens
18
- @pos = 0
19
- end
20
-
21
- def pos() @pos; end
22
- def eos?() @pos >= @tokens.size; end
23
-
24
-
25
- def include?( *types )
26
- pos = @pos
27
- ## puts " starting include? #{types.inspect} @ #{pos}"
28
- while pos < @tokens.size do
29
- return true if types.include?( @tokens[pos][0] )
30
- pos +=1
31
- end
32
- false
33
- end
34
-
35
- ## pattern e.g. [:text, [:vs,:score], :text]
36
- def match?( *pattern )
37
- ## puts " starting match? #{pattern.inspect} @ #{@pos}"
38
- pattern.each_with_index do |types,offset|
39
- ## if single symbol wrap in array
40
- types = types.is_a?(Array) ? types : [types]
41
- return false unless types.include?( peek(offset) )
42
- end
43
- true
44
- end
45
-
46
-
47
- ## return token type (e.g. :text, :num, etc.)
48
- def cur() peek(0); end
49
- ## return content (assumed to be text)
50
- def text(offset=0)
51
- ## raise error - why? why not?
52
- ## return nil?
53
- if peek( offset ) != :text
54
- raise ArgumentError, "text(#{offset}) - token not a text type"
55
- end
56
- @tokens[@pos+offset][1]
57
- end
58
-
59
-
60
- def peek(offset=1)
61
- ## return nil if eos
62
- if @pos+offset >= @tokens.size
63
- nil
64
- else
65
- @tokens[@pos+offset][0]
66
- end
67
- end
68
-
69
- ## note - returns complete token
70
- def next
71
- # if @pos >= @tokens.size
72
- # raise ArgumentError, "end of array - #{@pos} >= #{@tokens.size}"
73
- # end
74
- # throw (standard) end of iteration here why? why not?
75
-
76
- t = @tokens[@pos]
77
- @pos += 1
78
- t
79
- end
80
-
81
- def collect( &blk )
82
- tokens = []
83
- loop do
84
- break if eos?
85
- tokens << if block_given?
86
- blk.call( self.next )
87
- else
88
- self.next
89
- end
90
- end
91
- tokens
92
- end
93
- end # class Tokens
94
-
95
-
96
-
97
- ##
98
- ##
99
- ## add !!!!
100
- ## collect_until e.g. collect_until( :text )
101
-
102
-
103
- def parse_with_errors( line, debug: false )
104
- errors = []
105
- tokens, token_errors = tokenize_with_errors( line, typed: true )
106
- errors += token_errors
107
-
108
- #############
109
- ## pass 1
110
- ## replace all texts with keyword matches (e.g. group, round, leg, etc.)
111
- tokens = tokens.map do |t|
112
- if t[0] == :text
113
- text = t[1]
114
- if is_group?( text )
115
- [:group, text]
116
- elsif is_leg?( text )
117
- [:leg, text]
118
- elsif is_round?( text )
119
- [:round, text]
120
- else
121
- t ## pass through as-is (1:1)
122
- end
123
- else
124
- t
125
- end
126
- end
127
-
128
-
129
- ## puts "tokens:"
130
- ## pp tokens
131
-
132
- ## transform tokens into (parse tree/ast) nodes
133
- nodes = []
134
-
135
- buf = Tokens.new( tokens )
136
- ## pp buf
137
-
138
-
139
- loop do
140
- break if buf.eos?
141
-
142
- ## simplify - remove separator for round + leg pair
143
- ## e.g. Round of 16, 1st Leg
144
- ## allow Round of 16 - 1st Leg too - why? why not?
145
- if buf.match?( :round, [:',', :'|',
146
- :'-',
147
- :vs, ### fix - change parser to issue :'-' only for (-) not :vs!!!
148
- ], :leg )
149
- nodes << [:round, buf.next[1]]
150
- buf.next ## swallow separator
151
- nodes << [:leg, buf.next[1]]
152
- next
153
- end
154
-
155
-
156
- if buf.pos == 0 ## MUST start line
157
- ## check for
158
- ## group def or round def
159
- if buf.match?( :round, :'|', [:date, :duration] ) ## assume round def (change round to round_def)
160
- nodes << [:round_def, buf.next[1]]
161
- buf.next ## swallow pipe
162
- nodes += buf.collect
163
- break
164
- end
165
- if buf.match?( :group, :'|', :text ) ## assume group def (change group to group_def)
166
- nodes << [:group_def, buf.next[1]]
167
- buf.next ## swallow pipe
168
- ## change all text to team
169
- nodes += buf.collect { |t|
170
- t[0] == :text ? [:team, t[1]] : t
171
- }
172
- break
173
- end
174
- end
175
-
176
-
177
- if buf.match?( :text, :'-', :text ) ## hacky? convert "generic" :- to :vs
178
- nodes << [:team, buf.next[1]] ## keep this rule/option - why? why not?
179
- nodes << [:vs]
180
- nodes << [:team, buf.next[1]]
181
- elsif buf.match?( :text, [:score, :vs], :text )
182
- nodes << [:team, buf.next[1]]
183
- nodes << buf.next
184
- nodes << [:team, buf.next[1]]
185
- elsif buf.match?( :text, :minute )
186
- nodes << [:player, buf.next[1]]
187
- nodes << buf.next
188
- elsif buf.cur == :'@'
189
- ## add all to the end as is
190
- ## only change text to geo
191
- nodes += buf.collect { |t|
192
- t[0] == :text ? [:geo, t[1]] : t
193
- }
194
- break
195
- else
196
- ## pass through
197
- nodes << buf.next
198
- end
199
- end
200
-
201
- [nodes,errors]
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by Racc 1.8.1
4
+ # from Racc grammar file "parser.y".
5
+ #
6
+
7
+ require 'racc/parser.rb'
8
+ class RaccMatchParser < Racc::Parser
9
+ ##### State transition tables begin ###
10
+
11
+ racc_action_table = [
12
+ 27, 45, 11, 36, 26, 21, 12, 13, 31, 14,
13
+ 45, 24, 46, 18, 20, 11, 58, 26, 21, 12,
14
+ 13, 46, 14, 32, 24, 52, 18, 20, 37, 42,
15
+ 50, 51, 52, 33, 48, 39, 40, 50, 51, 76,
16
+ 55, 20, 36, 56, 34, 60, 55, 61, 24, 29,
17
+ 30, 65, 66, 78, 79, 83, 84, 63, 67, 68,
18
+ 55, 69, 71, 73, 33, 74, 36, 81, 36, 85,
19
+ 86, 87, 88, 55, 36, 36, 90 ]
20
+
21
+ racc_action_check = [
22
+ 1, 17, 1, 23, 1, 1, 1, 1, 12, 1,
23
+ 41, 1, 17, 1, 1, 0, 23, 0, 0, 0,
24
+ 0, 41, 0, 13, 0, 42, 0, 0, 15, 16,
25
+ 42, 42, 21, 13, 18, 15, 15, 21, 21, 53,
26
+ 21, 18, 14, 22, 14, 24, 53, 27, 14, 11,
27
+ 11, 31, 31, 55, 55, 62, 62, 29, 34, 35,
28
+ 36, 38, 44, 46, 48, 49, 57, 58, 60, 64,
29
+ 67, 68, 72, 76, 80, 82, 88 ]
30
+
31
+ racc_action_pointer = [
32
+ 13, 0, nil, nil, nil, nil, nil, nil, nil, nil,
33
+ nil, 46, 5, 19, 37, 24, 24, -3, 27, nil,
34
+ nil, 21, 39, -2, 27, nil, nil, 47, nil, 52,
35
+ nil, 44, nil, nil, 48, 49, 41, nil, 55, nil,
36
+ nil, 6, 14, nil, 58, nil, 58, nil, 50, 60,
37
+ nil, nil, nil, 27, nil, 33, nil, 61, 63, nil,
38
+ 63, nil, 51, nil, 65, nil, nil, 66, 67, nil,
39
+ nil, nil, 60, nil, nil, nil, 54, nil, nil, nil,
40
+ 69, nil, 70, nil, nil, nil, nil, nil, 71, nil,
41
+ nil ]
42
+
43
+ racc_action_default = [
44
+ -60, -60, -1, -3, -4, -5, -6, -7, -8, -9,
45
+ -10, -60, -21, -30, -60, -60, -60, -60, -27, -29,
46
+ -32, -60, -60, -44, -60, -49, -59, -60, -2, -60,
47
+ -19, -60, -17, -31, -60, -60, -60, -20, -60, -23,
48
+ -24, -60, -60, -26, -60, -34, -60, -28, -30, -60,
49
+ -39, -40, -41, -51, -52, -55, -43, -60, -47, -50,
50
+ -60, 91, -60, -12, -60, -15, -16, -60, -60, -22,
51
+ -25, -33, -35, -36, -38, -53, -60, -56, -57, -58,
52
+ -46, -48, -45, -11, -13, -14, -18, -42, -60, -54,
53
+ -37 ]
54
+
55
+ racc_goto_table = [
56
+ 59, 43, 80, 75, 1, 82, 2, 28, 62, 64,
57
+ 38, 41, 47, 72, 35, 57, 77, nil, nil, nil,
58
+ nil, nil, nil, nil, nil, 70, 89, nil, nil, nil,
59
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
60
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
61
+ nil, nil, nil, nil, nil, nil, nil, 59, nil, 59 ]
62
+
63
+ racc_goto_check = [
64
+ 25, 17, 23, 27, 1, 23, 2, 2, 11, 12,
65
+ 14, 16, 18, 20, 22, 24, 28, nil, nil, nil,
66
+ nil, nil, nil, nil, nil, 17, 27, nil, nil, nil,
67
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
68
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
69
+ nil, nil, nil, nil, nil, nil, nil, 25, nil, 25 ]
70
+
71
+ racc_goto_pointer = [
72
+ nil, 4, 6, nil, nil, nil, nil, nil, nil, nil,
73
+ nil, -21, -22, nil, -5, nil, -5, -16, -6, nil,
74
+ -33, nil, 0, -55, -8, -23, nil, -50, -39 ]
75
+
76
+ racc_goto_default = [
77
+ nil, nil, nil, 3, 4, 5, 6, 7, 8, 9,
78
+ 10, nil, nil, 15, nil, 16, 17, nil, 19, 44,
79
+ nil, 49, 22, 23, nil, 25, 53, 54, nil ]
80
+
81
+ racc_reduce_table = [
82
+ 0, 0, :racc_error,
83
+ 1, 23, :_reduce_none,
84
+ 2, 23, :_reduce_none,
85
+ 1, 24, :_reduce_none,
86
+ 1, 24, :_reduce_none,
87
+ 1, 24, :_reduce_none,
88
+ 1, 24, :_reduce_none,
89
+ 1, 24, :_reduce_none,
90
+ 1, 24, :_reduce_none,
91
+ 1, 24, :_reduce_none,
92
+ 1, 24, :_reduce_none,
93
+ 4, 28, :_reduce_11,
94
+ 1, 33, :_reduce_12,
95
+ 2, 33, :_reduce_13,
96
+ 4, 29, :_reduce_14,
97
+ 1, 34, :_reduce_15,
98
+ 1, 34, :_reduce_16,
99
+ 2, 25, :_reduce_17,
100
+ 4, 25, :_reduce_18,
101
+ 2, 26, :_reduce_19,
102
+ 2, 27, :_reduce_20,
103
+ 1, 35, :_reduce_21,
104
+ 3, 35, :_reduce_22,
105
+ 1, 36, :_reduce_none,
106
+ 1, 36, :_reduce_none,
107
+ 3, 30, :_reduce_25,
108
+ 2, 30, :_reduce_26,
109
+ 1, 37, :_reduce_27,
110
+ 2, 37, :_reduce_28,
111
+ 1, 37, :_reduce_none,
112
+ 1, 40, :_reduce_30,
113
+ 2, 40, :_reduce_31,
114
+ 1, 40, :_reduce_32,
115
+ 2, 39, :_reduce_33,
116
+ 1, 39, :_reduce_34,
117
+ 2, 41, :_reduce_35,
118
+ 1, 42, :_reduce_36,
119
+ 3, 42, :_reduce_37,
120
+ 3, 38, :_reduce_38,
121
+ 1, 43, :_reduce_39,
122
+ 1, 43, :_reduce_40,
123
+ 1, 43, :_reduce_41,
124
+ 4, 31, :_reduce_42,
125
+ 2, 31, :_reduce_43,
126
+ 1, 44, :_reduce_44,
127
+ 3, 44, :_reduce_45,
128
+ 3, 44, :_reduce_46,
129
+ 1, 46, :_reduce_none,
130
+ 2, 46, :_reduce_none,
131
+ 1, 45, :_reduce_49,
132
+ 2, 45, :_reduce_50,
133
+ 2, 47, :_reduce_51,
134
+ 1, 48, :_reduce_52,
135
+ 2, 48, :_reduce_53,
136
+ 3, 48, :_reduce_54,
137
+ 1, 49, :_reduce_55,
138
+ 2, 49, :_reduce_56,
139
+ 1, 50, :_reduce_57,
140
+ 1, 50, :_reduce_58,
141
+ 1, 32, :_reduce_59 ]
142
+
143
+ racc_reduce_n = 60
144
+
145
+ racc_shift_n = 91
146
+
147
+ racc_token_table = {
148
+ false => 0,
149
+ :error => 1,
150
+ :GROUP => 2,
151
+ "|" => 3,
152
+ :NEWLINE => 4,
153
+ :TEXT => 5,
154
+ :ROUND => 6,
155
+ :DATE => 7,
156
+ :DURATION => 8,
157
+ "[" => 9,
158
+ "]" => 10,
159
+ "-" => 11,
160
+ "," => 12,
161
+ :ORD => 13,
162
+ :TIME => 14,
163
+ "@" => 15,
164
+ :SCORE => 16,
165
+ :VS => 17,
166
+ ";" => 18,
167
+ :MINUTE => 19,
168
+ :OG => 20,
169
+ :PEN => 21 }
170
+
171
+ racc_nt_base = 22
172
+
173
+ racc_use_result_var = true
174
+
175
+ Racc_arg = [
176
+ racc_action_table,
177
+ racc_action_check,
178
+ racc_action_default,
179
+ racc_action_pointer,
180
+ racc_goto_table,
181
+ racc_goto_check,
182
+ racc_goto_default,
183
+ racc_goto_pointer,
184
+ racc_nt_base,
185
+ racc_reduce_table,
186
+ racc_token_table,
187
+ racc_shift_n,
188
+ racc_reduce_n,
189
+ racc_use_result_var ]
190
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
191
+
192
+ Racc_token_to_s_table = [
193
+ "$end",
194
+ "error",
195
+ "GROUP",
196
+ "\"|\"",
197
+ "NEWLINE",
198
+ "TEXT",
199
+ "ROUND",
200
+ "DATE",
201
+ "DURATION",
202
+ "\"[\"",
203
+ "\"]\"",
204
+ "\"-\"",
205
+ "\",\"",
206
+ "ORD",
207
+ "TIME",
208
+ "\"@\"",
209
+ "SCORE",
210
+ "VS",
211
+ "\";\"",
212
+ "MINUTE",
213
+ "OG",
214
+ "PEN",
215
+ "$start",
216
+ "statements",
217
+ "statement",
218
+ "date_header",
219
+ "group_header",
220
+ "round_header",
221
+ "group_def",
222
+ "round_def",
223
+ "match_line",
224
+ "goal_lines",
225
+ "empty_line",
226
+ "team_values",
227
+ "round_date_opts",
228
+ "round_values",
229
+ "round_sep",
230
+ "match_opts",
231
+ "match",
232
+ "more_match_opts",
233
+ "date_opts",
234
+ "geo_opts",
235
+ "geo_values",
236
+ "score_value",
237
+ "goal_lines_body",
238
+ "goals",
239
+ "goal_sep",
240
+ "goal",
241
+ "minutes",
242
+ "minute",
243
+ "minute_opts" ]
244
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
245
+
246
+ Racc_debug_parser = false
247
+
248
+ ##### State transition tables end #####
249
+
250
+ # reduce 0 omitted
251
+
252
+ # reduce 1 omitted
253
+
254
+ # reduce 2 omitted
255
+
256
+ # reduce 3 omitted
257
+
258
+ # reduce 4 omitted
259
+
260
+ # reduce 5 omitted
261
+
262
+ # reduce 6 omitted
263
+
264
+ # reduce 7 omitted
265
+
266
+ # reduce 8 omitted
267
+
268
+ # reduce 9 omitted
269
+
270
+ # reduce 10 omitted
271
+
272
+ module_eval(<<'.,.,', 'parser.y', 30)
273
+ def _reduce_11(val, _values, result)
274
+ @tree << GroupDef.new( name: val[0],
275
+ teams: val[2] )
276
+
277
+ result
278
+ end
279
+ .,.,
280
+
281
+ module_eval(<<'.,.,', 'parser.y', 36)
282
+ def _reduce_12(val, _values, result)
283
+ result = val
284
+ ## e.g. val is ["Austria"]
285
+
286
+ result
287
+ end
288
+ .,.,
289
+
290
+ module_eval(<<'.,.,', 'parser.y', 40)
291
+ def _reduce_13(val, _values, result)
292
+ result.push( val[1] )
293
+
294
+ result
295
+ end
296
+ .,.,
297
+
298
+ module_eval(<<'.,.,', 'parser.y', 49)
299
+ def _reduce_14(val, _values, result)
300
+ kwargs = { name: val[0] }.merge( val[2] )
301
+ @tree<< RoundDef.new( **kwargs )
302
+
303
+ result
304
+ end
305
+ .,.,
306
+
307
+ module_eval(<<'.,.,', 'parser.y', 54)
308
+ def _reduce_15(val, _values, result)
309
+ result = { date: val[0][1] }
310
+ result
311
+ end
312
+ .,.,
313
+
314
+ module_eval(<<'.,.,', 'parser.y', 55)
315
+ def _reduce_16(val, _values, result)
316
+ result = { duration: val[0][1] }
317
+ result
318
+ end
319
+ .,.,
320
+
321
+ module_eval(<<'.,.,', 'parser.y', 61)
322
+ def _reduce_17(val, _values, result)
323
+ @tree << DateHeader.new( date: val[0][1] )
324
+
325
+ result
326
+ end
327
+ .,.,
328
+
329
+ module_eval(<<'.,.,', 'parser.y', 65)
330
+ def _reduce_18(val, _values, result)
331
+ @tree << DateHeader.new( date: val[1][1] )
332
+
333
+ result
334
+ end
335
+ .,.,
336
+
337
+ module_eval(<<'.,.,', 'parser.y', 72)
338
+ def _reduce_19(val, _values, result)
339
+ @tree << GroupHeader.new( name: val[0] )
340
+
341
+ result
342
+ end
343
+ .,.,
344
+
345
+ module_eval(<<'.,.,', 'parser.y', 82)
346
+ def _reduce_20(val, _values, result)
347
+ @tree << RoundHeader.new( names: val[0] )
348
+
349
+ result
350
+ end
351
+ .,.,
352
+
353
+ module_eval(<<'.,.,', 'parser.y', 85)
354
+ def _reduce_21(val, _values, result)
355
+ result = val
356
+ result
357
+ end
358
+ .,.,
359
+
360
+ module_eval(<<'.,.,', 'parser.y', 86)
361
+ def _reduce_22(val, _values, result)
362
+ result.push( val[2] )
363
+ result
364
+ end
365
+ .,.,
366
+
367
+ # reduce 23 omitted
368
+
369
+ # reduce 24 omitted
370
+
371
+ module_eval(<<'.,.,', 'parser.y', 97)
372
+ def _reduce_25(val, _values, result)
373
+ puts "match:"
374
+ pp val[1]
375
+ puts "more match opts:"
376
+ pp val[2]
377
+
378
+ kwargs = {}.merge( val[0], val[1], val[2] )
379
+ @tree << MatchLine.new( **kwargs )
380
+
381
+ result
382
+ end
383
+ .,.,
384
+
385
+ module_eval(<<'.,.,', 'parser.y', 107)
386
+ def _reduce_26(val, _values, result)
387
+ kwargs = {}.merge( val[0], val[1] )
388
+ @tree << MatchLine.new( **kwargs )
389
+
390
+ result
391
+ end
392
+ .,.,
393
+
394
+ module_eval(<<'.,.,', 'parser.y', 112)
395
+ def _reduce_27(val, _values, result)
396
+ result = { ord: val[0][1][:value] }
397
+ result
398
+ end
399
+ .,.,
400
+
401
+ module_eval(<<'.,.,', 'parser.y', 113)
402
+ def _reduce_28(val, _values, result)
403
+ result = { ord: val[0][1][:value] }.merge( val[1] )
404
+ result
405
+ end
406
+ .,.,
407
+
408
+ # reduce 29 omitted
409
+
410
+ module_eval(<<'.,.,', 'parser.y', 117)
411
+ def _reduce_30(val, _values, result)
412
+ result = { date: val[0][1]}
413
+ result
414
+ end
415
+ .,.,
416
+
417
+ module_eval(<<'.,.,', 'parser.y', 118)
418
+ def _reduce_31(val, _values, result)
419
+ result = { date: val[0][1], time: val[1][1] }
420
+ result
421
+ end
422
+ .,.,
423
+
424
+ module_eval(<<'.,.,', 'parser.y', 119)
425
+ def _reduce_32(val, _values, result)
426
+ result = { time: val[0][1]}
427
+ result
428
+ end
429
+ .,.,
430
+
431
+ module_eval(<<'.,.,', 'parser.y', 123)
432
+ def _reduce_33(val, _values, result)
433
+ result = { geo: val[0]}
434
+ result
435
+ end
436
+ .,.,
437
+
438
+ module_eval(<<'.,.,', 'parser.y', 124)
439
+ def _reduce_34(val, _values, result)
440
+ result = {}
441
+ result
442
+ end
443
+ .,.,
444
+
445
+ module_eval(<<'.,.,', 'parser.y', 128)
446
+ def _reduce_35(val, _values, result)
447
+ result = val[1]
448
+ result
449
+ end
450
+ .,.,
451
+
452
+ module_eval(<<'.,.,', 'parser.y', 131)
453
+ def _reduce_36(val, _values, result)
454
+ result = val
455
+ result
456
+ end
457
+ .,.,
458
+
459
+ module_eval(<<'.,.,', 'parser.y', 132)
460
+ def _reduce_37(val, _values, result)
461
+ result.push( val[2] )
462
+ result
463
+ end
464
+ .,.,
465
+
466
+ module_eval(<<'.,.,', 'parser.y', 137)
467
+ def _reduce_38(val, _values, result)
468
+ result = { team1: val[0],
469
+ team2: val[2]
470
+ }.merge( val[1] )
471
+
472
+ result
473
+ end
474
+ .,.,
475
+
476
+ module_eval(<<'.,.,', 'parser.y', 142)
477
+ def _reduce_39(val, _values, result)
478
+ result = { score: val[0][1] }
479
+ result
480
+ end
481
+ .,.,
482
+
483
+ module_eval(<<'.,.,', 'parser.y', 143)
484
+ def _reduce_40(val, _values, result)
485
+ result = {}
486
+ result
487
+ end
488
+ .,.,
489
+
490
+ module_eval(<<'.,.,', 'parser.y', 144)
491
+ def _reduce_41(val, _values, result)
492
+ result = {}
493
+ result
494
+ end
495
+ .,.,
496
+
497
+ module_eval(<<'.,.,', 'parser.y', 161)
498
+ def _reduce_42(val, _values, result)
499
+ kwargs = val[1]
500
+ @tree << GoalLine.new( **kwargs )
501
+
502
+ result
503
+ end
504
+ .,.,
505
+
506
+ module_eval(<<'.,.,', 'parser.y', 166)
507
+ def _reduce_43(val, _values, result)
508
+ kwargs = val[0]
509
+ @tree << GoalLine.new( **kwargs )
510
+
511
+ result
512
+ end
513
+ .,.,
514
+
515
+ module_eval(<<'.,.,', 'parser.y', 171)
516
+ def _reduce_44(val, _values, result)
517
+ result = { goals1: val[0],
518
+ goals2: [] }
519
+
520
+ result
521
+ end
522
+ .,.,
523
+
524
+ module_eval(<<'.,.,', 'parser.y', 174)
525
+ def _reduce_45(val, _values, result)
526
+ result = { goals1: [],
527
+ goals2: val[2] }
528
+
529
+ result
530
+ end
531
+ .,.,
532
+
533
+ module_eval(<<'.,.,', 'parser.y', 177)
534
+ def _reduce_46(val, _values, result)
535
+ result = { goals1: val[0],
536
+ goals2: val[2] }
537
+
538
+ result
539
+ end
540
+ .,.,
541
+
542
+ # reduce 47 omitted
543
+
544
+ # reduce 48 omitted
545
+
546
+ module_eval(<<'.,.,', 'parser.y', 191)
547
+ def _reduce_49(val, _values, result)
548
+ result = val
549
+ result
550
+ end
551
+ .,.,
552
+
553
+ module_eval(<<'.,.,', 'parser.y', 192)
554
+ def _reduce_50(val, _values, result)
555
+ result.push( val[1])
556
+ result
557
+ end
558
+ .,.,
559
+
560
+ module_eval(<<'.,.,', 'parser.y', 197)
561
+ def _reduce_51(val, _values, result)
562
+ result = Goal.new( player: val[0],
563
+ minutes: val[1] )
564
+
565
+ result
566
+ end
567
+ .,.,
568
+
569
+ module_eval(<<'.,.,', 'parser.y', 204)
570
+ def _reduce_52(val, _values, result)
571
+ result = val
572
+ result
573
+ end
574
+ .,.,
575
+
576
+ module_eval(<<'.,.,', 'parser.y', 205)
577
+ def _reduce_53(val, _values, result)
578
+ result.push( val[1])
579
+ result
580
+ end
581
+ .,.,
582
+
583
+ module_eval(<<'.,.,', 'parser.y', 206)
584
+ def _reduce_54(val, _values, result)
585
+ result.push( val[2])
586
+ result
587
+ end
588
+ .,.,
589
+
590
+ module_eval(<<'.,.,', 'parser.y', 212)
591
+ def _reduce_55(val, _values, result)
592
+ kwargs = {}.merge( val[0][1] )
593
+ result = Minute.new( **kwargs )
594
+
595
+ result
596
+ end
597
+ .,.,
598
+
599
+ module_eval(<<'.,.,', 'parser.y', 217)
600
+ def _reduce_56(val, _values, result)
601
+ kwargs = { }.merge( val[0][1] ).merge( val[1] )
602
+ result = Minute.new( **kwargs )
603
+
604
+ result
605
+ end
606
+ .,.,
607
+
608
+ module_eval(<<'.,.,', 'parser.y', 221)
609
+ def _reduce_57(val, _values, result)
610
+ result = { og: true }
611
+ result
612
+ end
613
+ .,.,
614
+
615
+ module_eval(<<'.,.,', 'parser.y', 222)
616
+ def _reduce_58(val, _values, result)
617
+ result = { pen: true }
618
+ result
619
+ end
620
+ .,.,
621
+
622
+ module_eval(<<'.,.,', 'parser.y', 227)
623
+ def _reduce_59(val, _values, result)
624
+ puts ' MATCH empty_line'
625
+ result
626
+ end
627
+ .,.,
628
+
629
+ def _reduce_none(val, _values, result)
630
+ val[0]
202
631
  end
203
632
 
204
-
205
- ### convience helper - ignore errors by default
206
- def parse( line, debug: false )
207
- nodes, _ = parse_with_errors( line, debug: debug )
208
- nodes
209
- end
210
-
211
-
212
- end # class Parser
213
- end # module SportDb
214
-
633
+ end # class RaccMatchParser