sportdb-parser 0.5.5 → 0.5.6

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: 6c262398deab4e59ae7f57655a5ab67b03e4ad6290c66aa1b68f082448619c9c
4
- data.tar.gz: 4c9b0c700f3bc472b27975cd1c4e7698eabf2e3965e0c1dbbed6feb4271103d6
3
+ metadata.gz: ac0970b3fbdf8ca8030b5b8de8f149b630b76546acbf094c78ccf5deb6d31ef0
4
+ data.tar.gz: 8ff6968c2d1113952040ab297cb522e5b8948f9a69c08543e9dd2763b0867f01
5
5
  SHA512:
6
- metadata.gz: dbfeb90c1e8499e67c653bc313696cdafd18c8f56af2b752aa6466e3ea76515d45ac91433741ba106b0ced8a55178aff54b348bf37463a86ec81127b87bec58d
7
- data.tar.gz: f98cb825168e198601b43a70e8e19173ddbec39a93f04f4d277d632dc5d8f45577190e3f780b88fe48c9d6c194e7e59c1caf67897aebcdaa8c9a6527e1bbc2c1
6
+ metadata.gz: b1a8eb1bef571c019e4201a71ccb73dfe06cf8e348f46f9cfa2b676d7acf639132c27b6c0cb59d9da40521ca82d522a4e240321b7402b38bab0354ca8d313e22
7
+ data.tar.gz: d4125ca745cdc4fc432e68577f80904a572050447272a32625b9df6f203de101c477be91574a2dc5f37f5ea1341d2bc517ecae4d2a99104c5048f6cbed71085c
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.5.5
1
+ ### 0.5.6
2
2
  ### 0.0.1 / 2024-07-12
3
3
 
4
4
  * Everything is new. First release.
data/Manifest.txt CHANGED
@@ -10,6 +10,8 @@ config/rounds_pt.txt
10
10
  lib/sportdb/parser.rb
11
11
  lib/sportdb/parser/lang.rb
12
12
  lib/sportdb/parser/parser.rb
13
+ lib/sportdb/parser/racc_parser.rb
14
+ lib/sportdb/parser/racc_tree.rb
13
15
  lib/sportdb/parser/token-date.rb
14
16
  lib/sportdb/parser/token-score.rb
15
17
  lib/sportdb/parser/token-status.rb
@@ -9,200 +9,200 @@ class RaccMatchParser < Racc::Parser
9
9
  ##### State transition tables begin ###
10
10
 
11
11
  racc_action_table = [
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 ]
12
+ 34, 120, 12, 106, 33, 38, 30, 58, 95, 39,
13
+ 16, 61, 24, 121, 13, 40, 27, 14, 15, 45,
14
+ 17, 19, 22, 24, 12, 30, 33, 27, 30, 56,
15
+ 71, 32, 16, 62, 63, 130, 13, 43, 27, 14,
16
+ 15, 41, 17, 19, 22, 24, 55, 52, 55, 92,
17
+ 32, 59, 81, 32, 82, 64, 129, 46, 49, 48,
18
+ 42, 73, 75, 76, 77, 68, 53, 56, 53, 56,
19
+ 66, 32, 86, 87, 108, 109, 118, 119, 126, 127,
20
+ 135, 127, 71, 72, 84, 88, 89, 90, 27, 97,
21
+ 99, 42, 100, 101, 32, 103, 32, 110, 38, 112,
22
+ 113, 81, 71, 122, 123, 124, 27, 128, 32, 32,
23
+ 71, 38, 133, 71, 27, 137, 138 ]
24
24
 
25
25
  racc_action_check = [
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 ]
26
+ 1, 83, 1, 69, 1, 12, 1, 22, 53, 13,
27
+ 1, 27, 22, 83, 1, 14, 1, 1, 1, 17,
28
+ 1, 1, 1, 1, 0, 16, 0, 20, 0, 53,
29
+ 69, 1, 0, 27, 27, 98, 0, 16, 0, 0,
30
+ 0, 15, 0, 0, 0, 0, 21, 21, 50, 50,
31
+ 16, 26, 38, 0, 38, 28, 98, 18, 18, 18,
32
+ 15, 36, 36, 36, 36, 30, 21, 21, 50, 50,
33
+ 29, 29, 40, 40, 71, 71, 82, 82, 93, 93,
34
+ 125, 125, 32, 34, 39, 43, 44, 47, 52, 54,
35
+ 56, 58, 60, 63, 65, 66, 68, 73, 74, 76,
36
+ 77, 79, 81, 85, 88, 89, 92, 96, 102, 104,
37
+ 106, 115, 116, 117, 127, 130, 132 ]
38
38
 
39
39
  racc_action_pointer = [
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 ]
40
+ 22, 0, nil, nil, nil, nil, nil, nil, nil, nil,
41
+ nil, nil, -2, -6, 0, 37, 19, 15, 53, nil,
42
+ 11, 42, -11, nil, nil, nil, 22, 5, 51, 40,
43
+ 35, nil, 50, nil, 83, nil, 58, nil, 44, 68,
44
+ 54, nil, nil, 74, 75, nil, nil, 66, nil, nil,
45
+ 44, nil, 72, 4, 85, nil, 63, nil, 68, nil,
46
+ 76, nil, nil, 77, nil, 63, 91, nil, 65, -2,
47
+ nil, 41, nil, 93, 91, nil, 95, 96, nil, 93,
48
+ nil, 70, 64, -3, nil, 99, nil, nil, 100, 101,
49
+ nil, nil, 90, 74, nil, nil, 103, nil, 30, nil,
50
+ nil, nil, 77, nil, 78, nil, 78, nil, nil, nil,
51
+ nil, nil, nil, nil, nil, 104, 101, 81, nil, nil,
52
+ nil, nil, nil, nil, nil, 76, nil, 98, nil, nil,
53
+ 88, nil, 107, nil, nil, nil, nil, nil, nil ]
54
54
 
