sportdb-parser 0.5.6 → 0.5.7
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/parser.rb +6 -6
- data/lib/sportdb/parser/racc_parser.rb +19 -4
- data/lib/sportdb/parser/tokenizer.rb +2 -2
- data/lib/sportdb/parser/version.rb +1 -1
- 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: eb23029ea58744e513c4a6af7112ed46a3440540cb7fe77fd2b480c58bbd5b14
|
|
4
|
+
data.tar.gz: 2aba09728fa175dbde9e270ad7250ee047639c1b8641068bcb5d159cf7e0da34
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa8dd925bdb7c3982ad18bba5f3864ee190535633043734186560e97a8692cfd589bf999e5e67fae3b23d3f625edd9608604b5fb3eb50222f84bd30a2dc97d0f
|
|
7
|
+
data.tar.gz: ac3e2c3a6c00a22e142db199c97842fad22f67f5c507456ff117ac82dde0ddcfa5ed0c4f0e0a23c78c491fb39ed9cc8d7058491c32bf645f5296ac76861b9aae
|
data/CHANGELOG.md
CHANGED
|
@@ -647,7 +647,7 @@ module_eval(<<'.,.,', 'parser.y', 199)
|
|
|
647
647
|
|
|
648
648
|
module_eval(<<'.,.,', 'parser.y', 213)
|
|
649
649
|
def _reduce_49(val, _values, result)
|
|
650
|
-
|
|
650
|
+
trace( "REDUCE => more_matches : match" )
|
|
651
651
|
result = val
|
|
652
652
|
|
|
653
653
|
result
|
|
@@ -656,7 +656,7 @@ module_eval(<<'.,.,', 'parser.y', 213)
|
|
|
656
656
|
|
|
657
657
|
module_eval(<<'.,.,', 'parser.y', 218)
|
|
658
658
|
def _reduce_50(val, _values, result)
|
|
659
|
-
|
|
659
|
+
trace( "REDUCE => more_matches : more_matches ',' match" )
|
|
660
660
|
result.push( val[2] )
|
|
661
661
|
|
|
662
662
|
result
|
|
@@ -765,7 +765,7 @@ module_eval(<<'.,.,', 'parser.y', 256)
|
|
|
765
765
|
|
|
766
766
|
module_eval(<<'.,.,', 'parser.y', 264)
|
|
767
767
|
def _reduce_67(val, _values, result)
|
|
768
|
-
|
|
768
|
+
trace( "RECUDE match_fixture" )
|
|
769
769
|
result = { team1: val[0],
|
|
770
770
|
team2: val[2] }
|
|
771
771
|
|
|
@@ -779,7 +779,7 @@ module_eval(<<'.,.,', 'parser.y', 264)
|
|
|
779
779
|
|
|
780
780
|
module_eval(<<'.,.,', 'parser.y', 275)
|
|
781
781
|
def _reduce_70(val, _values, result)
|
|
782
|
-
|
|
782
|
+
trace( "REDUCE => match_result : TEXT SCORE TEXT" )
|
|
783
783
|
result = { team1: val[0],
|
|
784
784
|
team2: val[2],
|
|
785
785
|
score: val[1][1]
|
|
@@ -791,7 +791,7 @@ module_eval(<<'.,.,', 'parser.y', 275)
|
|
|
791
791
|
|
|
792
792
|
module_eval(<<'.,.,', 'parser.y', 283)
|
|
793
793
|
def _reduce_71(val, _values, result)
|
|
794
|
-
|
|
794
|
+
trace( "REDUCE => match_result : match_fixture SCORE" )
|
|
795
795
|
result = { score: val[1][1] }.merge( val[0] )
|
|
796
796
|
|
|
797
797
|
result
|
|
@@ -925,7 +925,7 @@ module_eval(<<'.,.,', 'parser.y', 379)
|
|
|
925
925
|
|
|
926
926
|
module_eval(<<'.,.,', 'parser.y', 384)
|
|
927
927
|
def _reduce_89(val, _values, result)
|
|
928
|
-
|
|
928
|
+
trace( "REDUCE empty_line" )
|
|
929
929
|
result
|
|
930
930
|
end
|
|
931
931
|
.,.,
|
|
@@ -5,11 +5,15 @@
|
|
|
5
5
|
class RaccMatchParser
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def initialize( txt )
|
|
8
|
+
def initialize( txt, debug: false )
|
|
9
9
|
## puts "==> txt:"
|
|
10
10
|
## puts txt
|
|
11
11
|
|
|
12
12
|
parser = SportDb::Parser.new
|
|
13
|
+
### todo:
|
|
14
|
+
## - pass along debug flag
|
|
15
|
+
## - use tokenize_with_errors and add/collect tokenize errors
|
|
16
|
+
|
|
13
17
|
@tokens = parser.tokenize( txt )
|
|
14
18
|
## pp @tokens
|
|
15
19
|
|
|
@@ -22,11 +26,22 @@ def initialize( txt )
|
|
|
22
26
|
end
|
|
23
27
|
end
|
|
24
28
|
end
|
|
25
|
-
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def debug( value ) @debug = value; end
|
|
32
|
+
def debug?() @debug == true; end
|
|
33
|
+
|
|
34
|
+
## debug - trace / print message
|
|
35
|
+
def trace( msg )
|
|
36
|
+
puts " [parse] " + msg if debug?
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
26
41
|
|
|
27
42
|
def next_token
|
|
28
43
|
tok = @tokens.shift
|
|
29
|
-
|
|
44
|
+
trace( "next_token => #{tok.pretty_inspect}" )
|
|
30
45
|
tok
|
|
31
46
|
end
|
|
32
47
|
|
|
@@ -35,7 +50,7 @@ def initialize( txt )
|
|
|
35
50
|
# end
|
|
36
51
|
|
|
37
52
|
def parse
|
|
38
|
-
|
|
53
|
+
trace( "start parse:" )
|
|
39
54
|
@tree = []
|
|
40
55
|
do_parse
|
|
41
56
|
@tree
|
|
@@ -331,7 +331,7 @@ def _tokenize_line( line, debug: false )
|
|
|
331
331
|
when '-' then [:'-']
|
|
332
332
|
when '.' then
|
|
333
333
|
## switch back to top-level mode!!
|
|
334
|
-
puts " LEAVE PROP_RE MODE, BACK TO TOP_LEVEL/RE"
|
|
334
|
+
puts " LEAVE PROP_RE MODE, BACK TO TOP_LEVEL/RE" if debug
|
|
335
335
|
@re = RE
|
|
336
336
|
[:'.']
|
|
337
337
|
else
|
|
@@ -352,7 +352,7 @@ def _tokenize_line( line, debug: false )
|
|
|
352
352
|
elsif m[:prop_key]
|
|
353
353
|
## switch context to PROP_RE
|
|
354
354
|
@re = PROP_RE
|
|
355
|
-
puts " ENTER PROP_RE MODE"
|
|
355
|
+
puts " ENTER PROP_RE MODE" if debug
|
|
356
356
|
[:PROP, m[:key]]
|
|
357
357
|
elsif m[:text]
|
|
358
358
|
[:TEXT, m[:text]] ## keep pos - why? why not?
|
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.7
|
|
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-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: cocos
|