sportdb-parser 0.5.2 → 0.5.3

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
  SHA256:
3
- metadata.gz: 2016adc1039046c3994f4d30cfe9f6b9ab9065c22ca6b07a94429e93ddfbe1bb
4
- data.tar.gz: ab301ed8b121015db6f196fc8a5a6988766ace5478ce8538491ed1ed2b7e21db
3
+ metadata.gz: a4ad809654d751437839e7f7bbda6502fb2c4b517c279988c7a3756059eaa9d8
4
+ data.tar.gz: 6dbacfa44774d32bfaccdb209a195f2f6c6c9ded43280023ffafbe1a3288d310
5
5
  SHA512:
6
- metadata.gz: 5fb05929a62c6e99e33d52647f71ed48fd8ec57c4db808b3b5f47d47fa78c3308407dfc3eccd8d2fe2dd37b38863ff75a060d32eb8815ebd56792f5f3edafbb5
7
- data.tar.gz: c3b3c924cc2ff525de7c048bf25ffa2d1cf23eac84d6bf4118ec1aa41d234262aeb805515ceb7e89f32fa78fb527888d9abd6fc6d1155ba8eea3bf4779d9e42c
6
+ metadata.gz: 52b60ab7ef460d46007bd135fc0a00d09514b72335941c2d46f06793abc6631f7e2dce2fafefbf83360c672a05d212cf88f56ed3a6b78e803d5e5d76c0dcb38b
7
+ data.tar.gz: 4e861cefafce9bca2fe9135ae7fdf35a2cdd0d2080fa3f4f2fb900fa0f075752da8647dcb2c6c9e16e99210c4198a63e7202ae3e32cd1b0f049126aac7f3d412
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.5.2
1
+ ### 0.5.3
2
2
  ### 0.0.1 / 2024-07-12
3
3
 
4
4
  * Everything is new. First release.
@@ -4,7 +4,12 @@
4
4
 
5
5
 
6
6
  module SportDb
7
- class Parser
7
+
8
+ ## use module or class for Lang namespace??
9
+ ## start with module for now
10
+
11
+
12
+ module Lang
8
13
 
9
14
  ## Group A-Z
10
15
  ## Group 1-99
@@ -17,7 +22,7 @@ GROUP_RE = %r{^
17
22
  Group [ ]
18
23
  (?<key>[a-z0-9]+)
19
24
  $}ix
20
- def is_group?( text )
25
+ def self.is_group?( text )
21
26
  ## use regex for match
22
27
  GROUP_RE.match?( text )
23
28
  end
@@ -191,9 +196,8 @@ def self.more_round_names
191
196
  end
192
197
 
193
198
 
194
- def is_round?( text )
195
- ROUND_RE.match?( text ) ||
196
- self.class.more_round_names.include?( text )
199
+ def self.is_round?( text )
200
+ ROUND_RE.match?( text ) || more_round_names.include?( text )
197
201
  end
198
202
 
199
203
  ##
@@ -208,10 +212,10 @@ LEG_RE = %r{^
208
212
  $}ix
209
213
 
210
214
  ### Pair matches/games if marked with leg1 n leg2
211
- def is_leg?( text )
215
+ def self.is_leg?( text )
212
216
  LEG_RE.match?( text )
213
217
  end
214
218
 
215
219
 
216
- end # class Parser
220
+ end # module Lang
217
221
  end # module SportDb
@@ -2,6 +2,64 @@
2
2
 
3
3
  module SportDb
4
4
 
5
+ ###
6
+ # add a simple Outline convenience class
7
+ # for processing OUtlines with OUtlineReader
8
+
9
+ class QuickMatchOutline
10
+ def self.read( path )
11
+ nodes = OutlineReader.read( path )
12
+ new( nodes )
13
+ end
14
+
15
+ def initialize( nodes )
16
+ @nodes = nodes
17
+ end
18
+
19
+ def each_para( &blk )
20
+ ## note: every (new) read call - resets errors list to empty
21
+ ### @errors = []
22
+
23
+ ## process nodes
24
+ h1 = nil
25
+ h2 = nil
26
+ orphans = 0 ## track paragraphs's with no heading
27
+
28
+ @nodes.each do |node|
29
+ type = node[0]
30
+
31
+ if type == :h1
32
+ h1 = node[1] ## get heading text
33
+ puts " = Heading 1 >#{node[1]}<"
34
+ elsif type == :h2
35
+ if h1.nil?
36
+ puts "!! WARN - no heading for subheading; skipping processing"
37
+ next
38
+ end
39
+ h2 = node[1] ## get heading text
40
+ puts " == Heading 2 >#{node[1]}<"
41
+ elsif type == :p
42
+ if h1.nil?
43
+ orphans += 1 ## only warn once
44
+ puts "!! WARN - no heading for #{orphans} text paragraph(s); skipping parse"
45
+ next
46
+ end
47
+
48
+ lines = node[1]
49
+ blk.call( lines )
50
+ else
51
+ pp node
52
+ raise ArgumentError, "unsupported (node) type >#{type}<"
53
+ end
54
+ end # each node
55
+ end # each_para
56
+ alias_method :each_paragraph, :each_para
57
+ alias_method :each_p, :each_para
58
+ end # class QuickMatchOutline
59
+
60
+
61
+
62
+
5
63
  class OutlineReader
6
64
 
7
65
  def self.debug=(value) @@debug = value; end
@@ -9,185 +9,204 @@ class RaccMatchParser < Racc::Parser
9
9
  ##### State transition tables begin ###
10
10
 