55
55
  racc_action_default = [
56
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 ]
57
+ -10, -11, -90, -90, -90, -54, -90, -90, -90, -41,
58
+ -90, -90, -51, -53, -56, -65, -66, -90, -90, -74,
59
+ -90, -79, -90, -89, -90, -2, -90, -13, -20, -90,
60
+ -90, -37, -55, -90, -90, -39, -40, -90, -43, -44,
61
+ -90, -46, -90, -90, -90, -60, -90, -52, -54, -71,
62
+ -90, -68, -69, -90, -73, -90, -77, -80, -90, -81,
63
+ -82, -85, 139, -90, -90, -15, -16, -18, -21, -22,
64
+ -24, -90, -90, -90, -32, -90, -35, -36, -90, -90,
65
+ -42, -45, -90, -90, -49, -57, -90, -59, -61, -63,
66
+ -67, -70, -76, -78, -75, -83, -90, -86, -87, -88,
67
+ -12, -14, -17, -19, -23, -90, -90, -27, -29, -30,
68
+ -31, -33, -34, -38, -72, -90, -48, -90, -58, -62,
69
+ -90, -84, -90, -26, -28, -47, -50, -64, -25 ]
70
70
 
71
71
  racc_goto_table = [
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,
72
+ 50, 37, 70, 80, 67, 93, 51, 102, 2, 35,
73
+ 104, 1, 36, 74, 78, 79, 116, 117, 83, 85,
74
+ 47, 57, 96, 98, 60, 44, 65, 69, 107, nil,
75
+ nil, nil, 94, nil, nil, 91, nil, nil, nil, 105,
76
+ nil, nil, nil, nil, 114, 125, nil, nil, nil, nil,
77
+ nil, 115, nil, nil, nil, nil, nil, nil, nil, nil,
78
+ nil, nil, nil, 111, nil, nil, nil, nil, nil, nil,
79
+ nil, nil, 94, nil, nil, nil, 131, 67, nil, 67,
80
+ nil, nil, nil, nil, nil, nil, nil, 134, nil, nil,
81
81
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
82
- nil, nil, nil, 131, nil, nil, nil, nil, 135 ]
82
+ nil, nil, nil, nil, 132, nil, nil, 136 ]
83
83
 
84
84
  racc_goto_check = [
85
- 26, 13, 38, 18, 17, 28, 27, 36, 2, 2,
85
+ 26, 13, 18, 17, 38, 28, 27, 36, 2, 2,
86
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,
87
+ 24, 29, 30, 31, 34, 35, 37, 39, 40, nil,
88
+ nil, nil, 26, nil, nil, 27, nil, nil, nil, 18,
89
+ nil, nil, nil, nil, 17, 28, nil, nil, nil, nil,
90
+ nil, 18, nil, nil, nil, nil, nil, nil, nil, nil,
91
+ nil, nil, nil, 13, nil, nil, nil, nil, nil, nil,
92
+ nil, nil, 26, nil, nil, nil, 18, 38, nil, 38,
93
+ nil, nil, nil, nil, nil, nil, nil, 18, nil, nil,
94
94
  nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
95
- nil, nil, nil, 13, nil, nil, nil, nil, 26 ]
95
+ nil, nil, nil, nil, 13, nil, nil, 26 ]
96
96
 
97
97
  racc_goto_pointer = [
98
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 ]
99
+ nil, nil, 0, -11, -23, -24, -23, -35, -30, -66,
100
+ -65, -21, -21, nil, 2, nil, -20, -15, -47, -1,
101
+ -31, -33, nil, nil, -3, 9, -58, -3, -25, -5,
102
+ -43 ]
103
103
 
104
104
  racc_goto_default = [
105
105
  nil, nil, nil, 3, 4, 5, 6, 7, 8, 9,
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,
106
+ 10, 11, nil, nil, nil, nil, nil, nil, nil, nil,
107
+ nil, nil, nil, 18, nil, 20, 21, nil, nil, 23,
108
+ 54, nil, 25, 26, nil, 28, 29, nil, 31, nil,
109
109
  nil ]
110
110
 
111
111
  racc_reduce_table = [
112
112
  0, 0, :racc_error,
113
- 1, 32, :_reduce_none,
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,
113
+ 1, 36, :_reduce_none,
114
+ 2, 36, :_reduce_none,
115
+ 1, 37, :_reduce_none,
116
+ 1, 37, :_reduce_none,
117
+ 1, 37, :_reduce_none,
118
+ 1, 37, :_reduce_none,
119
+ 1, 37, :_reduce_none,
120
+ 1, 37, :_reduce_none,
121
+ 1, 37, :_reduce_none,
122
+ 1, 37, :_reduce_none,
123
+ 1, 37, :_reduce_none,
124
+ 4, 46, :_reduce_12,
125
+ 1, 47, :_reduce_13,
126
+ 3, 47, :_reduce_14,
127
+ 2, 47, :_reduce_15,
128
+ 1, 49, :_reduce_none,
129
+ 2, 49, :_reduce_17,
130
+ 1, 49, :_reduce_none,
131
+ 2, 49, :_reduce_19,
132
+ 1, 48, :_reduce_20,
133
+ 2, 48, :_reduce_21,
134
+ 1, 50, :_reduce_22,
135
+ 2, 50, :_reduce_23,
136
+ 1, 50, :_reduce_24,
137
+ 4, 52, :_reduce_25,
138
+ 3, 51, :_reduce_26,
139
+ 1, 54, :_reduce_27,
140
+ 2, 54, :_reduce_28,
155
141
  1, 55, :_reduce_none,
156
142
  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 ]
