fbtxt-parser 0.9.0 → 0.9.1

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -1
  3. data/Manifest.txt +0 -37
  4. data/README.md +4 -8
  5. data/Rakefile +2 -1
  6. data/lib/fbtxt/parser/parse_tree-match.rb +3 -1
  7. data/lib/fbtxt/parser/parse_tree-props.rb +39 -10
  8. data/lib/fbtxt/parser/parser-top.rb +0 -9
  9. data/lib/fbtxt/parser/parser.rb +879 -843
  10. data/lib/fbtxt/parser/version.rb +1 -1
  11. data/lib/fbtxt/parser.rb +14 -82
  12. metadata +18 -41
  13. data/lib/fbtxt/parser/debuggable.rb +0 -53
  14. data/lib/fbtxt/parser/lexer-logger.rb +0 -20
  15. data/lib/fbtxt/parser/lexer-on_goal.rb +0 -167
  16. data/lib/fbtxt/parser/lexer-on_group_def.rb +0 -31
  17. data/lib/fbtxt/parser/lexer-on_prop_lineup.rb +0 -79
  18. data/lib/fbtxt/parser/lexer-on_prop_misc.rb +0 -123
  19. data/lib/fbtxt/parser/lexer-on_prop_penalties.rb +0 -40
  20. data/lib/fbtxt/parser/lexer-on_round_def.rb +0 -37
  21. data/lib/fbtxt/parser/lexer-on_top.rb +0 -133
  22. data/lib/fbtxt/parser/lexer-prep_doc.rb +0 -131
  23. data/lib/fbtxt/parser/lexer-prep_line.rb +0 -63
  24. data/lib/fbtxt/parser/lexer-tokenize.rb +0 -468
  25. data/lib/fbtxt/parser/lexer.rb +0 -231
  26. data/lib/fbtxt/parser/lexer_buffer.rb +0 -68
  27. data/lib/fbtxt/parser/lexer_token.rb +0 -126
  28. data/lib/fbtxt/parser/token-date--helpers.rb +0 -130
  29. data/lib/fbtxt/parser/token-date--names.rb +0 -108
  30. data/lib/fbtxt/parser/token-date.rb +0 -200
  31. data/lib/fbtxt/parser/token-date_duration.rb +0 -171
  32. data/lib/fbtxt/parser/token-geo.rb +0 -134
  33. data/lib/fbtxt/parser/token-goals--helpers.rb +0 -114
  34. data/lib/fbtxt/parser/token-goals.rb +0 -306
  35. data/lib/fbtxt/parser/token-group.rb +0 -29
  36. data/lib/fbtxt/parser/token-note.rb +0 -40
  37. data/lib/fbtxt/parser/token-prop.rb +0 -309
  38. data/lib/fbtxt/parser/token-prop_name.rb +0 -83
  39. data/lib/fbtxt/parser/token-round.rb +0 -88
  40. data/lib/fbtxt/parser/token-score--helpers.rb +0 -189
  41. data/lib/fbtxt/parser/token-score.rb +0 -60
  42. data/lib/fbtxt/parser/token-score_full.rb +0 -331
  43. data/lib/fbtxt/parser/token-score_fuller.rb +0 -434
  44. data/lib/fbtxt/parser/token-score_legs.rb +0 -59
  45. data/lib/fbtxt/parser/token-status.rb +0 -192
  46. data/lib/fbtxt/parser/token-status_inline.rb +0 -112
  47. data/lib/fbtxt/parser/token-text.rb +0 -221
  48. data/lib/fbtxt/parser/token-time.rb +0 -144
  49. data/lib/fbtxt/parser/token.rb +0 -224