11
11
  racc_action_table = [
12
- 95, 37, 26, 29, 112, 12, 87, 28, 58, 26,
13
- 81, 82, 41, 16, 39, 51, 113, 13, 38, 23,
14
- 14, 15, 61, 20, 22, 52, 56, 57, 12, 61,
15
- 28, 51, 26, 49, 52, 58, 16, 35, 97, 98,
16
- 13, 41, 23, 14, 15, 33, 20, 22, 34, 49,
17
- 52, 64, 54, 56, 57, 22, 68, 70, 71, 72,
18
- 42, 45, 44, 76, 36, 77, 110, 111, 47, 62,
19
- 66, 67, 79, 83, 84, 61, 85, 89, 91, 38,
20
- 92, 93, 41, 100, 41, 102, 33, 104, 105, 76,
21
- 61, 114, 115, 116, 117, 118, 119, 61, 41, 41,
22
- 33, 122, 61, 124, 125 ]
12
+ 103, 54, 60, 120, 28, 58, 35, 92, 23, 128,
13
+ 80, 60, 81, 60, 43, 121, 41, 39, 38, 52,
14
+ 55, 61, 62, 65, 65, 31, 55, 12, 127, 30,
15
+ 61, 28, 61, 62, 40, 16, 12, 50, 30, 13,
16
+ 28, 25, 14, 15, 16, 21, 23, 54, 13, 37,
17
+ 25, 14, 15, 43, 21, 23, 72, 74, 75, 76,
18
+ 36, 44, 47, 46, 68, 52, 55, 85, 86, 105,
19
+ 106, 118, 119, 129, 130, 137, 130, 56, 66, 70,
20
+ 71, 83, 87, 88, 65, 89, 91, 94, 96, 99,
21
+ 40, 100, 101, 43, 108, 43, 110, 35, 112, 113,
22
+ 80, 65, 122, 123, 124, 99, 126, 132, 65, 43,
23
+ 43, 35, 135, 65, 138, 99, 140, 141 ]
23
24
 
24
25
  racc_action_check = [
25
- 59, 15, 16, 1, 78, 1, 49, 1, 23, 1,
26
- 36, 36, 16, 1, 16, 19, 78, 1, 15, 1,
27
- 1, 1, 59, 1, 1, 49, 23, 23, 0, 23,
28
- 0, 46, 0, 19, 19, 47, 0, 13, 61, 61,
29
- 0, 25, 0, 0, 0, 12, 0, 0, 13, 46,
30
- 46, 25, 20, 47, 47, 20, 31, 31, 31, 31,
31
- 17, 17, 17, 33, 14, 33, 77, 77, 18, 24,
32
- 26, 29, 34, 39, 40, 41, 43, 50, 52, 54,
33
- 55, 56, 63, 64, 66, 68, 69, 71, 72, 74,
34
- 76, 80, 83, 84, 88, 90, 93, 95, 99, 101,
35
- 107, 108, 109, 118, 121 ]
26
+ 63, 19, 25, 82, 16, 21, 12, 52, 21, 95,
27
+ 35, 99, 35, 50, 16, 82, 16, 15, 14, 19,
28
+ 19, 25, 25, 63, 25, 1, 52, 1, 95, 1,
29
+ 99, 1, 50, 50, 15, 1, 0, 18, 0, 1,
30
+ 0, 1, 1, 1, 0, 1, 1, 48, 0, 13,
31
+ 0, 0, 0, 27, 0, 0, 33, 33, 33, 33,
32
+ 13, 17, 17, 17, 27, 48, 48, 38, 38, 65,
33
+ 65, 81, 81, 97, 97, 125, 125, 20, 26, 28,
34
+ 31, 36, 41, 42, 43, 45, 49, 53, 55, 56,
35
+ 58, 59, 62, 67, 68, 70, 72, 73, 75, 76,
36
+ 78, 80, 84, 87, 88, 91, 93, 100, 103, 107,
37
+ 109, 115, 116, 117, 128, 130, 131, 134 ]
36
38
 
37
39
  racc_action_pointer = [
38
- 26, 3, nil, nil, nil, nil, nil, nil, nil, nil,
39
- nil, nil, 38, 33, 49, -3, -4, 56, 52, 11,
40
- 34, nil, nil, 2, 65, 25, 44, nil, nil, 71,
41
- nil, 53, nil, 55, 56, nil, -8, nil, nil, 62,
42
- 63, 48, nil, 59, nil, nil, 27, 29, nil, 2,
43
- 73, nil, 62, nil, 58, 64, 65, nil, nil, -5,
44
- nil, 10, nil, 66, 79, nil, 68, nil, 81, 79,
45
- nil, 83, 84, nil, 81, nil, 63, 54, 0, nil,
46
- 87, nil, nil, 88, 89, nil, nil, nil, 90, nil,
47
- 90, nil, nil, 71, nil, 70, nil, nil, nil, 82,
48
- nil, 83, nil, nil, nil, nil, nil, 93, 90, 75,
49
- nil, nil, nil, nil, nil, nil, nil, nil, 87, nil,
50
- nil, 95, nil, nil, nil, nil ]
40
+ 34, 25, nil, nil, nil, nil, nil, nil, nil, nil,
41
+ nil, nil, -1, 45, 3, 13, -2, 57, 21, -3,
42
+ 72, -13, nil, nil, nil, -4, 74, 37, 52, nil,
43
+ nil, 80, nil, 53, nil, 2, 65, nil, 49, nil,
44
+ nil, 71, 72, 56, nil, 68, nil, nil, 43, 81,
45
+ 7, nil, 3, 83, nil, 72, 73, nil, 69, 75,
46
+ nil, nil, 76, -5, nil, 40, nil, 77, 90, nil,
47
+ 79, nil, 92, 90, nil, 94, 95, nil, 92, nil,
48
+ 73, 59, -1, nil, 98, nil, nil, 99, 100, nil,
49
+ nil, 89, nil, 102, nil, 4, nil, 69, nil, 5,
50
+ 81, nil, nil, 80, nil, nil, nil, 93, nil, 94,
51
+ nil, nil, nil, nil, nil, 104, 101, 85, nil, nil,
52
+ nil, nil, nil, nil, nil, 71, nil, nil, 98, nil,
53
+ 99, 100, nil, nil, 108, nil, nil, nil, nil, nil,
54
+ nil, nil ]
51
55
 