143
+ 4, 41, :_reduce_31,
144
+ 1, 56, :_reduce_32,
145
+ 2, 56, :_reduce_33,
146
+ 4, 42, :_reduce_34,
147
+ 1, 57, :_reduce_35,
148
+ 1, 57, :_reduce_36,
149
+ 2, 38, :_reduce_37,
150
+ 4, 38, :_reduce_38,
151
+ 2, 39, :_reduce_39,
152
+ 2, 40, :_reduce_40,
153
+ 1, 58, :_reduce_41,
154
+ 3, 58, :_reduce_42,
155
+ 1, 59, :_reduce_none,
156
+ 1, 59, :_reduce_none,
157
+ 3, 43, :_reduce_45,
158
+ 2, 43, :_reduce_46,
159
+ 5, 43, :_reduce_47,
160
+ 4, 43, :_reduce_48,
161
+ 1, 63, :_reduce_49,
162
+ 3, 63, :_reduce_50,
163
+ 1, 60, :_reduce_51,
164
+ 2, 60, :_reduce_52,
165
+ 1, 60, :_reduce_none,
166
+ 1, 64, :_reduce_54,
167
+ 2, 64, :_reduce_55,
168
+ 1, 64, :_reduce_56,
169
+ 2, 62, :_reduce_57,
170
+ 3, 62, :_reduce_58,
171
+ 2, 62, :_reduce_59,
172
+ 1, 62, :_reduce_60,
173
+ 2, 65, :_reduce_61,
174
+ 3, 65, :_reduce_62,
175
+ 1, 66, :_reduce_63,
176
+ 3, 66, :_reduce_64,
177
+ 1, 61, :_reduce_none,
178
+ 1, 61, :_reduce_none,
179
+ 3, 68, :_reduce_67,
180
+ 1, 69, :_reduce_none,
181
+ 1, 69, :_reduce_none,
182
+ 3, 67, :_reduce_70,
183
+ 2, 67, :_reduce_71,
184
+ 4, 44, :_reduce_72,
185
+ 2, 44, :_reduce_73,
186
+ 1, 70, :_reduce_74,
187
+ 3, 70, :_reduce_75,
188
+ 3, 70, :_reduce_76,
189
+ 1, 72, :_reduce_none,
190
+ 2, 72, :_reduce_none,
191
+ 1, 71, :_reduce_79,
192
+ 2, 71, :_reduce_80,
193
+ 2, 73, :_reduce_81,
194
+ 1, 74, :_reduce_82,
195
+ 2, 74, :_reduce_83,
196
+ 3, 74, :_reduce_84,
197
+ 1, 53, :_reduce_85,
198
+ 2, 53, :_reduce_86,
199
+ 1, 75, :_reduce_87,
200
+ 1, 75, :_reduce_88,
201
+ 1, 45, :_reduce_89 ]
202
202
 
203
203
  racc_reduce_n = 90
204
204
 
205
- racc_shift_n = 138
205
+ racc_shift_n = 139
206
206
 
207
207
  racc_token_table = {
208
208
  false => 0,
@@ -219,25 +219,29 @@ racc_token_table = {
219
219
  "]" => 11,
220
220
  :YELLOW_CARD => 12,
221
221
  :RED_CARD => 13,
222
- :GROUP => 14,
222
+ :GROUP_DEF => 14,
223
223
  "|" => 15,
224
- :TEXT => 16,
225
- :ROUND => 17,
224
+ :TEAM => 16,
225
+ :ROUND_DEF => 17,
226
226
  :DATE => 18,
227
227
  :DURATION => 19,
228
- :ORD => 20,
229
- :TIME => 21,
230
- :STATUS => 22,
231
- "@" => 23,
232
- :TIMEZONE => 24,
233
- :VS => 25,
234
- :SCORE => 26,
235
- ";" => 27,
236
- :MINUTE => 28,
237
- :OG => 29,
238
- :PEN => 30 }
239
-
240
- racc_nt_base = 31
228
+ :GROUP => 20,
229
+ :ROUND => 21,
230
+ :ORD => 22,
231
+ :TIME => 23,
232
+ :STATUS => 24,
233
+ "@" => 25,
234
+ :TIMEZONE => 26,
235
+ :TEXT => 27,
236
+ :VS => 28,
237
+ :SCORE => 29,
238
+ ";" => 30,
239
+ :PLAYER => 31,
240
+ :MINUTE => 32,
241
+ :OG => 33,
242
+ :PEN => 34 }
243
+
244
+ racc_nt_base = 35
241
245
 
242
246
  racc_use_result_var = true
243
247
 