@@ -1,171 +0,0 @@
1
- module Fbtxt
2
- class Lexer
3
-
4
-
5
-
6
-
7
- ###
8
- # date duration
9
- # use - or + as separator
10
- # in theory plus( +) only if dates
11
- # are two days next to each other
12
- #
13
- # otherwise define new dates type in the future? why? why not?
14
- #
15
- # check for plus (+) if dates are next to each other (t+1) - why? why not?
16
-
17
- #
18
- # Sun Jun 23 - Wed Jun 26 -- YES
19
- # Jun 23 - Jun 26 -- YES
20
- # Jun 25 - 26 - why? why not??? - YES - see blow variant iii!!!
21
-
22
- # Tue Jun 25 + Wed Jun 26 -- NO
23
- # Jun 25 + Jun 26 -- NO
24
- # Jun 25 .. 26 - why? why not???
25
- # Jun 25 to 26 - why? why not???
26
- # Jun 25 + 26 - add - why? why not???
27
- # Sun-Wed Jun 23-26 - add - why? why not???
28
- # Wed+Thu Jun 26+27 2024 - add - why? why not???
29
- #
30
- # maybe use comma and plus for list of dates
31
- # Tue Jun 25, Wed Jun 26, Thu Jun 27 ??
32
- # Tue Jun 25 + Wed Jun 26 + Thu Jun 27 ??
33
- #
34
- # add back optional comma (before) year - why? why not?
35
- #
36
-
37
-
38
- ##
39
- # todo add plus later on - why? why not?
40
- ### todo/fix add optional comma (,) before year
41
-
42
- ### regex note/tip/remindr - \b () \b MUST always get enclosed in parantheses
43
- ## because alternation (|) has lowest priority/binding
44
-
45
-
46
- DURATION_I_RE = %r{
47
- (?<duration>
48
- \b
49
- (?:
50
- ## optional day name
51
- ((?<day_name1>#{DAY_NAMES})
52
- [ ]
53
- )?
54
- (?<month_name1>#{MONTH_NAMES})
55
- [ ]
56
- (?<day1>\d{1,2})
57
- ## optional year
58
- ( ,? # optional comma
59
- [ ]
60
- (?<year1>\d{4})
61
- )?
62
-
63
- ## support + and - (add .. or such - why??)
64
- [ ]* - [ ]*
65
-
66
- ## optional day name
67
- ((?<day_name2>#{DAY_NAMES})
68
- [ ]
69
- )?
70
- (?<month_name2>#{MONTH_NAMES})
71
- [ ]
72
- (?<day2>\d{1,2})
73
- ## optional year
74
- ( ,? # optional comma
75
- [ ]
76
- (?<year2>\d{4})
77
- )?
78
- )
79
- \b
80
- )}ix
81
-
82
-
83
-
84
- # FIX - remove this variant
85
- # "standardize on month day [year]" !!!!
86
-
87
- =begin
88
- ###
89
- # variant ii
90
- # e.g. 26 July - 27 July
91
- # 26 July,
92
- XXX_DURATION_II_RE = %r{
93
- (?<duration>
94
- \b
95
- (?
96
- ## optional day name
97
- ((?<day_name1>#{DAY_NAMES})
98
- [ ]
99
- )?
100
- (?<day1>\d{1,2})
101
- [ ]
102
- (?<month_name1>#{MONTH_NAMES})
103
- ## optional year
104
- (
105
- [ ]
106
- (?<year1>\d{4})
107
- )?
108
-
109
- ## support + and - (add .. or such - why??)
110
- [ ]*[-][ ]*
111
-
112
- ## optional day name
113
- ((?<day_name2>#{DAY_NAMES})
114
- [ ]
115
- )?
116
- (?<day2>\d{1,2})
117
- [ ]
118
- (?<month_name2>#{MONTH_NAMES})
119
- ## optional year
120
- ( [ ]
121
- (?<year2>\d{4})
122
- )?
123
- )
124
- \b
125
- )}ix
126
- =end
127
-
128
-
129
- # variant ii
130
- # add support for shorthand
131
- # August 16-18, 2011
132
- # September 13-15, 2011
133
- # October 18-20, 2011
134
- # March 6-8 2012
135
- # March 6-8
136
- #
137
- # - add support for August 16+17 or such (and check 16+18)
138
- # use <op> to check if day2 is a plus or range or such - why? why not?
139
-
140
- DURATION_II_RE = %r{
141
- (?<duration>
142
- \b
143
- (?:
144
- (?<month_name1>#{MONTH_NAMES})
145
- [ ]
146
- (?<day1>\d{1,2})
147
- -
148
- (?<day2>\d{1,2})
149
- (?:
150
- ,? ## optional comma
151
- [ ]
152
- (?<year1>\d{4})
153
- )? ## optional year
154
- )
155
- \b
156
- )}ix
157
-
158
-
159
-
160
- #############################################
161
- # map tables
162
- # note: order matters; first come-first matched/served
163
- DURATION_RE = Regexp.union(
164
- DURATION_I_RE,
165
- DURATION_II_RE,
166
- )
167
-
168
-
169
-
170
- end # class Lexer
171
- end # module Fbtxt
@@ -1,134 +0,0 @@
1
- module Fbtxt
2
- class Lexer
3
-
4
-
5
- ##
6
- # allow Cote'd Ivoir or such
7
- ## e.g. add '
8
-
9
-
10
- ## todo/fix - make geo text regex more generic
11
- ## only care about two space rule
12
-
13
-
14
- GEO_TEXT_RE = %r{
15
- ## must start with alpha (allow unicode letters!!)
16
- (?<text>
17
- ## positive lookbehind - for now space (or beginning of line - for testing) only
18
- ## (MUST be fixed number of chars - no quantifier e.g. +? etc.)
19
- (?<= [ ,›>\[\]]|^)
20
- (?:
21
- # opt 1 - start with alpha
22
- \p{L}+ ## all unicode letters (e.g. [a-z])
23
- |
24
- # opt 2 - start with num!! -
25
- \d+ # check for num lookahead (MUST be space or dot)
26
- ## MAY be followed by (optional space) !
27
- ## MUST be follow by a to z!!!!
28
- [ ]? ## make space optional too - why? why not?
29
- ## yes - eg. 1st, 2nd, 5th etc.
30
- \p{L}+
31
- |
32
- ## opt 3 - add another weirdo case
33
- ## e.g. 's Gravenwezel-Schilde
34
- ## add more letters (or sequences here - why? why not?)
35
- '\p{L}+
36
- )
37
-
38
- ##
39
- ## todo/check - find a different "more intuitive" regex/rule if possible?
40
- ## for single spaces only (and _/ MUST not be surround by spaces)
41
-
42
- (?:
43
- (?:
44
- [ ]? # only single (inline) space allowed - double spaces are breaks!!!
45
- (?:
46
- \p{L} | \d | [.&'°]
47
- |
48
- (?: (?<! [ ]) ## no space allowed before (but possible after)
49
- [-]
50
- )
51
- |
52
- (?: (?<! [ ]) ## no spaces allowed around these characters
53
- [_/]
54
- (?! [ ])
55
- )
56
- )+
57
- )
58
- |
59
- ## for now allow auto-add optional
60
- ## parenthesis enclosed closed text
61
- ## e.g. Dublin (Dalymount Park)
62
- ## Bucuresti (23 August)
63
- ## Paris (Parc des Princes)
64
- ## Ost-Berlin (Walter-Ulbricht)
65
- ## Athinai (OAKA - Maroussi)
66
- ##
67
- ## or Valencia (Spain) or Solna
68
- (?:
69
- [ ]
70
- \(
71
- [^()\[\],;:›<>]+ ## todo - add more special chars
72
- ## maybe list only allowed ones??
73
- ## make pattern more strict - why? why not?
74
- \)
75
- )
76
- )*
77
-
78
-
79
- ## must NOT end with space or dash(-)
80
- ## todo/fix - possible in regex here
81
- ## only end in alphanum a-z0-9 (not dot or & ???)
82
-
83
- ## add lookahead/lookbehind
84
- ## must be space!!!
85
- ## (or comma or start/end of string)
86
- ## kind of \b !!!
87
- ## POSITIVE lookahead
88
- (?=[ ,›>\[\]]|$)
89
-
90
- )
91
- }ix
92
-
93
-
94
-
95
-
96
-
97
-
98
- ## note - add "hacky" check for comma that is followed by a prop(erty)
99
- ##
100
- ## make sure to NOT match
101
- ## props e.g. att: 18000
102
- ## July 10 @ Paris, Parc des Princes, att: 18000
103
- ## July 10 @ Paris, Parc des Princes, att: 18000
104
- ##
105
-
106
-
107
- GEO_END_RE = %r{
108
- (?<geo_end>
109
- ,
110
- )
111
- ## POSITIVE lookahead for props
112
- ## todo/fix - use generic [a-z]+ - why? why not?
113
- (?=
114
- [ ]* ## optional spaces
115
- (?: attendance|att
116
- | referee?s|refs?
117
- )
118
- :
119
- )
120
- }ix
121
-
122
-
123
-
124
-
125
- GEO_RE = Regexp.union(
126
- SPACES_RE,
127
- GEO_END_RE,
128
- GEO_TEXT_RE,
129
- / (?<sym> [,›>\[▪] ) /x,
130
- ANY_RE,
131
- )
132
-
133
- end # class Lexer
134
- end # module Fbtxt
@@ -1,114 +0,0 @@
1
- module Fbtxt
2
- class Lexer
3
-
4
-
5
-
6
- def self._build_goal_minute( m )
7
- minute = {}
8
-
9
- minute[:m] = m[:value].to_i(10) ## always required
10
-
11
- ## stoppage/injury time (offset)
12
- minute[:offset] = m[:value2].to_i(10) if m[:value2]
13
-
14
- minute[:og] = true if m[:og]
15
- minute[:pen] = true if m[:pen]
16
- minute[:freekick] = true if m[:fk]
17
- minute[:header] = true if m[:hdr]
18
-
19
- minute[:secs] = m[:secs].to_i(10) if m[:secs]
20
-
21
- minute
22
- end
23
-
24
- def self._build_goal_minute_na( m )
25
- minute = {}
26
-
27
- minute[:m] = '?' ## or use nil or 999 or -1 or ???
28
-
29
- minute[:og] = true if m[:og]
30
- minute[:pen] = true if m[:pen]
31
- minute[:freekick] = true if m[:fk]
32
- minute[:header] = true if m[:hdr]
33
-
34
- minute
35
- end
36
-
37
-
38
-
39
- def self._build_minute( m )
40
- minute = {}
41
- minute[:m] = m[:value].to_i(10) ## always required
42
-
43
- ## stoppage/injury time (offset)
44
- minute[:offset] = m[:value2].to_i(10) if m[:value2]
45
-
46
- minute
47
- end
48
-
49
-
50
- def self._build_goal_count( m )
51
- count = {}
52
- count[:count] = m[:value].to_i(10) if m[:value]
53
- count[:og] = m[:og_value] ? m[:og_value].to_i(10) : 1 if m[:og] ## check flag
54
- count[:pen] = m[:pen_value] ? m[:pen_value].to_i(10) : 1 if m[:pen] ## check flag
55
- count
56
- end
57
-
58
- def self._build_goal_type( m )
59
- goal = {}
60
- goal[:og] = true if m[:og]
61
- goal[:pen] = true if m[:pen]
62
- goal[:freekick] = true if m[:fk]
63
- goal[:header] = true if m[:hdr]
64
- goal
65
- end
66
-
67
-
68
- def _build_goal_minute( m ) self.class._build_goal_minute( m ); end
69
- def _build_goal_minute_na( m ) self.class._build_goal_minute_na( m ); end
70
- def _build_minute( m ) self.class._build_minute( m ); end
71
- def _build_goal_count( m ) self.class._build_goal_count( m ); end
72
- def _build_goal_type( m ) self.class._build_goal_type( m ); end
73
-
74
-
75
-
76
-
77
-
78
- ###
79
- # parse helpers
80
-
81
- def self._parse_goal_minute( str )
82
- ## note - strip - leading/trailing spaces
83
- m = GOAL_MINUTE_RE.match( str.strip )
84
- if m && m.pre_match == '' && m.post_match == ''
85
- _build_goal_minute( m )
86
- elsif m
87
- ## note - match BUT not anchored to start and end-of-string!!!
88
- ## report, error somehow??
89
- nil
90
- else
91
- nil ## no match - return nil
92
- end
93
- end
94
-
95
- def self._parse_goal_count( str )
96
- ## note - strip - leading/trailing spaces
97
- m = GOAL_COUNT_RE.match( str.strip )
98
- if m && m.pre_match == '' && m.post_match == ''
99
- _build_goal_count( m )
100
- elsif m
101
- ## note - match BUT not anchored to start and end-of-string!!!
102
- ## report, error somehow??
103
- nil
104
- else
105
- nil ## no match - return nil
106
- end
107
- end
108
-
109
-
110
-
111
-
112
-
113
- end # class Lexer
114
- end # module Fbtxt
@@ -1,306 +0,0 @@
1
- module Fbtxt
2
- class Lexer
3
-
4
-
5
- ######################################################
6
- ## goal mode
7
- ## note - must be enclosed in ()!!!
8
- ##
9
- ## todo - add () in basics - why? why not?
10
-
11
-
12
-
13
-
14
- ## note - assume lines starting with opening ( are goal lines!!!!
15
- ## note - use \A (instead of ^) - \A strictly matches the start of the string.
16
- ##
17
- ## note - check for negative lookahead
18
- ## to exclude ord (numbers) e.g. (1), (42), etc.!!!
19
- ##
20
- ## todo/fix -- exclude (a), (h), (n) - TEAM_AWAY, TEAM_HOME, TEAM_NEUTRAL tokens!!
21
-
22
- START_GOAL_LINE_RE = %r{
23
- \A
24
- [ ]* ## ignore leading spaces (if any)
25
- \(
26
-
27
- # check NEGATIVE lookahead
28
- (?!
29
- ## exclude (a), (h), (n)
30
- ## TEAM_AWAY, TEAM_HOME, TEAM_NEUTRAL
31
- (?: a|h|n )
32
- \)
33
- )
34
-
35
- }xi
36
-
37
-
38
-
39
- #############
40
- ## check for goal compat(ility) "legacy" line
41
- ## e.g.
42
- ## (6' Puskás 0-1, 9' Czibor 0-2, 11' Morlock 1-2, 18' Rahn 2-2,
43
- ## 84' Rahn 3-2)
44
- ## (6 Puskás 0-1, 9 Czibor 0-2, 11 Morlock 1-2, 18 Rahn 2-2,
45
- ## 84 Rahn 3-2)
46
-
47
-
48
- START_GOAL_LINE_COMPAT_RE = %r{
49
- \A
50
- [ ]* ## ignore leading spaces (if any)
51
- \(
52
-
53
- ## (i) check NEGATIVE lookahead
54
- ## exclude score e.g. 1-1 etc.
55
- (?! [ ]* \b \d-\d \b)
56
-
57
- ## (ii) check POSITIVE lookahead
58
- (?= [ ]*
59
- \d{1,3}
60
- '? ## optional minute marker
61
- (?: \+
62
- \d{1,2}
63
- '? ## optional minute marker
64
- )?
65
- )
66
- }xi
67
-
68
-
69
-
70
- ###
71
- ## check for goal line (alternate syntax)
72
- ## (1-0 Player, 1-1 Player, ...)
73
- # must start-off OR yes, include score
74
- ##
75
- ## note - allow "centered" style e.g.
76
- ## ( Player 44' (p) 1-0
77
- ## 1-1 Player 64' )
78
- START_GOAL_LINE_ALT_RE = %r{
79
- \A
80
- [ ]* ## ignore leading spaces (if any)
81
- \(
82
-
83
- # check POSITIVE lookahead
84
- (?= .*? ## note - non-greedy
85
- \b \d-\d \b ## score e.g. 0-1
86
- )
87
- }xi
88
-
89
-
90
-
91
-
92
-
93
-
94
-
95
- ###
96
- # note - alternate goal separator dash (-) MUST have leading and trailing space!!!
97
- # e.g. (Metzger 83 - Krämer 29, 88, Cichy 33, Rahn 37)
98
- # e.g. (Metzger - Krämer (2), Cichy, Rahn)
99
- # (Brunnenmeier 17 - Gerwien 74)
100
- # (Brunnenmeier - Gerwien)
101
- # that is, NOT allowed
102
- # e.g. (Metzger 83-Krämer 29, 88, Cichy 33, Rahn 37)
103
- # (Brunnenmeier 17-Gerwien 74)
104
- # (Brunnenmeier-Gerwien)
105
- #
106
- # note - allow split by - e.g.
107
- # Frankfurt 4-2 Schalke (Kreß 45, Solz 55, Trimhold 58, Huberts 73 p -
108
- # Berz 7, Herrmann 74)
109
-
110
-
111
- GOAL_SEP_ALT_RE = %r{
112
- (?<goal_sep_alt>
113
- (?<=[ ]) ## positive lookbehind - space required
114
- -
115
- (?=[ ]|\z) ## positive lookahead - speace required
116
- )}x
117
-
118
-
119
- ## e.g. (2)
120
- ## (2/p), (2/pen.), (3/2p), (3/ 2 pen.)
121
- ## -or- (2,1pen), (3, 2 pens)
122
- ##
123
- ## (p), (pen.) (2 pen.), (2p)
124
- ## (og), (o.g.),
125
- ## (2og), (2 o.g.), (2ogs)
126
- #
127
- ##
128
-
129
- GOAL_COUNT_RE = %r{
130
- (?<goal_count>
131
- \(
132
- (?:
133
- ## opt penalties
134
- (?<pen>
135
- (?: (?<pen_value> \d{1,2}) [ ]? )?
136
- (?:pens|pen\.?|p)
137
- )
138
- |
139
- ## opt own goals (og)
140
- (?<og>
141
- (?: (?<og_value> \d{1,2}) [ ]? )?
142
- (?:ogs?|o\.g\.|o)
143
- )
144
- |
145
- ## opt fallback - classic count/number
146
- (?: (?<value> [1-9])
147
- ## check for option penalties
148
- (?<pen>
149
- [,/] [ ]*
150
- (?: (?<pen_value> \d{1,2}) [ ]? )?
151
- (?:pens|pen\.?|p)
152
- )?
153
- )
154
- )
155
- \)
156
- )}ix
157
-
158
-
159
-
160
-
161
- ##
162
- ## note - inline \b check in MINUTE_RE excludes
163
- ## 85pen or 90+4pen or 38p
164
- ## (possible and NOT excluded in GOAL_MINUTE_RE !!!)
165
- ##
166
- ## minute with optional stoppage (offset)
167
-
168
- MINUTE_RE = %r{
169
- (?<minute>
170
- \b
171
- (?<value>\d{1,3}) ## constrain numbers to 0 to 999!!!
172
- \b
173
- '? ## optional minute marker
174
-
175
- (?: \+ (?<value2>\d{1,2})
176
- \b
177
- '? ## optional minute marker
178
- )?
179
- )
180
- }ix
181
-
182
-
183
-
184
- ##
185
- ## keep separate? or add simply inside GOAL_MINUTE_RE - why? why not?
186
- ## fix-fix-fix - move into GOAL_MINUTE_RE !!!
187
-
188
- GOAL_MINUTE_NA_RE = %r{
189
- (?<goal_minute_na>
190
-
191
- # positive lookbehind
192
- (?<=[ ,;])
193
-
194
- (?<value> \?{1,2})
195
- '? ## optional minute marker
196
- ## note - add goal minute qualifiers here inline!!!
197
- (?:
198
- (?: [ ]? (?<og> (?: \((?:og|o\.g\.|o)\)) ## allow (og)
199
- |
200
- (?: (?:og|o\.g\.|o)) ## allow plain og
201
- )
202
- )
203
- |
204
- (?: [ ]? (?<pen> (?: \((?:pen\.?|p)\)) ## allow ()
205
- |
206
- (?: (?:pen\.?|p))
207
- )
208
- )
209
- |
210
- ## add experimental header qualifier
211
- (?: [ ]? (?<hdr> \( (?:hdr\.?|h ) \) | (?: hdr\.?|h ) ))
212
- |
213
- ## add experimental free kick qualifier
214
- (?: [ ]? (?<fk> \( (?:fk\.?|f ) \) | (?: fk\.?|f) ))
215
- )?
216
-
217
- ## note - check positive lookahead
218
- (?=[ ,;)]|$)
219
- )
220
- }ix
221
-
222
-
223
- ## goal types
224
- # (pen.) or (pen) or (p.) or (p)
225
- ## (o.g.) or (og)
226
- ## todo/check - keep case-insensitive
227
- ## or allow OG or P or PEN or
228
- ## only lower case - why? why not?
229
- ##
230
- ## add (gg) for golden goal - why? why not?
231
- ## add (sg) for silver goal - why? why not??
232
-
233
- GOAL_MINUTE_RE = %r{
234
- (?<goal_minute>
235
- \b
236
- (?<value>\d{1,3}) ## constrain numbers to 0 to 999!!!
237
- '? ## optional minute marker
238
-
239
- (?: \+ (?<value2>\d{1,2})
240
- '? ## optional minute marker
241
- )?
242
-
243
- ## note - add goal minute qualifiers here inline!!!
244
- (?:
245
- (?: [ ]? (?<og> (?: \((?:og|o\.g\.|o)\)) ## allow (og)
246
- |
247
- (?: (?:og|o\.g\.|o)) ## allow plain og
248
- )
249
- )
250
- |
251
- (?: [ ]? (?<pen> (?: \((?:pen\.?|p)\)) ## allow ()
252
- |
253
- (?: (?:pen\.?|p))
254
- )
255
- )
256
- |
257
- ## add experimental header qualifier
258
- (?: [ ]? (?<hdr> \( (?:hdr\.?|h ) \) | (?: hdr\.?|h ) ))
259
- |
260
- ## add experimental free kick qualifier
261
- (?: [ ]? (?<fk> \( (?:fk\.?|f ) \) | (?: fk\.?|f) ))
262
- )?
263
-
264
- ## add experimental seconds
265
- ## e.g. (95 secs) or (95sec) etc.
266
- (?: [ ]* \(
267
- (?<secs>\d{1,3})
268
- [ ]?secs?
269
- \)
270
- )?
271
- )
272
-
273
- ## note - check positive lookahead
274
- (?=[ ,;)]|$)
275
- }ix
276
-
277
-
278
-
279
-
280
-
281
- ###
282
- ## more regex for goal alt
283
-
284
-
285
- GOAL_TYPE_RE = %r{
286
- (?<goal_type>
287
- \(
288
- (?:
289
- (?<og> og|o\.g\.|o )
290
- |
291
- (?<pen> pen\.?|p )
292
- |
293
- ## add experimental header qualifier
294
- (?<hdr> hdr\.?|h )
295
- |
296
- ## add experimental free kick qualifier
297
- (?<fk> fk\.?|f )
298
- )
299
- \)
300
- )}xi
301
-
302
-
303
-
304
-
305
- end # class Lexer
306
- end # module Fbtxt