sportdb-parser 0.6.10 → 0.6.12

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.
@@ -169,10 +169,12 @@ end
169
169
 
170
170
 
171
171
  MatchLine = Struct.new( :ord, :date, :time, :wday,
172
- :team1, :team2, :score,
173
- :status,
172
+ :team1, :team2,
173
+ :score, :score_note,
174
+ :status,
174
175
  :geo,
175
- :timezone ) do ## change to geos - why? why not?
176
+ :timezone,
177
+ :note ) do ## change to geos - why? why not?
176
178
 
177
179
  def pretty_print( printer )
178
180
  printer.text( "<MatchLine " )
@@ -90,63 +90,104 @@ NOTE_RE = %r{
90
90
  # add "top-level" NB: version
91
91
  ## with full (end-of) line note - why? why not?
92
92
  |
93
- (?: originally[ ])? scheduled
94
- ## e.g. [originally scheduled to play in Mexico City]
95
- |
96
93
  rescheduled
97
- ## e.g. [Rescheduled due to earthquake occurred in Mexico on September 19]
94
+ ## e.g. [rescheduled due to earthquake occurred in Mexico on September 19]
95
+ |
96
+ declared
97
+ ## e.g. [declared void]
98
98
  |
99
99
  remaining
100
100
  ## e.g. [remaining 79']
101
101
  ## [remaining 84']
102
102
  ## [remaining 59']
103
103
  ## [remaining 5']
104
- |
105
- played
106
- ## e.g. [played in Macaé-RJ]
107
- ## [played in Caxias do Sul-RS]
108
- ## [played in Sete Lagoas-MG]
109
- ## [played in Uberlândia-MG]
110
- ## [played in Brasília-DF]
111
- ## [played in Vöcklabruck]
112
- ## [played in Pasching]
113
- |
114
- declared
115
- ## e.g. [declared void]
116
- |
117
- inter-group
118
- ## e.g. [inter-group A-B]
119
- ## [inter-group C-D]
120
104
  )
121
105
  [ ]
122
106
  [^\]]+? ## slurp all to next ] - (use non-greedy)
123
107
  )
108
+ )
109
+ \]
110
+ }ix
111
+
112
+
113
+
114
+ SCORE_NOTE_RE = %r{
115
+ \[
116
+ (?<score_note>
117
+ (?: # plain aet e.g. [aet]
118
+ aet | a\.e\.t\. |
119
+ after [ ] extra [ -] time
120
+ )
121
+ |
122
+ (?: # plain penalties e.g. [3-2 pen]
123
+ \d{1,2}-\d{1,2}
124
+ [ ]* (?: p|pen )
125
+ )
126
+ |
127
+ (?: # plain aet with penalties e.g. [aet; 4-3 pen] or [aet, 4-3p]
128
+ aet [ ]* [,;]
129
+ [ ]*
130
+ \d{1,2}-\d{1,2}
131
+ [ ]* (?: p|pen )
132
+ )
124
133
  |
125
- (?:
126
- ## starting with in - do NOT allow digits
127
- ## name starting with in possible - why? why not?
128
- in[ ]
129
- [^0-9\]]+?
130
- ## e.g. [In Estadio La Corregidora]
131
- ## [in Unidad Deportiva Centenario]
132
- ## [in Estadio Olímpico Universitario]
133
- ## [in Estadio Victoria]
134
- ## [in UD José Brindis]
135
- ## [in Colomos Alfredo "Pistache" Torres stadium]
136
- )
137
- |
138
134
  (?:
139
135
  ## e.g. Spain wins on penalties
140
136
  ## 1860 München wins on penalties etc.
141
137
  ## must start with digit 1-9 or letter
142
138
  ## todo - add more special chars - why? why not?
143
- [1-9\p{L}][0-9\p{L} .-]+?
144
- [ ]wins[ ]on[ ]penalties
145
- [^\]]*? ## use non-greedy
146
- )
147
- )
148
- \]
149
- }ix
139
+ ##
140
+ (?:
141
+ aet [ ]* ## allow space here - why? why not
142
+ [,;][ ]
143
+ )?
144
+
145
+ (?:
146
+ (?: # opt 1 - no team listed/named - requires score
147
+ (?: won|wins? ) [ ] ## note - allow won,win or wins
148
+ (?: ## score
149
+ \d{1,2}-\d{1,2}
150
+ [ ]
151
+ )
152
+ on [ ] (?: pens | penalties |
153
+ aggregate )
154
+ )
155
+ |
156
+ (?: # opt 2 - team required; score optional
157
+ (?: ## team required
158
+ [1-9\p{L}][0-9\p{L} .-]+?
159
+ [ ]
160
+ )
161
+ (?: won|wins? ) [ ] ## won/win/wins
162
+ (?: ## score optional
163
+ \d{1,2}-\d{1,2}
164
+ [ ]
165
+ )?
166
+ on [ ] (?: pens | penalties |
167
+ aggregate )
168
+ ### [^\]]*? ## allow more? use non-greedy
169
+ )
170
+ ))
171
+ |
172
+ (?: ## e.g. agg 3-2 etc.
173
+ agg [ ] \d{1,2}-\d{1,2}
174
+ )
175
+ |
176
+ (?: ## e.g. agg 4-4, Ajax win on away goals
177
+ (?: ## agg 4-4, optional for now - why? why not?
178
+ agg [ ] \d{1,2}-\d{1,2}
179
+ [ ]*[,;][ ]
180
+ )?
181
+ (?: ## team required
182
+ [1-9\p{L}][0-9\p{L} .-]+?
183
+ [ ]
184
+ )
185
+ (?: won|wins? ) [ ] # won/win/wins
186
+ on [ ] away [ ] goals
187
+ )
188
+ ) # score_note ref
189
+ \]
190
+ }ix
150
191
 
151
192
 
152
193
  end # class Lexer
@@ -133,6 +133,7 @@ ANY_RE = %r{
133
133
 
134
134
  RE = Regexp.union(
135
135
  STATUS_RE,
136
+ SCORE_NOTE_RE,
136
137
  NOTE_RE,
137
138
  DURATION_RE, # note - duration MUST match before date
138
139
  DATE_RE, ## note - date must go before time (e.g. 12.12. vs 12.12)
@@ -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 = 6
7
- PATCH = 10
7
+ PATCH = 12
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
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.6.10
4
+ version: 0.6.12
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-03-03 00:00:00.000000000 Z
11
+ date: 2025-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocos
@@ -85,6 +85,7 @@ extra_rdoc_files:
85
85
  - config/rounds_es.txt
86
86
  - config/rounds_misc.txt
87
87
  - config/rounds_pt.txt
88
+ - config/zones_en.txt
88
89
  files:
89
90
  - CHANGELOG.md
90
91
  - Manifest.txt
@@ -95,6 +96,7 @@ files:
95
96
  - config/rounds_es.txt
96
97
  - config/rounds_misc.txt
97
98
  - config/rounds_pt.txt
99
+ - config/zones_en.txt
98
100
  - lib/sportdb/parser.rb
99
101
  - lib/sportdb/parser/lang.rb
100
102
  - lib/sportdb/parser/lexer.rb