52
56
  racc_action_default = [
53
- -83, -83, -1, -3, -4, -5, -6, -7, -8, -9,
54
- -10, -11, -83, -83, -41, -50, -83, -83, -83, -83,
55
- -47, -49, -52, -83, -83, -67, -83, -72, -82, -83,
56
- -2, -83, -13, -20, -83, -39, -83, -37, -51, -83,
57
- -83, -83, -40, -83, -43, -44, -83, -83, -46, -83,
58
- -83, -56, -83, -48, -50, -83, -83, -63, -64, -74,
59
- -75, -78, -66, -83, -70, -73, -83, 126, -83, -83,
60
- -15, -16, -18, -21, -22, -24, -83, -83, -83, -32,
61
- -83, -35, -36, -83, -83, -42, -45, -53, -83, -55,
62
- -57, -58, -60, -61, -76, -83, -79, -80, -81, -69,
63
- -71, -68, -12, -14, -17, -19, -23, -83, -83, -27,
64
- -29, -30, -31, -33, -34, -38, -65, -54, -83, -62,
65
- -77, -83, -26, -28, -59, -25 ]
57
+ -90, -90, -1, -3, -4, -5, -6, -7, -8, -9,
58
+ -10, -11, -90, -90, -41, -54, -90, -90, -90, -90,
59
+ -66, -51, -53, -56, -65, -90, -90, -74, -90, -79,
60
+ -89, -90, -2, -90, -13, -20, -90, -39, -90, -37,
61
+ -55, -90, -90, -90, -40, -90, -43, -44, -90, -66,
62
+ -90, -46, -90, -90, -60, -90, -90, -52, -54, -90,
63
+ -68, -69, -90, -81, -82, -85, -73, -90, -77, -80,
64
+ -90, 142, -90, -90, -15, -16, -18, -21, -22, -24,
65
+ -90, -90, -90, -32, -90, -35, -36, -90, -90, -42,
66
+ -45, -90, -57, -90, -59, -61, -63, -90, -49, -90,
67
+ -67, -70, -83, -90, -86, -87, -88, -76, -78, -75,
68
+ -12, -14, -17, -19, -23, -90, -90, -27, -29, -30,
69
+ -31, -33, -34, -38, -72, -90, -58, -62, -90, -48,
70
+ -90, -90, -71, -84, -90, -26, -28, -47, -64, -50,
71
+ -67, -25 ]
66
72
 
67
73
  racc_goto_table = [
68
- 32, 65, 94, 75, 48, 99, 2, 30, 101, 1,
69
- 31, 69, 73, 74, 108, 109, 78, 80, 43, 107,
70
- 46, 53, 88, 90, 40, 63, 96, nil, nil, nil,
71
- nil, 86, nil, nil, nil, nil, nil, nil, 120, nil,
72
- nil, nil, nil, nil, 106, nil, nil, nil, nil, nil,
73
- nil, nil, 123, nil, nil, nil, nil, 103, nil, nil,
74
+ 49, 34, 69, 102, 79, 97, 51, 107, 2, 32,
75
+ 109, 1, 33, 73, 77, 78, 116, 117, 82, 84,
76
+ 115, 45, 48, 57, 93, 95, 131, 42, 67, 104,
77
+ nil, nil, nil, nil, nil, 90, nil, nil, 98, nil,
78
+ 125, nil, nil, 133, nil, nil, nil, 114, nil, nil,
79
+ nil, nil, nil, nil, nil, nil, nil, 136, nil, nil,
80
+ nil, nil, 111, nil, nil, nil, nil, nil, nil, nil,
81
+ nil, nil, nil, 98, nil, nil, nil, nil, nil, nil,
82
+ nil, nil, 69, nil, 69, nil, nil, nil, nil, nil,
74
83
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
75
- nil, nil, nil, nil, nil, 65, nil, 65, nil, nil,
76
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
77
- nil, nil, nil, nil, nil, 121 ]
84
+ nil, nil, nil, nil, 134, nil, nil, nil, nil, nil,
85
+ nil, nil, 139 ]
78
86
 
79
87
  racc_goto_check = [
80
- 13, 35, 18, 17, 27, 33, 2, 2, 33, 1,
81
- 12, 14, 15, 16, 19, 20, 21, 22, 24, 18,
82
- 26, 28, 29, 30, 32, 34, 37, nil, nil, nil,
83
- nil, 27, nil, nil, nil, nil, nil, nil, 18, nil,
84
- nil, nil, nil, nil, 17, nil, nil, nil, nil, nil,
85
- nil, nil, 18, nil, nil, nil, nil, 13, nil, nil,
86
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
87
- nil, nil, nil, nil, nil, 35, nil, 35, nil, nil,
88
+ 28, 13, 38, 18, 17, 29, 27, 36, 2, 2,
89
+ 36, 1, 12, 14, 15, 16, 19, 20, 21, 22,
90
+ 18, 24, 26, 30, 31, 32, 34, 35, 37, 40,
91
+ nil, nil, nil, nil, nil, 27, nil, nil, 28, nil,
92
+ 29, nil, nil, 18, nil, nil, nil, 17, nil, nil,
93
+ nil, nil, nil, nil, nil, nil, nil, 18, nil, nil,
94
+ nil, nil, 13, nil, nil, nil, nil, nil, nil, nil,
95
+ nil, nil, nil, 28, nil, nil, nil, nil, nil, nil,
96
+ nil, nil, 38, nil, 38, nil, nil, nil, nil, nil,
88
97
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
89
- nil, nil, nil, nil, nil, 13 ]
98
+ nil, nil, nil, nil, 13, nil, nil, nil, nil, nil,
99
+ nil, nil, 28 ]
90
100
 