@@ -273,20 +277,24 @@ Racc_token_to_s_table = [
273
277
  "\"]\"",
274
278
  "YELLOW_CARD",
275
279
  "RED_CARD",
276
- "GROUP",
280
+ "GROUP_DEF",
277
281
  "\"|\"",
278
- "TEXT",
279
- "ROUND",
282
+ "TEAM",
283
+ "ROUND_DEF",
280
284
  "DATE",
281
285
  "DURATION",
286
+ "GROUP",
287
+ "ROUND",
282
288
  "ORD",
283
289
  "TIME",
284
290
  "STATUS",
285
291
  "\"@\"",
286
292
  "TIMEZONE",
293
+ "TEXT",
287
294
  "VS",
288
295
  "SCORE",
289
296
  "\";\"",
297
+ "PLAYER",
290
298
  "MINUTE",
291
299
  "OG",
292
300
  "PEN",
@@ -0,0 +1,58 @@
1
+
2
+ ####
3
+ # RaccMatchParser support machinery (incl. node classes/abstract syntax tree)
4
+
5
+ class RaccMatchParser
6
+
7
+
8
+ def initialize( txt )
9
+ ## puts "==> txt:"
10
+ ## puts txt
11
+
12
+ parser = SportDb::Parser.new
13
+ @tokens = parser.tokenize( txt )
14
+ ## pp @tokens
15
+
16
+ ## quick hack - convert to racc format single char literal tokens e.g. '@' etc.
17
+ @tokens = @tokens.map do |tok|
18
+ if tok.size == 1
19
+ [tok[0].to_s, tok[0].to_s]
20
+ else
21
+ tok
22
+ end
23
+ end
24
+ end
25
+
26
+
27
+ def next_token
28
+ tok = @tokens.shift
29
+ puts "next_token => #{tok.pretty_inspect}"
30
+ tok
31
+ end
32
+
33
+ # on_error do |error_token_id, error_value, value_stack|
34
+ # puts "Parse error on token: #{error_token_id}, value: #{error_value}"
35
+ # end
36
+
37
+ def parse
38
+ puts "parse:"
39
+ @tree = []
40
+ do_parse
41
+ @tree
42
+ end
43
+
44
+
45
+ def on_error(*args)
46
+ puts
47
+ puts "!! on parse error:"
48
+ puts "args=#{args.pretty_inspect}"
49
+ exit 1 ## exit for now - get and print more info about context etc.!!
50
+ end
51
+
52
+
53
+ =begin
54
+ on_error do |error_token_id, error_value, value_stack|
55
+ puts "Parse error on token: #{error_token_id}, value: #{error_value}"
56
+ end
57
+ =end
58
+ end # class RaccMatchParser
@@ -0,0 +1,162 @@
1
+
2
+ ####
3
+ # RaccMatchParser support machinery (incl. node classes/abstract syntax tree)
4
+
5
+ class RaccMatchParser
6
+
7
+
8
+ LineupLine = Struct.new( :team, :lineup ) do
9
+ def pretty_print( printer )
10
+ printer.text( "<LineupLine " )
11
+ printer.text( self.team )
12
+ printer.text( " lineup=" + self.lineup.pretty_inspect )
13
+ printer.text( ">" )
14
+ end
15
+ end
16
+
17
+ Lineup = Struct.new( :name, :card, :sub ) do
18
+ def pretty_print( printer )
19
+ buf = String.new
20
+ buf << self.name
21
+ buf << " card=" + self.card.pretty_inspect if card
22
+ buf << " sub=" + self.sub.pretty_inspect if sub
23
+ printer.text( buf )
24
+ end
25
+ end
26
+
27
+
28
+ Card = Struct.new( :name, :minute ) do
29
+ def to_s
30
+ buf = String.new
31
+ buf << "#{self.name}"
32
+ buf << " #{self.minute.to_s}" if self.minute
33
+ buf
34
+ end
35
+
36
+ def pretty_print( printer )
37
+ printer.text( to_s )
38
+ end
39
+ end
40
+
41
+
42
+ Sub = Struct.new( :minute, :sub ) do
43
+ def pretty_print( printer )
44
+ buf = String.new
45
+ buf << "(#{self.minute.to_s} "
46
+ buf << self.sub.pretty_inspect
47
+ buf << ")"
48
+ printer.text( buf )
49
+ end
50
+ end
51
+
52
+
53
+
54
+ GroupDef = Struct.new( :name, :teams ) do
55
+ def pretty_print( printer )
56
+ printer.text( "<GroupDef " )
57
+ printer.text( self.name )
58
+ printer.text( " teams=" + self.teams.pretty_inspect )
59
+ printer.text( ">" )
60
+ end
61
+ end
62
+
63
+
64
+ RoundDef = Struct.new( :name, :date, :duration ) do
65
+ def pretty_print( printer )
66
+ printer.text( "<RoundDef " )
67
+ printer.text( self.name )
68
+ printer.text( " date=" + self.date.pretty_inspect ) if date
69
+ printer.text( " durattion=" + self.duration.pretty_inspect ) if duration
70
+ printer.text( ">" )
71
+ end
72
+ end
73
+
74
+ DateHeader = Struct.new( :date ) do
75
+ def pretty_print( printer )
76
+ printer.text( "<DateHeader " )
77
+ printer.text( "#{self.date.pretty_inspect}>" )
78
+ end
79
+ end
80
+
81
+ GroupHeader = Struct.new( :name ) do
82
+ def pretty_print( printer )
83
+ printer.text( "<GroupHeader " )
84
+ printer.text( "#{self.name}>" )
85
+ end
86
+ end
87
+
88
+ RoundHeader = Struct.new( :names ) do
89
+ def pretty_print( printer )
90
+ printer.text( "<RoundHeader " )
91
+ printer.text( "#{self.names.join(', ')}>" )
92
+ end
93
+ end
94
+
95
+ MatchLine = Struct.new( :ord, :date, :time,
96
+ :team1, :team2, :score,
97
+ :status,
98
+ :geo,
99
+ :timezone ) do ## change to geos - why? why not?
100
+
101
+ def pretty_print( printer )
102
+ printer.text( "<MatchLine " )
103
+ printer.text( "#{self.team1} v #{self.team2}")
104
+ printer.breakable
105
+
106
+ members.zip(values) do |name, value|
107
+ next if [:team1, :team2].include?( name )
108
+ next if value.nil?
109
+
110
+ printer.text( "#{name}=#{value.pretty_inspect}" )
111
+ end
112
+
113
+ printer.text( ">" )
114
+ end
115
+
116
+ end
117
+
118
+ GoalLine = Struct.new( :goals1, :goals2 ) do
119
+ def pretty_print( printer )
120
+ printer.text( "<GoalLine " )
121
+ printer.text( "goals1=" + self.goals1.pretty_inspect + "," )
122
+ printer.breakable
123
+ printer.text( "goals2=" + self.goals2.pretty_inspect + ">" )
124
+ end
125
+ end
126
+
127
+ Goal = Struct.new( :player, :minutes ) do
128
+ def to_s
129
+ buf = String.new
130
+ buf << "#{self.player}"
131
+ buf << " "
132
+ buf << minutes.map { |min| min.to_s }.join(' ')
133
+ buf
134
+ end
135
+
136
+ def pretty_print( printer )
137
+ printer.text( to_s )
138
+ end
139
+
140
+ end
141
+
142
+
143
+ ##
144
+ ## fix - move :og, :pen to Goal if possible - why? why not?
145
+ ## or change to GoalMinute ???
146
+ Minute = Struct.new( :m, :offset, :og, :pen ) do
147
+ def to_s
148
+ buf = String.new
149
+ buf << "#{self.m}"
150
+ buf << "+#{self.offset}" if self.offset
151
+ buf << "'"
152
+ buf << "(og)" if self.og
153
+ buf << "(pen)" if self.pen
154
+ buf
155
+ end
156
+
157
+ def pretty_print( printer )
158
+ printer.text( to_s )
159
+ end
160
+ end
161
+
162
+ end # class RaccMatchParser
@@ -14,8 +14,239 @@ def log( msg )
14
14
  end
15
15
 
16
16
 
17
+ ## transforms
18
+ ##
19
+ ## Netherlands 1-2 (1-1) England
20
+ ## => text => team
21
+ ## score|vs
22
+ ## text => team
23
+
24
+
25
+ ## token iter/find better name
26
+ ## e.g. TokenBuffer/Scanner or such ??
27
+ class Tokens
28
+ def initialize( tokens )
29
+ @tokens = tokens
30
+ @pos = 0
31
+ end
32
+
33
+ def pos() @pos; end
34
+ def eos?() @pos >= @tokens.size; end
35
+
36
+
37
+ def include?( *types )
38
+ pos = @pos
39
+ ## puts " starting include? #{types.inspect} @ #{pos}"
40
+ while pos < @tokens.size do
41
+ return true if types.include?( @tokens[pos][0] )
42
+ pos +=1
43
+ end
44
+ false
45
+ end
46
+
47
+ ## pattern e.g. [:TEXT, [:VS,:SCORE], :TEXT]
48
+ def match?( *pattern )
49
+ ## puts " starting match? #{pattern.inspect} @ #{@pos}"
50
+ pattern.each_with_index do |types,offset|
51
+ ## if single symbol wrap in array
52
+ types = types.is_a?(Array) ? types : [types]
53
+ return false unless types.include?( peek(offset) )
54
+ end
55
+ true
56
+ end
57
+
58
+
59
+ ## return token type (e.g. :TEXT, :NUM, etc.)
60
+ def cur() peek(0); end
61
+ ## return content (assumed to be text)
62
+ def text(offset=0)
63
+ ## raise error - why? why not?
64
+ ## return nil?
65
+ if peek( offset ) != :text
66
+ raise ArgumentError, "text(#{offset}) - token not a text type"
67
+ end
68
+ @tokens[@pos+offset][1]
69
+ end
70
+
17
71
 
18
- def tokenize_with_errors( line, debug: false )
72
+ def peek(offset=1)
73
+ ## return nil if eos
74
+ if @pos+offset >= @tokens.size
75
+ nil
76
+ else
77
+ @tokens[@pos+offset][0]
78
+ end
79
+ end
80
+
81
+ ## note - returns complete token
82
+ def next
83
+ # if @pos >= @tokens.size
84
+ # raise ArgumentError, "end of array - #{@pos} >= #{@tokens.size}"
85
+ # end
86
+ # throw (standard) end of iteration here why? why not?
87
+
88
+ t = @tokens[@pos]
89
+ @pos += 1
90
+ t
91
+ end
92
+
93
+ def collect( &blk )
94
+ tokens = []
95
+ loop do
96
+ break if eos?
97
+ tokens << if block_given?
98
+ blk.call( self.next )
99
+ else
100
+ self.next
101
+ end
102
+ end
103
+ tokens
104
+ end
105
+ end # class Tokens
106
+
107
+
108
+
109
+
110
+ ### convience helper - ignore errors by default
111
+ def tokenize( lines, debug: false )
112
+ tokens, _ = tokenize_with_errors( lines, debug: debug )
113
+ tokens
114
+ end
115
+
116
+ def tokenize_with_errors( lines, debug: false )
117
+
118
+ ##
119
+ ## note - for convenience - add support
120
+ ## comments (incl. inline end-of-line comments) and empty lines here
121
+ ## why? why not?
122
+ ## why? keeps handling "centralized" here in one place
123
+
124
+ ## todo/fix - rework and make simpler
125
+ ## no need to double join array of string to txt etc.
126
+
127
+ txt_pre = if lines.is_a?( Array )
128
+ ## join together with newline
129
+ lines.reduce( String.new ) do |mem,line|
130
+ mem << line; mem << "\n"; mem
131
+ end
132
+ else ## assume single-all-in-one txt
133
+ lines
134
+ end
135
+
136
+ ## preprocess automagically - why? why not?
137
+ ## strip lines with comments and empty lines striped / removed
138
+ ## keep empty lines? why? why not?
139
+ ## keep leading spaces (indent) - why?
140
+ txt = String.new
141
+ txt_pre.each_line do |line| ## preprocess
142
+ line = line.strip
143
+ next if line.empty? || line.start_with?('#') ### skip empty lines and comments
144
+
145
+ line = line.sub( /#.*/, '' ).strip ### cut-off end-of line comments too
146
+
147
+ txt << line
148
+ txt << "\n"
149
+ end
150
+
151
+
152
+ tokens_by_line = [] ## note: add tokens line-by-line (flatten later)
153
+ errors = [] ## keep a list of errors - why? why not?
154
+
155
+ txt.each_line do |line|
156
+ line = line.rstrip ## note - MUST remove/strip trailing newline (spaces optional)!!!
157
+
158
+ more_tokens, more_errors = _tokenize_line( line, debug: debug )
159
+
160
+ tokens_by_line << more_tokens
161
+ errors += more_errors
162
+ end # each line
163
+
164
+
165
+
166
+
167
+ tokens_by_line = tokens_by_line.map do |tokens|
168
+ #############
169
+ ## pass 1
170
+ ## replace all texts with keyword matches
171
+ ## (e.g. group, round, leg, etc.)
172
+ tokens = tokens.map do |t|
173
+ if t[0] == :TEXT
174
+ text = t[1]
175
+ t = if is_group?( text )
176
+ [:GROUP, text]
177
+ elsif is_round?( text ) || is_leg?( text )
178
+ [:ROUND, text]
179
+ else
180
+ t ## pass through as-is (1:1)
181
+ end
182
+ end
183
+ t
184
+ end
185
+
186
+ #################
187
+ ## pass 2
188
+ ## transform tokens (using simple patterns)
189
+ ## to help along the (racc look ahead 1 - LA1) parser
190
+ nodes = []
191
+
192
+ buf = Tokens.new( tokens )
193
+ ## pp buf
194
+
195
+
196
+ loop do
197
+ break if buf.eos?
198
+
199
+ if buf.pos == 0 ## MUST start line
200
+ ## check for
201
+ ## group def or round def
202
+ if buf.match?( :ROUND, :'|' ) ## assume round def (change round to round_def)
203
+ nodes << [:ROUND_DEF, buf.next[1]]
204
+ nodes << buf.next
205
+ nodes += buf.collect
206
+ break
207
+ end
208
+ if buf.match?( :GROUP, :'|' ) ## assume group def (change group to group_def)
209
+ nodes << [:GROUP_DEF, buf.next[1]]
210
+ nodes << buf.next
211
+ ## change all text to team - why? why not?
212
+ nodes += buf.collect { |t|
213
+ t[0] == :TEXT ? [:TEAM, t[1]] : t
214
+ }
215
+ break
216
+ end
217
+ end
218
+
219
+
220
+ if buf.match?( :TEXT, [:SCORE, :VS, :'-'], :TEXT )
221
+ nodes << [:TEAM, buf.next[1]]
222
+ nodes << buf.next
223
+ nodes << [:TEAM, buf.next[1]]
224
+ elsif buf.match?( :TEXT, :MINUTE )
225
+ nodes << [:PLAYER, buf.next[1]]
226
+ nodes << buf.next
227
+ else
228
+ ## pass through
229
+ nodes << buf.next
230
+ end
231
+ end # loop
232
+ nodes
233
+ end # map tokens_by_line
234
+
235
+
236
+
237
+ ## flatten tokens
238
+ tokens = []
239
+ tokens_by_line.each do |tok|
240
+ tokens += tok
241
+ tokens << [:NEWLINE, "\n"] ## auto-add newlines
242
+ end
243
+
244
+ [tokens,errors]
245
+ end # method tokenize_with_errors
246
+
247
+
248
+
249
+ def _tokenize_line( line, debug: false )
19
250
  tokens = []
20
251
  errors = [] ## keep a list of errors - why? why not?
21
252
 
@@ -252,11 +483,5 @@ def tokenize_with_errors( line, debug: false )
252
483
  end
253
484
 
254
485
 
255
- ### convience helper - ignore errors by default
256
- def tokenize( line, debug: false )
257
- tokens, _ = tokenize_with_errors( line, debug: debug )
258
- tokens
259
- end
260
-
261
486
  end # class Parser
262
487
  end # module SportDb
@@ -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 = 5
7
+ PATCH = 6
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
@@ -24,7 +24,9 @@ require_relative 'parser/token-status'
24
24
  require_relative 'parser/token'
25
25
  require_relative 'parser/tokenizer'
26
26
 
27
- require_relative 'parser/parser'
27
+ require_relative 'parser/parser' ## auto-generated by racc (from parser.y)
28
+ require_relative 'parser/racc_parser'
29
+ require_relative 'parser/racc_tree'
28
30
 
29
31
 
30
32
 
@@ -44,9 +46,11 @@ end # module SportDb
44
46
 
45
47
 
46
48
  module SportDb
47
-
48
-
49
-
49
+ ###
50
+ ## todo/fix - use LangHelper or such
51
+ ## e.g. class Parser
52
+ ## include LangHelper
53
+ ## end
50
54
  class Parser
51
55
  ## keep "old" access to checking for group, round & friends
52
56
  ## for now for compatibility
@@ -54,302 +58,9 @@ class Parser
54
58
  def is_round?( text ) Lang.is_round?( text ); end
55
59
  def is_leg?( text ) Lang.is_leg?( text ); end
56
60
  end
61
+ end # module SportDb
57
62
 
58
63
 
59
64
 
60
- class Tokenizer
61
-
62
- attr_reader :tokens
63
-
64
- def initialize( txt )
65
- parser = Parser.new
66
-
67
- tree = []
68
-
69
- lines = txt.split( "\n" )
70
- lines.each_with_index do |line,i|
71
- next if line.strip.empty? || line.strip.start_with?( '#' )
72
- ## support for inline (end-of-line) comments
73
- line = line.sub( /#.*/, '' ).strip
74
-
75
- puts "line >#{line}<"
76
- tokens = parser.tokenize( line )
77
- pp tokens
78
-
79
- tree << tokens
80
- end
81
-
82
-
83
- =begin
84
- ## quick hack
85
- ## turn all text tokens followed by minute token
86
- ## into player tokens!!!
87
- ##
88
- ## also auto-convert text tokens into team tokens - why? why not?
89
- tree.each do |tokens|
90
- tokens.each_with_index do |t0,idx|
91
- t1 = tokens[idx+1]
92
- if t1 && t1[0] == :minute && t0[0] == :text
93
- t0[0] = :player
94
- end
95
- end
96
- end
97
- =end
98
-
99
- =begin
100
- ## auto-add/insert start tokens for known line patterns
101
- ## START_GOALS for goals_line
102
- ## why? why not?
103
- =end
104
-
105
- ## flatten
106
- @tokens = []
107
- tree.each do |tokens|
108
- @tokens += tokens
109
- @tokens << [:NEWLINE, "\n"] ## auto-add newlines
110
- end
111
-
112
-
113
- ## convert to racc format
114
- @tokens = @tokens.map do |tok|
115
- if tok.size == 1
116
- [tok[0].to_s, tok[0].to_s]
117
- elsif tok.size == 2
118
- #############
119
- ## pass 1
120
- ## replace all texts with keyword matches (e.g. group, round, leg, etc.)
121
- if tok[0] == :TEXT
122
- text = tok[1]
123
- tok = if parser.is_group?( text )
124
- [:GROUP, text]
125
- elsif parser.is_round?( text ) || parser.is_leg?( text )
126
- [:ROUND, text]
127
- else
128
- tok ## pass through as-is (1:1)
129
- end
130
- end
131
- ## pass 2
132
- tok
133
- else
134
- raise ArgumentError, "tokens of size 1|2 expected; got #{tok.pretty_inspect}"
135
- end
136
- end
137
- end
138
-
139
-
140
-
141
- def next_token
142
- @tokens.shift
143
- end
144
- end # class Tokenizer
145
- end # module SportDb
146
-
147
-
148
-
149
- ####
150
- # RaccMatchParser support machinery (incl. node classes/abstract syntax tree)
151
-
152
- class RaccMatchParser
153
-
154
-
155
- LineupLine = Struct.new( :team, :lineup ) do
156
- def pretty_print( printer )
157
- printer.text( "<LineupLine " )
158
- printer.text( self.team )
159
- printer.text( " lineup=" + self.lineup.pretty_inspect )
160
- printer.text( ">" )
161
- end
162
- end
163
-
164
- Lineup = Struct.new( :name, :card, :sub ) do
165
- def pretty_print( printer )
166
- buf = String.new
167
- buf << self.name
168
- buf << " card=" + self.card.pretty_inspect if card
169
- buf << " sub=" + self.sub.pretty_inspect if sub
170
- printer.text( buf )
171
- end
172
- end
173
-
174
-
175
- Card = Struct.new( :name, :minute ) do
176
- def to_s
177
- buf = String.new
178
- buf << "#{self.name}"
179
- buf << " #{self.minute.to_s}" if self.minute
180
- buf
181
- end
182
-
183
- def pretty_print( printer )
184
- printer.text( to_s )
185
- end
186
- end
187
-
188
-
189
- Sub = Struct.new( :minute, :sub ) do
190
- def pretty_print( printer )
191
- buf = String.new
192
- buf << "(#{self.minute.to_s} "
193
- buf << self.sub.pretty_inspect
194
- buf << ")"
195
- printer.text( buf )
196
- end
197
- end
198
-
199
-
200
-
201
- GroupDef = Struct.new( :name, :teams ) do
202
- def pretty_print( printer )
203
- printer.text( "<GroupDef " )
204
- printer.text( self.name )
205
- printer.text( " teams=" + self.teams.pretty_inspect )
206
- printer.text( ">" )
207
- end
208
- end
209
-
210
-
211
- RoundDef = Struct.new( :name, :date, :duration ) do
212
- def pretty_print( printer )
213
- printer.text( "<RoundDef " )
214
- printer.text( self.name )
215
- printer.text( " date=" + self.date.pretty_inspect ) if date
216
- printer.text( " durattion=" + self.duration.pretty_inspect ) if duration
217
- printer.text( ">" )
218
- end
219
- end
220
-
221
- DateHeader = Struct.new( :date ) do
222
- def pretty_print( printer )
223
- printer.text( "<DateHeader " )
224
- printer.text( "#{self.date.pretty_inspect}>" )
225
- end
226
- end
227
-
228
- GroupHeader = Struct.new( :name ) do
229
- def pretty_print( printer )
230
- printer.text( "<GroupHeader " )
231
- printer.text( "#{self.name}>" )
232
- end
233
- end
234
-
235
- RoundHeader = Struct.new( :names ) do
236
- def pretty_print( printer )
237
- printer.text( "<RoundHeader " )
238
- printer.text( "#{self.names.join(', ')}>" )
239
- end
240
- end
241
-
242
- MatchLine = Struct.new( :ord, :date, :time,
243
- :team1, :team2, :score,
244
- :status,
245
- :geo,
246
- :timezone ) do ## change to geos - why? why not?
247
-
248
- def pretty_print( printer )
249
- printer.text( "<MatchLine " )
250
- printer.text( "#{self.team1} v #{self.team2}")
251
- printer.breakable
252
-
253
- members.zip(values) do |name, value|
254
- next if [:team1, :team2].include?( name )
255
- next if value.nil?
256
-
257
- printer.text( "#{name}=#{value.pretty_inspect}" )
258
- end
259
-
260
- printer.text( ">" )
261
- end
262
-
263
- end
264
-
265
- GoalLine = Struct.new( :goals1, :goals2 ) do
266
- def pretty_print( printer )
267
- printer.text( "<GoalLine " )
268
- printer.text( "goals1=" + self.goals1.pretty_inspect + "," )
269
- printer.breakable
270
- printer.text( "goals2=" + self.goals2.pretty_inspect + ">" )
271
- end
272
- end
273
-
274
- Goal = Struct.new( :player, :minutes ) do
275
- def to_s
276
- buf = String.new
277
- buf << "#{self.player}"
278
- buf << " "
279
- buf << minutes.map { |min| min.to_s }.join(' ')
280
- buf
281
- end
282
-
283
- def pretty_print( printer )
284
- printer.text( to_s )
285
- end
286
-
287
- end
288
-
289
-
290
- ##
291
- ## fix - move :og, :pen to Goal if possible - why? why not?
292
- ## or change to GoalMinute ???
293
- Minute = Struct.new( :m, :offset, :og, :pen ) do
294
- def to_s
295
- buf = String.new
296
- buf << "#{self.m}"
297
- buf << "+#{self.offset}" if self.offset
298
- buf << "'"
299
- buf << "(og)" if self.og
300
- buf << "(pen)" if self.pen
301
- buf
302
- end
303
-
304
- def pretty_print( printer )
305
- printer.text( to_s )
306
- end
307
- end
308
-
309
-
310
-
311
-
312
- def initialize(input)
313
- puts "==> input:"
314
- puts input
315
- @tokenizer = SportDb::Tokenizer.new(input)
316
- end
317
-
318
-
319
- def next_token
320
- tok = @tokenizer.next_token
321
- puts "next_token => #{tok.pretty_inspect}"
322
- tok
323
- end
324
-
325
- # on_error do |error_token_id, error_value, value_stack|
326
- # puts "Parse error on token: #{error_token_id}, value: #{error_value}"
327
- # end
328
-
329
- def parse
330
- puts "parse:"
331
- @tree = []
332
- do_parse
333
- @tree
334
- end
335
-
336
-
337
- def on_error(*args)
338
- puts
339
- puts "!! on parse error:"
340
- puts "args=#{args.pretty_inspect}"
341
- exit 1 ## exit for now - get and print more info about context etc.!!
342
- end
343
-
344
-
345
- =begin
346
- on_error do |error_token_id, error_value, value_stack|
347
- puts "Parse error on token: #{error_token_id}, value: #{error_value}"
348
- end
349
- =end
350
-
351
- end
352
-
353
-
354
65
  puts SportDb::Module::Parser.banner # say hello
355
66
 
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.5
4
+ version: 0.5.6
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-19 00:00:00.000000000 Z
11
+ date: 2025-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocos
@@ -98,6 +98,8 @@ files:
98
98
  - lib/sportdb/parser.rb
99
99
  - lib/sportdb/parser/lang.rb
100
100
  - lib/sportdb/parser/parser.rb
101
+ - lib/sportdb/parser/racc_parser.rb
102
+ - lib/sportdb/parser/racc_tree.rb
101
103
  - lib/sportdb/parser/token-date.rb
102
104
  - lib/sportdb/parser/token-score.rb
103
105
  - lib/sportdb/parser/token-status.rb