sportdb-parser 0.5.2 → 0.5.4
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.
- 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 +322 -259
- data/lib/sportdb/parser/token-score.rb +5 -5
- 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: 810f7cacd444fa67848438b267081211851a2ab8ff8e2da633bdf9c885bf102b
|
4
|
+
data.tar.gz: f15d3dc28d68c4d12737ace20fbc0f1110f1b0b864a96cf33950c6cb6b946a87
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ccc2618cfb5400f869a18cb6fcbb5f1f7323515e439983c5ac65fe3c9fbd6a9bb53b501e3196cca01f00db921e1f08153854167d78fa0509da4cd2e99d7445a
|
7
|
+
data.tar.gz: 92395315b0e90b501584b48dfbd1dea206c35e8cf91dae3d2a2357e6d18f8948e5fd5ee3b855c77dd5c201205e0592451cb149487b17315bc58733aa304e8897
|
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,200 @@ 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
|
+
102, 94, 60, 119, 28, 35, 37, 129, 43, 57,
|
13
|
+
38, 39, 22, 60, 43, 120, 41, 36, 49, 68,
|
14
|
+
55, 61, 62, 65, 65, 31, 128, 12, 40, 30,
|
15
|
+
58, 28, 61, 62, 66, 16, 12, 70, 30, 13,
|
16
|
+
28, 25, 14, 15, 16, 20, 22, 80, 13, 81,
|
17
|
+
25, 14, 15, 71, 20, 22, 54, 51, 54, 91,
|
18
|
+
72, 74, 75, 76, 44, 47, 46, 85, 86, 104,
|
19
|
+
105, 117, 118, 83, 52, 55, 52, 55, 125, 126,
|
20
|
+
134, 126, 87, 88, 65, 89, 49, 96, 98, 40,
|
21
|
+
99, 100, 43, 107, 43, 109, 35, 111, 112, 80,
|
22
|
+
65, 121, 122, 123, 49, 127, 65, 43, 43, 35,
|
23
|
+
132, 65, 49, 136, 137 ]
|
23
24
|
|
24
25
|
racc_action_check = [
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
0,
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
63, 52, 25, 82, 16, 12, 13, 97, 27, 20,
|
27
|
+
14, 15, 20, 49, 16, 82, 16, 13, 18, 27,
|
28
|
+
52, 25, 25, 63, 25, 1, 97, 1, 15, 1,
|
29
|
+
24, 1, 49, 49, 26, 1, 0, 28, 0, 1,
|
30
|
+
0, 1, 1, 1, 0, 1, 1, 35, 0, 35,
|
31
|
+
0, 0, 0, 31, 0, 0, 19, 19, 48, 48,
|
32
|
+
33, 33, 33, 33, 17, 17, 17, 38, 38, 65,
|
33
|
+
65, 81, 81, 36, 19, 19, 48, 48, 92, 92,
|
34
|
+
124, 124, 41, 42, 43, 45, 51, 53, 55, 57,
|
35
|
+
59, 62, 67, 68, 70, 72, 73, 75, 76, 78,
|
36
|
+
80, 84, 87, 88, 91, 95, 102, 106, 108, 114,
|
37
|
+
115, 116, 126, 129, 131 ]
|
36
38
|
|
37
39
|
racc_action_pointer = [
|
38
|
-
|
39
|
-
nil, nil,
|
40
|
-
|
41
|
-
nil, 53, nil,
|
42
|
-
|
43
|
-
|
44
|
-
nil,
|
45
|
-
nil,
|
46
|
-
|
47
|
-
|
48
|
-
nil,
|
49
|
-
nil, nil, nil, nil,
|
50
|
-
nil,
|
40
|
+
34, 25, nil, nil, nil, nil, nil, nil, nil, nil,
|
41
|
+
nil, nil, -2, 2, -5, 7, -2, 60, 2, 52,
|
42
|
+
-9, nil, nil, nil, 4, -4, 30, -8, 10, nil,
|
43
|
+
nil, 53, nil, 57, nil, 39, 57, nil, 49, nil,
|
44
|
+
nil, 71, 72, 56, nil, 68, nil, nil, 54, 7,
|
45
|
+
nil, 70, -3, 83, nil, 72, nil, 68, nil, 74,
|
46
|
+
nil, nil, 75, -5, nil, 40, nil, 76, 89, nil,
|
47
|
+
78, nil, 91, 89, nil, 93, 94, nil, 91, nil,
|
48
|
+
72, 59, -1, nil, 97, nil, nil, 98, 99, nil,
|
49
|
+
nil, 88, 74, nil, nil, 101, nil, 2, nil, nil,
|
50
|
+
nil, nil, 78, nil, nil, nil, 91, nil, 92, nil,
|
51
|
+
nil, nil, nil, nil, 102, 99, 83, nil, nil, nil,
|
52
|
+
nil, nil, nil, nil, 76, nil, 96, nil, nil, 97,
|
53
|
+
nil, 105, nil, nil, nil, nil, nil, nil ]
|
51
54
|
|
52
55
|
racc_action_default = [
|
53
|
-
-
|
54
|
-
-10, -11, -
|
55
|
-
-
|
56
|
-
-2, -
|
57
|
-
-
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
61
|
-
-
|
62
|
-
-
|
63
|
-
-
|
64
|
-
-
|
65
|
-
-
|
56
|
+
-90, -90, -1, -3, -4, -5, -6, -7, -8, -9,
|
57
|
+
-10, -11, -90, -90, -41, -54, -90, -90, -90, -90,
|
58
|
+
-51, -53, -56, -65, -66, -90, -90, -74, -90, -79,
|
59
|
+
-89, -90, -2, -90, -13, -20, -90, -39, -90, -37,
|
60
|
+
-55, -90, -90, -90, -40, -90, -43, -44, -90, -90,
|
61
|
+
-46, -90, -90, -90, -60, -90, -52, -54, -71, -90,
|
62
|
+
-68, -69, -90, -81, -82, -85, -73, -90, -77, -80,
|
63
|
+
-90, 138, -90, -90, -15, -16, -18, -21, -22, -24,
|
64
|
+
-90, -90, -90, -32, -90, -35, -36, -90, -90, -42,
|
65
|
+
-45, -90, -90, -49, -57, -90, -59, -61, -63, -67,
|
66
|
+
-70, -83, -90, -86, -87, -88, -76, -78, -75, -12,
|
67
|
+
-14, -17, -19, -23, -90, -90, -27, -29, -30, -31,
|
68
|
+
-33, -34, -38, -72, -90, -48, -90, -58, -62, -90,
|
69
|
+
-84, -90, -26, -28, -47, -50, -64, -25 ]
|
66
70
|
|
67
71
|
racc_goto_table = [
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
nil,
|
72
|
-
nil, nil,
|
73
|
-
nil, nil,
|
72
|
+
48, 34, 69, 101, 79, 92, 50, 106, 2, 32,
|
73
|
+
108, 1, 33, 73, 77, 78, 115, 116, 82, 84,
|
74
|
+
114, 45, 56, 95, 97, 42, 67, 103, nil, nil,
|
75
|
+
nil, nil, nil, 93, nil, 90, nil, nil, nil, nil,
|
76
|
+
nil, nil, 130, nil, nil, 124, nil, 113, nil, nil,
|
77
|
+
nil, nil, nil, nil, nil, nil, 133, nil, nil, nil,
|
78
|
+
nil, nil, 110, nil, nil, nil, nil, nil, nil, nil,
|
79
|
+
nil, nil, nil, 93, nil, nil, nil, nil, nil, nil,
|
80
|
+
nil, 69, nil, 69, nil, nil, nil, nil, nil, nil,
|
74
81
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
75
|
-
nil, nil, nil,
|
76
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
77
|
-
nil, nil, nil, nil, nil, 121 ]
|
82
|
+
nil, nil, nil, 131, nil, nil, nil, nil, 135 ]
|
78
83
|
|
79
84
|
racc_goto_check = [
|
80
|
-
13,
|
81
|
-
12, 14, 15, 16, 19, 20, 21, 22,
|
82
|
-
|
83
|
-
nil,
|
84
|
-
nil, nil, nil, nil,
|
85
|
-
nil, nil,
|
86
|
-
nil, nil,
|
87
|
-
nil, nil, nil, nil, nil,
|
85
|
+
26, 13, 38, 18, 17, 28, 27, 36, 2, 2,
|
86
|
+
36, 1, 12, 14, 15, 16, 19, 20, 21, 22,
|
87
|
+
18, 24, 29, 30, 31, 35, 37, 40, nil, nil,
|
88
|
+
nil, nil, nil, 26, nil, 27, nil, nil, nil, nil,
|
89
|
+
nil, nil, 18, nil, nil, 28, nil, 17, nil, nil,
|
90
|
+
nil, nil, nil, nil, nil, nil, 18, nil, nil, nil,
|
91
|
+
nil, nil, 13, nil, nil, nil, nil, nil, nil, nil,
|
92
|
+
nil, nil, nil, 26, nil, nil, nil, nil, nil, nil,
|
93
|
+
nil, 38, nil, 38, nil, nil, nil, nil, nil, nil,
|
88
94
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
89
|
-
nil, nil, nil, nil, nil,
|
95
|
+
nil, nil, nil, 13, nil, nil, nil, nil, 26 ]
|
90
96
|
|
91
97
|
racc_goto_pointer = [
|
92
|
-
nil,
|
93
|
-
nil, nil,
|
94
|
-
-
|
95
|
-
-29, nil,
|
98
|
+
nil, 11, 8, nil, nil, nil, nil, nil, nil, nil,
|
99
|
+
nil, nil, 0, -11, -20, -21, -20, -31, -60, -65,
|
100
|
+
-64, -18, -19, nil, 4, nil, -18, -13, -46, 2,
|
101
|
+
-29, -31, nil, nil, nil, 9, -60, -1, -25, nil,
|
102
|
+
-38 ]
|
96
103
|
|
97
104
|
racc_goto_default = [
|
98
105
|
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, 21,
|
101
|
-
nil,
|
106
|
+
10, 11, nil, nil, nil, nil, nil, nil, 64, nil,
|
107
|
+
nil, nil, nil, 17, nil, 18, 19, nil, nil, 21,
|
108
|
+
53, nil, 23, 24, 59, 26, 27, nil, 29, 63,
|
109
|
+
nil ]
|
102
110
|
|
103
111
|
racc_reduce_table = [
|
104
112
|
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
113
|
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
|
-
|
114
|
+
2, 32, :_reduce_none,
|
115
|
+
1, 33, :_reduce_none,
|
116
|
+
1, 33, :_reduce_none,
|
117
|
+
1, 33, :_reduce_none,
|
118
|
+
1, 33, :_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
|
+
4, 42, :_reduce_12,
|
125
|
+
1, 43, :_reduce_13,
|
126
|
+
3, 43, :_reduce_14,
|
127
|
+
2, 43, :_reduce_15,
|
128
|
+
1, 45, :_reduce_none,
|
129
|
+
2, 45, :_reduce_17,
|
130
|
+
1, 45, :_reduce_none,
|
131
|
+
2, 45, :_reduce_19,
|
132
|
+
1, 44, :_reduce_20,
|
133
|
+
2, 44, :_reduce_21,
|
134
|
+
1, 46, :_reduce_22,
|
135
|
+
2, 46, :_reduce_23,
|
136
|
+
1, 46, :_reduce_24,
|
137
|
+
4, 48, :_reduce_25,
|
138
|
+
3, 47, :_reduce_26,
|
139
|
+
1, 50, :_reduce_27,
|
140
|
+
2, 50, :_reduce_28,
|
141
|
+
1, 51, :_reduce_none,
|
142
|
+
1, 51, :_reduce_none,
|
143
|
+
4, 37, :_reduce_31,
|
144
|
+
1, 52, :_reduce_32,
|
145
|
+
2, 52, :_reduce_33,
|
146
|
+
4, 38, :_reduce_34,
|
147
|
+
1, 53, :_reduce_35,
|
148
|
+
1, 53, :_reduce_36,
|
149
|
+
2, 34, :_reduce_37,
|
150
|
+
4, 34, :_reduce_38,
|
151
|
+
2, 35, :_reduce_39,
|
152
|
+
2, 36, :_reduce_40,
|
153
|
+
1, 54, :_reduce_41,
|
154
|
+
3, 54, :_reduce_42,
|
153
155
|
1, 55, :_reduce_none,
|
154
|
-
1,
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
3,
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
1,
|
177
|
-
|
178
|
-
|
179
|
-
1,
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
2,
|
184
|
-
1,
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
156
|
+
1, 55, :_reduce_none,
|
157
|
+
3, 39, :_reduce_45,
|
158
|
+
2, 39, :_reduce_46,
|
159
|
+
5, 39, :_reduce_47,
|
160
|
+
4, 39, :_reduce_48,
|
161
|
+
1, 59, :_reduce_49,
|
162
|
+
3, 59, :_reduce_50,
|
163
|
+
1, 56, :_reduce_51,
|
164
|
+
2, 56, :_reduce_52,
|
165
|
+
1, 56, :_reduce_none,
|
166
|
+
1, 60, :_reduce_54,
|
167
|
+
2, 60, :_reduce_55,
|
168
|
+
1, 60, :_reduce_56,
|
169
|
+
2, 58, :_reduce_57,
|
170
|
+
3, 58, :_reduce_58,
|
171
|
+
2, 58, :_reduce_59,
|
172
|
+
1, 58, :_reduce_60,
|
173
|
+
2, 61, :_reduce_61,
|
174
|
+
3, 61, :_reduce_62,
|
175
|
+
1, 62, :_reduce_63,
|
176
|
+
3, 62, :_reduce_64,
|
177
|
+
1, 57, :_reduce_none,
|
178
|
+
1, 57, :_reduce_none,
|
179
|
+
3, 64, :_reduce_67,
|
180
|
+
1, 65, :_reduce_none,
|
181
|
+
1, 65, :_reduce_none,
|
182
|
+
3, 63, :_reduce_70,
|
183
|
+
2, 63, :_reduce_71,
|
184
|
+
4, 40, :_reduce_72,
|
185
|
+
2, 40, :_reduce_73,
|
186
|
+
1, 66, :_reduce_74,
|
187
|
+
3, 66, :_reduce_75,
|
188
|
+
3, 66, :_reduce_76,
|
189
|
+
1, 68, :_reduce_none,
|
190
|
+
2, 68, :_reduce_none,
|
191
|
+
1, 67, :_reduce_79,
|
192
|
+
2, 67, :_reduce_80,
|
193
|
+
2, 69, :_reduce_81,
|
194
|
+
1, 70, :_reduce_82,
|
195
|
+
2, 70, :_reduce_83,
|
196
|
+
3, 70, :_reduce_84,
|
197
|
+
1, 49, :_reduce_85,
|
198
|
+
2, 49, :_reduce_86,
|
199
|
+
1, 71, :_reduce_87,
|
200
|
+
1, 71, :_reduce_88,
|
201
|
+
1, 41, :_reduce_89 ]
|
202
|
+
|
203
|
+
racc_reduce_n = 90
|
204
|
+
|
205
|
+
racc_shift_n = 138
|
191
206
|
|
192
207
|
racc_token_table = {
|
193
208
|
false => 0,
|
@@ -214,14 +229,15 @@ racc_token_table = {
|
|
214
229
|
:TIME => 21,
|
215
230
|
:STATUS => 22,
|
216
231
|
"@" => 23,
|
217
|
-
:
|
218
|
-
:
|
219
|
-
|
220
|
-
|
221
|
-
:
|
222
|
-
:
|
232
|
+
:TIMEZONE => 24,
|
233
|
+
:VS => 25,
|
234
|
+
:SCORE => 26,
|
235
|
+
";" => 27,
|
236
|
+
:MINUTE => 28,
|
237
|
+
:OG => 29,
|
238
|
+
:PEN => 30 }
|
223
239
|
|
224
|
-
racc_nt_base =
|
240
|
+
racc_nt_base = 31
|
225
241
|
|
226
242
|
racc_use_result_var = true
|
227
243
|
|
@@ -267,6 +283,7 @@ Racc_token_to_s_table = [
|
|
267
283
|
"TIME",
|
268
284
|
"STATUS",
|
269
285
|
"\"@\"",
|
286
|
+
"TIMEZONE",
|
270
287
|
"VS",
|
271
288
|
"SCORE",
|
272
289
|
"\";\"",
|
@@ -301,10 +318,13 @@ Racc_token_to_s_table = [
|
|
301
318
|
"match_opts",
|
302
319
|
"match",
|
303
320
|
"more_match_opts",
|
321
|
+
"more_matches",
|
304
322
|
"date_opts",
|
305
323
|
"geo_opts",
|
306
324
|
"geo_values",
|
307
|
-
"
|
325
|
+
"match_result",
|
326
|
+
"match_fixture",
|
327
|
+
"match_sep",
|
308
328
|
"goal_lines_body",
|
309
329
|
"goals",
|
310
330
|
"goal_sep",
|
@@ -573,19 +593,14 @@ module_eval(<<'.,.,', 'parser.y', 165)
|
|
573
593
|
|
574
594
|
module_eval(<<'.,.,', 'parser.y', 176)
|
575
595
|
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] )
|
596
|
+
kwargs = {}.merge( val[0], val[1], val[2] )
|
582
597
|
@tree << MatchLine.new( **kwargs )
|
583
598
|
|
584
599
|
result
|
585
600
|
end
|
586
601
|
.,.,
|
587
602
|
|
588
|
-
module_eval(<<'.,.,', 'parser.y',
|
603
|
+
module_eval(<<'.,.,', 'parser.y', 181)
|
589
604
|
def _reduce_46(val, _values, result)
|
590
605
|
kwargs = {}.merge( val[0], val[1] )
|
591
606
|
@tree << MatchLine.new( **kwargs )
|
@@ -594,141 +609,189 @@ module_eval(<<'.,.,', 'parser.y', 186)
|
|
594
609
|
end
|
595
610
|
.,.,
|
596
611
|
|
597
|
-
module_eval(<<'.,.,', 'parser.y',
|
612
|
+
module_eval(<<'.,.,', 'parser.y', 189)
|
598
613
|
def _reduce_47(val, _values, result)
|
599
|
-
|
614
|
+
kwargs = {}.merge( val[0], val[1] )
|
615
|
+
@tree << MatchLine.new( **kwargs )
|
616
|
+
|
617
|
+
## add more match fixtures
|
618
|
+
val[3].each do |kwargs|
|
619
|
+
@tree << MatchLine.new( **kwargs)
|
620
|
+
end
|
621
|
+
|
600
622
|
result
|
601
623
|
end
|
602
624
|
.,.,
|
603
625
|
|
604
|
-
module_eval(<<'.,.,', 'parser.y',
|
626
|
+
module_eval(<<'.,.,', 'parser.y', 199)
|
605
627
|
def _reduce_48(val, _values, result)
|
606
|
-
|
628
|
+
kwargs = val[0]
|
629
|
+
@tree << MatchLine.new( **kwargs )
|
630
|
+
|
631
|
+
## add more match fixtures
|
632
|
+
val[2].each do |kwargs|
|
633
|
+
@tree << MatchLine.new( **kwargs)
|
634
|
+
end
|
635
|
+
|
607
636
|
result
|
608
637
|
end
|
609
638
|
.,.,
|
610
639
|
|
611
|
-
|
640
|
+
module_eval(<<'.,.,', 'parser.y', 213)
|
641
|
+
def _reduce_49(val, _values, result)
|
642
|
+
puts " REDUCE => more_match_fixtures : match_fixture"
|
643
|
+
result = val
|
612
644
|
|
613
|
-
module_eval(<<'.,.,', 'parser.y', 196)
|
614
|
-
def _reduce_50(val, _values, result)
|
615
|
-
result = { date: val[0][1]}
|
616
645
|
result
|
617
646
|
end
|
618
647
|
.,.,
|
619
648
|
|
620
|
-
module_eval(<<'.,.,', 'parser.y',
|
621
|
-
def
|
622
|
-
|
649
|
+
module_eval(<<'.,.,', 'parser.y', 218)
|
650
|
+
def _reduce_50(val, _values, result)
|
651
|
+
puts " REDUCE => more_match_fixtures : more_match_fixtures ',' match_fixture "
|
652
|
+
result.push( val[2] )
|
653
|
+
|
623
654
|
result
|
624
655
|
end
|
625
656
|
.,.,
|
626
657
|
|
627
|
-
module_eval(<<'.,.,', 'parser.y',
|
628
|
-
def
|
629
|
-
result = {
|
658
|
+
module_eval(<<'.,.,', 'parser.y', 224)
|
659
|
+
def _reduce_51(val, _values, result)
|
660
|
+
result = { ord: val[0][1][:value] }
|
630
661
|
result
|
631
662
|
end
|
632
663
|
.,.,
|
633
664
|
|
634
|
-
module_eval(<<'.,.,', 'parser.y',
|
635
|
-
def
|
636
|
-
|
637
|
-
result = { status: val[0][1][:status] }
|
638
|
-
|
665
|
+
module_eval(<<'.,.,', 'parser.y', 225)
|
666
|
+
def _reduce_52(val, _values, result)
|
667
|
+
result = { ord: val[0][1][:value] }.merge( val[1] )
|
639
668
|
result
|
640
669
|
end
|
641
670
|
.,.,
|
642
671
|
|
643
|
-
|
644
|
-
def _reduce_54(val, _values, result)
|
645
|
-
result = { status: val[0][1][:status],
|
646
|
-
geo: val[1] }
|
672
|
+
# reduce 53 omitted
|
647
673
|
|
674
|
+
module_eval(<<'.,.,', 'parser.y', 229)
|
675
|
+
def _reduce_54(val, _values, result)
|
676
|
+
result = { date: val[0][1]}
|
648
677
|
result
|
649
678
|
end
|
650
679
|
.,.,
|
651
680
|
|
652
|
-
module_eval(<<'.,.,', 'parser.y',
|
681
|
+
module_eval(<<'.,.,', 'parser.y', 230)
|
653
682
|
def _reduce_55(val, _values, result)
|
654
|
-
|
683
|
+
result = { date: val[0][1], time: val[1][1] }
|
655
684
|
result
|
656
685
|
end
|
657
686
|
.,.,
|
658
687
|
|
659
|
-
module_eval(<<'.,.,', 'parser.y',
|
688
|
+
module_eval(<<'.,.,', 'parser.y', 231)
|
660
689
|
def _reduce_56(val, _values, result)
|
661
|
-
|
690
|
+
result = { time: val[0][1]}
|
662
691
|
result
|
663
692
|
end
|
664
693
|
.,.,
|
665
694
|
|
666
|
-
module_eval(<<'.,.,', 'parser.y',
|
695
|
+
module_eval(<<'.,.,', 'parser.y', 237)
|
667
696
|
def _reduce_57(val, _values, result)
|
668
|
-
|
697
|
+
## todo - add possible status_notes too!!!
|
698
|
+
result = { status: val[0][1][:status] }
|
699
|
+
|
669
700
|
result
|
670
701
|
end
|
671
702
|
.,.,
|
672
703
|
|
673
|
-
module_eval(<<'.,.,', 'parser.y',
|
704
|
+
module_eval(<<'.,.,', 'parser.y', 242)
|
674
705
|
def _reduce_58(val, _values, result)
|
675
|
-
|
706
|
+
result = { status: val[0][1][:status] }.merge( val[1] )
|
707
|
+
|
676
708
|
result
|
677
709
|
end
|
678
710
|
.,.,
|
679
711
|
|
680
|
-
module_eval(<<'.,.,', 'parser.y',
|
712
|
+
module_eval(<<'.,.,', 'parser.y', 244)
|
681
713
|
def _reduce_59(val, _values, result)
|
682
|
-
|
714
|
+
result = {}.merge( val[0] )
|
683
715
|
result
|
684
716
|
end
|
685
717
|
.,.,
|
686
718
|
|
687
|
-
module_eval(<<'.,.,', 'parser.y',
|
719
|
+
module_eval(<<'.,.,', 'parser.y', 245)
|
688
720
|
def _reduce_60(val, _values, result)
|
689
|
-
|
690
|
-
team2: val[2]
|
691
|
-
}.merge( val[1] )
|
692
|
-
|
721
|
+
result = {}
|
693
722
|
result
|
694
723
|
end
|
695
724
|
.,.,
|
696
725
|
|
697
|
-
module_eval(<<'.,.,', 'parser.y',
|
726
|
+
module_eval(<<'.,.,', 'parser.y', 251)
|
698
727
|
def _reduce_61(val, _values, result)
|
699
|
-
|
700
|
-
|
728
|
+
result = { geo: val[1] }
|
701
729
|
result
|
702
730
|
end
|
703
731
|
.,.,
|
704
732
|
|
705
|
-
module_eval(<<'.,.,', 'parser.y',
|
733
|
+
module_eval(<<'.,.,', 'parser.y', 252)
|
706
734
|
def _reduce_62(val, _values, result)
|
707
|
-
|
708
|
-
team2: val[2],
|
709
|
-
score: val[3][1]
|
710
|
-
}
|
711
|
-
|
735
|
+
result = { geo: val[1], timezone: val[2] }
|
712
736
|
result
|
713
737
|
end
|
714
738
|
.,.,
|
715
739
|
|
716
|
-
module_eval(<<'.,.,', 'parser.y',
|
740
|
+
module_eval(<<'.,.,', 'parser.y', 255)
|
717
741
|
def _reduce_63(val, _values, result)
|
718
|
-
result =
|
742
|
+
result = val
|
719
743
|
result
|
720
744
|
end
|
721
745
|
.,.,
|
722
746
|
|
723
|
-
module_eval(<<'.,.,', 'parser.y',
|
747
|
+
module_eval(<<'.,.,', 'parser.y', 256)
|
724
748
|
def _reduce_64(val, _values, result)
|
725
|
-
result
|
749
|
+
result.push( val[2] )
|
750
|
+
result
|
751
|
+
end
|
752
|
+
.,.,
|
753
|
+
|
754
|
+
# reduce 65 omitted
|
755
|
+
|
756
|
+
# reduce 66 omitted
|
757
|
+
|
758
|
+
module_eval(<<'.,.,', 'parser.y', 264)
|
759
|
+
def _reduce_67(val, _values, result)
|
760
|
+
puts " RECUDE match_fixture"
|
761
|
+
result = { team1: val[0],
|
762
|
+
team2: val[2] }
|
763
|
+
|
764
|
+
result
|
765
|
+
end
|
766
|
+
.,.,
|
767
|
+
|
768
|
+
# reduce 68 omitted
|
769
|
+
|
770
|
+
# reduce 69 omitted
|
771
|
+
|
772
|
+
module_eval(<<'.,.,', 'parser.y', 275)
|
773
|
+
def _reduce_70(val, _values, result)
|
774
|
+
puts " REDUCE => match_result : TEXT SCORE TEXT"
|
775
|
+
result = { team1: val[0],
|
776
|
+
team2: val[2],
|
777
|
+
score: val[1][1]
|
778
|
+
}
|
779
|
+
|
780
|
+
result
|
781
|
+
end
|
782
|
+
.,.,
|
783
|
+
|
784
|
+
module_eval(<<'.,.,', 'parser.y', 283)
|
785
|
+
def _reduce_71(val, _values, result)
|
786
|
+
puts " REDUCE => match_result : match_fixture SCORE"
|
787
|
+
result = { score: val[1][1] }.merge( val[0] )
|
788
|
+
|
726
789
|
result
|
727
790
|
end
|
728
791
|
.,.,
|
729
792
|
|
730
|
-
module_eval(<<'.,.,', 'parser.y',
|
731
|
-
def
|
793
|
+
module_eval(<<'.,.,', 'parser.y', 302)
|
794
|
+
def _reduce_72(val, _values, result)
|
732
795
|
kwargs = val[1]
|
733
796
|
@tree << GoalLine.new( **kwargs )
|
734
797
|
|
@@ -736,8 +799,8 @@ module_eval(<<'.,.,', 'parser.y', 261)
|
|
736
799
|
end
|
737
800
|
.,.,
|
738
801
|
|
739
|
-
module_eval(<<'.,.,', 'parser.y',
|
740
|
-
def
|
802
|
+
module_eval(<<'.,.,', 'parser.y', 307)
|
803
|
+
def _reduce_73(val, _values, result)
|
741
804
|
kwargs = val[0]
|
742
805
|
@tree << GoalLine.new( **kwargs )
|
743
806
|
|
@@ -745,8 +808,8 @@ module_eval(<<'.,.,', 'parser.y', 266)
|
|
745
808
|
end
|
746
809
|
.,.,
|
747
810
|
|
748
|
-
module_eval(<<'.,.,', 'parser.y',
|
749
|
-
def
|
811
|
+
module_eval(<<'.,.,', 'parser.y', 312)
|
812
|
+
def _reduce_74(val, _values, result)
|
750
813
|
result = { goals1: val[0],
|
751
814
|
goals2: [] }
|
752
815
|
|
@@ -754,8 +817,8 @@ module_eval(<<'.,.,', 'parser.y', 271)
|
|
754
817
|
end
|
755
818
|
.,.,
|
756
819
|
|
757
|
-
module_eval(<<'.,.,', 'parser.y',
|
758
|
-
def
|
820
|
+
module_eval(<<'.,.,', 'parser.y', 315)
|
821
|
+
def _reduce_75(val, _values, result)
|
759
822
|
result = { goals1: [],
|
760
823
|
goals2: val[2] }
|
761
824
|
|
@@ -763,8 +826,8 @@ module_eval(<<'.,.,', 'parser.y', 274)
|
|
763
826
|
end
|
764
827
|
.,.,
|
765
828
|
|
766
|
-
module_eval(<<'.,.,', 'parser.y',
|
767
|
-
def
|
829
|
+
module_eval(<<'.,.,', 'parser.y', 318)
|
830
|
+
def _reduce_76(val, _values, result)
|
768
831
|
result = { goals1: val[0],
|
769
832
|
goals2: val[2] }
|
770
833
|
|
@@ -772,56 +835,56 @@ module_eval(<<'.,.,', 'parser.y', 277)
|
|
772
835
|
end
|
773
836
|
.,.,
|
774
837
|
|
775
|
-
# reduce
|
838
|
+
# reduce 77 omitted
|
776
839
|
|
777
|
-
# reduce
|
840
|
+
# reduce 78 omitted
|
778
841
|
|
779
|
-
module_eval(<<'.,.,', 'parser.y',
|
780
|
-
def
|
842
|
+
module_eval(<<'.,.,', 'parser.y', 332)
|
843
|
+
def _reduce_79(val, _values, result)
|
781
844
|
result = val
|
782
845
|
result
|
783
846
|
end
|
784
847
|
.,.,
|
785
848
|
|
786
|
-
module_eval(<<'.,.,', 'parser.y',
|
787
|
-
def
|
849
|
+
module_eval(<<'.,.,', 'parser.y', 333)
|
850
|
+
def _reduce_80(val, _values, result)
|
788
851
|
result.push( val[1])
|
789
852
|
result
|
790
853
|
end
|
791
854
|
.,.,
|
792
855
|
|
793
|
-
module_eval(<<'.,.,', 'parser.y',
|
794
|
-
def
|
795
|
-
|
796
|
-
|
856
|
+
module_eval(<<'.,.,', 'parser.y', 349)
|
857
|
+
def _reduce_81(val, _values, result)
|
858
|
+
result = Goal.new( player: val[0],
|
859
|
+
minutes: val[1] )
|
797
860
|
|
798
861
|
result
|
799
862
|
end
|
800
863
|
.,.,
|
801
864
|
|
802
|
-
module_eval(<<'.,.,', 'parser.y',
|
803
|
-
def
|
865
|
+
module_eval(<<'.,.,', 'parser.y', 361)
|
866
|
+
def _reduce_82(val, _values, result)
|
804
867
|
result = val
|
805
868
|
result
|
806
869
|
end
|
807
870
|
.,.,
|
808
871
|
|
809
|
-
module_eval(<<'.,.,', 'parser.y',
|
810
|
-
def
|
872
|
+
module_eval(<<'.,.,', 'parser.y', 362)
|
873
|
+
def _reduce_83(val, _values, result)
|
811
874
|
result.push( val[1])
|
812
875
|
result
|
813
876
|
end
|
814
877
|
.,.,
|
815
878
|
|
816
|
-
module_eval(<<'.,.,', 'parser.y',
|
817
|
-
def
|
879
|
+
module_eval(<<'.,.,', 'parser.y', 363)
|
880
|
+
def _reduce_84(val, _values, result)
|
818
881
|
result.push( val[2])
|
819
882
|
result
|
820
883
|
end
|
821
884
|
.,.,
|
822
885
|
|
823
|
-
module_eval(<<'.,.,', 'parser.y',
|
824
|
-
def
|
886
|
+
module_eval(<<'.,.,', 'parser.y', 369)
|
887
|
+
def _reduce_85(val, _values, result)
|
825
888
|
kwargs = {}.merge( val[0][1] )
|
826
889
|
result = Minute.new( **kwargs )
|
827
890
|
|
@@ -829,8 +892,8 @@ module_eval(<<'.,.,', 'parser.y', 312)
|
|
829
892
|
end
|
830
893
|
.,.,
|
831
894
|
|
832
|
-
module_eval(<<'.,.,', 'parser.y',
|
833
|
-
def
|
895
|
+
module_eval(<<'.,.,', 'parser.y', 374)
|
896
|
+
def _reduce_86(val, _values, result)
|
834
897
|
kwargs = { }.merge( val[0][1] ).merge( val[1] )
|
835
898
|
result = Minute.new( **kwargs )
|
836
899
|
|
@@ -838,22 +901,22 @@ module_eval(<<'.,.,', 'parser.y', 317)
|
|
838
901
|
end
|
839
902
|
.,.,
|
840
903
|
|
841
|
-
module_eval(<<'.,.,', 'parser.y',
|
842
|
-
def
|
904
|
+
module_eval(<<'.,.,', 'parser.y', 378)
|
905
|
+
def _reduce_87(val, _values, result)
|
843
906
|
result = { og: true }
|
844
907
|
result
|
845
908
|
end
|
846
909
|
.,.,
|
847
910
|
|
848
|
-
module_eval(<<'.,.,', 'parser.y',
|
849
|
-
def
|
911
|
+
module_eval(<<'.,.,', 'parser.y', 379)
|
912
|
+
def _reduce_88(val, _values, result)
|
850
913
|
result = { pen: true }
|
851
914
|
result
|
852
915
|
end
|
853
916
|
.,.,
|
854
917
|
|
855
|
-
module_eval(<<'.,.,', 'parser.y',
|
856
|
-
def
|
918
|
+
module_eval(<<'.,.,', 'parser.y', 384)
|
919
|
+
def _reduce_89(val, _values, result)
|
857
920
|
puts ' MATCH empty_line'
|
858
921
|
result
|
859
922
|
end
|
@@ -25,7 +25,7 @@ class Parser
|
|
25
25
|
)? # note: make penalty (P) score optional for now
|
26
26
|
(?<et1>\d{1,2}) - (?<et2>\d{1,2})
|
27
27
|
[ ]* #{ET_EN}
|
28
|
-
(?=[
|
28
|
+
(?=[ ,\]]|$)
|
29
29
|
)}ix
|
30
30
|
## todo/check: remove loakahead assertion here - why require space?
|
31
31
|
## note: \b works only after non-alphanum e.g. )
|
@@ -38,7 +38,7 @@ class Parser
|
|
38
38
|
\b
|
39
39
|
(?<p1>\d{1,2}) - (?<p2>\d{1,2})
|
40
40
|
[ ]* #{P_EN}
|
41
|
-
(?=[
|
41
|
+
(?=[ ,\]]|$)
|
42
42
|
)}ix
|
43
43
|
## todo/check: remove loakahead assertion here - why require space?
|
44
44
|
## note: \b works only after non-alphanum e.g. )
|
@@ -71,7 +71,7 @@ class Parser
|
|
71
71
|
)?
|
72
72
|
)? # note: make half time (HT) score optional for now
|
73
73
|
\)
|
74
|
-
(?=[
|
74
|
+
(?=[ ,\]]|$)
|
75
75
|
)}ix ## todo/check: remove loakahead assertion here - why require space?
|
76
76
|
## note: \b works only after non-alphanum e.g. )
|
77
77
|
|
@@ -94,7 +94,7 @@ class Parser
|
|
94
94
|
)?
|
95
95
|
)? # note: make half time (HT) score optional for now
|
96
96
|
\)
|
97
|
-
(?=[
|
97
|
+
(?=[ ,\]]|$)
|
98
98
|
)}ix ## todo/check: remove loakahead assertion here - why require space?
|
99
99
|
## note: \b works only after non-alphanum e.g. )
|
100
100
|
|
@@ -112,7 +112,7 @@ class Parser
|
|
112
112
|
(?<ht1>\d{1,2}) - (?<ht2>\d{1,2})
|
113
113
|
[ ]* \)
|
114
114
|
)? # note: make half time (HT) score optional for now
|
115
|
-
(?=[
|
115
|
+
(?=[ ,\]]|$)
|
116
116
|
)}ix ## todo/check: remove loakahead assertion here - why require space?
|
117
117
|
## note: \b works only after non-alphanum e.g. )
|
118
118
|
|
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.4
|
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
|