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 +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/sportdb/parser/lang.rb +11 -7
- data/lib/sportdb/parser/outline_reader.rb +58 -0
- data/lib/sportdb/parser/parser.rb +327 -257
- data/lib/sportdb/parser/version.rb +1 -1
- data/lib/sportdb/parser.rb +18 -2
- 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: a4ad809654d751437839e7f7bbda6502fb2c4b517c279988c7a3756059eaa9d8
|
4
|
+
data.tar.gz: 6dbacfa44774d32bfaccdb209a195f2f6c6c9ded43280023ffafbe1a3288d310
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52b60ab7ef460d46007bd135fc0a00d09514b72335941c2d46f06793abc6631f7e2dce2fafefbf83360c672a05d212cf88f56ed3a6b78e803d5e5d76c0dcb38b
|
7
|
+
data.tar.gz: 4e861cefafce9bca2fe9135ae7fdf35a2cdd0d2080fa3f4f2fb900fa0f075752da8647dcb2c6c9e16e99210c4198a63e7202ae3e32cd1b0f049126aac7f3d412
|
data/CHANGELOG.md
CHANGED
data/lib/sportdb/parser/lang.rb
CHANGED
@@ -4,7 +4,12 @@
|
|
4
4
|
|
5
5
|
|
6
6
|
module SportDb
|
7
|
-
|
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 #
|
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
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
0,
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
39
|
-
nil, nil,
|
40
|
-
|
41
|
-
nil,
|
42
|
-
|
43
|
-
|
44
|
-
nil,
|
45
|
-
nil,
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
nil, nil, nil, nil, nil,
|
50
|
-
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
|
-
-
|
54
|
-
-10, -11, -
|
55
|
-
-
|
56
|
-
-2, -
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
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
|
-
|
69
|
-
|
70
|
-
|
71
|
-
nil,
|
72
|
-
|
73
|
-
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,
|
76
|
-
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,
|
81
|
-
12, 14, 15, 16, 19, 20, 21, 22,
|
82
|
-
|
83
|
-
nil,
|
84
|
-
|
85
|
-
nil, nil,
|
86
|
-
nil, nil,
|
87
|
-
nil, nil, nil, 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,
|
98
|
+
nil, nil, nil, nil, 13, nil, nil, nil, nil, nil,
|
99
|
+
nil, nil, 28 ]
|
90
100
|
|
91
101
|
racc_goto_pointer = [
|
92
|
-
nil,
|
93
|
-
nil, nil,
|
94
|
-
-
|
95
|
-
-
|
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,
|
100
|
-
nil, nil, nil, 17, nil, 18, 19, nil,
|
101
|
-
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
|
-
|
114
|
-
1,
|
115
|
-
1,
|
116
|
-
|
117
|
-
1,
|
118
|
-
|
119
|
-
|
120
|
-
1,
|
121
|
-
|
122
|
-
1,
|
123
|
-
|
124
|
-
1, 43, :
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
1,
|
132
|
-
2,
|
133
|
-
1,
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
1,
|
141
|
-
|
142
|
-
4,
|
143
|
-
|
144
|
-
2,
|
145
|
-
|
146
|
-
|
147
|
-
1,
|
148
|
-
|
149
|
-
|
150
|
-
2,
|
151
|
-
|
152
|
-
|
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
|
-
|
155
|
-
2,
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
1,
|
161
|
-
2,
|
162
|
-
1,
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
2,
|
171
|
-
|
172
|
-
|
173
|
-
3,
|
174
|
-
1,
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
1,
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
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
|
-
:
|
218
|
-
:
|
219
|
-
|
220
|
-
|
221
|
-
:
|
222
|
-
:
|
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 =
|
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
|
-
"
|
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
|
-
|
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',
|
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',
|
616
|
+
module_eval(<<'.,.,', 'parser.y', 189)
|
598
617
|
def _reduce_47(val, _values, result)
|
599
|
-
|
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',
|
630
|
+
module_eval(<<'.,.,', 'parser.y', 199)
|
605
631
|
def _reduce_48(val, _values, result)
|
606
|
-
|
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
|
-
|
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',
|
621
|
-
def
|
622
|
-
|
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',
|
628
|
-
def
|
629
|
-
result = {
|
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',
|
635
|
-
def
|
636
|
-
|
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
|
-
|
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',
|
685
|
+
module_eval(<<'.,.,', 'parser.y', 230)
|
653
686
|
def _reduce_55(val, _values, result)
|
654
|
-
|
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',
|
692
|
+
module_eval(<<'.,.,', 'parser.y', 231)
|
660
693
|
def _reduce_56(val, _values, result)
|
661
|
-
|
694
|
+
result = { time: val[0][1]}
|
662
695
|
result
|
663
696
|
end
|
664
697
|
.,.,
|
665
698
|
|
666
|
-
module_eval(<<'.,.,', 'parser.y',
|
699
|
+
module_eval(<<'.,.,', 'parser.y', 237)
|
667
700
|
def _reduce_57(val, _values, result)
|
668
|
-
|
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',
|
708
|
+
module_eval(<<'.,.,', 'parser.y', 242)
|
674
709
|
def _reduce_58(val, _values, result)
|
675
|
-
|
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',
|
716
|
+
module_eval(<<'.,.,', 'parser.y', 244)
|
681
717
|
def _reduce_59(val, _values, result)
|
682
|
-
|
718
|
+
result = {}.merge( val[0] )
|
683
719
|
result
|
684
720
|
end
|
685
721
|
.,.,
|
686
722
|
|
687
|
-
module_eval(<<'.,.,', 'parser.y',
|
723
|
+
module_eval(<<'.,.,', 'parser.y', 245)
|
688
724
|
def _reduce_60(val, _values, result)
|
689
|
-
|
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',
|
730
|
+
module_eval(<<'.,.,', 'parser.y', 251)
|
698
731
|
def _reduce_61(val, _values, result)
|
699
|
-
|
700
|
-
|
732
|
+
result = { geo: val[1] }
|
701
733
|
result
|
702
734
|
end
|
703
735
|
.,.,
|
704
736
|
|
705
|
-
module_eval(<<'.,.,', 'parser.y',
|
737
|
+
module_eval(<<'.,.,', 'parser.y', 252)
|
706
738
|
def _reduce_62(val, _values, result)
|
707
|
-
|
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',
|
744
|
+
module_eval(<<'.,.,', 'parser.y', 255)
|
717
745
|
def _reduce_63(val, _values, result)
|
718
|
-
result =
|
746
|
+
result = val
|
719
747
|
result
|
720
748
|
end
|
721
749
|
.,.,
|
722
750
|
|
723
|
-
module_eval(<<'.,.,', 'parser.y',
|
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',
|
731
|
-
def
|
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',
|
740
|
-
def
|
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',
|
749
|
-
def
|
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',
|
758
|
-
def
|
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',
|
767
|
-
def
|
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
|
845
|
+
# reduce 77 omitted
|
776
846
|
|
777
|
-
# reduce
|
847
|
+
# reduce 78 omitted
|
778
848
|
|
779
|
-
module_eval(<<'.,.,', 'parser.y',
|
780
|
-
def
|
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',
|
787
|
-
def
|
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',
|
794
|
-
def
|
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',
|
803
|
-
def
|
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',
|
810
|
-
def
|
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',
|
817
|
-
def
|
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',
|
824
|
-
def
|
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',
|
833
|
-
def
|
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',
|
842
|
-
def
|
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',
|
849
|
-
def
|
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',
|
856
|
-
def
|
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
|
data/lib/sportdb/parser.rb
CHANGED
@@ -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
|
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.
|
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-
|
11
|
+
date: 2025-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocos
|