sportdb-parser 0.4.0 → 0.5.1

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.
@@ -1,214 +1,822 @@
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]
202
- end
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
+ 29, 50, 12, 92, 28, 53, 26, 50, 22, 33,
13
+ 57, 16, 76, 37, 77, 13, 57, 23, 14, 15,
14
+ 51, 20, 22, 12, 60, 28, 51, 26, 55, 56,
15
+ 60, 38, 16, 26, 55, 56, 13, 108, 23, 14,
16
+ 15, 35, 20, 22, 41, 63, 39, 42, 45, 44,
17
+ 109, 81, 82, 34, 36, 41, 67, 69, 70, 71,
18
+ 72, 94, 95, 106, 107, 47, 61, 65, 66, 79,
19
+ 83, 84, 60, 85, 87, 89, 38, 90, 41, 97,
20
+ 41, 99, 33, 101, 76, 60, 110, 111, 112, 113,
21
+ 60, 41, 41, 33, 116, 60, 118, 119 ]
22
+
23
+ racc_action_check = [
24
+ 1, 19, 1, 58, 1, 20, 1, 46, 20, 12,
25
+ 23, 1, 33, 15, 33, 1, 47, 1, 1, 1,
26
+ 19, 1, 1, 0, 58, 0, 46, 0, 23, 23,
27
+ 23, 15, 0, 16, 47, 47, 0, 78, 0, 0,
28
+ 0, 13, 0, 0, 16, 25, 16, 17, 17, 17,
29
+ 78, 36, 36, 13, 14, 25, 31, 31, 31, 31,
30
+ 31, 60, 60, 77, 77, 18, 24, 26, 29, 34,
31
+ 39, 40, 41, 43, 49, 51, 53, 54, 62, 63,
32
+ 65, 67, 68, 70, 74, 76, 80, 83, 84, 88,
33
+ 92, 96, 98, 103, 104, 105, 113, 115 ]
34
+
35
+ racc_action_pointer = [
36
+ 21, 0, nil, nil, nil, nil, nil, nil, nil, nil,
37
+ nil, nil, 1, 37, 38, 9, 27, 43, 48, -3,
38
+ -14, nil, nil, 4, 62, 38, 60, nil, nil, 68,
39
+ nil, 53, nil, 3, 52, nil, 32, nil, nil, 58,
40
+ 59, 46, nil, 55, nil, nil, 3, 10, nil, 70,
41
+ nil, 58, nil, 54, 60, nil, nil, nil, -2, nil,
42
+ 34, nil, 61, 75, nil, 63, nil, 77, 74, nil,
43
+ 79, nil, nil, nil, 75, nil, 59, 50, 33, nil,
44
+ 82, nil, nil, 83, 84, nil, nil, nil, 84, nil,
45
+ nil, nil, 64, nil, nil, nil, 74, nil, 75, nil,
46
+ nil, nil, nil, 85, 82, 69, nil, nil, nil, nil,
47
+ nil, nil, nil, 79, nil, 87, nil, nil, nil, nil ]
48
+
49
+ racc_action_default = [
50
+ -80, -80, -1, -3, -4, -5, -6, -7, -8, -9,
51
+ -10, -11, -80, -80, -41, -50, -80, -80, -80, -80,
52
+ -47, -49, -52, -80, -80, -64, -80, -69, -79, -80,
53
+ -2, -80, -13, -20, -80, -39, -80, -37, -51, -80,
54
+ -80, -80, -40, -80, -43, -44, -80, -80, -46, -80,
55
+ -54, -80, -48, -50, -80, -59, -60, -61, -71, -72,
56
+ -75, -63, -80, -67, -70, -80, 120, -80, -80, -15,
57
+ -16, -18, -19, -21, -22, -24, -80, -80, -80, -32,
58
+ -80, -35, -36, -80, -80, -42, -45, -53, -55, -56,
59
+ -58, -73, -80, -76, -77, -78, -66, -68, -65, -12,
60
+ -14, -17, -23, -80, -80, -27, -29, -30, -31, -33,
61
+ -34, -38, -62, -80, -74, -80, -26, -28, -57, -25 ]
62
+
63
+ racc_goto_table = [
64
+ 32, 64, 91, 75, 48, 96, 2, 30, 98, 1,
65
+ 31, 68, 73, 74, 104, 105, 78, 80, 43, 46,
66
+ 103, 52, 88, 40, 62, 93, nil, nil, nil, nil,
67
+ nil, 86, nil, nil, nil, nil, 114, nil, nil, nil,
68
+ nil, nil, nil, nil, 102, nil, nil, nil, nil, 117,
69
+ nil, nil, nil, nil, nil, nil, 100, nil, nil, nil,
70
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
71
+ nil, nil, 64, nil, 64, nil, nil, nil, nil, nil,
72
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
73
+ nil, 115 ]
74
+
75
+ racc_goto_check = [
76
+ 13, 35, 18, 17, 27, 33, 2, 2, 33, 1,
77
+ 12, 14, 15, 16, 19, 20, 21, 22, 24, 26,
78
+ 18, 28, 30, 32, 34, 37, nil, nil, nil, nil,
79
+ nil, 27, nil, nil, nil, nil, 18, nil, nil, nil,
80
+ nil, nil, nil, nil, 17, nil, nil, nil, nil, 18,
81
+ nil, nil, nil, nil, nil, nil, 13, nil, nil, nil,
82
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
83
+ nil, nil, 35, nil, 35, nil, nil, nil, nil, nil,
84
+ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
85
+ nil, 13 ]
86
+
87
+ racc_goto_pointer = [
88
+ nil, 9, 6, nil, nil, nil, nil, nil, nil, nil,
89
+ nil, nil, -2, -12, -20, -21, -20, -30, -56, -63,
90
+ -62, -18, -19, nil, 1, nil, 1, -15, 1, nil,
91
+ -29, nil, 7, -57, -1, -24, nil, -35 ]
92
+
93
+ racc_goto_default = [
94
+ nil, nil, nil, 3, 4, 5, 6, 7, 8, 9,
95
+ 10, 11, nil, nil, nil, nil, nil, nil, 59, nil,
96
+ nil, nil, nil, 17, nil, 18, 19, nil, 21, 49,
97
+ nil, 54, 24, 25, nil, 27, 58, nil ]
98
+
99
+ racc_reduce_table = [
100
+ 0, 0, :racc_error,
101
+ 1, 30, :_reduce_none,
102
+ 2, 30, :_reduce_none,
103
+ 1, 31, :_reduce_none,
104
+ 1, 31, :_reduce_none,
105
+ 1, 31, :_reduce_none,
106
+ 1, 31, :_reduce_none,
107
+ 1, 31, :_reduce_none,
108
+ 1, 31, :_reduce_none,
109
+ 1, 31, :_reduce_none,
110
+ 1, 31, :_reduce_none,
111
+ 1, 31, :_reduce_none,
112
+ 4, 40, :_reduce_12,
113
+ 1, 41, :_reduce_13,
114
+ 3, 41, :_reduce_14,
115
+ 2, 41, :_reduce_15,
116
+ 1, 43, :_reduce_none,
117
+ 2, 43, :_reduce_17,
118
+ 1, 43, :_reduce_none,
119
+ 1, 43, :_reduce_none,
120
+ 1, 42, :_reduce_20,
121
+ 2, 42, :_reduce_21,
122
+ 1, 44, :_reduce_22,
123
+ 2, 44, :_reduce_23,
124
+ 1, 44, :_reduce_24,
125
+ 4, 46, :_reduce_25,
126
+ 3, 45, :_reduce_26,
127
+ 1, 48, :_reduce_27,
128
+ 2, 48, :_reduce_28,
129
+ 1, 49, :_reduce_none,
130
+ 1, 49, :_reduce_none,
131
+ 4, 35, :_reduce_31,
132
+ 1, 50, :_reduce_32,
133
+ 2, 50, :_reduce_33,
134
+ 4, 36, :_reduce_34,
135
+ 1, 51, :_reduce_35,
136
+ 1, 51, :_reduce_36,
137
+ 2, 32, :_reduce_37,
138
+ 4, 32, :_reduce_38,
139
+ 2, 33, :_reduce_39,
140
+ 2, 34, :_reduce_40,
141
+ 1, 52, :_reduce_41,
142
+ 3, 52, :_reduce_42,
143
+ 1, 53, :_reduce_none,
144
+ 1, 53, :_reduce_none,
145
+ 3, 37, :_reduce_45,
146
+ 2, 37, :_reduce_46,
147
+ 1, 54, :_reduce_47,
148
+ 2, 54, :_reduce_48,
149
+ 1, 54, :_reduce_none,
150
+ 1, 57, :_reduce_50,
151
+ 2, 57, :_reduce_51,
152
+ 1, 57, :_reduce_52,
153
+ 2, 56, :_reduce_53,
154
+ 1, 56, :_reduce_54,
155
+ 2, 58, :_reduce_55,
156
+ 1, 59, :_reduce_56,
157
+ 3, 59, :_reduce_57,
158
+ 3, 55, :_reduce_58,
159
+ 1, 60, :_reduce_59,
160
+ 1, 60, :_reduce_60,
161
+ 1, 60, :_reduce_61,
162
+ 4, 38, :_reduce_62,
163
+ 2, 38, :_reduce_63,
164
+ 1, 61, :_reduce_64,
165
+ 3, 61, :_reduce_65,
166
+ 3, 61, :_reduce_66,
167
+ 1, 63, :_reduce_none,
168
+ 2, 63, :_reduce_none,
169
+ 1, 62, :_reduce_69,
170
+ 2, 62, :_reduce_70,
171
+ 2, 64, :_reduce_71,
172
+ 1, 65, :_reduce_72,
173
+ 2, 65, :_reduce_73,
174
+ 3, 65, :_reduce_74,
175
+ 1, 47, :_reduce_75,
176
+ 2, 47, :_reduce_76,
177
+ 1, 66, :_reduce_77,
178
+ 1, 66, :_reduce_78,
179
+ 1, 39, :_reduce_79 ]
180
+
181
+ racc_reduce_n = 80
182
+
183
+ racc_shift_n = 120
184
+
185
+ racc_token_table = {
186
+ false => 0,
187
+ :error => 1,
188
+ :PROP => 2,
189
+ "." => 3,
190
+ :NEWLINE => 4,
191
+ "," => 5,
192
+ "-" => 6,
193
+ ";" => 7,
194
+ :PROP_NAME => 8,
195
+ "(" => 9,
196
+ ")" => 10,
197
+ "[" => 11,
198
+ "]" => 12,
199
+ :YELLOW_CARD => 13,
200
+ :RED_CARD => 14,
201
+ :GROUP => 15,
202
+ "|" => 16,
203
+ :TEXT => 17,
204
+ :ROUND => 18,
205
+ :DATE => 19,
206
+ :DURATION => 20,
207
+ :ORD => 21,
208
+ :TIME => 22,
209
+ "@" => 23,
210
+ :SCORE => 24,
211
+ :VS => 25,
212
+ :MINUTE => 26,
213
+ :OG => 27,
214
+ :PEN => 28 }
215
+
216
+ racc_nt_base = 29
217
+
218
+ racc_use_result_var = true
219
+
220
+ Racc_arg = [
221
+ racc_action_table,
222
+ racc_action_check,
223
+ racc_action_default,
224
+ racc_action_pointer,
225
+ racc_goto_table,
226
+ racc_goto_check,
227
+ racc_goto_default,
228
+ racc_goto_pointer,
229
+ racc_nt_base,
230
+ racc_reduce_table,
231
+ racc_token_table,
232
+ racc_shift_n,
233
+ racc_reduce_n,
234
+ racc_use_result_var ]
235
+ Ractor.make_shareable(Racc_arg) if defined?(Ractor)
236
+
237
+ Racc_token_to_s_table = [
238
+ "$end",
239
+ "error",
240
+ "PROP",
241
+ "\".\"",
242
+ "NEWLINE",
243
+ "\",\"",
244
+ "\"-\"",
245
+ "\";\"",
246
+ "PROP_NAME",
247
+ "\"(\"",
248
+ "\")\"",
249
+ "\"[\"",
250
+ "\"]\"",
251
+ "YELLOW_CARD",
252
+ "RED_CARD",
253
+ "GROUP",
254
+ "\"|\"",
255
+ "TEXT",
256
+ "ROUND",
257
+ "DATE",
258
+ "DURATION",
259
+ "ORD",
260
+ "TIME",
261
+ "\"@\"",
262
+ "SCORE",
263
+ "VS",
264
+ "MINUTE",
265
+ "OG",
266
+ "PEN",
267
+ "$start",
268
+ "statements",
269
+ "statement",
270
+ "date_header",
271
+ "group_header",
272
+ "round_header",
273
+ "group_def",
274
+ "round_def",
275
+ "match_line",
276
+ "goal_lines",
277
+ "empty_line",
278
+ "lineup_lines",
279
+ "lineup",
280
+ "lineup_name",
281
+ "lineup_sep",
282
+ "lineup_name_more",
283
+ "card",
284
+ "lineup_sub",
285
+ "minute",
286
+ "card_body",
287
+ "card_type",
288
+ "team_values",
289
+ "round_date_opts",
290
+ "round_values",
291
+ "round_sep",
292
+ "match_opts",
293
+ "match",
294
+ "more_match_opts",
295
+ "date_opts",
296
+ "geo_opts",
297
+ "geo_values",
298
+ "score_value",
299
+ "goal_lines_body",
300
+ "goals",
301
+ "goal_sep",
302
+ "goal",
303
+ "minutes",
304
+ "minute_opts" ]
305
+ Ractor.make_shareable(Racc_token_to_s_table) if defined?(Ractor)
306
+
307
+ Racc_debug_parser = false
308
+
309
+ ##### State transition tables end #####
310
+
311
+ # reduce 0 omitted
312
+
313
+ # reduce 1 omitted
314
+
315
+ # reduce 2 omitted
316
+
317
+ # reduce 3 omitted
318
+
319
+ # reduce 4 omitted
320
+
321
+ # reduce 5 omitted
322
+
323
+ # reduce 6 omitted
324
+
325
+ # reduce 7 omitted
326
+
327
+ # reduce 8 omitted
328
+
329
+ # reduce 9 omitted
330
+
331
+ # reduce 10 omitted
332
+
333
+ # reduce 11 omitted
334
+
335
+ module_eval(<<'.,.,', 'parser.y', 30)
336
+ def _reduce_12(val, _values, result)
337
+ @tree << LineupLine.new( team: val[0],
338
+ lineup: val[1]
339
+ )
340
+
341
+ result
342
+ end
343
+ .,.,
344
+
345
+ module_eval(<<'.,.,', 'parser.y', 37)
346
+ def _reduce_13(val, _values, result)
347
+ result = [[val[0]]]
348
+ result
349
+ end
350
+ .,.,
351
+
352
+ module_eval(<<'.,.,', 'parser.y', 40)
353
+ def _reduce_14(val, _values, result)
354
+ ## if lineup_sep is - start a new sub array!!
355
+ if val[1] == '-'
356
+ result << [val[2]]
357
+ else
358
+ result[-1] << val[2]
359
+ end
360
+
361
+ result
362
+ end
363
+ .,.,
364
+
365
+ module_eval(<<'.,.,', 'parser.y', 48)
366
+ def _reduce_15(val, _values, result)
367
+ result = val[0]
368
+ result
369
+ end
370
+ .,.,
371
+
372
+ # reduce 16 omitted
373
+
374
+ module_eval(<<'.,.,', 'parser.y', 52)
375
+ def _reduce_17(val, _values, result)
376
+ result = val[0]
377
+ result
378
+ end
379
+ .,.,
380
+
381
+ # reduce 18 omitted
382
+
383
+ # reduce 19 omitted
384
+
385
+ module_eval(<<'.,.,', 'parser.y', 58)
386
+ def _reduce_20(val, _values, result)
387
+ result = Lineup.new( name: val[0] )
388
+
389
+ result
390
+ end
391
+ .,.,
203
392
 
393
+ module_eval(<<'.,.,', 'parser.y', 62)
394
+ def _reduce_21(val, _values, result)
395
+ kwargs = { name: val[0] }.merge( val[1] )
396
+ result = Lineup.new( **kwargs )
204
397
 
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
398
+ result
399
+ end
400
+ .,.,
401
+
402
+ module_eval(<<'.,.,', 'parser.y', 68)
403
+ def _reduce_22(val, _values, result)
404
+ result = { card: val[0] }
210
405
 
406
+ result
407
+ end
408
+ .,.,
211
409
 
212
- end # class Parser
213
- end # module SportDb
410
+ module_eval(<<'.,.,', 'parser.y', 72)
411
+ def _reduce_23(val, _values, result)
412
+ result = { card: val[0], sub: val[1] }
413
+
414
+ result
415
+ end
416
+ .,.,
417
+
418
+ module_eval(<<'.,.,', 'parser.y', 76)
419
+ def _reduce_24(val, _values, result)
420
+ result = { sub: val[0] }
421
+
422
+ result
423
+ end
424
+ .,.,
425
+
426
+ module_eval(<<'.,.,', 'parser.y', 82)
427
+ def _reduce_25(val, _values, result)
428
+ result = Sub.new( minute: val[1], sub: val[2] )
429
+
430
+ result
431
+ end
432
+ .,.,
433
+
434
+ module_eval(<<'.,.,', 'parser.y', 88)
435
+ def _reduce_26(val, _values, result)
436
+ kwargs = val[1]
437
+ result = Card.new( **kwargs )
438
+
439
+ result
440
+ end
441
+ .,.,
442
+
443
+ module_eval(<<'.,.,', 'parser.y', 93)
444
+ def _reduce_27(val, _values, result)
445
+ result = { name: val[0] }
446
+ result
447
+ end
448
+ .,.,
449
+
450
+ module_eval(<<'.,.,', 'parser.y', 96)
451
+ def _reduce_28(val, _values, result)
452
+ result = { name: val[0], minute: val[1] }
453
+ result
454
+ end
455
+ .,.,
456
+
457
+ # reduce 29 omitted
458
+
459
+ # reduce 30 omitted
460
+
461
+ module_eval(<<'.,.,', 'parser.y', 107)
462
+ def _reduce_31(val, _values, result)
463
+ @tree << GroupDef.new( name: val[0],
464
+ teams: val[2] )
465
+
466
+ result
467
+ end
468
+ .,.,
469
+
470
+ module_eval(<<'.,.,', 'parser.y', 113)
471
+ def _reduce_32(val, _values, result)
472
+ result = val
473
+ ## e.g. val is ["Austria"]
474
+
475
+ result
476
+ end
477
+ .,.,
478
+
479
+ module_eval(<<'.,.,', 'parser.y', 117)
480
+ def _reduce_33(val, _values, result)
481
+ result.push( val[1] )
482
+
483
+ result
484
+ end
485
+ .,.,
486
+
487
+ module_eval(<<'.,.,', 'parser.y', 126)
488
+ def _reduce_34(val, _values, result)
489
+ kwargs = { name: val[0] }.merge( val[2] )
490
+ @tree<< RoundDef.new( **kwargs )
491
+
492
+ result
493
+ end
494
+ .,.,
495
+
496
+ module_eval(<<'.,.,', 'parser.y', 131)
497
+ def _reduce_35(val, _values, result)
498
+ result = { date: val[0][1] }
499
+ result
500
+ end
501
+ .,.,
502
+
503
+ module_eval(<<'.,.,', 'parser.y', 132)
504
+ def _reduce_36(val, _values, result)
505
+ result = { duration: val[0][1] }
506
+ result
507
+ end
508
+ .,.,
509
+
510
+ module_eval(<<'.,.,', 'parser.y', 138)
511
+ def _reduce_37(val, _values, result)
512
+ @tree << DateHeader.new( date: val[0][1] )
513
+
514
+ result
515
+ end
516
+ .,.,
517
+
518
+ module_eval(<<'.,.,', 'parser.y', 142)
519
+ def _reduce_38(val, _values, result)
520
+ @tree << DateHeader.new( date: val[1][1] )
521
+
522
+ result
523
+ end
524
+ .,.,
525
+
526
+ module_eval(<<'.,.,', 'parser.y', 149)
527
+ def _reduce_39(val, _values, result)
528
+ @tree << GroupHeader.new( name: val[0] )
529
+
530
+ result
531
+ end
532
+ .,.,
533
+
534
+ module_eval(<<'.,.,', 'parser.y', 159)
535
+ def _reduce_40(val, _values, result)
536
+ @tree << RoundHeader.new( names: val[0] )
537
+
538
+ result
539
+ end
540
+ .,.,
541
+
542
+ module_eval(<<'.,.,', 'parser.y', 162)
543
+ def _reduce_41(val, _values, result)
544
+ result = val
545
+ result
546
+ end
547
+ .,.,
548
+
549
+ module_eval(<<'.,.,', 'parser.y', 163)
550
+ def _reduce_42(val, _values, result)
551
+ result.push( val[2] )
552
+ result
553
+ end
554
+ .,.,
555
+
556
+ # reduce 43 omitted
557
+
558
+ # reduce 44 omitted
559
+
560
+ module_eval(<<'.,.,', 'parser.y', 174)
561
+ def _reduce_45(val, _values, result)
562
+ puts "match:"
563
+ pp val[1]
564
+ puts "more match opts:"
565
+ pp val[2]
566
+
567
+ kwargs = {}.merge( val[0], val[1], val[2] )
568
+ @tree << MatchLine.new( **kwargs )
569
+
570
+ result
571
+ end
572
+ .,.,
573
+
574
+ module_eval(<<'.,.,', 'parser.y', 184)
575
+ def _reduce_46(val, _values, result)
576
+ kwargs = {}.merge( val[0], val[1] )
577
+ @tree << MatchLine.new( **kwargs )
578
+
579
+ result
580
+ end
581
+ .,.,
582
+
583
+ module_eval(<<'.,.,', 'parser.y', 189)
584
+ def _reduce_47(val, _values, result)
585
+ result = { ord: val[0][1][:value] }
586
+ result
587
+ end
588
+ .,.,
589
+
590
+ module_eval(<<'.,.,', 'parser.y', 190)
591
+ def _reduce_48(val, _values, result)
592
+ result = { ord: val[0][1][:value] }.merge( val[1] )
593
+ result
594
+ end
595
+ .,.,
596
+
597
+ # reduce 49 omitted
598
+
599
+ module_eval(<<'.,.,', 'parser.y', 194)
600
+ def _reduce_50(val, _values, result)
601
+ result = { date: val[0][1]}
602
+ result
603
+ end
604
+ .,.,
605
+
606
+ module_eval(<<'.,.,', 'parser.y', 195)
607
+ def _reduce_51(val, _values, result)
608
+ result = { date: val[0][1], time: val[1][1] }
609
+ result
610
+ end
611
+ .,.,
612
+
613
+ module_eval(<<'.,.,', 'parser.y', 196)
614
+ def _reduce_52(val, _values, result)
615
+ result = { time: val[0][1]}
616
+ result
617
+ end
618
+ .,.,
619
+
620
+ module_eval(<<'.,.,', 'parser.y', 200)
621
+ def _reduce_53(val, _values, result)
622
+ result = { geo: val[0]}
623
+ result
624
+ end
625
+ .,.,
626
+
627
+ module_eval(<<'.,.,', 'parser.y', 201)
628
+ def _reduce_54(val, _values, result)
629
+ result = {}
630
+ result
631
+ end
632
+ .,.,
633
+
634
+ module_eval(<<'.,.,', 'parser.y', 205)
635
+ def _reduce_55(val, _values, result)
636
+ result = val[1]
637
+ result
638
+ end
639
+ .,.,
640
+
641
+ module_eval(<<'.,.,', 'parser.y', 208)
642
+ def _reduce_56(val, _values, result)
643
+ result = val
644
+ result
645
+ end
646
+ .,.,
647
+
648
+ module_eval(<<'.,.,', 'parser.y', 209)
649
+ def _reduce_57(val, _values, result)
650
+ result.push( val[2] )
651
+ result
652
+ end
653
+ .,.,
654
+
655
+ module_eval(<<'.,.,', 'parser.y', 214)
656
+ def _reduce_58(val, _values, result)
657
+ result = { team1: val[0],
658
+ team2: val[2]
659
+ }.merge( val[1] )
660
+
661
+ result
662
+ end
663
+ .,.,
664
+
665
+ module_eval(<<'.,.,', 'parser.y', 219)
666
+ def _reduce_59(val, _values, result)
667
+ result = { score: val[0][1] }
668
+ result
669
+ end
670
+ .,.,
671
+
672
+ module_eval(<<'.,.,', 'parser.y', 220)
673
+ def _reduce_60(val, _values, result)
674
+ result = {}
675
+ result
676
+ end
677
+ .,.,
678
+
679
+ module_eval(<<'.,.,', 'parser.y', 221)
680
+ def _reduce_61(val, _values, result)
681
+ result = {}
682
+ result
683
+ end
684
+ .,.,
685
+
686
+ module_eval(<<'.,.,', 'parser.y', 238)
687
+ def _reduce_62(val, _values, result)
688
+ kwargs = val[1]
689
+ @tree << GoalLine.new( **kwargs )
690
+
691
+ result
692
+ end
693
+ .,.,
694
+
695
+ module_eval(<<'.,.,', 'parser.y', 243)
696
+ def _reduce_63(val, _values, result)
697
+ kwargs = val[0]
698
+ @tree << GoalLine.new( **kwargs )
699
+
700
+ result
701
+ end
702
+ .,.,
703
+
704
+ module_eval(<<'.,.,', 'parser.y', 248)
705
+ def _reduce_64(val, _values, result)
706
+ result = { goals1: val[0],
707
+ goals2: [] }
708
+
709
+ result
710
+ end
711
+ .,.,
712
+
713
+ module_eval(<<'.,.,', 'parser.y', 251)
714
+ def _reduce_65(val, _values, result)
715
+ result = { goals1: [],
716
+ goals2: val[2] }
717
+
718
+ result
719
+ end
720
+ .,.,
721
+
722
+ module_eval(<<'.,.,', 'parser.y', 254)
723
+ def _reduce_66(val, _values, result)
724
+ result = { goals1: val[0],
725
+ goals2: val[2] }
726
+
727
+ result
728
+ end
729
+ .,.,
730
+
731
+ # reduce 67 omitted
732
+
733
+ # reduce 68 omitted
734
+
735
+ module_eval(<<'.,.,', 'parser.y', 268)
736
+ def _reduce_69(val, _values, result)
737
+ result = val
738
+ result
739
+ end
740
+ .,.,
741
+
742
+ module_eval(<<'.,.,', 'parser.y', 269)
743
+ def _reduce_70(val, _values, result)
744
+ result.push( val[1])
745
+ result
746
+ end
747
+ .,.,
748
+
749
+ module_eval(<<'.,.,', 'parser.y', 274)
750
+ def _reduce_71(val, _values, result)
751
+ result = Goal.new( player: val[0],
752
+ minutes: val[1] )
753
+
754
+ result
755
+ end
756
+ .,.,
757
+
758
+ module_eval(<<'.,.,', 'parser.y', 281)
759
+ def _reduce_72(val, _values, result)
760
+ result = val
761
+ result
762
+ end
763
+ .,.,
764
+
765
+ module_eval(<<'.,.,', 'parser.y', 282)
766
+ def _reduce_73(val, _values, result)
767
+ result.push( val[1])
768
+ result
769
+ end
770
+ .,.,
771
+
772
+ module_eval(<<'.,.,', 'parser.y', 283)
773
+ def _reduce_74(val, _values, result)
774
+ result.push( val[2])
775
+ result
776
+ end
777
+ .,.,
778
+
779
+ module_eval(<<'.,.,', 'parser.y', 289)
780
+ def _reduce_75(val, _values, result)
781
+ kwargs = {}.merge( val[0][1] )
782
+ result = Minute.new( **kwargs )
783
+
784
+ result
785
+ end
786
+ .,.,
787
+
788
+ module_eval(<<'.,.,', 'parser.y', 294)
789
+ def _reduce_76(val, _values, result)
790
+ kwargs = { }.merge( val[0][1] ).merge( val[1] )
791
+ result = Minute.new( **kwargs )
792
+
793
+ result
794
+ end
795
+ .,.,
796
+
797
+ module_eval(<<'.,.,', 'parser.y', 298)
798
+ def _reduce_77(val, _values, result)
799
+ result = { og: true }
800
+ result
801
+ end
802
+ .,.,
803
+
804
+ module_eval(<<'.,.,', 'parser.y', 299)
805
+ def _reduce_78(val, _values, result)
806
+ result = { pen: true }
807
+ result
808
+ end
809
+ .,.,
810
+
811
+ module_eval(<<'.,.,', 'parser.y', 304)
812
+ def _reduce_79(val, _values, result)
813
+ puts ' MATCH empty_line'
814
+ result
815
+ end
816
+ .,.,
817
+
818
+ def _reduce_none(val, _values, result)
819
+ val[0]
820
+ end
214
821
 
822
+ end # class RaccMatchParser