sportdb-parser 0.6.8 → 0.6.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8d65c02b835d52ddb9f7fd61bd44dd6ff4392bd7ddcef751dcc2ec7a0934065
4
- data.tar.gz: 92b797acbb7c1652ea50910207f86ae53fa5097bec9acaadeae96e161b005aa2
3
+ metadata.gz: 6d2e6a1f243cdd9e255d659ffd616e875d3baf978edada8e663eb54e9bff35df
4
+ data.tar.gz: 76ddc2f54d6ac9e117963e15ae5fa3cadfbaebce8d942021efcd849aaed7811d
5
5
  SHA512:
6
- metadata.gz: dee3a2ff615fe8789593db7f627d00a1f3931d18bc150af50e75c4d68b9ad74c87dc359ebfe4268a5f974de7c681b4ddfdb4cd87e66b69b86c4fd6633c1b98a5
7
- data.tar.gz: 54762780eb57ba090caa44c4efd53e2fcc8149c87a2aa97b7d052efc58f51da5d4f2f49cfe4ce7b1a45db437a3c9d82856cf7bb887382f75942acda6f495be4c
6
+ metadata.gz: 750b13d813a7fddf80b991c4fdb244856b4bd7d07410caa75cacabcd8cc724631b87eb15b3f61de0e84c378475a1dbc42529933997389102378527b623c39f90
7
+ data.tar.gz: a88f83b33728a761cbb44c134456aeb3b49f003b422a42b30642c43a95514f8a2825929b56d7d54d788f4c197f680e7830d4dffcb7728ab284ea6e23bae64877
data/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
- ### 0.6.8
1
+ ### 0.6.9
2
2
  ### 0.0.1 / 2024-07-12
3
3
 
4
4
  * Everything is new. First release.
@@ -339,8 +339,11 @@ def _tokenize_line( line )
339
339
  @re = PROP_CARDS_RE
340
340
  tokens << [:PROP_YELLOWCARDS, m[:key]]
341
341
  elsif ['ref', 'referee'].include?( key.downcase )
342
- @re = PROP_RE ## (re)use prop setup for now - why? why not?
342
+ @re = PROP_REFEREE_RE
343
343
  tokens << [:PROP_REFEREE, m[:key]]
344
+ elsif ['att', 'attn', 'attendance'].include?( key.downcase )
345
+ @re = PROP_ATTENDANCE_RE
346
+ tokens << [:PROP_ATTENDANCE, m[:key]]
344
347
  elsif ['goals'].include?( key.downcase )
345
348
  @re = PROP_GOAL_RE
346
349
  tokens << [:PROP_GOALS, m[:key]]
@@ -514,6 +517,65 @@ def _tokenize_line( line )
514
517
  puts "!!! TOKENIZE ERROR (PROP_RE) - no match found"
515
518
  nil
516
519
  end
520
+ elsif @re == PROP_ATTENDANCE_RE
521
+ if m[:space] || m[:spaces]
522
+ nil ## skip space(s)
523
+ elsif m[:enclosed_name]
524
+ ## reserverd for use for sold out or such (in the future) - why? why not?
525
+ [:ENCLOSED_NAME, m[:name]]
526
+ elsif m[:num]
527
+ [:PROP_NUM, [m[:num], { value: m[:value].to_i(10) } ]]
528
+ =begin
529
+ elsif m[:sym]
530
+ sym = m[:sym]
531
+ case sym
532
+ when ',' then [:',']
533
+ when ';' then [:';']
534
+ # when '[' then [:'[']
535
+ # when ']' then [:']']
536
+ else
537
+ nil ## ignore others (e.g. brackets [])
538
+ end
539
+ =end
540
+ else
541
+ ## report error
542
+ puts "!!! TOKENIZE ERROR (PROP_ATTENDANCE_RE) - no match found"
543
+ nil
544
+ end
545
+ elsif @re == PROP_REFEREE_RE
546
+ if m[:space] || m[:spaces]
547
+ nil ## skip space(s)
548
+ elsif m[:prop_key] ## check for inline prop keys
549
+ key = m[:key]
550
+ ## supported for now coach/trainer (add manager?)
551
+ if ['att', 'attn', 'attendance' ].include?( key.downcase )
552
+ [:ATTENDANCE, m[:key]] ## use COACH_KEY or such - why? why not?
553
+ else
554
+ ## report error - for unknown (inline) prop key in lineup
555
+ nil
556
+ end
557
+ elsif m[:prop_name] ## note - change prop_name to player
558
+ [:PROP_NAME, m[:name]] ### use PLAYER for token - why? why not?
559
+ elsif m[:num]
560
+ [:PROP_NUM, [m[:num], { value: m[:value].to_i(10) } ]]
561
+ elsif m[:enclosed_name]
562
+ ## use HOLD,SAVE,POST or such keys - why? why not?
563
+ [:ENCLOSED_NAME, m[:name]]
564
+ elsif m[:sym]
565
+ sym = m[:sym]
566
+ case sym
567
+ when ',' then [:',']
568
+ when ';' then [:';']
569
+ # when '[' then [:'[']
570
+ # when ']' then [:']']
571
+ else
572
+ nil ## ignore others (e.g. brackets [])
573
+ end
574
+ else
575
+ ## report error
576
+ puts "!!! TOKENIZE ERROR (PROP_REFEREE_RE) - no match found"
577
+ nil
578
+ end
517
579
  elsif @re == PROP_PENALTIES_RE
518
580
  if m[:space] || m[:spaces]
519
581
  nil ## skip space(s)
@@ -713,7 +775,12 @@ def _tokenize_line( line )
713
775
  end
714
776
  elsif m[:any]
715
777
  ## todo/check log error
716
- puts "!!! TOKENIZE ERROR (any) - no match found >#{m[:any]}<"
778
+ msg = "parse error (tokenize) - skipping any match>#{m[:any]}< @#{offsets[0]},#{offsets[1]} in line >#{line}<"
779
+ puts "!! WARN - #{msg}"
780
+
781
+ errors << msg
782
+ log( "!! WARN - #{msg}" )
783
+
717
784
  nil
718
785
  else
719
786
  ## report error
@@ -750,8 +817,9 @@ def _tokenize_line( line )
750
817
  ##
751
818
  ## if in prop mode continue if last token is [,-]
752
819
  ## otherwise change back to "standard" mode
753
- if @re == PROP_RE || @re == PROP_CARDS_RE ||
754
- @re == PROP_GOAL_RE || @re == PROP_PENALTIES_RE
820
+ if @re == PROP_RE || @re == PROP_CARDS_RE ||
821
+ @re == PROP_GOAL_RE || @re == PROP_PENALTIES_RE ||
822
+ @re == PROP_ATTENDANCE_RE || @re == PROP_REFEREE_RE
755
823
  if [:',', :'-', :';'].include?( tokens[-1][0] )
756
824
  ## continue/stay in PROP_RE mode
757
825
  ## todo/check - auto-add PROP_CONT token or such