91
101
  racc_goto_pointer = [
92
- nil, 9, 6, nil, nil, nil, nil, nil, nil, nil,
93
- nil, nil, -2, -12, -20, -21, -20, -30, -57, -63,
94
- -62, -18, -19, nil, 1, nil, 2, -15, 1, -27,
95
- -29, nil, 8, -58, 0, -24, nil, -35 ]
102
+ nil, 11, 8, nil, nil, nil, nil, nil, nil, nil,
103
+ nil, nil, 0, -11, -20, -21, -20, -31, -60, -65,
104
+ -64, -18, -19, nil, 4, nil, 4, -13, -18, -51,
105
+ 2, -28, -30, nil, -73, 11, -60, 1, -25, nil,
106
+ -36 ]
96
107
 
97
108
  racc_goto_default = [
98
109
  nil, nil, nil, 3, 4, 5, 6, 7, 8, 9,
99
- 10, 11, nil, nil, nil, nil, nil, nil, 60, nil,
100
- nil, nil, nil, 17, nil, 18, 19, nil, 21, 50,
101
- nil, 55, 24, 25, nil, 27, 59, nil ]
110
+ 10, 11, nil, nil, nil, nil, nil, nil, 64, nil,
111
+ nil, nil, nil, 17, nil, 18, 19, nil, 20, nil,
112
+ 22, 53, nil, 24, 59, 26, 27, nil, 29, 63,
113
+ nil ]
102
114
 
103
115
  racc_reduce_table = [
104
116
  0, 0, :racc_error,
105
- 1, 31, :_reduce_none,
106
- 2, 31, :_reduce_none,
107
- 1, 32, :_reduce_none,
108
- 1, 32, :_reduce_none,
109
- 1, 32, :_reduce_none,
110
- 1, 32, :_reduce_none,
111
- 1, 32, :_reduce_none,
112
117
  1, 32, :_reduce_none,
113
- 1, 32, :_reduce_none,
114
- 1, 32, :_reduce_none,
115
- 1, 32, :_reduce_none,
116
- 4, 41, :_reduce_12,
117
- 1, 42, :_reduce_13,
118
- 3, 42, :_reduce_14,
119
- 2, 42, :_reduce_15,
120
- 1, 44, :_reduce_none,
121
- 2, 44, :_reduce_17,
122
- 1, 44, :_reduce_none,
123
- 2, 44, :_reduce_19,
124
- 1, 43, :_reduce_20,
125
- 2, 43, :_reduce_21,
126
- 1, 45, :_reduce_22,
127
- 2, 45, :_reduce_23,
128
- 1, 45, :_reduce_24,
129
- 4, 47, :_reduce_25,
130
- 3, 46, :_reduce_26,
131
- 1, 49, :_reduce_27,
132
- 2, 49, :_reduce_28,
133
- 1, 50, :_reduce_none,
134
- 1, 50, :_reduce_none,
135
- 4, 36, :_reduce_31,
136
- 1, 51, :_reduce_32,
137
- 2, 51, :_reduce_33,
138
- 4, 37, :_reduce_34,
139
- 1, 52, :_reduce_35,
140
- 1, 52, :_reduce_36,
141
- 2, 33, :_reduce_37,
142
- 4, 33, :_reduce_38,
143
- 2, 34, :_reduce_39,
144
- 2, 35, :_reduce_40,
145
- 1, 53, :_reduce_41,
146
- 3, 53, :_reduce_42,
147
- 1, 54, :_reduce_none,
148
- 1, 54, :_reduce_none,
149
- 3, 38, :_reduce_45,
150
- 2, 38, :_reduce_46,
151
- 1, 55, :_reduce_47,
152
- 2, 55, :_reduce_48,
118
+ 2, 32, :_reduce_none,
119
+ 1, 33, :_reduce_none,
120
+ 1, 33, :_reduce_none,
121
+ 1, 33, :_reduce_none,
122
+ 1, 33, :_reduce_none,
123
+ 1, 33, :_reduce_none,
124
+ 1, 33, :_reduce_none,
125
+ 1, 33, :_reduce_none,
126
+ 1, 33, :_reduce_none,
127
+ 1, 33, :_reduce_none,
128
+ 4, 42, :_reduce_12,
129
+ 1, 43, :_reduce_13,
130
+ 3, 43, :_reduce_14,
131
+ 2, 43, :_reduce_15,
132
+ 1, 45, :_reduce_none,
133
+ 2, 45, :_reduce_17,
134
+ 1, 45, :_reduce_none,
135
+ 2, 45, :_reduce_19,
136
+ 1, 44, :_reduce_20,
137
+ 2, 44, :_reduce_21,
138
+ 1, 46, :_reduce_22,
139
+ 2, 46, :_reduce_23,
140
+ 1, 46, :_reduce_24,
141
+ 4, 48, :_reduce_25,
142
+ 3, 47, :_reduce_26,
143
+ 1, 50, :_reduce_27,
144
+ 2, 50, :_reduce_28,
145
+ 1, 51, :_reduce_none,
146
+ 1, 51, :_reduce_none,
147
+ 4, 37, :_reduce_31,
148
+ 1, 52, :_reduce_32,
149
+ 2, 52, :_reduce_33,
150
+ 4, 38, :_reduce_34,
151
+ 1, 53, :_reduce_35,
152
+ 1, 53, :_reduce_36,
153
+ 2, 34, :_reduce_37,
154
+ 4, 34, :_reduce_38,
155
+ 2, 35, :_reduce_39,
156
+ 2, 36, :_reduce_40,
157
+ 1, 54, :_reduce_41,
158
+ 3, 54, :_reduce_42,
159
+ 1, 55, :_reduce_none,
153
160
  1, 55, :_reduce_none,
154
- 1, 58, :_reduce_50,
155
- 2, 58, :_reduce_51,
156
- 1, 58, :_reduce_52,
157
- 2, 57, :_reduce_53,
158
- 3, 57, :_reduce_54,
159
- 2, 57, :_reduce_55,
160
- 1, 57, :_reduce_56,
161
- 2, 59, :_reduce_57,
162
- 1, 60, :_reduce_58,
163
- 3, 60, :_reduce_59,
164
- 3, 56, :_reduce_60,
165
- 3, 56, :_reduce_61,
166
- 4, 56, :_reduce_62,
167
- 1, 61, :_reduce_63,
168
- 1, 61, :_reduce_64,
169
- 4, 39, :_reduce_65,
170
- 2, 39, :_reduce_66,
171
- 1, 62, :_reduce_67,
172
- 3, 62, :_reduce_68,
173
- 3, 62, :_reduce_69,
174
- 1, 64, :_reduce_none,
175
- 2, 64, :_reduce_none,
176
- 1, 63, :_reduce_72,
177
- 2, 63, :_reduce_73,
178
- 2, 65, :_reduce_74,
179
- 1, 66, :_reduce_75,
180
- 2, 66, :_reduce_76,
181
- 3, 66, :_reduce_77,
182
- 1, 48, :_reduce_78,
183
- 2, 48, :_reduce_79,
184
- 1, 67, :_reduce_80,
185
- 1, 67, :_reduce_81,
186
- 1, 40, :_reduce_82 ]
187
-
188
- racc_reduce_n = 83
189
-
190
- racc_shift_n = 126
161
+ 3, 39, :_reduce_45,
162
+ 2, 39, :_reduce_46,
163
+ 5, 39, :_reduce_47,
164
+ 4, 39, :_reduce_48,
165
+ 1, 60, :_reduce_49,
166
+ 3, 60, :_reduce_50,
167
+ 1, 56, :_reduce_51,
168
+ 2, 56, :_reduce_52,
169
+ 1, 56, :_reduce_none,
170
+ 1, 61, :_reduce_54,
171
+ 2, 61, :_reduce_55,
172
+ 1, 61, :_reduce_56,
173
+ 2, 58, :_reduce_57,
174
+ 3, 58, :_reduce_58,
175
+ 2, 58, :_reduce_59,
176
+ 1, 58, :_reduce_60,
177
+ 2, 62, :_reduce_61,
178
+ 3, 62, :_reduce_62,
179
+ 1, 63, :_reduce_63,
180
+ 3, 63, :_reduce_64,
181
+ 1, 57, :_reduce_none,
182
+ 1, 57, :_reduce_none,
183
+ 3, 59, :_reduce_67,
184
+ 1, 65, :_reduce_none,
185
+ 1, 65, :_reduce_none,
186
+ 3, 64, :_reduce_70,
187
+ 4, 64, :_reduce_71,
188
+ 4, 40, :_reduce_72,
189
+ 2, 40, :_reduce_73,
190
+ 1, 66, :_reduce_74,
191
+ 3, 66, :_reduce_75,
192
+ 3, 66, :_reduce_76,
193
+ 1, 68, :_reduce_none,
194
+ 2, 68, :_reduce_none,
195
+ 1, 67, :_reduce_79,
196
+ 2, 67, :_reduce_80,
197
+ 2, 69, :_reduce_81,
198
+ 1, 70, :_reduce_82,
199
+ 2, 70, :_reduce_83,
200
+ 3, 70, :_reduce_84,
201
+ 1, 49, :_reduce_85,
202
+ 2, 49, :_reduce_86,
203
+ 1, 71, :_reduce_87,
204
+ 1, 71, :_reduce_88,
205
+ 1, 41, :_reduce_89 ]
206
+
207
+ racc_reduce_n = 90
208
+
209
+ racc_shift_n = 142
191
210
 
192
211
  racc_token_table = {
193
212
  false => 0,
@@ -214,14 +233,15 @@ racc_token_table = {
214
233
  :TIME => 21,
215
234
  :STATUS => 22,
216
235
  "@" => 23,
217
- :VS => 24,
218
- :SCORE => 25,
219
- ";" => 26,
220
- :MINUTE => 27,
221
- :OG => 28,
222
- :PEN => 29 }
236
+ :TIMEZONE => 24,
237
+ :VS => 25,
238
+ :SCORE => 26,
239
+ ";" => 27,
240
+ :MINUTE => 28,
241
+ :OG => 29,
242
+ :PEN => 30 }
223
243
 
224
- racc_nt_base = 30
244
+ racc_nt_base = 31
225
245
 
226
246
  racc_use_result_var = true
227
247
 
@@ -267,6 +287,7 @@ Racc_token_to_s_table = [
267
287
  "TIME",
268
288
  "STATUS",
269
289
  "\"@\"",
290
+ "TIMEZONE",
270
291
  "VS",
271
292
  "SCORE",
272
293
  "\";\"",
@@ -301,10 +322,13 @@ Racc_token_to_s_table = [
301
322
  "match_opts",
302
323
  "match",
303
324
  "more_match_opts",
325
+ "match_fixture",
326
+ "more_match_fixtures",
304
327
  "date_opts",
305
328
  "geo_opts",
306
329
  "geo_values",
307
- "score_value",
330
+ "match_result",
331
+ "match_sep",
308
332
  "goal_lines_body",
309
333
  "goals",
310
334
  "goal_sep",
@@ -573,19 +597,14 @@ module_eval(<<'.,.,', 'parser.y', 165)
573
597
 
574
598
  module_eval(<<'.,.,', 'parser.y', 176)
575
599
  def _reduce_45(val, _values, result)
576
- puts "match:"
577
- pp val[1]
578
- puts "more match opts:"
579
- pp val[2]
580
-
581
- kwargs = {}.merge( val[0], val[1], val[2] )
600
+ kwargs = {}.merge( val[0], val[1], val[2] )
582
601
  @tree << MatchLine.new( **kwargs )
583
602
 
584
603
  result
585
604
  end
586
605
  .,.,
587
606
 
588
- module_eval(<<'.,.,', 'parser.y', 186)
607
+ module_eval(<<'.,.,', 'parser.y', 181)
589
608
  def _reduce_46(val, _values, result)
590
609
  kwargs = {}.merge( val[0], val[1] )
591
610
  @tree << MatchLine.new( **kwargs )
@@ -594,141 +613,192 @@ module_eval(<<'.,.,', 'parser.y', 186)
594
613
  end
595
614
  .,.,
596
615
 
597
- module_eval(<<'.,.,', 'parser.y', 191)
616
+ module_eval(<<'.,.,', 'parser.y', 189)
598
617
  def _reduce_47(val, _values, result)
599
- result = { ord: val[0][1][:value] }
618
+ kwargs = {}.merge( val[0], val[1] )
619
+ @tree << MatchLine.new( **kwargs )
620
+
621
+ ## add more match fixtures
622
+ val[3].each do |kwargs|
623
+ @tree << MatchLine.new( **kwargs)
624
+ end
625
+
600
626
  result
601
627
  end
602
628
  .,.,
603
629
 
604
- module_eval(<<'.,.,', 'parser.y', 192)
630
+ module_eval(<<'.,.,', 'parser.y', 199)
605
631
  def _reduce_48(val, _values, result)
606
- result = { ord: val[0][1][:value] }.merge( val[1] )
632
+ kwargs = val[0]
633
+ @tree << MatchLine.new( **kwargs )
634
+
635
+ ## add more match fixtures
636
+ val[2].each do |kwargs|
637
+ @tree << MatchLine.new( **kwargs)
638
+ end
639
+
607
640
  result
608
641
  end
609
642
  .,.,
610
643
 
611
- # reduce 49 omitted
644
+ module_eval(<<'.,.,', 'parser.y', 213)
645
+ def _reduce_49(val, _values, result)
646
+ puts " REDUCE => more_match_fixtures : match_fixture"
647
+ result = val
612
648
 
613
- module_eval(<<'.,.,', 'parser.y', 196)
614
- def _reduce_50(val, _values, result)
615
- result = { date: val[0][1]}
616
649
  result
617
650
  end
618
651
  .,.,
619
652
 
620
- module_eval(<<'.,.,', 'parser.y', 197)
621
- def _reduce_51(val, _values, result)
622
- result = { date: val[0][1], time: val[1][1] }
653
+ module_eval(<<'.,.,', 'parser.y', 218)
654
+ def _reduce_50(val, _values, result)
655
+ puts " REDUCE => more_match_fixtures : more_match_fixtures ',' match_fixture "
656
+ result.push( val[2] )
657
+
623
658
  result
624
659
  end
625
660
  .,.,
626
661
 
627
- module_eval(<<'.,.,', 'parser.y', 198)
628
- def _reduce_52(val, _values, result)
629
- result = { time: val[0][1]}
662
+ module_eval(<<'.,.,', 'parser.y', 224)
663
+ def _reduce_51(val, _values, result)
664
+ result = { ord: val[0][1][:value] }
630
665
  result
631
666
  end
632
667
  .,.,
633
668
 
634
- module_eval(<<'.,.,', 'parser.y', 204)
635
- def _reduce_53(val, _values, result)
636
- ## todo - add possible status_notes too!!!
637
- result = { status: val[0][1][:status] }
638
-
669
+ module_eval(<<'.,.,', 'parser.y', 225)
670
+ def _reduce_52(val, _values, result)
671
+ result = { ord: val[0][1][:value] }.merge( val[1] )
639
672
  result
640
673
  end
641
674
  .,.,
642
675
 
643
- module_eval(<<'.,.,', 'parser.y', 209)
644
- def _reduce_54(val, _values, result)
645
- result = { status: val[0][1][:status],
646
- geo: val[1] }
676
+ # reduce 53 omitted
647
677
 
678
+ module_eval(<<'.,.,', 'parser.y', 229)
679
+ def _reduce_54(val, _values, result)
680
+ result = { date: val[0][1]}
648
681
  result
649
682
  end
650
683
  .,.,
651
684
 
652
- module_eval(<<'.,.,', 'parser.y', 212)
685
+ module_eval(<<'.,.,', 'parser.y', 230)
653
686
  def _reduce_55(val, _values, result)
654
- result = { geo: val[0] }
687
+ result = { date: val[0][1], time: val[1][1] }
655
688
  result
656
689
  end
657
690
  .,.,
658
691
 
659
- module_eval(<<'.,.,', 'parser.y', 213)
692
+ module_eval(<<'.,.,', 'parser.y', 231)
660
693
  def _reduce_56(val, _values, result)
661
- result = {}
694
+ result = { time: val[0][1]}
662
695
  result
663
696
  end
664
697
  .,.,
665
698
 
666
- module_eval(<<'.,.,', 'parser.y', 218)
699
+ module_eval(<<'.,.,', 'parser.y', 237)
667
700
  def _reduce_57(val, _values, result)
668
- result = val[1]
701
+ ## todo - add possible status_notes too!!!
702
+ result = { status: val[0][1][:status] }
703
+
669
704
  result
670
705
  end
671
706
  .,.,
672
707
 
673
- module_eval(<<'.,.,', 'parser.y', 221)
708
+ module_eval(<<'.,.,', 'parser.y', 242)
674
709
  def _reduce_58(val, _values, result)
675
- result = val
710
+ result = { status: val[0][1][:status] }.merge( val[1] )
711
+
676
712
  result
677
713
  end
678
714
  .,.,
679
715
 
680
- module_eval(<<'.,.,', 'parser.y', 222)
716
+ module_eval(<<'.,.,', 'parser.y', 244)
681
717
  def _reduce_59(val, _values, result)
682
- result.push( val[2] )
718
+ result = {}.merge( val[0] )
683
719
  result
684
720
  end
685
721
  .,.,
686
722
 
687
- module_eval(<<'.,.,', 'parser.y', 227)
723
+ module_eval(<<'.,.,', 'parser.y', 245)
688
724
  def _reduce_60(val, _values, result)
689
- result = { team1: val[0],
690
- team2: val[2]
691
- }.merge( val[1] )
692
-
725
+ result = {}
693
726
  result
694
727
  end
695
728
  .,.,
696
729
 
697
- module_eval(<<'.,.,', 'parser.y', 233)
730
+ module_eval(<<'.,.,', 'parser.y', 251)
698
731
  def _reduce_61(val, _values, result)
699
- result = { team1: val[0], team2: val[2] }
700
-
732
+ result = { geo: val[1] }
701
733
  result
702
734
  end
703
735
  .,.,
704
736
 
705
- module_eval(<<'.,.,', 'parser.y', 237)
737
+ module_eval(<<'.,.,', 'parser.y', 252)
706
738
  def _reduce_62(val, _values, result)
707
- result = { team1: val[0],
708
- team2: val[2],
709
- score: val[3][1]
710
- }
711
-
739
+ result = { geo: val[1], timezone: val[2] }
712
740
  result
713
741
  end
714
742
  .,.,
715
743
 
716
- module_eval(<<'.,.,', 'parser.y', 243)
744
+ module_eval(<<'.,.,', 'parser.y', 255)
717
745
  def _reduce_63(val, _values, result)
718
- result = { score: val[0][1] }
746
+ result = val
719
747
  result
720
748
  end
721
749
  .,.,
722
750
 
723
- module_eval(<<'.,.,', 'parser.y', 244)
751
+ module_eval(<<'.,.,', 'parser.y', 256)
724
752
  def _reduce_64(val, _values, result)
725
- result = {}
753
+ result.push( val[2] )
754
+ result
755
+ end
756
+ .,.,
757
+
758
+ # reduce 65 omitted
759
+
760
+ # reduce 66 omitted
761
+
762
+ module_eval(<<'.,.,', 'parser.y', 264)
763
+ def _reduce_67(val, _values, result)
764
+ puts " match MATCH_FIXTURE"
765
+ result = { team1: val[0],
766
+ team2: val[2] }
767
+
768
+ result
769
+ end
770
+ .,.,
771
+
772
+ # reduce 68 omitted
773
+
774
+ # reduce 69 omitted
775
+
776
+ module_eval(<<'.,.,', 'parser.y', 275)
777
+ def _reduce_70(val, _values, result)
778
+ puts " match TEXT SCORE TEXT"
779
+ result = { team1: val[0],
780
+ team2: val[2],
781
+ score: val[1][1]
782
+ }
783
+
726
784
  result
727
785
  end
728
786
  .,.,
729
787
 
730
- module_eval(<<'.,.,', 'parser.y', 261)
731
- def _reduce_65(val, _values, result)
788
+ module_eval(<<'.,.,', 'parser.y', 289)
789
+ def _reduce_71(val, _values, result)
790
+ puts " match TEXT match_sep TEXT SCORE"
791
+ result = { team1: val[0],
792
+ team2: val[2],
793
+ score: val[3][1]
794
+ }
795
+
796
+ result
797
+ end
798
+ .,.,
799
+
800
+ module_eval(<<'.,.,', 'parser.y', 311)
801
+ def _reduce_72(val, _values, result)
732
802
  kwargs = val[1]
733
803
  @tree << GoalLine.new( **kwargs )
734
804
 
@@ -736,8 +806,8 @@ module_eval(<<'.,.,', 'parser.y', 261)
736
806
  end
737
807
  .,.,
738
808
 
739
- module_eval(<<'.,.,', 'parser.y', 266)
740
- def _reduce_66(val, _values, result)
809
+ module_eval(<<'.,.,', 'parser.y', 316)
810
+ def _reduce_73(val, _values, result)
741
811
  kwargs = val[0]
742
812
  @tree << GoalLine.new( **kwargs )
743
813
 
@@ -745,8 +815,8 @@ module_eval(<<'.,.,', 'parser.y', 266)
745
815
  end
746
816
  .,.,
747
817
 
748
- module_eval(<<'.,.,', 'parser.y', 271)
749
- def _reduce_67(val, _values, result)
818
+ module_eval(<<'.,.,', 'parser.y', 321)
819
+ def _reduce_74(val, _values, result)
750
820
  result = { goals1: val[0],
751
821
  goals2: [] }
752
822
 
@@ -754,8 +824,8 @@ module_eval(<<'.,.,', 'parser.y', 271)
754
824
  end
755
825
  .,.,
756
826
 
757
- module_eval(<<'.,.,', 'parser.y', 274)
758
- def _reduce_68(val, _values, result)
827
+ module_eval(<<'.,.,', 'parser.y', 324)
828
+ def _reduce_75(val, _values, result)
759
829
  result = { goals1: [],
760
830
  goals2: val[2] }
761
831
 
@@ -763,8 +833,8 @@ module_eval(<<'.,.,', 'parser.y', 274)
763
833
  end
764
834
  .,.,
765
835
 
766
- module_eval(<<'.,.,', 'parser.y', 277)
767
- def _reduce_69(val, _values, result)
836
+ module_eval(<<'.,.,', 'parser.y', 327)
837
+ def _reduce_76(val, _values, result)
768
838
  result = { goals1: val[0],
769
839
  goals2: val[2] }
770
840
 
@@ -772,26 +842,26 @@ module_eval(<<'.,.,', 'parser.y', 277)
772
842
  end
773
843
  .,.,
774
844
 
775
- # reduce 70 omitted
845
+ # reduce 77 omitted
776
846
 
777
- # reduce 71 omitted
847
+ # reduce 78 omitted
778
848
 
779
- module_eval(<<'.,.,', 'parser.y', 291)
780
- def _reduce_72(val, _values, result)
849
+ module_eval(<<'.,.,', 'parser.y', 341)
850
+ def _reduce_79(val, _values, result)
781
851
  result = val
782
852
  result
783
853
  end
784
854
  .,.,
785
855
 
786
- module_eval(<<'.,.,', 'parser.y', 292)
787
- def _reduce_73(val, _values, result)
856
+ module_eval(<<'.,.,', 'parser.y', 342)
857
+ def _reduce_80(val, _values, result)
788
858
  result.push( val[1])
789
859
  result
790
860
  end
791
861
  .,.,
792
862
 
793
- module_eval(<<'.,.,', 'parser.y', 297)
794
- def _reduce_74(val, _values, result)
863
+ module_eval(<<'.,.,', 'parser.y', 347)
864
+ def _reduce_81(val, _values, result)
795
865
  result = Goal.new( player: val[0],
796
866
  minutes: val[1] )
797
867
 
@@ -799,29 +869,29 @@ module_eval(<<'.,.,', 'parser.y', 297)
799
869
  end
800
870
  .,.,
801
871
 
802
- module_eval(<<'.,.,', 'parser.y', 304)
803
- def _reduce_75(val, _values, result)
872
+ module_eval(<<'.,.,', 'parser.y', 354)
873
+ def _reduce_82(val, _values, result)
804
874
  result = val
805
875
  result
806
876
  end
807
877
  .,.,
808
878
 
809
- module_eval(<<'.,.,', 'parser.y', 305)
810
- def _reduce_76(val, _values, result)
879
+ module_eval(<<'.,.,', 'parser.y', 355)
880
+ def _reduce_83(val, _values, result)
811
881
  result.push( val[1])
812
882
  result
813
883
  end
814
884
  .,.,
815
885
 
816
- module_eval(<<'.,.,', 'parser.y', 306)
817
- def _reduce_77(val, _values, result)
886
+ module_eval(<<'.,.,', 'parser.y', 356)
887
+ def _reduce_84(val, _values, result)
818
888
  result.push( val[2])
819
889
  result
820
890
  end
821
891
  .,.,
822
892
 
823
- module_eval(<<'.,.,', 'parser.y', 312)
824
- def _reduce_78(val, _values, result)
893
+ module_eval(<<'.,.,', 'parser.y', 362)
894
+ def _reduce_85(val, _values, result)
825
895
  kwargs = {}.merge( val[0][1] )
826
896
  result = Minute.new( **kwargs )
827
897
 
@@ -829,8 +899,8 @@ module_eval(<<'.,.,', 'parser.y', 312)
829
899
  end
830
900
  .,.,
831
901
 
832
- module_eval(<<'.,.,', 'parser.y', 317)
833
- def _reduce_79(val, _values, result)
902
+ module_eval(<<'.,.,', 'parser.y', 367)
903
+ def _reduce_86(val, _values, result)
834
904
  kwargs = { }.merge( val[0][1] ).merge( val[1] )
835
905
  result = Minute.new( **kwargs )
836
906
 
@@ -838,22 +908,22 @@ module_eval(<<'.,.,', 'parser.y', 317)
838
908
  end
839
909
  .,.,
840
910
 
841
- module_eval(<<'.,.,', 'parser.y', 321)
842
- def _reduce_80(val, _values, result)
911
+ module_eval(<<'.,.,', 'parser.y', 371)
912
+ def _reduce_87(val, _values, result)
843
913
  result = { og: true }
844
914
  result
845
915
  end
846
916
  .,.,
847
917
 
848
- module_eval(<<'.,.,', 'parser.y', 322)
849
- def _reduce_81(val, _values, result)
918
+ module_eval(<<'.,.,', 'parser.y', 372)
919
+ def _reduce_88(val, _values, result)
850
920
  result = { pen: true }
851
921
  result
852
922
  end
853
923
  .,.,
854
924
 
855
- module_eval(<<'.,.,', 'parser.y', 327)
856
- def _reduce_82(val, _values, result)
925
+ module_eval(<<'.,.,', 'parser.y', 377)
926
+ def _reduce_89(val, _values, result)
857
927
  puts ' MATCH empty_line'
858
928
  result
859
929
  end
@@ -4,7 +4,7 @@ module SportDb
4
4
  module Parser
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
6
  MINOR = 5
7
- PATCH = 2
7
+ PATCH = 3
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -17,6 +17,9 @@ require 'season/formats' # e.g. Season() support machinery
17
17
 
18
18
 
19
19
  require_relative 'parser/version'
20
+
21
+ require_relative 'parser/lang'
22
+
20
23
  require_relative 'parser/token-score'
21
24
  require_relative 'parser/token-date'
22
25
  require_relative 'parser/token-text'
@@ -24,7 +27,6 @@ require_relative 'parser/token-status'
24
27
  require_relative 'parser/token'
25
28
  require_relative 'parser/tokenizer'
26
29
 
27
- require_relative 'parser/lang'
28
30
  require_relative 'parser/parser'
29
31
 
30
32
 
@@ -51,6 +53,19 @@ end # module SportDb
51
53
 
52
54
 
53
55
  module SportDb
56
+
57
+
58
+
59
+ class Parser
60
+ ## keep "old" access to checking for group, round & friends
61
+ ## for now for compatibility
62
+ def is_group?( text ) Lang.is_group?( text ); end
63
+ def is_round?( text ) Lang.is_round?( text ); end
64
+ def is_leg?( text ) Lang.is_leg?( text ); end
65
+ end
66
+
67
+
68
+
54
69
  class Tokenizer
55
70
 
56
71
  attr_reader :tokens
@@ -236,7 +251,8 @@ end
236
251
  MatchLine = Struct.new( :ord, :date, :time,
237
252
  :team1, :team2, :score,
238
253
  :status,
239
- :geo ) do ## change to geos - why? why not?
254
+ :geo,
255
+ :timezone ) do ## change to geos - why? why not?
240
256
 
241
257
  def pretty_print( printer )
242
258
  printer.text( "<MatchLine " )
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sportdb-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-17 00:00:00.000000000 Z
11
+ date: 2025-01-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocos